char login[USERS_LOGIN_SIZE], shell[USERS_SHELL_SIZE];
char fullname[USERS_FULLNAME_SIZE], oa[USERS_OFFICE_ADDR_SIZE];
char op[USERS_OFFICE_PHONE_SIZE], hp[USERS_HOME_PHONE_SIZE];
- char nn[USERS_NICKNAME_SIZE], ptype[USERS_POTYPE_SIZE];
- int uid, flag1, flag2, id, pid, status;
+ char nn[USERS_NICKNAME_SIZE];
+ int uid, flag1, flag2, id, pid, iid, mid, status;
EXEC SQL END DECLARE SECTION;
sprintf(poutf, "%s/passwd.db", hesiod_dir);
users = create_hash(12001);
EXEC SQL DECLARE u_cursor CURSOR FOR
SELECT login, unix_uid, shell, fullname, nickname, office_addr,
- office_phone, home_phone, users_id, pop_id, potype, status
+ office_phone, home_phone, users_id, pop_id, imap_id, status
FROM users
WHERE status = 1 OR status = 2 OR status = 5 OR status = 6
ORDER BY users_id;
while (1)
{
EXEC SQL FETCH u_cursor INTO :login, :uid, :shell, :fullname, :nn,
- :oa, :op, :hp, :id, :pid, :ptype, :status;
+ :oa, :op, :hp, :id, :pid, :iid, :status;
if (sqlca.sqlcode)
break;
strtrim(login);
op, hp, login, shell);
fprintf(uout, "%d.uid\t%s CNAME %s.passwd\n", uid, HCLASS, login);
}
+
+ if (iid != 0)
+ {
+ EXEC SQL SELECT mach_id INTO :mid FROM filesys
+ WHERE filsys_id = :iid AND type = 'IMAP';
+ if (sqlca.sqlcode == 0)
+ pid = mid;
+ }
+
if (pid != 0 && (mach = hash_lookup(machines, pid)))
{
fprintf(bout, "%s.pobox\t%s %s \"POP %s %s\"\n",
void get_info(void)
{
EXEC SQL BEGIN DECLARE SECTION;
- int id, pid, bid, cnt, maillistp, acl, mid;
+ int id, pid, iid, bid, cnt, maillistp, acl, mid;
char mname[MACHINE_NAME_SIZE], str[STRINGS_STRING_SIZE];
char login[USERS_LOGIN_SIZE], potype[USERS_POTYPE_SIZE];
char lname[LIST_NAME_SIZE], desc[LIST_DESCRIPTION_SIZE];
users = create_hash(13001);
EXEC SQL DECLARE u_cursor CURSOR FOR
- SELECT users_id, login, potype, pop_id, box_id
+ SELECT users_id, login, potype, pop_id, imap_id, box_id
FROM users
WHERE status != 3
ORDER BY users_id;
EXEC SQL OPEN u_cursor;
while (1)
{
- EXEC SQL FETCH u_cursor INTO :id, :login, :potype, :pid, :bid;
+ EXEC SQL FETCH u_cursor INTO :id, :login, :potype, :pid, :iid, :bid;
if (sqlca.sqlcode)
break;
u = malloc(sizeof(struct user));
u->login = strdup(strtrim(login));
+ if (potype[0] == 'I')
+ {
+ EXEC SQL SELECT f.mach_id INTO :pid FROM filesys f, users u
+ WHERE u.users_id = :id AND f.filsys_id = u.imap_id;
+ if (sqlca.sqlcode == 0)
+ potype[0] = 'P';
+ }
if (potype[0] == 'P' && (s = hash_lookup(machines, pid)))
{
char *buf = malloc(strlen(u->login) + strlen(s) + 2);