The Samba-Bugzilla – Attachment 5548 Details for
Bug 7288
SMB job IDs in CUPS job names wrong
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am format patch for 3.5.2 and 3.4.8
0001-Fix-bug-7288-SMB-job-IDs-in-CUPS-job-names-wrong.patch (text/plain), 4.71 KB, created by
Jeremy Allison
on 2010-03-25 19:46:56 UTC
(
hide
)
Description:
git-am format patch for 3.5.2 and 3.4.8
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2010-03-25 19:46:56 UTC
Size:
4.71 KB
patch
obsolete
>From c79ca41baf15b4ef7eb287d343b17a53ba41e852 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Thu, 25 Mar 2010 17:36:47 -0700 >Subject: [PATCH] Fix bug #7288 - SMB job IDs in CUPS job names wrong. > >Based on a patch from Michael Karcher <samba@mkarcher.dialup.fu-berlin.de>. > >I think this is the correct fix. It causes cups_job_submit to use >print_parse_jobid(), which I've moved into printing/lpq_parse.c (to allow the >link to work). > >It turns out the old print_parse_jobid() was *broken*, in that the pjob >filename was set as an absolute path - not relative to the sharename (due to it >not going through the VFS calls). > >This meant that the original code doing a strncmp on the first part of the >filename would always fail - it starts with a "/", not the relative pathname of >PRINT_SPOOL_PREFIX ("smbprn."). > >This fix could fix some other mysterious printing bugs - probably the ones >Guenther noticed where job control fails on non-cups backends. > >Guenther PLEASE CHECK ! > >Jeremy. >--- > source3/include/proto.h | 1 + > source3/printing/lpq_parse.c | 21 +++++++++++++++++++++ > source3/printing/print_cups.c | 11 ++++++++++- > source3/printing/printing.c | 19 ------------------- > 4 files changed, 32 insertions(+), 20 deletions(-) > >diff --git a/source3/include/proto.h b/source3/include/proto.h >index dca58cc..c211501 100644 >--- a/source3/include/proto.h >+++ b/source3/include/proto.h >@@ -4772,6 +4772,7 @@ void load_printers(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/notify.c */ > >diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c >index addf2d1..16b9b09 100644 >--- a/source3/printing/lpq_parse.c >+++ b/source3/printing/lpq_parse.c >@@ -18,6 +18,7 @@ > */ > > #include "includes.h" >+#include "printing.h" > > static const char *Months[13] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", > "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Err"}; >@@ -1150,3 +1151,23 @@ 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 fc1f52a..5c023ed 100644 >--- a/source3/printing/print_cups.c >+++ b/source3/printing/print_cups.c >@@ -918,6 +918,7 @@ 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; > char addr[INET6_ADDRSTRLEN]; > > DEBUG(5,("cups_job_submit(%d, %p)\n", snum, pjob)); >@@ -984,12 +985,20 @@ static int cups_job_submit(int snum, struct printjob *pjob) > "job-originating-host-name", NULL, > clientname); > >+ /* 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)pjob->smbjob, >+ (unsigned int)jobid, > jobname); > if (new_jobname == NULL) { > goto out; >diff --git a/source3/printing/printing.c b/source3/printing/printing.c >index e48a2d1..7804997 100644 >--- a/source3/printing/printing.c >+++ b/source3/printing/printing.c >@@ -644,25 +644,6 @@ void pjob_delete(const char* sharename, uint32 jobid) > } > > /**************************************************************************** >- Parse a file name from the system spooler to generate a jobid. >-****************************************************************************/ >- >-static uint32 print_parse_jobid(char *fname) >-{ >- int jobid; >- >- if (strncmp(fname,PRINT_SPOOL_PREFIX,strlen(PRINT_SPOOL_PREFIX)) != 0) >- return (uint32)-1; >- fname += strlen(PRINT_SPOOL_PREFIX); >- >- jobid = atoi(fname); >- if (jobid <= 0) >- return (uint32)-1; >- >- return (uint32)jobid; >-} >- >-/**************************************************************************** > List a unix job in the print database. > ****************************************************************************/ > >-- >1.6.3.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 7288
:
5532
|
5546
|
5547
|
5548
|
5549