[Samba] Samba-CUPS interface

Andrew Bartlett abartlet at samba.org
Mon Sep 5 09:48:59 UTC 2016


On Mon, 2016-09-05 at 12:11 +0400, henri transfert via samba wrote:
> 2016-09-04 15:22 GMT+04:00 Andrew Bartlett <abartlet at samba.org>:
> 
> > 
> > On Fri, 2016-09-02 at 11:59 +0400, henri transfert via samba wrote:
> > > 
> > > Hi,
> > > 
> > > One of our Samba server (4.4.5) is a print server with CUPS
> > > backend .
> > > In
> > > addition we are using a print management product that is itself a
> > > backend
> > > to cups.
> > > 
> > > Everything works well, except that the document names that are
> > > transmitted
> > > in the chain is of the form : "smbprn.00000648 MyDocument.pdf" .
> > > I
> > > guess
> > > that the prefix smbprn.00000648 is the samba job ID that is
> > > concatenated to
> > > the file name , that is itself transmitted to cups, and then to
> > > our
> > > third
> > > party product.
> > > 
> > > Is cups able to separate the job ID and the original filename ? I
> > > did
> > > not
> > > find any parameter in cups about that.
> > > 
> > > Is it possible in Samba to remove this prefix to the file name
> > > that
> > > is
> > > passed to cups ?
> > 
> > I don't see an option for that, but I also don't see any indication
> > that we reverse parse that string, we use the job-id to track the
> > job.
> > 
> > So my untested suggestion is that we/you could remove it from this
> > in
> > print_cups.c:
> > 
> >         new_jobname = talloc_asprintf(frame,
> >                         "%s%.8u %s", PRINT_SPOOL_PREFIX,
> >                         pjob->jobid, jobname);
> >         if (new_jobname == NULL) {
> >                 goto out;
> >         }
> > 
> > Andrew Bartlett
> > 
> 
> Hi Andrew,
> 
> You are right, I have thought also about this solution of modifying
> Samba
> source code.
> BUT , I wonder :
> - if there could be any side effect on Samba and/or CUPS ?

It was only a quick check, but I couldn't find anything in Samba that
was parsing the name back.  Typically that would be a sscanf() call
with reference to smbprn or PRINT_SPOOL_PREFIX, and I couldn't find any
of those.

> - if it is a good idea to modify Samba source code , and to not
> forget to
> redo the modification after all upgrade operation in the future.
> That's not
> very clean.

The best idea would be to make it an option, or to remove it for all
users (except say if no other name was specified) if we decide there is
no need for it.

> Anyway, I will just have a test, to validate the idea.

Thanks,

Andrew Bartlett
-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba




More information about the samba mailing list