Bug 4034

Summary: lpd problem + solution
Product: [Retired] Red Hat Linux Reporter: Tony Kocurko <akocurko>
Component: lprAssignee: David Lawrence <dkl>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-07-14 16:43:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tony Kocurko 1999-07-14 16:35:30 UTC
Situation: Network printer set up on internal LAN.
           Gateway linux box connected to internal LAN and
             to external, campus network.
           Linux box has printer declared through
             control-panel as a remote printer.
           All boxes on internal LAN can print to printer.
           Linux box on external, campus network has the
             printer configured through control-panel as
             a remote printer connected to the gateway box.
           When trying to print from the external Linux box
             to the printer, syslog on the gateway box
             contains this message:

           "Can't create temp cfp file "

Analysis: In lpr-0.35/lpd/printjob.c, there is this pair
          of statements at line 774:

             memcpy((dup_cfpname+7), "XXXXXX", 6);
             mktemp(dup_cfpname);

          These make a copy of the cf file sent by the
          remote computer, but in the case described above,
          the cf file name ends with the fully qualified
          host name (e.g., "cf...music.esd.mun.ca", where
          the ellipsis is filled with the usual cf file
          name characters. Now, the memcpy() invocation
          above will actually embed the "XXXXXX" in the
          cf file name copy rather than append it as the
          mktemp() function demands. (cf. mktemp(2) man
          page)

Solution: Replace the line

             memcpy((dup_cfpname+7), "XXXXXX", 6);

          with this:

             memcpy((dup_cfpname + strlen(dup_cfpname) - 6),
                     "XXXXXX", 6);

          With this change, I now have no trouble printing
          from outside the internal LAN, through the gateway
          an to the printer on the internal LAN, assuming,
          of course, that the external host is in either
          /etc/hosts.equiv or /etc/hosts.lpd on the gateway.

Cheers,
Tony Kocurko - Memorial University of Newfoundland

Comment 1 Bill Nottingham 1999-07-14 16:43:59 UTC
Fixed in the latest lpd in Raw Hide. (0.38+)