]> andersk Git - moira.git/commitdiff
deal with IMAP poboxes
authordanw <danw>
Tue, 16 Nov 1999 04:47:29 +0000 (04:47 +0000)
committerdanw <danw>
Tue, 16 Nov 1999 04:47:29 +0000 (04:47 +0000)
gen/hesiod.pc
gen/mailhub.pc

index 885895a14ce8a09e5db6a9be6079a827756a61d2..a44a9cc8ab15646c80b75db12017dccbdd61940a 100644 (file)
@@ -203,8 +203,8 @@ int do_passwd(void)
   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);
@@ -254,7 +254,7 @@ int do_passwd(void)
   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;
@@ -262,7 +262,7 @@ int do_passwd(void)
   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);
@@ -283,6 +283,15 @@ int do_passwd(void)
                  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",
index 91a49adcf3ee9ac2f748a339081273e27a56c4d0..7a624fa2e94c934d8b7815a28771bd6d49eb19c4 100644 (file)
@@ -136,7 +136,7 @@ int main(int argc, char **argv)
 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];
@@ -214,19 +214,26 @@ void get_info(void)
   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);
This page took 0.0755439999999999 seconds and 5 git commands to generate.