Fix smbd file IO based print job spooling

David Disseldorp ddiss at
Fri Jun 22 11:37:36 MDT 2012

Currently print job spooling via smbd using printer share file IO in
3.6 and master is broken, as described in bug 8719.

When smbd takes responsibility for spooling a print job, the
spool-file path is generated and created in print_spool_open() without
a jobid component.
StartDocPrinter is then called to register the corresponding job with
the spoolss layer. The spoolss layer validates the spool-file's

When EndDocPrinter is called, the spool-file path is passed to
cups_job_submit() for printing. cups_job_submit() uses this path to
obtain the print jobid via print_parse_jobid(), which assumes a
smbprn.$JOBID.$TMP_HASH format. Where the spool-file path does not meet
this format requirement, job submission fails.

This patch set attempts to fix smbd print job spooling by removing the
reliance on the spool file name to obtain the jobid, instead storing
the value in a tdb. Feedback appreciated.

Cheers, David;a=shortlog;h=refs/heads/bso8719_smbd_spooler

The following changes since commit 4676e7f65df5e6743ed2319e64d787429c23faf0:

  dbwrap: don't ignore the result of dbwrap_parse_record in dbwrap_fetch_int32() (2012-06-22 17:10:52 +0200)

are available in the git repository at:
  git:// bso8719_smbd_spooler

David Disseldorp (17):
      torture: add test for smbd print job spooling
      s3-printing: store print jobid as part of struct printjob
      s3-printing: remove print_parse_jobid() from print_cups.c
      s3-printing: rename queue->job sysjob
      s3-printing: remove print_parse_jobid() calls from printing.c
      s3-printing: remove redundant variable set
      s3-printing: remove print_parse_jobid()
      s3-spoolss: remove duplicate "." in smbd spooler path
      s3-printing: fix potential print db refcount leak
      s3-printing: clean up print_job_pause/resume interface
      s3-printing: return talloced print jobs
      s3-printing: pass a talloc ctx to unpack_pjob
      s3-printing: remove unused print_job_fname()
      s3-printing: pass lpq command to job_submit
      s3-printing: fill print_generic sysjob id on job submission
      s3-printing: use euid for vlp job tracking
      s3-torture: Use static printer for smbd spooler test

 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                 |  481 +++++++++++++++++----------
 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, 525 insertions(+), 318 deletions(-)

More information about the samba-technical mailing list