apple / cups

Apple CUPS Sources
https://www.cups.org
Apache License 2.0
1.93k stars 464 forks source link

lpd backend insists on always printing from non-privileged port #540

Closed michaelrsweet closed 20 years ago

michaelrsweet commented 20 years ago

Version: 1.1.17 CUPS.org User: kiniry.cs.kun

I am using this CUPS:

Name : cups Relocations: (not relocateable) Version : 1.1.17 Vendor: Red Hat, Inc. Release : 0.9 Build Date: Wed 29 Oct 2003 05:09:44 PM CET Install date: Thu 15 Jan 2004 03:54:45 PM CET Build Host: daffy.perf.redhat.com Group : System Environment/Daemons Source RPM: cups-1.1.17-0.9.src.rpm

on this system: Linux kind 2.6.11 #2 Fri Jan 16 09:42:10 CET 2004 i686 i686 i386 GNU/Linux

and attempting to print to this printer:

Info laserop Location 6th floor DeviceURI lpd://printer-srv.cs.kun.nl/laserop State Idle Accepting Yes JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 I am using this lpoptions: Default laserop PageRegion=A4 Quality=600dpi GSResolution=600x600DPI PageSize=A4 Duplex=On I am using the latest available PPD for this printer: HP LaserJet 4200 Foomatic/Postscript (recommended) With this configuration, I cannot see the remote spool of the printer (e.g., if I use LPRng's lpq I see other people's jobs, but with CUPS's lpq, I do not), nor can I print to the printer. CUPS's error log reports: D [23/Jan/2004:13:23:08 +0100] StartJob: argv = "laserop","15","kiniry","Test Page","1","","/var/spool/cups/d00015-001" D [23/Jan/2004:13:23:08 +0100] StartJob: envp = "PATH=/usr/lib/cups/filter:/bin:/usr/bin","SOFTWARE=CUPS/1.1","USER=root","CHARSET=iso-8859-1","LANG=en_US","","PPD=/etc/cups/ppd/laserop.ppd","CUPS_SERVERROOT=/etc/cups","RIP_MAX_CACHE=8m","TMPDIR=/var/spool/cups/tmp","CONTENT_TYPE=application/postscript","DEVICE_URI=lpd://printer-srv.cs.kun.nl/laserop","PRINTER=laserop","CUPS_DATADIR=/usr/share/cups","CUPS_FONTPATH=/usr/share/cups/fonts","","","" D [23/Jan/2004:13:23:08 +0100] StartJob: statusfds = 7, 8 D [23/Jan/2004:13:23:08 +0100] StartJob: filterfds[1] = 9, -1 D [23/Jan/2004:13:23:08 +0100] StartJob: filter = "/usr/lib/cups/filter/pstops" D [23/Jan/2004:13:23:08 +0100] StartJob: filterfds[0] = 10, 11 D [23/Jan/2004:13:23:08 +0100] start_process("/usr/lib/cups/filter/pstops", 0xbfffbac0, 0xbfffaf70, 9, 11, 8) I [23/Jan/2004:13:23:08 +0100] Started filter /usr/lib/cups/filter/pstops (PID 11134) for job 15. D [23/Jan/2004:13:23:08 +0100] StartJob: filter = "/usr/lib/cups/filter/foomatic-rip" D [23/Jan/2004:13:23:08 +0100] StartJob: filterfds[1] = 9, 12 D [23/Jan/2004:13:23:08 +0100] start_process("/usr/lib/cups/filter/foomatic-rip", 0xbfffbac0, 0xbfffaf70, 10, 12, 8) I [23/Jan/2004:13:23:08 +0100] Started filter /usr/lib/cups/filter/foomatic-rip (PID 11135) for job 15. D [23/Jan/2004:13:23:08 +0100] StartJob: backend = "/usr/lib/cups/backend/lpd" D [23/Jan/2004:13:23:08 +0100] StartJob: filterfds[0] = -1, 10 D [23/Jan/2004:13:23:08 +0100] start_process("/usr/lib/cups/backend/lpd", 0xbfffbac0, 0xbfffaf70, 9, 10, 8) I [23/Jan/2004:13:23:08 +0100] Started backend /usr/lib/cups/backend/lpd (PID 11136) for job 15. ....etc.... D [23/Jan/2004:13:23:08 +0100] [Job 15] Closing foomatic-rip. D [23/Jan/2004:13:23:08 +0100] [Job 15] lpd_command 02 laserop D [23/Jan/2004:13:23:08 +0100] [Job 15] Sending command string (9 bytes)... D [23/Jan/2004:13:23:08 +0100] [Job 15] Reading command status... E [23/Jan/2004:13:23:08 +0100] PID 11136 stopped with status 1! D [23/Jan/2004:13:23:08 +0100] [Job 15] lpd_command returning 108 Status code 108 is undocumented anywhere that I can find, including the RFC 1179 and the lpd.c source. If I tcpdump the connection between my machine and the lpd server I see: 13:58:03.544472 kind.cs.kun.nl.60083 > pandora.cs.kun.nl.printer: R 9:9(0) ack 54 win 5840 (DF) 0x0000 4500 0034 cc68 4000 4006 2499 83ae 2162 E..4.h@.@.$...!b 0x0010 83ae 2104 eab3 0203 4e37 de8a 2b7c 8f4f ..!.....N7..+|.O 0x0020 8014 16d0 40ec 0000 0101 080a 0ac5 12f7 ....@........... 0x0030 023a e0ff Note the source port number (60083, in this case) is non-privileged. I have tried to make all CUPS binaries suid root to force getuid() to always return 0, but this has no effect. Thus, there seems to be a problem in backend/lpd.c I have seen a couple of other queries related to this one. For example, http://www.linuxprinting.org/pipermail/hp-list/2003q4/004273.html but as of yet I have seen no responses, commentary, etc. I see a discussion of a new "reserve" option for lpd.c in CHANGES, but do not understand how to pass this switch to the backend.
michaelrsweet commented 20 years ago

CUPS.org User: mike

First, read the documentation.

Modify the printer (web interface or lpadmin command is fine) and add "?reserve=yes" to the end of the device URI.