Re: [MOD] STR #4230: No PPD file for class being returned with OS X Lion client
Douglas Kosovic <[email protected]> Wed, 16 Jan 2013 21:31:59 -0800 (PST)
| Newsgroups | gmane.comp.printing.cups.bugs |
|---|---|
| Message-ID | <[email protected]> |
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Closed w/o Resolution] Attached file "cups-classes-ppd.patch.txt"... Link: https://www.cups.org/str.php?L4230 Version: 1.6.1 Fix Version: None _______________________________________________ cups-bugs mailing list [email protected] http://lists.easysw.com/mailman/listinfo/cups-bugs
cups-classes-ppd.patch.txt
(text/plain, 1.6 KB)
diff -up cups-1.6.1/scheduler/client.c.classes_ppd cups-1.6.1/scheduler/client.c
--- cups-1.6.1/scheduler/client.c.classes_ppd 2013-01-17 11:25:00 +1000
+++ cups-1.6.1/scheduler/client.c 2013-01-17 14:11:17 +1000
@@ -742,6 +742,7 @@ cupsdReadClient(cupsd_client_t *con) /*
context_t tmpcon; /* temp context to swap the level */
char *clirange; /* SELinux sensitivity range */
char *cliclearance; /* SELinux low end clearance */
+ int i; /* Looping var */
#endif /* WITH_LSPP */
@@ -1359,6 +1360,35 @@ cupsdReadClient(cupsd_client_t *con) /*
break;
}
}
+ else if (!strncmp(con->uri, "/classes/", 9) &&
+ !strcmp(con->uri + strlen(con->uri) - 4, ".ppd"))
+ {
+ /*
+ * Send PPD file of first printer in the class
+ */
+
+ con->uri[strlen(con->uri) - 4] = '\0'; /* Drop ".ppd" */
+ p = cupsdFindClass(con->uri + 9);
+
+ if (p)
+ for (i = 0; i < p->num_printers; i ++)
+ if (!(p->printers[i]->type & CUPS_PRINTER_CLASS))
+ {
+ snprintf(con->uri, sizeof(con->uri), "/ppd/%s.ppd",
+ p->printers[i]->name);
+ break;
+ }
+ else
+ {
+ if (!cupsdSendError(con, HTTP_NOT_FOUND, CUPSD_AUTH_NONE))
+ {
+ cupsdCloseClient(con);
+ return;
+ }
+
+ break;
+ }
+ }
else if ((!strncmp(con->uri, "/printers/", 10) ||
!strncmp(con->uri, "/classes/", 9)) &&
!strcmp(con->uri + strlen(con->uri) - 4, ".png"))