]> andersk Git - moira.git/blobdiff - gen/cups-print.pc
cups-lpd DCM.
[moira.git] / gen / cups-print.pc
index f6f5f51b4f05746e37d21d6e5ad93f3ec095c622..b9355ecc23600d30648a9d65c94d3563cfd4eb5f 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$");
@@ -35,11 +35,12 @@ char *db = "moira/moira";
 
 /* 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 Send-Document\
+ Set-Job-Attributes Send-URI Create-Job-Subscription Renew-Subscription\
+ Cancel-Subscription Get-Notifications CUPS-Move-Job>";
 const char *alterpntr = "<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer\
  CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>";
 const char *lpcpntr = "<Limit Pause-Printer Resume-Printer Enable-Printer\
@@ -49,6 +50,7 @@ const char *lpcpntr = "<Limit Pause-Printer Resume-Printer Enable-Printer\
  CUPS-Accept-Jobs CUPS-Reject-Jobs>";
 const char *canceljob = "<Limit Cancel-Job CUPS-Authenticate-Job>";
 const char *catchall = "<Limit All>";
+const char *phost = "printers.MIT.EDU";
 
 void do_host(char *host);
 void sqlerr(void);
@@ -133,7 +135,7 @@ void do_host(char *host)
 
   /* printers.conf */
   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,
@@ -210,7 +212,7 @@ void do_host(char *host)
 
   /* 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, 
@@ -337,13 +339,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, "ServerAlias %s\n", phost);
   fprintf(out, "Krb5Keytab /etc/krb5-ipp.keytab\n");
-  fprintf(out, "Browsing On\n");
-  fprintf(out, "BrowseProtocols cups\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 +369,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);
 
@@ -384,8 +390,9 @@ void do_host(char *host)
       fprintf (out, "Order deny,allow\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");
@@ -403,9 +410,12 @@ void do_host(char *host)
       fprintf (out, "Require user @OWNER @SYSTEM\n");
       printer_user_list(out, "LIST", top_lpc_acl, "Require user");
       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");
     }
@@ -432,6 +442,7 @@ void do_host(char *host)
       fprintf (out, "Require user @OWNER @SYSTEM\n");
       printer_user_list(out, "LIST", lpc_acl, "Require user");
       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? */
@@ -445,6 +456,7 @@ void do_host(char *host)
       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");
@@ -466,9 +478,12 @@ void do_host(char *host)
       printer_user_list(out, "LIST", lpc_acl, "Require user");
       printer_user_list(out, "LIST", top_lpc_acl, "Require user");
       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.35745 seconds and 4 git commands to generate.