]> andersk Git - moira.git/blobdiff - dbck/phase2.pc
check printservers
[moira.git] / dbck / phase2.pc
index 8dddbd229eac26f82ef43470ecd877077fa70cf4..9bc0d6c36c753ac4a550e4615de06ffbc7ee671a 100644 (file)
@@ -22,15 +22,22 @@ EXEC SQL WHENEVER SQLERROR DO dbmserr();
 int show_mcm_mach(void *id);
 int show_mcm_clu(void *id);
 int show_hostalias(void *id);
-int show_pcap_mach(void *id);
-int show_pcap_quota(void *id);
+int show_printer_mach(void *id);
+int show_printer_server(void *id);
+int show_printer_loghost(void *id);
+int show_printer_spool(void *id);
+int show_printer_quota(void *id);
+int show_printer_ac(void *id);
+int show_printer_lpc_acl(void *id);
+void fix_printer_ac(void *id);
+void fix_printer_lpc_acl(void *id);
 void user_check(int id, void *user, void *hint);
 int maybe_fixup_unref_string(int sid, int oid, char *oname, char *table,
                             char *field, char *idfield);
 int maybe_fixup_modby(int sid, int oid, char *oname, char *table,
                      char *field, char *idfield);
-int maybe_fixup_unref_string2(char *table, char *field, char *cursor, int sid);
-int maybe_fixup_modby2(char *table, char *field, char *cursor, int id);
+int maybe_fixup_unref_string2(char *table, char *field, char *rowid, int sid);
+int maybe_fixup_modby2(char *table, char *field, char *rowid, int id);
 void pobox_check(int id, struct user *u);
 void remove_pobox(int id);
 void fix_smtp_pobox(int id, int sid);
@@ -56,6 +63,7 @@ void del_sh_mach(void *id);
 void fsmatch(int id, void *nfsphys, void *filesys);
 void check_fs(int id, void *filesys, void *hint);
 void check_nfsphys(int id, void *nfsphys, void *hint);
+void check_ps(int id, void *printserver, void *hint);
 int show_fsg_missing(void *id);
 int show_fsg_type(void *filesys);
 void fix_fsg_type(void *filesys);
@@ -80,7 +88,7 @@ int show_mcm_mach(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
   int iid = (int)id, found = 1;
-  char name[33];
+  char name[CLUSTERS_NAME_SIZE];
   EXEC SQL END DECLARE SECTION;
 
   EXEC SQL DECLARE csr201 CURSOR FOR
@@ -106,7 +114,7 @@ int show_mcm_clu(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
   int iid = (int)id, found = 1;
-  char name[33];
+  char name[MACHINE_NAME_SIZE];
   EXEC SQL END DECLARE SECTION;
 
   EXEC SQL DECLARE csr202 CURSOR FOR
@@ -133,7 +141,7 @@ int show_hostalias(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
   int iid = (int)id, found = 1;
-  char name[33];
+  char name[HOSTALIAS_NAME_SIZE];
   EXEC SQL END DECLARE SECTION;
 
   EXEC SQL DECLARE csr234 CURSOR FOR
@@ -155,15 +163,15 @@ int show_hostalias(void *id)
   return found;
 }
 
-int show_pcap_mach(void *id)
+int show_printer_mach(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
   int iid = (int)id, found = 1;
-  char name[33];
+  char name[PRINTERS_NAME_SIZE];
   EXEC SQL END DECLARE SECTION;
 
   EXEC SQL DECLARE csr235 CURSOR FOR
-    SELECT name FROM printcap WHERE mach_id = :iid;
+    SELECT name FROM printers WHERE mach_id = :iid;
   EXEC SQL OPEN csr235;
   while (1)
     {
@@ -174,22 +182,48 @@ int show_pcap_mach(void *id)
       strtrim(name);
 
       found = 0;
-      printf("Printer %s, non-existant spool machine %d in printcap table\n",
+      printf("Printer %s, non-existant machine %d in printers table\n",
             name, iid);
     }
   EXEC SQL CLOSE csr235;
   return found;
 }
 
-int show_pcap_quota(void *id)
+int show_printer_server(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
   int iid = (int)id, found = 1;
-  char name[33];
+  char name[PRINTERS_NAME_SIZE];
+  EXEC SQL END DECLARE SECTION;
+
+  EXEC SQL DECLARE csr_sps CURSOR FOR
+    SELECT name FROM printers WHERE mach_id = :iid;
+  EXEC SQL OPEN csr_sps;
+  while (1)
+    {
+      EXEC SQL FETCH csr_sps INTO :name;
+      if (sqlca.sqlcode)
+       break;
+
+      strtrim(name);
+
+      found = 0;
+      printf("Printer %s, non-existant printserver %d in printers table\n",
+            name, iid);
+    }
+  EXEC SQL CLOSE csr_sps;
+  return found;
+}
+
+int show_printer_loghost(void *id)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  int iid = (int)id, found = 1;
+  char name[PRINTERS_NAME_SIZE];
   EXEC SQL END DECLARE SECTION;
 
   EXEC SQL DECLARE csr236 CURSOR FOR
-    SELECT name FROM printcap WHERE quotaserver = :iid;
+    SELECT name FROM printers WHERE loghost = :iid;
   EXEC SQL OPEN csr236;
   while (1)
     {
@@ -200,13 +234,147 @@ int show_pcap_quota(void *id)
       strtrim(name);
 
       found = 0;
-      printf("Printer %s, non-existant quota server %d in printcap table\n",
+      printf("Printer %s, non-existant spool machine %d in printers table\n",
             name, iid);
     }
   EXEC SQL CLOSE csr236;
   return found;
 }
 
+int show_printer_spool(void *id)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  int iid = (int)id, found = 1;
+  char name[PRINTERS_NAME_SIZE];
+  EXEC SQL END DECLARE SECTION;
+
+  EXEC SQL DECLARE csr237 CURSOR FOR
+    SELECT name FROM printers WHERE rm = :iid;
+  EXEC SQL OPEN csr237;
+  while (1)
+    {
+      EXEC SQL FETCH csr237 INTO :name;
+      if (sqlca.sqlcode)
+       break;
+
+      strtrim(name);
+
+      found = 0;
+      printf("Printer %s, non-existant spool machine %d in printers table\n",
+            name, iid);
+    }
+  EXEC SQL CLOSE csr237;
+  return found;
+}
+
+int show_printer_quota(void *id)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  int iid = (int)id, found = 1;
+  char name[PRINTERS_NAME_SIZE];
+  EXEC SQL END DECLARE SECTION;
+
+  EXEC SQL DECLARE csr238 CURSOR FOR
+    SELECT name FROM printers WHERE rq = :iid;
+  EXEC SQL OPEN csr238;
+  while (1)
+    {
+      EXEC SQL FETCH csr238 INTO :name;
+      if (sqlca.sqlcode)
+       break;
+
+      strtrim(name);
+
+      found = 0;
+      printf("Printer %s, non-existant quota server %d in printers table\n",
+            name, iid);
+    }
+  EXEC SQL CLOSE csr238;
+  return found;
+}
+
+int show_printer_ac(void *id)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  int iid = (int)id, found = 1;
+  char name[PRINTERS_NAME_SIZE];
+  EXEC SQL END DECLARE SECTION;
+
+  EXEC SQL DECLARE csr239 CURSOR FOR
+    SELECT name FROM printers WHERE ac = :iid;
+  EXEC SQL OPEN csr239;
+  while (1)
+    {
+      EXEC SQL FETCH csr239 INTO :name;
+      if (sqlca.sqlcode)
+       break;
+
+      strtrim(name);
+
+      found = 0;
+      printf("Printer %s, non-existant restrict list %d in printers table\n",
+            name, iid);
+    }
+  EXEC SQL CLOSE csr239;
+  return found;
+}
+
+int show_printer_lpc_acl(void *id)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  int iid = (int)id, found = 1;
+  char name[PRINTERS_NAME_SIZE];
+  EXEC SQL END DECLARE SECTION;
+
+  EXEC SQL DECLARE csr240 CURSOR FOR
+    SELECT name FROM printers WHERE lpc_acl = :iid;
+  EXEC SQL OPEN csr240;
+  while (1)
+    {
+      EXEC SQL FETCH csr240 INTO :name;
+      if (sqlca.sqlcode)
+       break;
+
+      strtrim(name);
+
+      found = 0;
+      printf("Printer %s, non-existant lpc ACL %d in printers table\n",
+            name, iid);
+    }
+  EXEC SQL CLOSE csr240;
+  return found;
+}
+
+void fix_printer_ac(void *id)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  int rowcount, iid = (int)id;
+  EXEC SQL END DECLARE SECTION;
+
+  EXEC SQL UPDATE printers SET ac = 0 WHERE ac = :iid;
+  rowcount = sqlca.sqlerrd[2];
+  if (rowcount > 0)
+    printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
+  else
+    printf("Not fixed\n");
+  modified("printers");
+}
+
+void fix_printer_lpc_acl(void *id)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  int rowcount, iid = (int)id;
+  EXEC SQL END DECLARE SECTION;
+
+  EXEC SQL UPDATE printers SET lpc_acl = 0 WHERE lpc_acl = :iid;
+  rowcount = sqlca.sqlerrd[2];
+  if (rowcount > 0)
+    printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
+  else
+    printf("Not fixed\n");
+  modified("printers");
+}
+
 void user_check(int id, void *user, void *hint)
 {
   struct user *u = user;
@@ -245,9 +413,9 @@ int maybe_fixup_unref_string(int sid, int oid, char *oname, char *table,
       if (single_fix("Replace duplicate", 0))
        {
          ret = newid;
-         string_check(newid);
          doit = 1;
        }
+      string_check(ret);
     }
   else if (!string_check(ret))
     {
@@ -310,7 +478,7 @@ int maybe_fixup_modby(int sid, int oid, char *oname, char *table,
   return sid;
 }
 
-int maybe_fixup_unref_string2(char *table, char *field, char *cursor, int sid)
+int maybe_fixup_unref_string2(char *table, char *field, char *rowid, int sid)
 {
   int ret = (sid < 0) ? -sid : sid, doit = 0, newid;
   EXEC SQL BEGIN DECLARE SECTION;
@@ -325,15 +493,15 @@ int maybe_fixup_unref_string2(char *table, char *field, char *cursor, int sid)
       if (single_fix("Replace duplicate", 0))
        {
          ret = newid;
-         string_check(newid);
          doit = 1;
        }
+      string_check(ret);
     }
   else if (!string_check(ret))
     {
       printf("%s entry has a %s with non-existant string %d\n",
             table, field, ret);
-      if (single_fix("Delete", 1))
+      if (single_fix("Clear", 1))
        {
          ret = 0;
          doit = 1;
@@ -342,8 +510,8 @@ int maybe_fixup_unref_string2(char *table, char *field, char *cursor, int sid)
 
   if (doit)
     {
-      sprintf(stmt_buf, "UPDATE %s SET %s = %d WHERE CURRENT OF %s",
-             table, field, (sid < 0) ? -ret : ret, cursor);
+      sprintf(stmt_buf, "UPDATE %s SET %s = %d WHERE rowid = '%s'",
+             table, field, (sid < 0) ? -ret : ret, rowid);
       EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
       rowcount = sqlca.sqlerrd[2];
       if (rowcount == 1)
@@ -355,7 +523,7 @@ int maybe_fixup_unref_string2(char *table, char *field, char *cursor, int sid)
   return (sid < 0) ? -ret : ret;
 }
 
-int maybe_fixup_modby2(char *table, char *field, char *cursor, int id)
+int maybe_fixup_modby2(char *table, char *field, char *rowid, int id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
   char stmt_buf[500];
@@ -363,17 +531,17 @@ int maybe_fixup_modby2(char *table, char *field, char *cursor, int id)
   EXEC SQL END DECLARE SECTION;
 
   if (id < 0)
-    return maybe_fixup_unref_string2(table, field, cursor, id);
+    return maybe_fixup_unref_string2(table, field, rowid, id);
   else
     {
       if (!hash_lookup(users, id))
        {
          printf("%s entry has a %s with non-existant user %d\n",
                 table, field, id);
-         if (single_fix("Delete", 1))
+         if (single_fix("Clear", 1))
            {
-             sprintf(stmt_buf, "UPDATE %s SET %s = 0 WHERE CURRENT OF %s",
-                     table, field, cursor);
+             sprintf(stmt_buf, "UPDATE %s SET %s = 0 WHERE rowid = '%s'",
+                     table, field, rowid);
              EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
              rowcount = sqlca.sqlerrd[2];
              if (rowcount == 1)
@@ -390,6 +558,8 @@ int maybe_fixup_modby2(char *table, char *field, char *cursor, int id)
 
 void pobox_check(int id, struct user *u)
 {
+  struct filesys *fs;
+
   switch (u->potype)
     {
     case 'P':
@@ -404,6 +574,7 @@ void pobox_check(int id, struct user *u)
            }
        }
       break;
+
     case 'S':
       if (hash_lookup(string_dups, u->pobox_id))
        {
@@ -430,6 +601,31 @@ void pobox_check(int id, struct user *u)
            }
        }
       break;
+
+    case 'I':
+      fs = hash_lookup(filesys, u->pobox_id);
+      if (!fs)
+       {
+         printf("User %s(%s) has P.O.Box on non-existant filesystem %d\n",
+                u->login, u->fullname, u->pobox_id);
+         if (single_fix("Delete", 0))
+           {
+             remove_pobox(u->users_id);
+             u->potype = 'N';
+           }
+       }
+      else if (fs->type != 'I')
+       {
+         printf("User %s(%s) has IMAP P.O.Box on non-IMAP filesystem %s\n",
+                u->login, u->fullname, fs->name);
+         if (single_fix("Delete", 0))
+           {
+             remove_pobox(u->users_id);
+             u->potype = 'N';
+           }
+       }
+      break;
+
     default:
       ;
     }
@@ -615,7 +811,7 @@ int show_svc(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
   int iid = (int)id, found = 1;
-  char label[17], data[33];
+  char label[SVC_SERV_LABEL_SIZE], data[SVC_SERV_CLUSTER_SIZE];
   EXEC SQL END DECLARE SECTION;
 
   EXEC SQL DECLARE csr203 CURSOR FOR
@@ -642,6 +838,9 @@ void list_check(int id, void *list, void *hint)
 {
   struct list *l = list;
 
+  l->modby = maybe_fixup_modby(l->modby, id, l->name, "list",
+                              "modby", "list_id");
+
   switch (l->acl_type)
     {
     case 'L':
@@ -693,12 +892,12 @@ int show_member_list(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
   int mid, iid = (int)id, found = 1;
-  char mtype[9], *name = "";
+  char mtype[IMEMBERS_MEMBER_TYPE_SIZE], *name = NULL;
   EXEC SQL END DECLARE SECTION;
 
   EXEC SQL DECLARE csr204 CURSOR FOR
     SELECT member_type, member_id FROM imembers
-    WHERE list_id = :iid AND direct = 1;
+    WHERE list_id = :iid;
   EXEC SQL OPEN csr204;
   while (1)
     {
@@ -709,12 +908,30 @@ int show_member_list(void *id)
       strtrim(mtype);
       found = 0;
       if (mtype[0] == 'L')
-       name = ((struct list *) hash_lookup(lists, mid))->name;
+       {
+         struct list *l = hash_lookup(lists, mid);
+         if (l)
+           name = l->name;
+       }
       else if (mtype[0] == 'U')
-       name = ((struct user *) hash_lookup(users, mid))->login;
+       {
+         struct user *u = hash_lookup(users, mid);
+         if (u)
+           name = u->login;
+       }
       else if (mtype[0] == 'S' || mtype[0] == 'K')
-       name = ((struct string *) hash_lookup(strings, mid))->name;
-      printf("Non-existant list %d has member %s %s\n", iid, mtype, name);
+       {
+         struct string *s = hash_lookup(strings, mid);
+         if (s)
+           name = s->name;
+       }
+      if (name)
+       printf("Non-existant list %d has member %s %s\n", iid, mtype, name);
+      else
+       {
+         printf("Non-existant list %d has non-existent member %s %d\n",
+                iid, mtype, mid);
+       }
     }
   EXEC SQL CLOSE csr204;
   return found;
@@ -725,20 +942,23 @@ int show_mem_user(void *id)
   EXEC SQL BEGIN DECLARE SECTION;
   int lid, iid = (int)id, found = 1;
   EXEC SQL END DECLARE SECTION;
+  struct list *l;
 
   EXEC SQL DECLARE csr205 CURSOR FOR
     SELECT list_id FROM imembers
-    WHERE member_id = :iid AND member_type = 'USER' AND direct = 1;
+    WHERE member_id = :iid AND member_type = 'USER';
   EXEC SQL OPEN csr205;
   while (1)
     {
       EXEC SQL FETCH csr205 INTO :lid;
       if (sqlca.sqlcode)
        break;
+      l = hash_lookup(lists, lid);
+      if (!l)
+       continue;
 
       found = 0;
-      printf("List %s has non-existant user member, id %d\n",
-            ((struct list *)hash_lookup(lists, lid))->name, iid);
+      printf("List %s has non-existant user member, id %d\n", l->name, iid);
     }
   EXEC SQL CLOSE csr205;
   return found;
@@ -749,20 +969,23 @@ int show_mem_list(void *id)
   EXEC SQL BEGIN DECLARE SECTION;
   int lid, iid = (int)id, found = 1;
   EXEC SQL END DECLARE SECTION;
+  struct list *l;
 
   EXEC SQL DECLARE csr206 CURSOR FOR
     SELECT list_id FROM imembers
-    WHERE member_id = :iid AND member_type = 'LIST' AND direct = 1;
+    WHERE member_id = :iid AND member_type = 'LIST';
   EXEC SQL OPEN csr206;
   while (1)
     {
       EXEC SQL FETCH csr206 INTO :lid;
       if (sqlca.sqlcode)
        break;
+      l = hash_lookup(lists, lid);
+      if (!l)
+       continue;
 
       found = 0;
-      printf("List %s has non-existant list member, id %d\n",
-            ((struct list *)hash_lookup(lists, lid))->name, iid);
+      printf("List %s has non-existant list member, id %d\n", l->name, iid);
     }
   EXEC SQL CLOSE csr206;
   return found;
@@ -773,20 +996,23 @@ int show_mem_str(void *id)
   EXEC SQL BEGIN DECLARE SECTION;
   int lid, iid = (int)id, found = 1;
   EXEC SQL END DECLARE SECTION;
+  struct list *l;
 
   EXEC SQL DECLARE csr207 CURSOR FOR
     SELECT list_id FROM imembers
-    WHERE member_id = :iid AND member_type = 'STRING' AND direct = 1;
+    WHERE member_id = :iid AND member_type = 'STRING';
   EXEC SQL OPEN csr207;
   while (1)
     {
       EXEC SQL FETCH csr207 INTO :lid;
       if (sqlca.sqlcode)
        break;
+      l = hash_lookup(lists, lid);
+      if (!l)
+       continue;
 
       found = 0;
-      printf("List %s has non-existant string member, id %d\n",
-            ((struct list *)hash_lookup(lists, lid))->name, iid);
+      printf("List %s has non-existant string member, id %d\n", l->name, iid);
     }
   EXEC SQL CLOSE csr207;
   return found;
@@ -798,20 +1024,24 @@ int show_mem_krb(void *id)
   EXEC SQL BEGIN DECLARE SECTION;
   int lid, iid = (int)id, found = 1;
   EXEC SQL END DECLARE SECTION;
+  struct list *l;
 
   EXEC SQL DECLARE csr208 CURSOR FOR
     SELECT list_id FROM imembers
-    WHERE member_id = :iid AND member_type = 'KERBEROS' AND direct = 1;
+    WHERE member_id = :iid AND member_type = 'KERBEROS';
   EXEC SQL OPEN csr208;
   while (1)
     {
       EXEC SQL FETCH csr208 INTO :lid;
       if (sqlca.sqlcode)
        break;
+      l = hash_lookup(lists, lid);
+      if (!l)
+       continue;
 
       found = 0;
       printf("List %s has non-existant kerberos member, id %d\n",
-            ((struct list *)hash_lookup(lists, lid))->name, iid);
+            l->name, iid);
     }
   EXEC SQL CLOSE csr208;
   return found;
@@ -825,7 +1055,7 @@ void del_mem_user(void *id)
   EXEC SQL END DECLARE SECTION;
 
   EXEC SQL DELETE FROM imembers WHERE member_type = 'USER' AND
-    member_id = :iid AND direct = 1;
+    member_id = :iid;
   rowcount = sqlca.sqlerrd[2];
   if (rowcount > 0)
     printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
@@ -841,7 +1071,7 @@ void del_mem_list(void *id)
   EXEC SQL END DECLARE SECTION;
 
   EXEC SQL DELETE FROM imembers WHERE member_type = 'LIST' AND
-    member_id = :iid AND direct = 1;
+    member_id = :iid;
   rowcount = sqlca.sqlerrd[2];
   if (rowcount > 0)
     printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
@@ -857,7 +1087,7 @@ void del_mem_str(void *id)
   EXEC SQL END DECLARE SECTION;
 
   EXEC SQL DELETE FROM imembers WHERE member_type = 'STRING' AND
-    member_id = :iid AND direct = 1;
+    member_id = :iid;
   rowcount = sqlca.sqlerrd[2];
   if (rowcount > 0)
     printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
@@ -874,7 +1104,7 @@ void del_mem_krb(void *id)
   EXEC SQL END DECLARE SECTION;
 
   EXEC SQL DELETE FROM imembers WHERE member_type = 'KERBEROS' AND
-    member_id = :iid AND direct = 1;
+    member_id = :iid;
   rowcount = sqlca.sqlerrd[2];
   if (rowcount > 0)
     printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
@@ -887,7 +1117,7 @@ void del_mem_krb(void *id)
 int show_sh(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
-  char name[33];
+  char name[SERVERHOSTS_SERVICE_SIZE];
   int iid = (int)id;
   EXEC SQL END DECLARE SECTION;
   int found = 1;
@@ -988,7 +1218,7 @@ void check_fs(int id, void *filesys, void *hint)
        }
     }
 
-  if (f->type == 'N')
+  if (f->type == 'N' || f->type == 'I')
     {
       if (!hash_lookup(nfsphys, f->phys_id))
        {
@@ -1081,6 +1311,9 @@ void check_nfsphys(int id, void *nfsphys, void *hint)
 {
   struct nfsphys *n = nfsphys;
 
+  n->modby = maybe_fixup_modby(n->modby, id, n->dir, "nfsphys",
+                              "modby", "nfsphys_id");
+
   if (!hash_lookup(machines, n->mach_id))
     {
       printf("NFSphys %d(%s) on non-existant machine %d\n",
@@ -1090,6 +1323,103 @@ void check_nfsphys(int id, void *nfsphys, void *hint)
     }
 }
 
+static void clear_ps_owner(struct printserver *ps)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  int rowcount, id = ps->mach_id;
+  EXEC SQL END DECLARE SECTION;
+
+  EXEC SQL UPDATE printserver SET owner_type = 'NONE', owner_id = 0
+    WHERE mach_id = :id;
+  rowcount = sqlca.sqlerrd[2];
+  if (rowcount > 0)
+    printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
+  else
+    printf("Not fixed\n");
+  modified("printservers");
+}
+
+static void clear_ps_lpc(struct printserver *ps)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  int rowcount, id = ps->mach_id;
+  EXEC SQL END DECLARE SECTION;
+
+  EXEC SQL UPDATE printserver SET lpc_acl = 0
+    WHERE mach_id = :id;
+  rowcount = sqlca.sqlerrd[2];
+  if (rowcount > 0)
+    printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
+  else
+    printf("Not fixed\n");
+  modified("printservers");
+}
+
+void check_ps(int id, void *printserver, void *hint)
+{
+  struct printserver *ps = printserver;
+  struct machine *m;
+  char *name;
+
+  m = hash_lookup(machines, id);
+  if (!m)
+    {
+      printf("Printserver on non-existant machine %d\n", id);
+      if (single_fix("Delete", 0))
+       {
+         single_delete("printserver", "mach_id", id);
+         return;
+       }
+      else
+       name = "[UNKNOWN]";
+    }
+  else
+    name = m->name;      
+
+  ps->modby = maybe_fixup_modby(ps->modby, id, name, "printserver",
+                               "modby", "mach_id");
+  ps->printer_types = maybe_fixup_unref_string(ps->printer_types, id, name,
+                                              "printservers", "printer_types",
+                                              "mach_id");
+
+  switch (ps->owner_type)
+    {
+    case 'U':
+      if (!hash_lookup(users, ps->owner_id))
+       {
+         printf("Printserver %s has non-existant USER owner %d\n",
+                name, ps->owner_id);
+         if (single_fix("Set to no owner", 1))
+           clear_ps_owner(ps);
+       }
+      break;
+    case 'L':
+      if (!hash_lookup(lists, ps->owner_id))
+       {
+         printf("Printserver %s has non-existant LIST owner %d\n",
+                name, ps->owner_id);
+         if (single_fix("Set to no owner", 1))
+           clear_ps_owner(ps);
+       }
+      break;
+    case 'K':
+      if (ps->owner_id)
+       ps->owner_id = maybe_fixup_unref_string(ps->owner_id, id, name,
+                                              "printserver", "owner_id",
+                                              "mach_id");
+      if (ps->owner_id == 0)
+       clear_ps_owner(ps);
+    }
+
+  if (!hash_lookup(lists, ps->lpc_acl))
+    {
+      printf("Printserver %s has non-existent lpc_acl %d\n",
+            name, ps->lpc_acl);
+      if (single_fix("Set to no lpc_acl", 1))
+       clear_ps_lpc(ps);
+    }
+}
+
 int show_fsg_missing(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
@@ -1241,10 +1571,9 @@ int show_quota_nolist(void *id)
 void fix_quota_nouser(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
-  int iid = (int)id, rowcount, id1;
+  int iid = (int)id, rowcount;
   EXEC SQL END DECLARE SECTION;
 
-  id1 = ((struct filesys *)hash_lookup(filesys, iid))->phys_id;
   EXEC SQL DELETE FROM quota
     WHERE entity_id = :iid AND type = 'USER';
   rowcount = sqlca.sqlerrd[2];
@@ -1258,10 +1587,9 @@ void fix_quota_nouser(void *id)
 void fix_quota_nolist(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
-  int iid = (int)id, rowcount, id1;
+  int iid = (int)id, rowcount;
   EXEC SQL END DECLARE SECTION;
 
-  id1 = ((struct filesys *)hash_lookup(filesys, iid))->phys_id;
   EXEC SQL DELETE FROM quota WHERE entity_id = :iid AND type = 'GROUP';
   rowcount = sqlca.sqlerrd[2];
   if (rowcount > 0)
@@ -1275,7 +1603,7 @@ int show_quota_nofs(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
   int iid = (int)id, id1, found = 1;
-  char type[9];
+  char type[QUOTA_TYPE_SIZE];
   EXEC SQL END DECLARE SECTION;
 
   EXEC SQL DECLARE csr214 CURSOR FOR
@@ -1304,7 +1632,7 @@ int show_quota_wrongpid(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
   int iid = (int)id, id1, found = 1;
-  char type[9];
+  char type[QUOTA_TYPE_SIZE];
   EXEC SQL END DECLARE SECTION;
   struct filesys *f;
 
@@ -1347,7 +1675,7 @@ void fix_quota_physid(void *id)
 int show_srv_user(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
-  char name[33];
+  char name[SERVERS_NAME_SIZE];
   int iid = (int)id;
   EXEC SQL END DECLARE SECTION;
   int found = 1;
@@ -1373,7 +1701,7 @@ int show_srv_user(void *id)
 int show_srv_list(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
-  char name[33];
+  char name[SERVERS_NAME_SIZE];
   int iid = (int)id;
   EXEC SQL END DECLARE SECTION;
   int found = 1;
@@ -1488,45 +1816,14 @@ int show_krb_str(void *id)
   return found;
 }
 
-int show_pdm_mach(void *id)
-{
-  EXEC SQL BEGIN DECLARE SECTION;
-  char name[33];
-  int iid = (int)id;
-  EXEC SQL END DECLARE SECTION;
-  int found = 1;
-
-  EXEC SQL DECLARE csr220 CURSOR FOR
-    SELECT name FROM palladium
-    WHERE mach_id = :iid;
-  EXEC SQL OPEN csr220;
-  while (1)
-    {
-      EXEC SQL FETCH csr220 INTO :name;
-      if (sqlca.sqlcode)
-       break;
-
-      strtrim(name);
-      printf("Palladium server/supervisor %s is on non-existant machine %d\n",
-            name, iid);
-      found = 0;
-    }
-  EXEC SQL CLOSE csr220;
-  return found;
-}
-
-
 void phase2(void)
 {
-  EXEC SQL BEGIN DECLARE SECTION;
-  int id1, id2, id3, id4, id5;
-  char type[9], name[33];
-  EXEC SQL END DECLARE SECTION;
-  struct save_queue *sq, *sq1, *sq2, *sq3, *sq4, *sq5;
+  struct save_queue *sq, *sq1, *sq2, *sq3, *sq4, *sq5, *sq6;
   struct filesys *f;
   struct list *l;
   struct nfsphys *n;
   struct machine *m;
+  char rowid[32];
 
   printf("Phase 2 - Checking references\n");
 
@@ -1550,14 +1847,18 @@ void phase2(void)
   EXEC SQL OPEN csr221;
   while (1)
     {
-      EXEC SQL FETCH csr221 INTO :id1, :id2;
+      EXEC SQL BEGIN DECLARE SECTION;
+      int mach_id, clu_id;
+      EXEC SQL END DECLARE SECTION;
+
+      EXEC SQL FETCH csr221 INTO :mach_id, :clu_id;
       if (sqlca.sqlcode)
        break;
 
-      if (!(m = hash_lookup(machines, id1)))
-       sq_save_unique_data(sq1, (void *)id1);
-      else if (!hash_lookup(clusters, id2))
-       sq_save_unique_data(sq2, (void *)id2);
+      if (!(m = hash_lookup(machines, mach_id)))
+       sq_save_unique_data(sq1, (void *)mach_id);
+      else if (!hash_lookup(clusters, clu_id))
+       sq_save_unique_data(sq2, (void *)clu_id);
       if (m)
        m->clucount++;
     }
@@ -1572,12 +1873,16 @@ void phase2(void)
   EXEC SQL OPEN csr222;
   while (1)
     {
-      EXEC SQL FETCH csr222 INTO :id1;
+      EXEC SQL BEGIN DECLARE SECTION;
+      int clu_id;
+      EXEC SQL END DECLARE SECTION;
+
+      EXEC SQL FETCH csr222 INTO :clu_id;
       if (sqlca.sqlcode)
        break;
 
-      if (!hash_lookup(clusters, id1))
-       sq_save_unique_data(sq1, (void *)id1);
+      if (!hash_lookup(clusters, clu_id))
+       sq_save_unique_data(sq1, (void *)clu_id);
     }
   EXEC SQL CLOSE csr222;
   generic_delete(sq1, show_svc, "svc", "clu_id", 1);
@@ -1593,25 +1898,31 @@ void phase2(void)
   sq5 = sq_create();
 
   EXEC SQL DECLARE csr223 CURSOR FOR
-    SELECT list_id, member_type, member_id, ref_count, direct
+    SELECT list_id, member_type, member_id, ref_count, direct, rowid
     FROM imembers FOR UPDATE OF member_id;
   EXEC SQL OPEN csr223;
   while (1)
     {
-      EXEC SQL FETCH csr223 INTO :id1, :type, :id2, :id3, :id4;
+      EXEC SQL BEGIN DECLARE SECTION;
+      int list_id, id, ref_count, direct;
+      char type[IMEMBERS_MEMBER_TYPE_SIZE];
+      EXEC SQL END DECLARE SECTION;
+
+      EXEC SQL FETCH csr223 INTO :list_id, :type, :id,
+       :ref_count, :direct, :rowid;
       if (sqlca.sqlcode)
        break;
 
-      if (!(l = hash_lookup(lists, id1)))
-       sq_save_unique_data(sq1, (void *)id1);
-      else if (type[0] == 'U' && !hash_lookup(users, id2))
-       sq_save_unique_data(sq2, (void *)id2);
-      else if (type[0] == 'L' && !hash_lookup(lists, id2))
-       sq_save_unique_data(sq3, (void *)id2);
-      else if (type[0] == 'S' && !maybe_fixup_unref_string2("imembers", "member_id", "csr223", id2))
-       sq_save_unique_data(sq4, (void *)id2);
-      else if (type[0] == 'K' && !maybe_fixup_unref_string2("imembers", "member_id", "csr223", id2))
-       sq_save_unique_data(sq5, (void *)id2);
+      if (!(l = hash_lookup(lists, list_id)))
+       sq_save_unique_data(sq1, (void *)list_id);
+      else if (type[0] == 'U' && !hash_lookup(users, id))
+       sq_save_unique_data(sq2, (void *)id);
+      else if (type[0] == 'L' && !hash_lookup(lists, id))
+       sq_save_unique_data(sq3, (void *)id);
+      else if (type[0] == 'S' && !maybe_fixup_unref_string2("imembers", "member_id", strtrim(rowid), id))
+       sq_save_unique_data(sq4, (void *)id);
+      else if (type[0] == 'K' && !maybe_fixup_unref_string2("imembers", "member_id", strtrim(rowid), id))
+       sq_save_unique_data(sq5, (void *)id);
       else
        l->members++;
     }
@@ -1626,21 +1937,26 @@ void phase2(void)
   sq1 = sq_create();
   sq2 = sq_create();
   EXEC SQL DECLARE csr224 CURSOR FOR
-    SELECT name, acl_type, acl_id, modby FROM servers
+    SELECT name, acl_type, acl_id, modby, rowid FROM servers
     FOR UPDATE of modby;
   EXEC SQL OPEN csr224;
   while (1)
     {
-      EXEC SQL FETCH csr224 INTO :name, :type, :id1, :id2;
+      EXEC SQL BEGIN DECLARE SECTION;
+      int acl_id, modby;
+      char name[SERVERS_NAME_SIZE], acl_type[SERVERS_ACL_TYPE_SIZE];
+      EXEC SQL END DECLARE SECTION;
+
+      EXEC SQL FETCH csr224 INTO :name, :acl_type, :acl_id, :modby, :rowid;
       if (sqlca.sqlcode)
        break;
 
-      maybe_fixup_modby2("servers", "modby", "csr224", id2);
-      strtrim(type);
-      if (!strcmp(type, "USER") && !hash_lookup(users, id1))
-       sq_save_data(sq1, (void *)id1);
-      else if (!strcmp(type, "LIST") && !hash_lookup(lists, id1))
-       sq_save_data(sq2, (void *)id1);
+      maybe_fixup_modby2("servers", "modby", strtrim(rowid), modby);
+      strtrim(acl_type);
+      if (!strcmp(acl_type, "USER") && !hash_lookup(users, acl_id))
+       sq_save_data(sq1, (void *)acl_id);
+      else if (!strcmp(acl_type, "LIST") && !hash_lookup(lists, acl_id))
+       sq_save_data(sq2, (void *)acl_id);
     }
   EXEC SQL CLOSE csr224;
   generic_fix(sq1, show_srv_user, "Fix", zero_srv_user, 1);
@@ -1649,18 +1965,22 @@ void phase2(void)
   dprintf("Checking serverhosts...\n");
   sq = sq_create();
   EXEC SQL DECLARE csr225 CURSOR FOR
-    SELECT mach_id, modby FROM serverhosts
+    SELECT mach_id, modby, rowid FROM serverhosts
     FOR UPDATE OF modby;
   EXEC SQL OPEN csr225;
   while (1)
     {
-      EXEC SQL FETCH csr225 INTO :id1, :id2;
+      EXEC SQL BEGIN DECLARE SECTION;
+      int mach_id, modby;
+      EXEC SQL END DECLARE SECTION;
+
+      EXEC SQL FETCH csr225 INTO :mach_id, :modby, :rowid;
       if (sqlca.sqlcode)
        break;
 
-      maybe_fixup_modby2("serverhosts", "modby", "csr225", id2);
-      if (!hash_lookup(machines, id1))
-       sq_save_data(sq, (void *)id1);
+      maybe_fixup_modby2("serverhosts", "modby", strtrim(rowid), modby);
+      if (!hash_lookup(machines, mach_id))
+       sq_save_data(sq, (void *)mach_id);
     }
   EXEC SQL CLOSE csr225;
   generic_fix(sq, show_sh, "Delete", del_sh_mach, 0);
@@ -1680,14 +2000,18 @@ void phase2(void)
   EXEC SQL OPEN csr226;
   while (1)
     {
-      EXEC SQL FETCH csr226 INTO :id1, :id2;
+      EXEC SQL BEGIN DECLARE SECTION;
+      int group_id, filsys_id;
+      EXEC SQL END DECLARE SECTION;
+
+      EXEC SQL FETCH csr226 INTO :group_id, :filsys_id;
       if (sqlca.sqlcode)
        break;
 
-      if (!(f = hash_lookup(filesys, id1)))
-       sq_save_data(sq1, (void *)id1);
-      if (!hash_lookup(filesys, id2))
-       sq_save_data(sq3, (void *)id2);
+      if (!(f = hash_lookup(filesys, group_id)))
+       sq_save_data(sq1, (void *)group_id);
+      if (!hash_lookup(filesys, filsys_id))
+       sq_save_data(sq3, (void *)filsys_id);
     }
   EXEC SQL CLOSE csr226;
   generic_delete(sq1, show_fsg_missing, "fsgroup", "group_id", 0);
@@ -1699,26 +2023,32 @@ void phase2(void)
   sq3 = sq_create();
   sq4 = sq_create();
   EXEC SQL DECLARE csr227 CURSOR FOR
-    SELECT entity_id, type, filsys_id, phys_id, quota, modby
+    SELECT entity_id, type, filsys_id, phys_id, quota, modby, rowid
     FROM quota FOR UPDATE OF modby;
   EXEC SQL OPEN csr227;
   while (1)
     {
-      EXEC SQL FETCH csr227 INTO :id1, :type, :id2, :id3, :id4, :id5;
+      EXEC SQL BEGIN DECLARE SECTION;
+      int entity_id, filsys_id, phys_id, quota, modby;
+      char type[QUOTA_TYPE_SIZE];
+      EXEC SQL END DECLARE SECTION;
+
+      EXEC SQL FETCH csr227 INTO :entity_id, :type, :filsys_id,
+       :phys_id, :quota, :modby, :rowid;
       if (sqlca.sqlcode)
        break;
 
-      maybe_fixup_modby2("quota", "modby", "csr227", id5);
-      if (type[0] == 'U' && id1 != 0 && !hash_lookup(users, id1))
-       sq_save_data(sq1, (void *)id1);
-      else if (type[0] == 'G' && !hash_lookup(lists, id1))
-       sq_save_data(sq4, (void *)id1);
-      else if (!(f = hash_lookup(filesys, id2)))
-       sq_save_data(sq2, (void *)id2);
-      else if (id3 != f->phys_id || !(n = hash_lookup(nfsphys, id3)))
-       sq_save_data(sq3, (void *)id2);
+      maybe_fixup_modby2("quota", "modby", strtrim(rowid), modby);
+      if (type[0] == 'U' && entity_id != 0 && !hash_lookup(users, entity_id))
+       sq_save_data(sq1, (void *)entity_id);
+      else if (type[0] == 'G' && !hash_lookup(lists, entity_id))
+       sq_save_data(sq4, (void *)entity_id);
+      else if (!(f = hash_lookup(filesys, filsys_id)))
+       sq_save_data(sq2, (void *)filsys_id);
+      else if (phys_id != f->phys_id || !(n = hash_lookup(nfsphys, phys_id)))
+       sq_save_data(sq3, (void *)phys_id);
       else
-       n->count += id4;
+       n->count += quota;
     }
   EXEC SQL CLOSE csr227;
   generic_fix(sq1, show_quota_nouser, "Delete", fix_quota_nouser, 1);
@@ -1730,71 +2060,61 @@ void phase2(void)
 
   dprintf("Checking hostaccess...\n");
   EXEC SQL DECLARE csr228 CURSOR FOR
-    SELECT mach_id, acl_type, acl_id, modby FROM hostaccess
+    SELECT mach_id, acl_type, acl_id, modby, rowid FROM hostaccess
     FOR UPDATE OF modby;
   EXEC SQL OPEN csr228;
   while (1)
     {
-      EXEC SQL FETCH csr228 INTO :id1, :type, :id2, :id3;
+      EXEC SQL BEGIN DECLARE SECTION;
+      int mach_id, acl_id, modby;
+      char acl_type[HOSTACCESS_ACL_TYPE_SIZE];
+      EXEC SQL END DECLARE SECTION;
+
+      EXEC SQL FETCH csr228 INTO :mach_id, :acl_type, :acl_id, :modby, :rowid;
       if (sqlca.sqlcode)
        break;
 
-      maybe_fixup_modby2("hostaccess", "modby", "csr228", id3);
-      strtrim(type);
-      if (!hash_lookup(machines, id1))
+      maybe_fixup_modby2("hostaccess", "modby", strtrim(rowid), modby);
+      strtrim(acl_type);
+      if (!hash_lookup(machines, mach_id))
        {
-         printf("Hostaccess for non-existant host %d\n", id1);
+         printf("Hostaccess for non-existant host %d\n", mach_id);
          printf("Not fixing this error\n");
        }
-      if (!strcmp(type, "USER") && !hash_lookup(users, id2))
+      if (!strcmp(acl_type, "USER") && !hash_lookup(users, acl_id))
        {
-         printf("Hostaccess for %d is non-existant user %d\n", id1, id2);
+         printf("Hostaccess for %d is non-existant user %d\n", mach_id, acl_id);
          printf("Not fixing this error\n");
        }
-      else if (!strcmp(type, "LIST") && !hash_lookup(lists, id2))
+      else if (!strcmp(acl_type, "LIST") && !hash_lookup(lists, acl_id))
        {
-         printf("Hostaccess for %d is non-existant list %d\n", id1, id2);
+         printf("Hostaccess for %d is non-existant list %d\n", mach_id, acl_id);
          printf("Not fixing this error\n");
        }
     }
   EXEC SQL CLOSE csr228;
 
-  dprintf("Checking palladium...\n");
-  sq1 = sq_create();
-  EXEC SQL DECLARE csr229 CURSOR FOR
-    SELECT mach_id, modby FROM palladium
-    FOR UPDATE OF modby;
-  EXEC SQL OPEN csr229;
-  while (1)
-    {
-      EXEC SQL FETCH csr229 INTO :id1, :id2;
-      if (sqlca.sqlcode)
-       break;
-
-      maybe_fixup_modby2("palladium", "modby", "csr229", id2);
-      if (!hash_lookup(machines, id1))
-       sq_save_unique_data(sq1, (void *)id1);
-    }
-  EXEC SQL CLOSE csr229;
-  generic_delete(sq1, show_pdm_mach, "palladium", "mach_id", 1);
-
   dprintf("Checking krbmap...\n");
   sq1 = sq_create();
   sq2 = sq_create();
   EXEC SQL DECLARE csr230 CURSOR FOR
-    SELECT users_id, string_id FROM krbmap
+    SELECT users_id, string_id, rowid FROM krbmap
     FOR UPDATE OF string_id;
   EXEC SQL OPEN csr230;
   while (1)
     {
-      EXEC SQL FETCH csr230 INTO :id1, :id2;
+      EXEC SQL BEGIN DECLARE SECTION;
+      int users_id, string_id;
+      EXEC SQL END DECLARE SECTION;
+
+      EXEC SQL FETCH csr230 INTO :users_id, :string_id, :rowid;
       if (sqlca.sqlcode)
        break;
 
-      if (!hash_lookup(users, id1))
-       sq_save_unique_data(sq1, (void *)id1);
-      else if (!maybe_fixup_unref_string2("krbmap", "string_id", "csr230", id2))
-       sq_save_unique_data(sq2, (void *)id2);
+      if (!hash_lookup(users, users_id))
+       sq_save_unique_data(sq1, (void *)users_id);
+      else if (!maybe_fixup_unref_string2("krbmap", "string_id", strtrim(rowid), string_id))
+       sq_save_unique_data(sq2, (void *)string_id);
     }
   EXEC SQL CLOSE csr230;
   generic_delete(sq1, show_krb_usr, "krbmap", "users_id", 1);
@@ -1806,13 +2126,18 @@ void phase2(void)
   EXEC SQL OPEN csr231;
   while (1)
     {
-      EXEC SQL FETCH csr231 INTO :id1, :name;
+      EXEC SQL BEGIN DECLARE SECTION;
+      int list_id;
+      char tag[CAPACLS_TAG_SIZE];
+      EXEC SQL END DECLARE SECTION;
+
+      EXEC SQL FETCH csr231 INTO :list_id, :tag;
       if (sqlca.sqlcode)
        break;
 
-      if (!hash_lookup(lists, id1))
+      if (!hash_lookup(lists, list_id))
        {
-         printf("Capacl for %s is non-existant list %d\n", name, id1);
+         printf("Capacl for %s is non-existant list %d\n", tag, list_id);
          printf("Not fixing this error\n");
        }
     }
@@ -1825,35 +2150,71 @@ void phase2(void)
   EXEC SQL OPEN csr232;
   while (1)
     {
-      EXEC SQL FETCH csr232 INTO :id1;
+      EXEC SQL BEGIN DECLARE SECTION;
+      int mach_id;
+      EXEC SQL END DECLARE SECTION;
+
+      EXEC SQL FETCH csr232 INTO :mach_id;
       if (sqlca.sqlcode)
        break;
 
-      if (!hash_lookup(machines, id1))
-       sq_save_unique_data(sq1, (void *)id1);
+      if (!hash_lookup(machines, mach_id))
+       sq_save_unique_data(sq1, (void *)mach_id);
     }
   EXEC SQL CLOSE csr232;
   generic_delete(sq1, show_hostalias, "hostalias", "mach_id", 1);
 
-  dprintf("Checking printcaps\n");
+  dprintf("Checking printers\n");
   sq1 = sq_create();
   sq2 = sq_create();
+  sq3 = sq_create();
+  sq4 = sq_create();
+  sq5 = sq_create();
+  sq6 = sq_create();
   EXEC SQL DECLARE csr233 CURSOR FOR
-    SELECT mach_id, quotaserver, modby FROM printcap;
+    SELECT mach_id, loghost, rm, rq, ac, lpc_acl, modby, rowid FROM printers;
   EXEC SQL OPEN csr233;
   while (1)
     {
-      EXEC SQL FETCH csr233 INTO :id1, :id2, :id3;
+      EXEC SQL BEGIN DECLARE SECTION;
+      int mach_id, loghost, rm, rq, ac, lpc_acl, modby;
+      EXEC SQL END DECLARE SECTION;
+
+      EXEC SQL FETCH csr233 INTO :mach_id, :loghost, :rm, :rq, :ac,
+       :lpc_acl, :modby, :rowid;
       if (sqlca.sqlcode)
        break;
 
-      maybe_fixup_modby2("printcap", "modby", "csr233", id3);
-      if (!hash_lookup(machines, id1))
-       sq_save_unique_data(sq1, (void *)id1);
-      else if (!hash_lookup(machines, id2))
-       sq_save_unique_data(sq2, (void *)id2);
+      maybe_fixup_modby2("printers", "modby", strtrim(rowid), modby);
+      if (!hash_lookup(machines, mach_id))
+       sq_save_unique_data(sq1, (void *)mach_id);
+      else if (!hash_lookup(machines, rm))
+       sq_save_unique_data(sq2, (void *)rm);
+      else if (!hash_lookup(printservers, rm))
+       sq_save_unique_data(sq6, (void *)mach_id);
+      else if (!hash_lookup(machines, rq))
+       sq_save_unique_data(sq3, (void *)rq);
+      else {
+       if (!hash_lookup(lists, ac))
+         sq_save_unique_data(sq4, (void *)ac);
+       if (!hash_lookup(lists, lpc_acl))
+         sq_save_unique_data(sq5, (void *)lpc_acl);
+       if (!hash_lookup(machines, loghost))
+         {
+           show_printer_loghost((void *)loghost);
+           cant_fix();
+         }
+      }
     }
   EXEC SQL CLOSE csr233;
-  generic_delete(sq1, show_pcap_mach, "printcap", "mach_id", 1);
-  generic_delete(sq2, show_pcap_quota, "printcap", "quotaserver", 1);
+  generic_delete(sq1, show_printer_mach, "printers", "mach_id", 1);
+  generic_delete(sq6, show_printer_server, "printers", "mach_id", 1);
+  generic_delete(sq2, show_printer_spool, "printers", "rm", 1);
+  generic_delete(sq3, show_printer_quota, "printers", "rq", 1);
+  generic_fix(sq4, show_printer_ac, "Clear", fix_printer_ac, 1);
+  generic_fix(sq5, show_printer_lpc_acl, "Clear", fix_printer_lpc_acl, 1);
+
+  dprintf("Checking printservers\n");
+  hash_step(printservers, check_ps, NULL);
 }
This page took 0.090711 seconds and 4 git commands to generate.