[cups.bugs] [LOW] STR #3199: cups-lpd receives print file before establishing it can create a job on the cupsd

Sebastian James sjames at wmltd.co.uk
Fri May 15 09:44:29 PDT 2009


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

cups-lpd.c will completely receive a print file from the lpd client and
send an acknowledgement BEFORE it establishes that it can create a job on
the cupsd.

If, for some reason, the cupsd fails to generate a job, then cups-lpd will
exit and the print data will be lost. The client thinks it has been
printed, because it was transferred to cups-lpd and an acknowledgement was
received, but the print file never makes it to cupsd for printing.

I've produced a fix for this problem. Rather than receiving the print
file, then sending it to the cupsd with the print_file() function, I
instead create a cups job as early as possible in the process (with
IPP_CREATE_JOB). If this fails, a failure acknowledgement is sent back to
the lpd client before all the data has been received.

The newly created job is then held (with IPP_HOLD_JOB) so that it doesn't
get auto-expired by cupsd while the print data comes in. The print data is
then received by cups-lpd from the lpd client, and is sent to the cupsd
with send_doc() using IPP_SEND_DOCUMENT. Finally, an IPP_RELEASE_JOB
command is sent in release_job.

Link: http://www.cups.org/str.php?L3199
Version: 1.4-current
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cups-lpd.create_job_before_receive_data.diff
URL: <https://lists.cups.org/pipermail/cups/attachments/20090515/65ea71a9/attachment.ksh>


More information about the cups mailing list