Fix bug #7269 - Job management commands don't work for CUPS queues.
authorMichael Karcher <samba@mkarcher.dialup.fu-berlin.de>
Thu, 25 Mar 2010 00:33:21 +0000 (17:33 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 6 May 2010 12:08:34 +0000 (14:08 +0200)
Samba needs to retrieve pjob->sysjob from the CUPS response (as
is done in the iprint backend).
(cherry picked from commit 1790e88f0f9c4fae90dcb53101f70c97ba6a6a5d)
(cherry picked from commit dc83d031398819c1b2c57aacf4f34c304cf09682)

source3/printing/print_cups.c

index d94c13f41cd78df1a5b12f17fb82095c38dc4807..8c75b7d68902b02b463ecdbbdecd00a3758036ae 100644 (file)
@@ -900,6 +900,7 @@ static int cups_job_submit(int snum, struct printjob *pjob)
        http_t          *http = NULL;           /* HTTP connection to server */
        ipp_t           *request = NULL,        /* IPP Request */
                        *response = NULL;       /* IPP Response */
+       ipp_attribute_t *attr_job_id = NULL;    /* IPP Attribute "job-id" */
        cups_lang_t     *language = NULL;       /* Default language */
        char            uri[HTTP_MAX_URI]; /* printer-uri attribute */
        const char      *clientname = NULL;     /* hostname of client for job-originating-host attribute */
@@ -914,7 +915,7 @@ static int cups_job_submit(int snum, struct printjob *pjob)
        size_t size;
        char addr[INET6_ADDRSTRLEN];
 
-       DEBUG(5,("cups_job_submit(%d, %p (%d))\n", snum, pjob, pjob->sysjob));
+       DEBUG(5,("cups_job_submit(%d, %p)\n", snum, pjob));
 
        /*
         * Make sure we don't ask for passwords...
@@ -1021,6 +1022,13 @@ static int cups_job_submit(int snum, struct printjob *pjob)
                                 ippErrorString(cupsLastError())));
                } else {
                        ret = 0;
+                       attr_job_id = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER);
+                       if(attr_job_id) {
+                               pjob->sysjob = attr_job_id->values[0].integer;
+                               DEBUG(5,("cups_job_submit: job-id %d\n", pjob->sysjob));
+                       } else {
+                               DEBUG(0,("Missing job-id attribute in IPP response"));
+                       }
                }
        } else {
                DEBUG(0,("Unable to print file to `%s' - %s\n", PRINTERNAME(snum),