The branch, master has been updated
       via  98ec5e9 s3-torture: Use static printer for smbd spooler test
       via  e01ef8a s3-printing: use euid for vlp job tracking
       via  1c2f154 s3-printing: fill print_generic sysjob id on job submission
       via  c29773d s3-printing: pass lpq command to job_submit
       via  91cd9a4 s3-printing: remove unused print_job_fname()
       via  9a296ef s3-printing: pass a talloc ctx to unpack_pjob
       via  2f85c1f s3-printing: return talloced print jobs
       via  e1ddf8f s3-printing: clean up print_job_pause/resume interface
       via  9707358 s3-printing: fix potential print db refcount leak
       via  1cd2433 s3-spoolss: remove duplicate "." in smbd spooler path
       via  4e33424 s3-printing: remove print_parse_jobid()
       via  fb2579e s3-printing: remove redundant variable set
       via  5eaa47c s3-printing: remove print_parse_jobid() calls from 
printing.c
       via  dbca645 s3-printing: rename queue->job sysjob
       via  a66618f s3-printing: remove print_parse_jobid() from print_cups.c
       via  a2d880d s3-printing: store print jobid as part of struct printjob
       via  33f0890 torture: add test for smbd print job spooling
      from  290e7de s3-pdbtest: Fix pdbtest to compare the same fields

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 98ec5e95ca726c10c9e0f2c4f151308279c8bed5
Author: David Disseldorp <dd...@samba.org>
Date:   Fri Jun 22 18:49:50 2012 +0200

    s3-torture: Use static printer for smbd spooler test
    
    Autobuild-User(master): David Disseldorp <dd...@samba.org>
    Autobuild-Date(master): Tue Jun 26 18:04:43 CEST 2012 on sn-devel-104

commit e01ef8a9bd36bda5b9a383585b74429a333f8567
Author: David Disseldorp <dd...@samba.org>
Date:   Thu Jun 21 15:49:55 2012 +0200

    s3-printing: use euid for vlp job tracking
    
    vlp can be called by print_run_command as root with euids set
    appropriately, vlp should use this to track the job owner.

commit 1c2f1543230b2a016b026e1f3a03a52f0d9d76d7
Author: David Disseldorp <dd...@samba.org>
Date:   Thu Feb 9 12:08:27 2012 +0100

    s3-printing: fill print_generic sysjob id on job submission
    
    Change the generic print backend to fill the printing backend job
    identifier (sysjob) on submission of a new job.
    This is needed to ensure correct mapping of spoolss jobs and entries in
    the backend print queue.
    
    This and the last 13 commits attempt to address bug 8719.

commit c29773d89036153a122f577ff9fb2a789e7f156f
Author: David Disseldorp <dd...@samba.org>
Date:   Wed Feb 8 18:47:11 2012 +0100

    s3-printing: pass lpq command to job_submit
    
    Currently the generic print backend does not fill the printing backend
    job identifier (sysjob) on submission of a new job. The sysjob
    identifier is required to correctly map jobs in the printer queue to
    corresponding spoolss print jobs.
    
    Passing the lpq command to job_submit allows the generic print backend
    to check the printer queue for the new job following submission. This
    behaviour will come in a later commit.

commit 91cd9a47974e0099d550c88ee646ee3b1f44df72
Author: David Disseldorp <dd...@samba.org>
Date:   Wed Feb 8 17:03:06 2012 +0100

    s3-printing: remove unused print_job_fname()

commit 9a296efa9e98594e1dd435dfb91dae440ddf98aa
Author: David Disseldorp <dd...@samba.org>
Date:   Wed Feb 8 17:57:02 2012 +0100

    s3-printing: pass a talloc ctx to unpack_pjob
    
    Rather than allocating the devicemode on a null context.

commit 2f85c1fcf268e447303990e48b49b149020320d0
Author: David Disseldorp <dd...@samba.org>
Date:   Wed Feb 8 16:55:40 2012 +0100

    s3-printing: return talloced print jobs
    
    print_job_find() currently returns print jobs to callers via a
    statically allocated variable, this is particularly messy as the
    device mode is talloced under the static variable.
    
    This change adds or passes a talloc context to all callers, giving them
    ownership of the returned print job.

commit e1ddf8f0e41643933c2aa58dc9421cbc7631e2e5
Author: David Disseldorp <dd...@samba.org>
Date:   Wed Feb 8 15:01:15 2012 +0100

    s3-printing: clean up print_job_pause/resume interface
    
    Currently both return a bool and sometimes set a werr pointer argument,
    always return werror instead.

commit 97073589d03f8ea4b871c58cfc86603909568da2
Author: David Disseldorp <dd...@samba.org>
Date:   Wed Feb 8 13:45:40 2012 +0100

    s3-printing: fix potential print db refcount leak

commit 1cd2433e8d632f979811b136e0bf31f07d1c1da7
Author: David Disseldorp <dd...@samba.org>
Date:   Wed Feb 1 13:21:04 2012 +0100

    s3-spoolss: remove duplicate "." in smbd spooler path

commit 4e33424581bcb33a32d7971f551a03d4087f75a0
Author: David Disseldorp <dd...@samba.org>
Date:   Mon Jan 30 17:35:28 2012 +0100

    s3-printing: remove print_parse_jobid()
    
    With all callers fixed, it is now safe to remove.

commit fb2579e3eec80da5502aab539ed55301ebac3e2b
Author: David Disseldorp <dd...@samba.org>
Date:   Mon Jan 30 16:05:21 2012 +0100

    s3-printing: remove redundant variable set

commit 5eaa47c43313d2c6a46edf61dea51875ee9db696
Author: David Disseldorp <dd...@samba.org>
Date:   Mon Jan 30 13:35:21 2012 +0100

    s3-printing: remove print_parse_jobid() calls from printing.c
    
    In all cases the spoolss layer job id can be determinded from the
    printing subsystem allocated job identifier (sysjob).

commit dbca645eecfabbd2c43d5b70152bb3001aaef00c
Author: David Disseldorp <dd...@samba.org>
Date:   Fri Jan 27 12:33:27 2012 +0100

    s3-printing: rename queue->job sysjob
    
    Print jobs maintain two job identifiers, the jobid allocated by the
    spoolss layer (pj->jobid), and the job identifier defined by the
    printing backend (pj->sysjob).
    
    Printer job queues currently only contain a single job identifier
    variable (queue->job), the variable is sometimes representative of the
    spoolss layer job identifier, and more often representative of the
    printing backend id.
    
    This change renames the queue job identifier from queue->job to
    queue->sysjob, in preparation for a change to only store the printing
    backend identifier.

commit a66618f40223dfb0ef544169e32bfa074587df29
Author: David Disseldorp <dd...@samba.org>
Date:   Mon Jan 30 13:44:33 2012 +0100

    s3-printing: remove print_parse_jobid() from print_cups.c
    
    The spoolss print job identifier is now passed to the cups layer via
    struct printjob, therefore it is no longer necessary to parse the job
    filename to determine it.

commit a2d880ddcda4c0f5227945b644f8abe6af4a276d
Author: David Disseldorp <dd...@samba.org>
Date:   Thu Jan 26 15:28:34 2012 +0100

    s3-printing: store print jobid as part of struct printjob
    
    Printing code in some places relies upon the spool-file format to
    retrieve the print jobid. By storing the jobid as part of struct
    printjob, and hence in the printing TDB, we can move away from this ugly
    behaviour.

commit 33f08906c66fd28383d9ffad6f3916086a9f517d
Author: David Disseldorp <dd...@samba.org>
Date:   Thu Jun 21 17:12:23 2012 +0200

    torture: add test for smbd print job spooling
    
    Clients can print by performing file IO on a printer share, rather than
    issuing spoolss RPCs.
    This commit attempts to reproduce bug 8719.

-----------------------------------------------------------------------

Summary of changes:
 source3/include/printing.h                  |   23 +-
 source3/printing/lpq_parse.c                |   41 +--
 source3/printing/print_cups.c               |   18 +-
 source3/printing/print_generic.c            |  149 +++++---
 source3/printing/print_iprint.c             |    6 +-
 source3/printing/printing.c                 |  505 +++++++++++++++++----------
 source3/printing/printspoolss.c             |   11 +-
 source3/printing/tests/vlp.c                |    3 +-
 source3/rpc_server/spoolss/srv_spoolss_nt.c |   30 +-
 source4/torture/rpc/spoolss.c               |   81 +++++
 10 files changed, 546 insertions(+), 321 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/printing.h b/source3/include/printing.h
index cfdf3a4..5d0672c 100644
--- a/source3/include/printing.h
+++ b/source3/include/printing.h
@@ -47,7 +47,7 @@ enum {
 };
 
 typedef struct _print_queue_struct {
-       int job;                /* normally the UNIX jobid -- see note in
+       int sysjob;             /* normally the UNIX jobid -- see note in
                                   printing.c:traverse_fn_delete() */
        int size;
        int page_count;
@@ -69,6 +69,7 @@ typedef struct {
 /* Information for print jobs */
 struct printjob {
        pid_t pid; /* which process launched the job */
+       uint32_t jobid; /* the spoolss print job identifier */
        int sysjob; /* the system (lp) job number */
        int fd; /* file descriptor of open file if open */
        time_t starttime; /* when the job started spooling */
@@ -101,7 +102,9 @@ struct printif
   int (*job_delete)(const char *sharename, const char *lprm_command, struct 
printjob *pjob);
   int (*job_pause)(int snum, struct printjob *pjob);
   int (*job_resume)(int snum, struct printjob *pjob);
-  int (*job_submit)(int snum, struct printjob *pjob);
+  int (*job_submit)(int snum, struct printjob *pjob,
+                   enum printing_types printing_type,
+                   char *lpq_command);
 };
 
 extern struct printif  generic_printif;
@@ -124,7 +127,7 @@ extern struct printif       iprint_printif;
 #ifndef PRINT_SPOOL_PREFIX
 #define PRINT_SPOOL_PREFIX "smbprn."
 #endif
-#define PRINT_DATABASE_VERSION 7
+#define PRINT_DATABASE_VERSION 8
 
 #ifdef AIX
 #define DEFAULT_PRINTING PRINT_AIX
@@ -193,8 +196,9 @@ uint32 sysjob_to_jobid(int unix_jobid);
 bool print_notify_register_pid(int snum);
 bool print_notify_deregister_pid(int snum);
 bool print_job_exists(const char* sharename, uint32 jobid);
-char *print_job_fname(const char* sharename, uint32 jobid);
-struct spoolss_DeviceMode *print_job_devmode(const char* sharename, uint32 
jobid);
+struct spoolss_DeviceMode *print_job_devmode(TALLOC_CTX *mem_ctx,
+                                            const char *sharename,
+                                            uint32 jobid);
 bool print_job_set_name(struct tevent_context *ev,
                        struct messaging_context *msg_ctx,
                        const char *sharename, uint32 jobid, const char *name);
@@ -202,12 +206,12 @@ bool print_job_get_name(TALLOC_CTX *mem_ctx, const char 
*sharename, uint32_t job
 WERROR print_job_delete(const struct auth_session_info *server_info,
                        struct messaging_context *msg_ctx,
                        int snum, uint32_t jobid);
-bool print_job_pause(const struct auth_session_info *server_info,
+WERROR print_job_pause(const struct auth_session_info *server_info,
                     struct messaging_context *msg_ctx,
-                    int snum, uint32 jobid, WERROR *errcode);
-bool print_job_resume(const struct auth_session_info *server_info,
+                    int snum, uint32 jobid);
+WERROR print_job_resume(const struct auth_session_info *server_info,
                      struct messaging_context *msg_ctx,
-                     int snum, uint32 jobid, WERROR *errcode);
+                     int snum, uint32 jobid);
 ssize_t print_job_write(struct tevent_context *ev,
                        struct messaging_context *msg_ctx,
                        int snum, uint32 jobid, const char *buf, size_t size);
@@ -242,7 +246,6 @@ void printing_end(void);
 bool parse_lpq_entry(enum printing_types printing_type,char *line,
                     print_queue_struct *buf,
                     print_status_struct *status,bool first);
-uint32_t print_parse_jobid(const char *fname);
 
 /* The following definitions come from printing/printing_db.c  */
 
diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c
index 9104497..21e7b37 100644
--- a/source3/printing/lpq_parse.c
+++ b/source3/printing/lpq_parse.c
@@ -164,7 +164,7 @@ static bool parse_lpq_bsd(char *line,print_queue_struct 
*buf,bool first)
                return False;
        }
 
-       buf->job = atoi(tok[JOBTOK]);
+       buf->sysjob = atoi(tok[JOBTOK]);
        buf->size = atoi(tok[TOTALTOK]);
        buf->status = strequal(tok[RANKTOK],"active")?LPQ_PRINTING:LPQ_QUEUED;
        buf->time = time(NULL);
@@ -281,7 +281,7 @@ static bool parse_lpq_lprng(char *line,print_queue_struct 
*buf,bool first)
                return False;
        }
 
-       buf->job  = atoi(tokarr[LPRNG_JOBTOK]);
+       buf->sysjob = atoi(tokarr[LPRNG_JOBTOK]);
        buf->size = atoi(tokarr[LPRNG_TOTALTOK]);
 
        if (strequal(tokarr[LPRNG_RANKTOK],"active")) {
@@ -384,7 +384,7 @@ static bool parse_lpq_aix(char *line,print_queue_struct 
*buf,bool first)
                                }
                        }
 
-                       buf->job = atoi(tok[1]);
+                       buf->sysjob = atoi(tok[1]);
                        buf->status = 
strequal(tok[0],"HELD")?LPQ_PAUSED:LPQ_QUEUED;
                        buf->priority = 0;
                        buf->time = time(NULL);
@@ -420,7 +420,7 @@ static bool parse_lpq_aix(char *line,print_queue_struct 
*buf,bool first)
                        }
                }
 
-               buf->job = atoi(tok[3]);
+               buf->sysjob = atoi(tok[3]);
                buf->status = 
strequal(tok[2],"RUNNING")?LPQ_PRINTING:LPQ_QUEUED;
                buf->priority = 0;
                buf->time = time(NULL);
@@ -511,7 +511,7 @@ static bool parse_lpq_hpux(char *line, print_queue_struct 
*buf, bool first)
 
                /* fill things from header line */
                buf->time = jobtime;
-               buf->job = jobid;
+               buf->sysjob = jobid;
                buf->status = jobstat;
                buf->priority = jobprio;
                if (jobuser) {
@@ -651,7 +651,7 @@ static bool parse_lpq_sysv(char *line,print_queue_struct 
*buf,bool first)
                tok[2] = p+1;
        }
 
-       buf->job = atoi(tok[1]);
+       buf->sysjob = atoi(tok[1]);
        buf->size = atoi(tok[3]);
        if (count > 7 && strequal(tok[7],"on")) {
                buf->status = LPQ_PRINTING;
@@ -726,7 +726,7 @@ static bool parse_lpq_qnx(char *line,print_queue_struct 
*buf,bool first)
                }
        }
 
-       buf->job = atoi(tok[2]);
+       buf->sysjob = atoi(tok[2]);
        buf->size = atoi(tok[4]);
        buf->status = strequal(tok[3],"active")?LPQ_PRINTING:LPQ_QUEUED;
        buf->priority = 0;
@@ -807,7 +807,7 @@ static bool parse_lpq_plp(char *line,print_queue_struct 
*buf,bool first)
                }
        }
 
-       buf->job = atoi(tok[4]);
+       buf->sysjob = atoi(tok[4]);
 
        buf->size = atoi(tok[7]);
        if (strchr_m(tok[7],'K')) {
@@ -897,7 +897,7 @@ static bool parse_lpq_nt(char *line,print_queue_struct 
*buf,bool first)
        parse_line->space3 = '\0';
        trim_char(parse_line->jobname, '\0', ' ');
 
-       buf->job = atoi(parse_line->jobid);
+       buf->sysjob = atoi(parse_line->jobid);
        buf->priority = 0;
        buf->size = atoi(parse_line->size);
        buf->time = time(NULL);
@@ -958,7 +958,7 @@ static bool parse_lpq_os2(char *line,print_queue_struct 
*buf,bool first)
        }
 
        /* Get the jobid */
-       buf->job = atoi(parse_line->jobid);
+       buf->sysjob = atoi(parse_line->jobid);
 
        /* Get the job name */
        parse_line->space2[0] = '\0';
@@ -1024,7 +1024,7 @@ static bool parse_lpq_vlp(char *line,print_queue_struct 
*buf,bool first)
        while(next_token_talloc(frame, &cline, &tok, NULL)) {
                switch (toknum) {
                case 0:
-                       buf->job = atoi(tok);
+                       buf->sysjob = atoi(tok);
                        break;
                case 1:
                        buf->size = atoi(tok);
@@ -1153,22 +1153,3 @@ bool parse_lpq_entry(enum printing_types 
printing_type,char *line,
        return ret;
 }
 
-/****************************************************************************
- Parse a file name from the system spooler to generate a jobid.
-****************************************************************************/
-
-uint32_t print_parse_jobid(const char *fname)
-{
-       int jobid;
-       const char *p = strstr_m(fname,PRINT_SPOOL_PREFIX);
-
-       if (!p) {
-               return (uint32_t)-1;
-       }
-       p += strlen(PRINT_SPOOL_PREFIX);
-       jobid = atoi(p);
-       if (jobid <= 0) {
-               return (uint32_t)-1;
-       }
-       return (uint32_t)jobid;
-}
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index 79b146c..b5c7b0d 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -852,7 +852,9 @@ static int cups_job_resume(int snum, struct printjob *pjob)
  * 'cups_job_submit()' - Submit a job for printing.
  */
 
-static int cups_job_submit(int snum, struct printjob *pjob)
+static int cups_job_submit(int snum, struct printjob *pjob,
+                          enum printing_types printing_type,
+                          char *lpq_cmd)
 {
        TALLOC_CTX *frame = talloc_stackframe();
        int             ret = 1;                /* Return value */
@@ -871,7 +873,6 @@ static int cups_job_submit(int snum, struct printjob *pjob)
        char *cupsoptions = NULL;
        char *filename = NULL;
        size_t size;
-       uint32_t jobid = (uint32_t)-1;
 
        DEBUG(5,("cups_job_submit(%d, %p)\n", snum, pjob));
 
@@ -933,21 +934,12 @@ static int cups_job_submit(int snum, struct printjob 
*pjob)
                     "job-originating-host-name", NULL,
                     pjob->clientmachine);
 
-       /* Get the jobid from the filename. */
-       jobid = print_parse_jobid(pjob->filename);
-       if (jobid == (uint32_t)-1) {
-               DEBUG(0,("cups_job_submit: failed to parse jobid from name 
%s\n",
-                               pjob->filename ));
-               jobid = 0;
-       }
-
        if (!push_utf8_talloc(frame, &jobname, pjob->jobname, &size)) {
                goto out;
        }
        new_jobname = talloc_asprintf(frame,
                        "%s%.8u %s", PRINT_SPOOL_PREFIX,
-                       (unsigned int)jobid,
-                       jobname);
+                       pjob->jobid, jobname);
        if (new_jobname == NULL) {
                goto out;
        }
@@ -1253,7 +1245,7 @@ static int cups_queue_get(const char *sharename,
                                continue;
                }
 
-               temp->job      = job_id;
+               temp->sysjob   = job_id;
                temp->size     = job_k_octets * 1024;
                temp->status   = job_status == IPP_JOB_PENDING ? LPQ_QUEUED :
                                 job_status == IPP_JOB_STOPPED ? LPQ_PAUSED :
diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c
index 14f4c6d..8f55737 100644
--- a/source3/printing/print_generic.c
+++ b/source3/printing/print_generic.c
@@ -139,10 +139,68 @@ static int generic_job_resume(int snum, struct printjob 
*pjob)
 }
 
 /****************************************************************************
+get the current list of queued jobs
+****************************************************************************/
+static int generic_queue_get(const char *printer_name,
+                             enum printing_types printing_type,
+                             char *lpq_command,
+                             print_queue_struct **q,
+                             print_status_struct *status)
+{
+       char **qlines;
+       int fd;
+       int numlines, i, qcount;
+       print_queue_struct *queue = NULL;
+
+       /* never do substitution when running the 'lpq command' since we can't
+          get it rigt when using the background update daemon.  Make the caller
+          do it before passing off the command string to us here. */
+
+       print_run_command(-1, printer_name, False, lpq_command, &fd, NULL);
+
+       if (fd == -1) {
+               DEBUG(5,("generic_queue_get: Can't read print queue status for 
printer %s\n",
+                       printer_name ));
+               return 0;
+       }
+
+       numlines = 0;
+       qlines = fd_lines_load(fd, &numlines,0,NULL);
+       close(fd);
+
+       /* turn the lpq output into a series of job structures */
+       qcount = 0;
+       ZERO_STRUCTP(status);
+       if (numlines && qlines) {
+               queue = SMB_MALLOC_ARRAY(print_queue_struct, numlines+1);
+               if (!queue) {
+                       TALLOC_FREE(qlines);
+                       *q = NULL;
+                       return 0;
+               }
+               memset(queue, '\0', sizeof(print_queue_struct)*(numlines+1));
+
+               for (i=0; i<numlines; i++) {
+                       /* parse the line */
+                       if (parse_lpq_entry(printing_type,qlines[i],
+                                           &queue[qcount],status,qcount==0)) {
+                               qcount++;
+                       }
+               }
+       }
+
+       TALLOC_FREE(qlines);
+        *q = queue;
+       return qcount;
+}
+
+/****************************************************************************
  Submit a file for printing - called from print_job_end()
 ****************************************************************************/
 
-static int generic_job_submit(int snum, struct printjob *pjob)
+static int generic_job_submit(int snum, struct printjob *pjob,
+                             enum printing_types printing_type,
+                             char *lpq_cmd)
 {
        int ret = -1;
        char *current_directory = NULL;
@@ -152,6 +210,8 @@ static int generic_job_submit(int snum, struct printjob 
*pjob)
        char *jobname = NULL;
        TALLOC_CTX *ctx = talloc_tos();
        fstring job_page_count, job_size;
+       print_queue_struct *q;
+       print_status_struct status;
 
        /* we print from the directory path to give the best chance of
            parsing the lpq output */
@@ -202,6 +262,36 @@ static int generic_job_submit(int snum, struct printjob 
*pjob)
                        "%z", job_size,
                        "%c", job_page_count,
                        NULL);
+       if (ret != 0) {
+               ret = -1;
+               goto out;
+       }
+
+       /*
+        * check the queue for the newly submitted job, this allows us to
+        * determine the backend job identifier (sysjob).
+        */
+       pjob->sysjob = -1;
+       ret = generic_queue_get(lp_printername(snum), printing_type, lpq_cmd,
+                               &q, &status);
+       if (ret > 0) {
+               int i;
+               for (i = 0; i < ret; i++) {
+                       if (strcmp(q[i].fs_file, p) == 0) {
+                               pjob->sysjob = q[i].sysjob;
+                               DEBUG(5, ("new job %u (%s) matches sysjob %d\n",
+                                         pjob->jobid, jobname, pjob->sysjob));
+                               break;
+                       }
+               }
+               SAFE_FREE(q);
+               ret = 0;
+       }
+       if (pjob->sysjob == -1) {
+               DEBUG(0, ("failed to get sysjob for job %u (%s), tracking as "
+                         "Unix job\n", pjob->jobid, jobname));
+       }
+
 
  out:
 
@@ -212,63 +302,6 @@ static int generic_job_submit(int snum, struct printjob 
*pjob)
         return ret;
 }
 
-
-/****************************************************************************
-get the current list of queued jobs
-****************************************************************************/
-static int generic_queue_get(const char *printer_name, 
-                             enum printing_types printing_type,
-                             char *lpq_command,
-                             print_queue_struct **q, 
-                             print_status_struct *status)
-{
-       char **qlines;
-       int fd;
-       int numlines, i, qcount;
-       print_queue_struct *queue = NULL;
-       
-       /* never do substitution when running the 'lpq command' since we can't
-          get it rigt when using the background update daemon.  Make the 
caller 
-          do it before passing off the command string to us here. */
-
-       print_run_command(-1, printer_name, False, lpq_command, &fd, NULL);
-
-       if (fd == -1) {
-               DEBUG(5,("generic_queue_get: Can't read print queue status for 
printer %s\n",
-                       printer_name ));
-               return 0;
-       }
-       
-       numlines = 0;
-       qlines = fd_lines_load(fd, &numlines,0,NULL);
-       close(fd);
-
-       /* turn the lpq output into a series of job structures */
-       qcount = 0;
-       ZERO_STRUCTP(status);
-       if (numlines && qlines) {
-               queue = SMB_MALLOC_ARRAY(print_queue_struct, numlines+1);
-               if (!queue) {
-                       TALLOC_FREE(qlines);
-                       *q = NULL;
-                       return 0;
-               }
-               memset(queue, '\0', sizeof(print_queue_struct)*(numlines+1));
-
-               for (i=0; i<numlines; i++) {
-                       /* parse the line */
-                       if (parse_lpq_entry(printing_type,qlines[i],
-                                           &queue[qcount],status,qcount==0)) {
-                               qcount++;
-                       }
-               }               
-       }
-
-       TALLOC_FREE(qlines);
-        *q = queue;
-       return qcount;
-}
-
 /****************************************************************************
  pause a queue
 ****************************************************************************/
diff --git a/source3/printing/print_iprint.c b/source3/printing/print_iprint.c
index 1ff705a..ea0c937 100644
--- a/source3/printing/print_iprint.c
+++ b/source3/printing/print_iprint.c
@@ -722,7 +722,9 @@ static int iprint_job_resume(int snum, struct printjob 
*pjob)
  * 'iprint_job_submit()' - Submit a job for printing.
  */
 
-static int iprint_job_submit(int snum, struct printjob *pjob)
+static int iprint_job_submit(int snum, struct printjob *pjob,
+                            enum printing_types printing_type,
+                            char *lpq_cmd)
 {
        int             ret = 1;                /* Return value */
        http_t          *http = NULL;           /* HTTP connection to server */
@@ -1157,7 +1159,7 @@ static int iprint_queue_get(const char *sharename,
                                continue;
                }
 
-               temp->job      = job_id;
+               temp->sysjob   = job_id;
                temp->size     = job_k_octets * 1024;
                temp->status   = job_status == IPP_JOB_PENDING ? LPQ_QUEUED :
                                 job_status == IPP_JOB_STOPPED ? LPQ_PAUSED :
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 0d943a3..1e0d61d 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -380,18 +380,21 @@ done:
  unpack a pjob from a tdb buffer
 ***********************************************************************/
 
-static int unpack_pjob( uint8 *buf, int buflen, struct printjob *pjob )
+static int unpack_pjob(TALLOC_CTX *mem_ctx, uint8 *buf, int buflen,
+                      struct printjob *pjob)
 {
        int     len = 0;
        int     used;
-       uint32 pjpid, pjsysjob, pjfd, pjstarttime, pjstatus;
+       uint32 pjpid, pjjobid, pjsysjob, pjfd, pjstarttime, pjstatus;
        uint32 pjsize, pjpage_count, pjspooled, pjsmbjob;
 
-       if ( !buf || !pjob )
+       if (!buf || !pjob) {
                return -1;
+       }
 
-       len += tdb_unpack(buf+len, buflen-len, "dddddddddfffff",
+       len += tdb_unpack(buf+len, buflen-len, "ddddddddddfffff",
                                &pjpid,
+                               &pjjobid,
                                &pjsysjob,
                                &pjfd,
                                &pjstarttime,
@@ -406,10 +409,11 @@ static int unpack_pjob( uint8 *buf, int buflen, struct 
printjob *pjob )
                                pjob->clientmachine,
                                pjob->queuename);


-- 
Samba Shared Repository

Reply via email to