Bug 3516 - lpd barfs on remote files
Summary: lpd barfs on remote files
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: lpr
Version: 6.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: David Lawrence
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1999-06-17 00:01 UTC by eric
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 1999-06-17 14:50:17 UTC

Attachments (Terms of Use)

Description eric 1999-06-17 00:01:32 UTC
When trying to print files from a remote Red Hat 6.0 system
to a Red Hat 6.0 lpd spool, the print daemon dies. The error
log is filled with a message

Jun 16 15:55:18 nfs lpd[11408]: Can't create temp cfp file
Jun 16 15:55:18 nfs last message repeated 1016 times
Jun 16 15:55:18 nfs lpd[11408]: lp: can't scan

The problem is in file 'printjob.c' (under the 'lpd'
directory) in the 'sendit' routine. The lpr spool command
has been modified to put control files into the spool
directory that are appended with the name of the system
sending the job, rather than the fixed-size control file
names that were previously the norm. The problem is that the
file name is assumed to be that fixed size, and the last six
characters of that fixed size are overwritten with XXXXXX
and handed off to mktemp(). So you get stuff like
"cf134a1XXXXXXebes" (the XXX's are overwritting part of the
host name, which would not have been there for a local print
job) rather than a useful string for 'mktemp'.  The problem
is that if the last character of the string is not an "X",
mktemp() returns a null string, and you get the message in

My solution: just write a 0 after the last 'X' to terminate
the string. The filenames for the temp files will still be
unique because the print job names are incremented and are
in that first 7 characters. Here is my patch:
-------------------------start patch--------------------
--- printjob.c.orig	Tue Feb 16 13:01:45 1999
+++ printjob.c	Wed Jun 16 16:05:30 1999
@@ -770,6 +770,7 @@
 	    dup_cfpname = strdup(file);
 	    memcpy((dup_cfpname+7), "XXXXXX", 6);
+            dup_cfpname[13]=0;  /* fix by eric! */
 	    tmpmask = umask(007);
 	    dup_cfp=fopen(dup_cfpname, "w");
---------------------end of patch--------------------

That should fix *THIS* bug, at least...

Eric Lee Green  eric
SysAdmin/Software Engineer
Enhanced Software Technologies, Inc. ("The BRU Guys")

Comment 1 Bill Nottingham 1999-06-17 14:50:59 UTC
ths has been fixed in the latest lpr release (0.36-4), available
from rawhide.redhat.com.

Note You need to log in before you can comment on or make changes to this bug.