Bug 3516 - lpd barfs on remote files
lpd barfs on remote files
Product: Red Hat Linux
Classification: Retired
Component: lpr (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: David Lawrence
Depends On:
  Show dependency treegraph
Reported: 1999-06-16 20:01 EDT by eric
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 1999-06-17 10:50:17 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description eric 1999-06-16 20:01:32 EDT
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@estinc.com
SysAdmin/Software Engineer
Enhanced Software Technologies, Inc. ("The BRU Guys")
Comment 1 Bill Nottingham 1999-06-17 10:50:59 EDT
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.