[1847] in Moira Commits
/svn/moira r3993 - trunk/moira/gen
daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Mon Mar 22 17:51:37 2010
Date: Mon, 22 Mar 2010 17:51:31 -0400
From: Garry Zacheiss <zacheiss@MIT.EDU>
Message-Id: <201003222151.o2MLpVf9024359@drugstore.mit.edu>
To: moira-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: zacheiss
Date: 2010-03-22 17:51:31 -0400 (Mon, 22 Mar 2010)
New Revision: 3993
Modified:
trunk/moira/gen/cups-cluster.pc
trunk/moira/gen/cups-print.pc
Log:
usefully support type LPR queues.
Modified: trunk/moira/gen/cups-cluster.pc
===================================================================
--- trunk/moira/gen/cups-cluster.pc 2010-03-15 02:52:24 UTC (rev 3992)
+++ trunk/moira/gen/cups-cluster.pc 2010-03-22 21:51:31 UTC (rev 3993)
@@ -53,7 +53,6 @@
const char *canceljob = "<Limit Cancel-Job>";
const char *catchall = "<Limit All>";
const char *phost = "cluster-printers.MIT.EDU";
-const char *svrlist = "cups-hosts";
void do_host(char *host);
void sqlerr(void);
@@ -101,7 +100,7 @@
sq = get_acl(type, id, NULL);
while (sq_remove_data(sq, &m))
{
- if (m->type != 'S' && m->type != NULL) {
+ if (m->type != 'S' && m->type != 0) {
/* CUPS wants mmanley/root, not mmanley.root@ATHENA.MIT.EDU */
canon_krb(m, krbvers, kbuf, sizeof(kbuf));
@@ -180,16 +179,14 @@
for (p = lowerhwtype; *p; p++)
*p = tolower(*p);
- fprintf(out, "<Printer %s>\n",rp);
- fprintf(out, "Info %s:%s\n", rp, hwtype);
- /* Note the use of "beh" to keep the CUPS from disabling print queues
- * should they not respond versus discarding the job.
- * See the "beh" page for details.
- * The 1/0/60 says "don't disable/try 20 times/try every 60s */
+ fprintf(out, "<Printer %s>\n",name);
+ fprintf(out, "Info %s:%s\n", name, hwtype);
if (!strncmp(hwtype, "HP", 2))
- fprintf(out, "DeviceURI beh:/1/20/60/socket://%s:9100\n", hostname);
+ fprintf(out, "DeviceURI accsnmp://socket://%s:9100\n", hostname);
+ else if (!strncmp(hwtype, "LPR", 3))
+ fprintf(out, "DeviceURI lpd://%s/%s\n", hostname, rp);
else
- fprintf(out, "DeviceURI beh:/1/20/60/socket://%s\n", hostname);
+ fprintf(out, "DeviceURI accsnmp://socket://%s\n", hostname);
fprintf(out, "State Idle\n"); // Always with the Idle
fprintf(out, "StateTime %ld\n", (long)time(NULL));
fprintf(out, "Accepting Yes\n");
@@ -264,9 +261,9 @@
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, "<Printer %s>\n",name);
+ fprintf(out, "Info %s:%s\n", name, hwtype);
+ fprintf(out, "DeviceURI ipp://%s:631/printers/%s?waitprinter=false&waitjob=false\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");
@@ -341,8 +338,8 @@
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, "<Printer %s>\n",name);
+ fprintf(out, "Info %s:LPRng Queue on %s\n", name, 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));
@@ -405,7 +402,7 @@
{
strtrim(name);
fprintf(out, "<Class %s>\n",name);
- fprintf(out, "Info Alias Queue to %s:%s\n", rp, hwtype);
+ fprintf(out, "Info Alias Queue to %s:%s\n", name, hwtype);
fprintf(out, "Printer %s\n", rp);
fprintf(out, "Option sides one-sided\n");
fprintf(out, "State Idle\n"); // Always with the Idle
@@ -442,9 +439,9 @@
strtrim(duplexname);
fprintf(out, "<Class %s>\n",duplexname);
if (!strcmp(prtype,"ALIAS"))
- fprintf(out, "Info Duplex Alias Queue to %s:%s\n", rp, hwtype);
+ fprintf(out, "Info Duplex Alias Queue to %s:%s\n", name, hwtype);
else
- fprintf(out, "Info Duplex Queue for %s:%s\n", rp, hwtype);
+ fprintf(out, "Info Duplex Queue for %s:%s\n", name, hwtype);
fprintf(out, "Option sides two-sided-long-edge\n"); // duplex
fprintf(out, "Printer %s\n", rp);
fprintf(out, "State Idle\n"); // Always with the Idle
@@ -479,7 +476,7 @@
out = tarfile_start(tf, "/etc/cups/cupsd.conf", 0755, 1, 1,
"root", "lp", now);
- fprintf(out, "LogLevel info\n");
+ fprintf(out, "LogLevel error\n");
fprintf(out, "SystemGroup sys root ops-group\n");
fprintf(out, "Port 631\n");
fprintf(out, "SSLPort 443\n");
@@ -601,7 +598,6 @@
fprintf (out, "AuthType Default\n");
fprintf (out, "Require user @OWNER @SYSTEM\n");
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");
@@ -618,10 +614,8 @@
else
fprintf (out, "AuthType None\n");
/* Access-control list. */
- if (ac) {
+ 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");
Modified: trunk/moira/gen/cups-print.pc
===================================================================
--- trunk/moira/gen/cups-print.pc 2010-03-15 02:52:24 UTC (rev 3992)
+++ trunk/moira/gen/cups-print.pc 2010-03-22 21:51:31 UTC (rev 3993)
@@ -53,7 +53,6 @@
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);
@@ -183,16 +182,14 @@
for (p = lowerhwtype; *p; p++)
*p = tolower(*p);
- fprintf(out, "<Printer %s>\n",rp);
- fprintf(out, "Info %s:%s\n", rp, hwtype);
- /* Note the use of "beh" to keep the CUPS from disabling print queues
- * should they not respond versus discarding the job.
- * See the "beh" page for details.
- * The 1/0/60 says "don't disable/try 20 times/try every 60s */
+ fprintf(out, "<Printer %s>\n",name);
+ fprintf(out, "Info %s:%s\n", name, hwtype);
if (!strncmp(hwtype, "HP", 2))
- fprintf(out, "DeviceURI beh:/1/20/60/socket://%s:9100\n", hostname);
+ fprintf(out, "DeviceURI accsnmp://socket://%s:9100\n", hostname);
+ else if (!strncmp(hwtype, "LPR", 3))
+ fprintf(out, "DeviceURI lpd://%s/%s\n", hostname, rp);
else
- fprintf(out, "DeviceURI beh:/1/20/60/socket://%s\n", hostname);
+ fprintf(out, "DeviceURI accsnmp://socket://%s\n", hostname);
fprintf(out, "State Idle\n"); // Always with the Idle
fprintf(out, "StateTime %ld\n", (long)time(NULL));
fprintf(out, "Accepting Yes\n");
@@ -267,9 +264,9 @@
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, "<Printer %s>\n",name);
+ fprintf(out, "Info %s:%s\n", name, hwtype);
+ fprintf(out, "DeviceURI ipp://%s:631/printers/%s?waitprinter=false&waitjob=false\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");
@@ -344,8 +341,8 @@
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, "<Printer %s>\n",name);
+ fprintf(out, "Info %s:LPRng Queue on %s\n", name, 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));
@@ -480,7 +477,7 @@
out = tarfile_start(tf, "/etc/cups/cupsd.conf", 0755, 1, 1,
"root", "lp", now);
- fprintf(out, "LogLevel info\n");
+ fprintf(out, "LogLevel error\n");
fprintf(out, "SystemGroup sys root ops-group\n");
fprintf(out, "Port 631\n");
fprintf(out, "SSLPort 443\n");
@@ -535,10 +532,6 @@
FROM printservers ps, machine m
WHERE m.name = :spoolhost AND m.mach_id = ps.mach_id;
- /* svrlist */
- EXEC SQL SELECT list_id INTO :svrlist_id
- FROM list l WHERE l.name = :svrlist;
-
/* first, what's our defaults? */
fprintf (out, "<Policy default>\n");
fprintf (out, "%s\n", alterjob);
@@ -608,7 +601,6 @@
fprintf (out, "AuthType Default\n");
fprintf (out, "Require user @OWNER @SYSTEM\n");
printer_user_list(out, "LIST", lpc_acl, "Require user", 1);
- printer_user_list(out, "LIST", svrlist_id, "Require user", 1);
fprintf (out, "Order deny,allow\n");
fprintf (out, "Allow from all\n");
fprintf (out, "</Limit>\n");
@@ -625,10 +617,8 @@
else
fprintf (out, "AuthType None\n");
/* Access-control list. */
- if (ac) {
+ if (ac)
printer_user_list(out, "LIST", ac, "Require user", 1);
- printer_user_list(out, "LIST", svrlist_id, "Require user", 1);
- }
else if (ka)
fprintf (out, "Require valid-user\n");
fprintf (out, "Order deny,allow\n");