]> andersk Git - moira.git/commitdiff
dbck changes for new printing infrastructure. (as yet untested)
authordanw <danw>
Wed, 27 Jan 1999 19:35:59 +0000 (19:35 +0000)
committerdanw <danw>
Wed, 27 Jan 1999 19:35:59 +0000 (19:35 +0000)
dbck/FIXES
dbck/phase1.pc
dbck/phase2.pc

index 09886abbaae9ac217a3a260900b8871fcd14ad50..00e32b68931becc7d37f261abc70cbee6e443505 100644 (file)
@@ -37,9 +37,6 @@ F* Each filesys name must be unique
    Each string_id must be unique
        Delete all copies
 F* Each printer name must be unique
-  *Each palladium id must be unique
-       Alloc new ID
-F**Each palladium name must be unique
 
 PHASE 2: checking references
 
@@ -108,12 +105,12 @@ P  Every quota's phys_id must match the filesys' phys_id
  * Every hostaccess must be for a real machine
  * Every hostaccess USER must exist
  * Every hostaccess LIST must exist
-   Every printer must have a real spool machine
-       Delete the printer
-   Every printer must have a real quota server
+   Every printer must have real printer, spool, and quota machines
        Delete the printer
-P  Every palladium server must be on a real machine
-       Delete the palladium entry
+ * Every printer must have a real log machine
+       Reset to WSLOGGER.MIT.EDU
+   Every print ac/lpc_acl must exist
+       Make it list 0
 P  Every user in the krbmap must exist
        Delete map entry
 P  Every string in the krbmap must exist
index 27b0add6a0e9e1fb70d10b278109d9bc26543580..026020ef8e3fa1d3bdbfbb3e94846bbfb21c3c97 100644 (file)
@@ -867,24 +867,28 @@ void phase1(void)
 
   generic_fix(sq, show_np_id, "Change ID", fix_np_id, 0);
 
-  dprintf("Checking printcap...\n");
-
-  EXEC SQL DECLARE csr119 CURSOR FOR
-    SELECT p1.name FROM printcap p1, printcap p2
-    WHERE p1.name = p2.name AND p1.rowid < p2.rowid;
-  EXEC SQL OPEN csr119;
-  while (1)
+  if (!fast)
     {
-      EXEC SQL BEGIN DECLARE SECTION;
-      char name[PRINTCAP_NAME_SIZE];
-      EXEC SQL END DECLARE SECTION;
+      dprintf("Checking printers...\n");
 
-      EXEC SQL FETCH csr119 INTO :name;
-      if (sqlca.sqlcode)
-       break;
+      EXEC SQL DECLARE csr119 CURSOR FOR
+       SELECT p1.name FROM printers p1, printers p2
+       WHERE ( p1.name = p2.name AND p1.rowid < p2.rowid )
+       OR ( p1.name = p2.duplexname );
+      EXEC SQL OPEN csr119;
+      while (1)
+       {
+         EXEC SQL BEGIN DECLARE SECTION;
+         char name[PRINTERS_NAME_SIZE];
+         EXEC SQL END DECLARE SECTION;
 
-      printf("Printer %s has duplicate name\n", name);
-      cant_fix(0);
+         EXEC SQL FETCH csr119 INTO :name;
+         if (sqlca.sqlcode)
+           break;
+
+         printf("Printer %s has duplicate name\n", name);
+         cant_fix(0);
+       }
+      EXEC SQL CLOSE csr119;
     }
-  EXEC SQL CLOSE csr119;
 }
index ec4efbaf7f4ed1efe9e6e113321d04da2f167d2c..af248b9f24b8e7cf5e166d8b6986a489f19c086c 100644 (file)
@@ -22,8 +22,14 @@ 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_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);
+int fix_printer_ac(void *id);
+int 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);
@@ -155,15 +161,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[PRINTCAP_NAME_SIZE];
+  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 +180,100 @@ 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_loghost(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
   int iid = (int)id, found = 1;
-  char name[PRINTCAP_NAME_SIZE];
+  char name[PRINTERS_NAME_SIZE];
+  EXEC SQL END DECLARE SECTION;
+
+  EXEC SQL DECLARE csr235 CURSOR FOR
+    SELECT name FROM printers WHERE loghost = :iid;
+  EXEC SQL OPEN csr235;
+  while (1)
+    {
+      EXEC SQL FETCH csr235 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 csr235;
+  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 csr235 CURSOR FOR
+    SELECT name FROM printers WHERE rm = :iid;
+  EXEC SQL OPEN csr235;
+  while (1)
+    {
+      EXEC SQL FETCH csr235 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 csr235;
+  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 csr236 CURSOR FOR
+    SELECT name FROM printers WHERE rq = :iid;
+  EXEC SQL OPEN csr236;
+  while (1)
+    {
+      EXEC SQL FETCH csr236 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 csr236;
+  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 csr236 CURSOR FOR
-    SELECT name FROM printcap WHERE quotaserver = :iid;
+    SELECT name FROM printers WHERE ac = :iid;
   EXEC SQL OPEN csr236;
   while (1)
     {
@@ -200,13 +284,69 @@ 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 restrict list %d in printers table\n",
             name, iid);
     }
   EXEC SQL CLOSE csr236;
   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 csr236 CURSOR FOR
+    SELECT name FROM printers WHERE lpc_acl = :iid;
+  EXEC SQL OPEN csr236;
+  while (1)
+    {
+      EXEC SQL FETCH csr236 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 csr236;
+  return found;
+}
+
+void fix_printer_ac(int 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(int 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;
@@ -1830,29 +1970,6 @@ void phase2(void)
     }
   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 BEGIN DECLARE SECTION;
-      int mach_id, modby;
-      EXEC SQL END DECLARE SECTION;
-
-      EXEC SQL FETCH csr229 INTO :mach_id, :modby;
-      if (sqlca.sqlcode)
-       break;
-
-      maybe_fixup_modby2("palladium", "modby", "csr229", modby);
-      if (!hash_lookup(machines, mach_id))
-       sq_save_unique_data(sq1, (void *)mach_id);
-    }
-  EXEC SQL CLOSE csr229;
-  generic_delete(sq1, show_pdm_mach, "palladium", "mach_id", 1);
-
   dprintf("Checking krbmap...\n");
   sq1 = sq_create();
   sq2 = sq_create();
@@ -1923,29 +2040,48 @@ void phase2(void)
   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();
   EXEC SQL DECLARE csr233 CURSOR FOR
-    SELECT mach_id, quotaserver, modby FROM printcap;
+    SELECT mach_id, loghost, rm, rq, ac, lpc_acl, modby FROM printers;
   EXEC SQL OPEN csr233;
   while (1)
     {
       EXEC SQL BEGIN DECLARE SECTION;
-      int mach_id, quotaserver, modby;
+      int mach_id, loghost, rm, rq, ac, lpc_acl, modby
       EXEC SQL END DECLARE SECTION;
 
-      EXEC SQL FETCH csr233 INTO :mach_id, :quotaserver, :modby;
+      EXEC SQL FETCH csr233 INTO :mach_id, :loghost, :rm, :rq,
+       :lpc_acl, :modby;
       if (sqlca.sqlcode)
        break;
 
-      maybe_fixup_modby2("printcap", "modby", "csr233", modby);
+      maybe_fixup_modby2("printers", "modby", "csr233", modby);
       if (!hash_lookup(machines, mach_id))
        sq_save_unique_data(sq1, (void *)mach_id);
-      else if (!hash_lookup(machines, quotaserver))
-       sq_save_unique_data(sq2, (void *)quotaserver);
+      else if (!hash_lookup(machines, rm))
+       sq_save_unique_data(sq2, (void *)rm);
+      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);
+           cantfix();
+         }
     }
   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(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);
 }
This page took 0.079747 seconds and 5 git commands to generate.