]> andersk Git - moira.git/blobdiff - gen/cups-print.pc
Fix lprm.
[moira.git] / gen / cups-print.pc
index f6f5f51b4f05746e37d21d6e5ad93f3ec095c622..b600d5d8630a7017ecd5c30d38a162c670b4881f 100644 (file)
 #include <string.h>
 
 #include <time.h>
+#ifdef HAVE_KRB4
 #include <krb.h>
+#endif
 #include <krb5.h>
 
 #include "util.h"
 
-
-
 EXEC SQL INCLUDE sqlca;
 
 RCSID("$Header$");
@@ -33,22 +33,27 @@ RCSID("$Header$");
 char *whoami = "cups-print.gen";
 char *db = "moira/moira";
 
+const int krbvers = 5; /* use Kerberos 5 */
+
 /* OMG, I hate this, but it's cleaner, I guess? */
 
-const char *alterjob = "<Limit Send-Document Send-URI Hold-Job Release-Job\
- Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription\
- Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job\
+const char *alterjob = "<Limit Hold-Job Release-Job\
+ Restart-Job Purge-Jobs Reprocess-Job Set-Job-Attributes\
  Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>";
-const char *submitjob = "<Limit Create-Job Print-Job Print-URI>";
+const char *submitjob = "<Limit Create-Job Print-Job Print-URI\
+ Set-Job-Attributes Send-URI Create-Job-Subscription Renew-Subscription\
+ Cancel-Subscription Get-Notifications CUPS-Move-Job CUPS-Authenticate-Job>";
 const char *alterpntr = "<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer\
- CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>";
+ CUPS-Add-Modify-Class CUPS-Delete-Class>";
 const char *lpcpntr = "<Limit Pause-Printer Resume-Printer Enable-Printer\
  Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs\
  Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer\
  Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After\
- CUPS-Accept-Jobs CUPS-Reject-Jobs>";
-const char *canceljob = "<Limit Cancel-Job CUPS-Authenticate-Job>";
+ CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>";
+const char *canceljob = "<Limit Cancel-Job>";
 const char *catchall = "<Limit All>";
+const char *phost = "printers.MIT.EDU";
+const char *svrlist = "cups-servers";
 
 void do_host(char *host);
 void sqlerr(void);
@@ -70,7 +75,8 @@ int main(int argc, char **argv)
 
   EXEC SQL DECLARE csr_hosts CURSOR FOR
     SELECT m.name FROM machine m, serverhosts sh
-    WHERE m.mach_id = sh.mach_id AND sh.service = 'CUPS-PRINT' AND sh.enable = 1;
+    WHERE m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' OR sh.service = 'CUPS-CLUSTER')
+    AND sh.enable = 1;
   EXEC SQL OPEN csr_hosts;
   while (1)
     {
@@ -86,16 +92,28 @@ int main(int argc, char **argv)
   exit(MR_SUCCESS);
 }
 
-void printer_user_list(FILE *out, char *type, int id, char *str)
+void printer_user_list(FILE *out, char *type, int id, char *str, int striprealm)
 {
   struct save_queue *sq;
   struct imember *m;
+  char kbuf[MAX_K_NAME_SZ];
+  char *cp;
 
   sq = get_acl(type, id, NULL);
   while (sq_remove_data(sq, &m))
     {
-      if (m->type == 'U')
-        fprintf(out, "%s %s\n", str, m->name);
+      if (m->type != 'S' && m->type != NULL) {
+       /* CUPS wants mmanley/root, not mmanley.root@ATHENA.MIT.EDU */
+        canon_krb(m, krbvers, kbuf, sizeof(kbuf));
+
+       /* now, take out all the @realm */
+       if (striprealm) {
+        for (cp=kbuf; *cp; cp++) {
+         if (*cp == '@') *cp = '\0';
+       }
+       }
+        fprintf(out, "%s %s\n", str, kbuf);
+      }
       freeimember(m);
     }
   sq_destroy(sq);
@@ -112,6 +130,7 @@ void do_host(char *host)
   char modtime[PRINTERS_MODTIME_SIZE], lmodtime[LIST_MODTIME_SIZE];
   char contact[PRINTERS_CONTACT_SIZE], hostname[MACHINE_NAME_SIZE];
   char cupshosts[MACHINE_NAME_SIZE], prtype [PRINTERS_TYPE_SIZE];
+  char service[SERVERHOSTS_SERVICE_SIZE];
   char *spoolhost = host, *unixtime_fmt = UNIXTIME_FMT, *p;
   char *lhost;
   int ka, pc, ac, lpc_acl, top_lpc_acl, banner, rm;
@@ -131,14 +150,14 @@ void do_host(char *host)
   sprintf(filename, "%s/cups-print/%s", DCM_DIR, host);
   tf = tarfile_open(filename);
 
-  /* printers.conf */
+  /* printers.conf entries for locally run queues */
   out = tarfile_start(tf, "/etc/cups/printers.conf", 0644, 0, 0,
-                     "root", "lp", now);
+                     "lp", "lp", now);
 
   EXEC SQL DECLARE csr_printers CURSOR FOR
     SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
     m.name, pr.banner, pr.location, pr.contact, pr.ka,
-    pr.ac
+    pr.ac, pr.lpc_acl
     FROM printers pr, machine m
     WHERE pr.rm = :rm AND m.mach_id = pr.mach_id
     AND pr.type != 'ALIAS';
@@ -146,7 +165,7 @@ void do_host(char *host)
   while (1)
     {
       EXEC SQL FETCH csr_printers INTO :rp, :name, :duplexname,
-       :hwtype, :hostname, :banner, :location, :contact, :ka, :ac;
+       :hwtype, :hostname, :banner, :location, :contact, :ka, :ac, :lpc_acl;
       if (sqlca.sqlcode)
        break;
 
@@ -158,6 +177,8 @@ void do_host(char *host)
       strtrim(location);
       strtrim(contact);
       strcpy(lowerhwtype, hwtype);
+      for (p = rp; *p; p++)    /* Because uppercased printer names suck */
+       *p = tolower(*p);
       for (p = lowerhwtype; *p; p++)
        *p = tolower(*p);
 
@@ -179,13 +200,18 @@ void do_host(char *host)
       fprintf(out, "PageLimit 0\n");
       fprintf(out, "Klimit 0\n");
       fprintf(out, "Option sides one-sided\n");
+      fprintf(out, "Filter application/vnd.cups-raw 0 -\n");
+      fprintf(out, "Filter application/vnd.cups-postscript 100 foomatic-rip\n");
+      fprintf(out, "Filter application/vnd.cups-pdf 0 foomatic-rip\n");
+      fprintf(out, "Filter application/vnd.apple-pdf 25 foomatic-rip\n");
+      fprintf(out, "Filter application/vnd.cups-command 0 commandtops\n");
       if (location[0])
         fprintf(out, "Location %s\n", location);
       fprintf(out, "ErrorPolicy abort-job\n");
-      if (! ka || ! lpc_acl)
-        fprintf(out, "OpPolicy default\n");
-      else
+      if (ka || lpc_acl)
        fprintf(out, "OpPolicy %s-policy\n", rp);
+      else
+        fprintf(out, "OpPolicy default\n");
 
       /* Access-control list. */
       if (ac)
@@ -193,8 +219,8 @@ void do_host(char *host)
           if (ka)
            fprintf(out, "AuthType Negotiate\n");
          else
-           fprintf(out, "AuthType Negotiate\n");
-          printer_user_list(out, "LIST", ac, "AllowUser");
+           fprintf(out, "AuthType Default\n");
+          printer_user_list(out, "LIST", ac, "AllowUser", 0);
         }
 
       if (banner == PRN_BANNER_NONE)
@@ -205,27 +231,165 @@ void do_host(char *host)
 
     }
   EXEC SQL CLOSE csr_printers;
+
+  /* printers.conf entries for non-local CUPS queues */
+  EXEC SQL DECLARE csr_remote_printers CURSOR FOR
+    SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
+    m.name, pr.banner, pr.location, pr.contact, pr.ka,
+    pr.ac, pr.lpc_acl, m.name as cupshosts
+    FROM printers pr, machine m, serverhosts sh
+    WHERE pr.rm = m.mach_id 
+    AND pr.type != 'ALIAS' AND m.name <> :spoolhost AND
+    m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' OR sh.service = 'CUPS-CLUSTER')
+    AND sh.enable = 1 AND m.mach_id = sh.mach_id;
+
+  EXEC SQL OPEN csr_remote_printers;
+  while (1)
+    {
+      EXEC SQL FETCH csr_remote_printers INTO :rp, :name, :duplexname,
+       :hwtype, :hostname, :banner, :location, :contact, :ka, :ac, :lpc_acl, :cupshosts;
+      if (sqlca.sqlcode)
+       break;
+
+      strtrim(rp);
+      strtrim(name);
+      strtrim(duplexname);
+      strtrim(hwtype);
+      strtrim(hostname);
+      strtrim(location);
+      strtrim(contact);
+      strtrim(cupshosts);
+      strcpy(lowerhwtype, hwtype);
+      for (p = rp; *p; p++)    /* Because uppercased printer names suck */
+       *p = tolower(*p);
+      for (p = lowerhwtype; *p; p++)
+       *p = tolower(*p);
+
+      fprintf(out, "<Printer %s>\n",rp);
+      fprintf(out, "Info %s:%s\n", rp, hwtype);
+      fprintf(out, "DeviceURI ipp://%s:631/printers/%s\n", cupshosts, rp);
+      fprintf(out, "State Idle\n");    // Always with the Idle
+      fprintf(out, "StateTime %ld\n", (long)time(NULL));
+      fprintf(out, "Accepting Yes\n");
+      fprintf(out, "Shared Yes\n");
+      fprintf(out, "QuotaPeriod 0\n");
+      fprintf(out, "PageLimit 0\n");
+      fprintf(out, "Klimit 0\n");
+      fprintf(out, "Option sides one-sided\n");
+      fprintf(out, "Filter application/vnd.cups-raw 0 -\n");
+      fprintf(out, "Filter application/vnd.cups-postscript 100 foomatic-rip\n");
+      fprintf(out, "Filter application/vnd.cups-pdf 0 foomatic-rip\n");
+      fprintf(out, "Filter application/vnd.apple-pdf 25 foomatic-rip\n");
+      fprintf(out, "Filter application/vnd.cups-command 0 commandtops\n");
+      if (location[0])
+        fprintf(out, "Location %s\n", location);
+      fprintf(out, "ErrorPolicy abort-job\n");
+      if (ka || lpc_acl)
+       fprintf(out, "OpPolicy %s-policy\n", rp);
+      else
+        fprintf(out, "OpPolicy default\n");
+
+      /* Access-control list. */
+      if (ac)
+        {
+          if (ka)
+           fprintf(out, "AuthType Negotiate\n");
+         else
+           fprintf(out, "AuthType Default\n");
+          printer_user_list(out, "LIST", ac, "AllowUser", 0);
+        }
+
+      if (banner == PRN_BANNER_NONE)
+       fprintf(out, "JobSheets none none\n");
+      else 
+       fprintf(out, "JobSheets athena none\n");
+      fprintf(out, "</Printer>\n");
+
+    }
+  EXEC SQL CLOSE csr_remote_printers;
+
+  /* printers.conf entries for non-local LPRng queues */
+  EXEC SQL DECLARE csr_lprng_printers CURSOR FOR
+    SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
+    m.name, pr.banner, pr.location, pr.contact, pr.ka,
+    pr.ac, pr.lpc_acl, m.name as cupshosts
+    FROM printers pr, machine m, serverhosts sh
+    WHERE pr.rm = m.mach_id 
+    AND pr.type != 'ALIAS' AND m.name <> :spoolhost AND
+    m.mach_id = sh.mach_id AND sh.service = 'PRINT' AND 
+    sh.enable = 1;
+
+  EXEC SQL OPEN csr_lprng_printers;
+  while (1)
+    {
+      EXEC SQL FETCH csr_lprng_printers INTO :rp, :name, :duplexname,
+       :hwtype, :hostname, :banner, :location, :contact, :ka, :ac, :lpc_acl, :cupshosts;
+      if (sqlca.sqlcode)
+       break;
+
+      strtrim(rp);
+      strtrim(name);
+      strtrim(duplexname);
+      strtrim(hwtype);
+      strtrim(hostname);
+      strtrim(location);
+      strtrim(contact);
+      strtrim(cupshosts);
+      strcpy(lowerhwtype, hwtype);
+      for (p = rp; *p; p++)    /* Because uppercased printer names suck */
+       *p = tolower(*p);
+      for (p = lowerhwtype; *p; p++)
+       *p = tolower(*p);
+
+      fprintf(out, "<Printer %s>\n",rp);
+      fprintf(out, "Info %s:LPRng Queue on %s\n", rp, cupshosts);
+      fprintf(out, "DeviceURI lpd://%s/%s\n", cupshosts, rp);
+      fprintf(out, "State Idle\n");    // Always with the Idle
+      fprintf(out, "StateTime %ld\n", (long)time(NULL));
+      fprintf(out, "Accepting Yes\n");
+      fprintf(out, "Shared Yes\n");
+      fprintf(out, "QuotaPeriod 0\n");
+      fprintf(out, "PageLimit 0\n");
+      fprintf(out, "Klimit 0\n");
+      fprintf(out, "Option sides one-sided\n");
+      fprintf(out, "Filter application/vnd.cups-raw 0 -\n");
+      fprintf(out, "Filter application/vnd.cups-postscript 100 foomatic-rip\n");
+      fprintf(out, "Filter application/vnd.cups-pdf 0 foomatic-rip\n");
+      fprintf(out, "Filter application/vnd.apple-pdf 25 foomatic-rip\n");
+      fprintf(out, "Filter application/vnd.cups-command 0 commandtops\n");
+      if (location[0])
+        fprintf(out, "Location %s\n", location);
+      fprintf(out, "ErrorPolicy abort-job\n");
+      fprintf(out, "OpPolicy default\n");
+      fprintf(out, "JobSheets none none\n");
+      fprintf(out, "</Printer>\n");
+
+    }
+  EXEC SQL CLOSE csr_lprng_printers;
   tarfile_end(tf);
 
 
   /* aliases are in classes.conf */
   out = tarfile_start(tf, "/etc/cups/classes.conf", 0644, 0, 0,
-                     "root", "root", now);
+                 "lp", "lp", now);
   EXEC SQL DECLARE csr_duplexqs CURSOR FOR
     SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
     m.name, pr.banner, pr.location, pr.contact, pr.ka, 
-    pr.type as prtype, pr.ac
-    FROM printers pr, machine m
-    WHERE pr.rm = :rm AND m.mach_id = pr.mach_id;
+    pr.type as prtype, pr.ac, sh.service
+    FROM printers pr, machine m, serverhosts sh
+    WHERE pr.rm = m.mach_id 
+    AND m.mach_id = sh.mach_id AND sh.enable = 1 
+    AND (sh.service = 'CUPS-PRINT' OR sh.service = 'PRINT' OR sh.service = 'CUPS-CLUSTER');
   EXEC SQL OPEN csr_duplexqs;
   while (1)
     {
       EXEC SQL FETCH csr_duplexqs INTO :rp, :name, :duplexname,
-       :hwtype, :hostname, :banner, :location, :contact, :ka, :prtype, :ac;
+       :hwtype, :hostname, :banner, :location, :contact, :ka, :prtype, :ac, :service;
       if (sqlca.sqlcode)
        break;
 
       strtrim(hwtype);
+      strtrim(service);
       strtrim(rp);
       strtrim(location);
       strtrim(contact);
@@ -250,21 +414,15 @@ void do_host(char *host)
           fprintf(out, "PageLimit 0\n");
           if (location[0])
             fprintf(out, "Location %s\n", location);
-          fprintf(out, "ErrorPolicy abort-job\n");
-          if (! ka || ! lpc_acl)
-            fprintf(out, "OpPolicy default\n");
-          else
+         /* do not use custom policies for LPRng printers */
+         if (strcmp(service,"PRINT") && (ka || lpc_acl))
                    fprintf(out, "OpPolicy %s-policy\n", rp);
+          else
+            fprintf(out, "OpPolicy default\n");
     
           /* Access-control list. */
           if (ac)
-            {
-              if (ka)
-                       fprintf(out, "AuthType Negotiate\n");
-             else
-                       fprintf(out, "AuthType Negotiate\n");
-              printer_user_list(out, "LIST", ac, "AllowUser");
-            }
+            printer_user_list(out, "LIST", ac, "AllowUser", 0);
     
           if (banner == PRN_BANNER_NONE)
            fprintf(out, "JobSheets none none\n");
@@ -295,21 +453,14 @@ void do_host(char *host)
           fprintf(out, "PageLimit 0\n");
           if (location[0])
             fprintf(out, "Location %s\n", location);
-          fprintf(out, "ErrorPolicy abort-job\n");
-          if (! ka || ! lpc_acl)
-            fprintf(out, "OpPolicy default\n");
-          else
+         if (strcmp(service,"PRINT") && (ka || lpc_acl))
                    fprintf(out, "OpPolicy %s-policy\n", rp);
+          else
+            fprintf(out, "OpPolicy default\n");
     
           /* Access-control list. */
           if (ac)
-            {
-              if (ka)
-                       fprintf(out, "AuthType Negotiate\n");
-             else
-                       fprintf(out, "AuthType Negotiate\n");
-              printer_user_list(out, "LIST", ac, "AllowUser");
-            }
+            printer_user_list(out, "LIST", ac, "AllowUser", 0);
     
           if (banner == PRN_BANNER_NONE)
            fprintf(out, "JobSheets none none\n");
@@ -328,6 +479,7 @@ void do_host(char *host)
   fprintf(out, "LogLevel info\n");
   fprintf(out, "SystemGroup sys root ops-group\n");
   fprintf(out, "Port 631\n");
+  fprintf(out, "SSLPort 443\n");
   fprintf(out, "Listen /var/run/cups/cups.sock\n");
   fprintf(out, "Browsing On\n");
   fprintf(out, "BrowseOrder allow,deny\n");
@@ -337,13 +489,19 @@ void do_host(char *host)
   fprintf(out, "ServerCertificate /etc/cups/ssl/%s-ipp-crt.pem\n", lhost);
   fprintf(out, "ServerKey /etc/cups/ssl/%s-ipp-key.pem\n", lhost);
   fprintf(out, "ServerName %s\n", lhost);
-  fprintf(out, "Krb5Keytab /etc/krb5-ipp.keytab\n");
-  fprintf(out, "Browsing On\n");
-  fprintf(out, "BrowseProtocols cups\n");
+  fprintf(out, "ServerAlias %s\n", phost);
+  /* fprintf(out, "Krb5Keytab /etc/krb5-ipp.keytab\n"); */
 
   /* The other CUPS servers should be aware of the other hosts'
      queues, so we'll let them browse each other. */
+  fprintf(out, "Include cups.local.conf\n");
+  fprintf(out, "Include cups.locations.conf\n");
+  fprintf(out, "Include cups.policies.conf\n");
+  tarfile_end(tf);
 
+  /* cups.hosts.conf */
+  out = tarfile_start(tf, "/etc/cups/cups.hosts.conf", 0755, 1, 1,
+                     "root", "lp", now);
   EXEC SQL DECLARE csr_cupshosts CURSOR FOR
     SELECT m.name AS cupshosts FROM machine m, printservers ps
     WHERE m.mach_id = ps.mach_id AND ps.kind = 'CUPS';
@@ -361,8 +519,6 @@ void do_host(char *host)
          fprintf(out, "BrowsePoll %s\n", cupshosts);
     }
   EXEC SQL CLOSE csr_cupshosts;
-  fprintf(out, "Include cups.locations.conf\n");
-  fprintf(out, "Include cups.policies.conf\n");
 
   tarfile_end(tf);
 
@@ -374,18 +530,25 @@ void do_host(char *host)
   EXEC SQL SELECT ps.lpc_acl INTO :top_lpc_acl
     FROM printservers ps, machine m
     WHERE m.name = :spoolhost AND m.mach_id = ps.mach_id;
-  if (!sqlca.sqlcode && lpc_acl)
-    {
+
+  /* first, what's our defaults? */
       fprintf (out, "<Policy default>\n");
       fprintf (out, "%s\n", alterjob);
       fprintf (out, "AuthType Default\n");
       fprintf (out, "Require user @OWNER @SYSTEM\n");
-      printer_user_list(out, "LIST", top_lpc_acl, "Require user");
+  printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
+  fprintf (out, "Order deny,allow\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "<Limit Send-Document CUPS-Get-Document>\n");
+  fprintf (out, "AuthType None\n");
+  fprintf (out, "Require user @OWNER @SYSTEM\n");
       fprintf (out, "Order deny,allow\n");
+  fprintf (out, "Allow from all\n");
       fprintf (out, "</Limit>\n");
       fprintf (out, "%s\n", submitjob);
-      fprintf (out, "AuthType Default\n");
+      fprintf (out, "AuthType None\n");
       fprintf (out, "Order deny,allow\n");
+      fprintf (out, "Allow from all\n");
       fprintf (out, "</Limit>\n");
       fprintf (out, "%s\n", alterpntr);
       fprintf (out, "AuthType Default\n");
@@ -395,20 +558,22 @@ void do_host(char *host)
       fprintf (out, "%s\n", lpcpntr);
       fprintf (out, "AuthType Default\n");
       fprintf (out, "Require user @SYSTEM\n");
-      printer_user_list(out, "LIST", top_lpc_acl, "Require user");
+  printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
       fprintf (out, "Order deny,allow\n");
       fprintf (out, "</Limit>\n");
       fprintf (out, "%s\n", canceljob);
       fprintf (out, "AuthType Default\n");
       fprintf (out, "Require user @OWNER @SYSTEM\n");
-      printer_user_list(out, "LIST", top_lpc_acl, "Require user");
+  printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
       fprintf (out, "Order deny,allow\n");
+      fprintf (out, "Allow from all\n");
       fprintf (out, "</Limit>\n");
       fprintf (out, "%s\n", catchall);
+      fprintf (out, "AuthType None\n");
       fprintf (out, "Order deny,allow\n");
+      fprintf (out, "Allow from all\n");
       fprintf (out, "</Limit>\n");
       fprintf (out, "</Policy>\n");
-    }
 
   /* restrict lists and lpcaccess policies.  Sadly, we have to put the
      top level for each new policy since CUPS doesn't have a way of 
@@ -416,7 +581,9 @@ void do_host(char *host)
   EXEC SQL DECLARE csr_lpc CURSOR FOR
     SELECT UNIQUE rp, ka, ac, lpc_acl
     FROM printers
-    WHERE rm = :rm AND ( ac != 0 OR lpc_acl != 0);
+    WHERE (ac != 0 OR lpc_acl != 0) AND rm in (SELECT m.mach_id FROM machine m, serverhosts sh
+    WHERE m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' OR sh.service = 'CUPS-CLUSTER')
+    AND sh.enable = 1);
   EXEC SQL OPEN csr_lpc;
   while (1)
     {
@@ -430,8 +597,16 @@ void do_host(char *host)
       fprintf (out, "%s\n", alterjob);
       fprintf (out, "AuthType Default\n");
       fprintf (out, "Require user @OWNER @SYSTEM\n");
-      printer_user_list(out, "LIST", lpc_acl, "Require user");
+      printer_user_list(out, "LIST", lpc_acl, "Require user", 1);
+      printer_user_list(out, "LIST", svrlist, "Require user", 1);
       fprintf (out, "Order deny,allow\n");
+      fprintf (out, "Allow from all\n");
+      fprintf (out, "</Limit>\n");
+      fprintf (out, "<Limit Send-Document CUPS-Get-Document>\n");
+      fprintf (out, "AuthType None\n");
+      fprintf (out, "Require user @OWNER @SYSTEM\n");
+      fprintf (out, "Order deny,allow\n");
+      fprintf (out, "Allow from all\n");
       fprintf (out, "</Limit>\n");
       fprintf (out, "%s\n", submitjob);
       /* If the printer is Kerberized? */
@@ -440,11 +615,14 @@ void do_host(char *host)
       else
         fprintf (out, "AuthType None\n");
       /* Access-control list. */
-      if (ac)
-        printer_user_list(out, "LIST", ac, "Require user");
+      if (ac) {
+        printer_user_list(out, "LIST", ac, "Require user", 1);
+        printer_user_list(out, "LIST", svrlist, "Require user", 1);
+      }
       else if (ka)
         fprintf (out, "Require valid-user\n");
       fprintf (out, "Order deny,allow\n");
+      fprintf (out, "Allow from all\n");
       fprintf (out, "</Limit>\n");
       fprintf (out, "%s\n", alterpntr);
       fprintf (out, "AuthType Default\n");
@@ -456,19 +634,22 @@ void do_host(char *host)
       fprintf (out, "Require user @SYSTEM\n");
       /* printer-specific lpc access. */
       if (lpc_acl)
-          printer_user_list(out, "LIST", lpc_acl, "Require user");
-      printer_user_list(out, "LIST", top_lpc_acl, "Require user");
+        printer_user_list(out, "LIST", lpc_acl, "Require user", 1);
+      printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
       fprintf (out, "Order deny,allow\n");
       fprintf (out, "</Limit>\n");
       fprintf (out, "%s\n", canceljob);
       fprintf (out, "AuthType Default\n");
       fprintf (out, "Require user @OWNER @SYSTEM\n");
-      printer_user_list(out, "LIST", lpc_acl, "Require user");
-      printer_user_list(out, "LIST", top_lpc_acl, "Require user");
+      printer_user_list(out, "LIST", lpc_acl, "Require user", 1);
+      printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
       fprintf (out, "Order deny,allow\n");
+      fprintf (out, "Allow from all\n");
       fprintf (out, "</Limit>\n");
       fprintf (out, "%s\n", catchall);
+      fprintf (out, "AuthType None\n");
       fprintf (out, "Order deny,allow\n");
+      fprintf (out, "Allow from all\n");
       fprintf (out, "</Limit>\n");
       fprintf (out, "</Policy>\n");
     }
This page took 0.055892 seconds and 4 git commands to generate.