svn commit: samba r5359 - in branches/SAMBA_3_0/source: param
printing
jerry at samba.org
jerry at samba.org
Sat Feb 12 14:41:00 GMT 2005
Author: jerry
Date: 2005-02-12 14:41:00 +0000 (Sat, 12 Feb 2005)
New Revision: 5359
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5359
Log:
BUG 2333: use the lpq command to pass in the correct printer name for cups_queue_get(). See comments in code for details
Modified:
branches/SAMBA_3_0/source/param/loadparm.c
branches/SAMBA_3_0/source/printing/print_cups.c
Changeset:
Modified: branches/SAMBA_3_0/source/param/loadparm.c
===================================================================
--- branches/SAMBA_3_0/source/param/loadparm.c 2005-02-12 11:33:42 UTC (rev 5358)
+++ branches/SAMBA_3_0/source/param/loadparm.c 2005-02-12 14:41:00 UTC (rev 5359)
@@ -1226,7 +1226,9 @@
case PRINT_CUPS:
#ifdef HAVE_CUPS
- string_set(&pService->szLpqcommand, "");
+ /* set the lpq command to contain the destination printer
+ name only. This is used by cups_queue_get() */
+ string_set(&pService->szLpqcommand, "%p");
string_set(&pService->szLprmcommand, "");
string_set(&pService->szPrintcommand, "");
string_set(&pService->szLppausecommand, "");
Modified: branches/SAMBA_3_0/source/printing/print_cups.c
===================================================================
--- branches/SAMBA_3_0/source/printing/print_cups.c 2005-02-12 11:33:42 UTC (rev 5358)
+++ branches/SAMBA_3_0/source/printing/print_cups.c 2005-02-12 14:41:00 UTC (rev 5359)
@@ -670,12 +670,13 @@
* 'cups_queue_get()' - Get all the jobs in the print queue.
*/
-static int cups_queue_get(const char *printer_name,
+static int cups_queue_get(const char *sharename,
enum printing_types printing_type,
char *lpq_command,
print_queue_struct **q,
print_status_struct *status)
{
+ fstring printername;
http_t *http = NULL; /* HTTP connection to server */
ipp_t *request = NULL, /* IPP Request */
*response = NULL; /* IPP Response */
@@ -711,8 +712,16 @@
*q = NULL;
- DEBUG(5,("cups_queue_get(%s, %p, %p)\n", printer_name, q, status));
+ /* HACK ALERT!!! The porblem with support the 'printer name'
+ option is that we key the tdb off the sharename. So we will
+ overload the lpq_command string to pass in the printername
+ (which is basically what we do for non-cups printers ... using
+ the lpq_command to get the queue listing). */
+ fstrcpy( printername, lpq_command );
+
+ DEBUG(5,("cups_queue_get(%s, %p, %p)\n", printername, q, status));
+
/*
* Make sure we don't ask for passwords...
*/
@@ -733,7 +742,7 @@
* Generate the printer URI...
*/
- slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s", printer_name);
+ slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s", printername);
/*
* Build an IPP_GET_JOBS request, which requires the following
@@ -936,14 +945,14 @@
*/
if ((response = cupsDoRequest(http, request, "/")) == NULL) {
- DEBUG(0,("Unable to get printer status for %s - %s\n", printer_name,
+ DEBUG(0,("Unable to get printer status for %s - %s\n", printername,
ippErrorString(cupsLastError())));
*q = queue;
goto out;
}
if (response->request.status.status_code >= IPP_OK_CONFLICT) {
- DEBUG(0,("Unable to get printer status for %s - %s\n", printer_name,
+ DEBUG(0,("Unable to get printer status for %s - %s\n", printername,
ippErrorString(response->request.status.status_code)));
*q = queue;
goto out;
More information about the samba-cvs
mailing list