---------- Forwarded message ----------
Date: Thu, 19 Mar 1998 15:23:21 +0100
From: Romano Giannetti <[EMAIL PROTECTED]>
To: Andreas Hirczy <[EMAIL PROTECTED]>
Subject: [SOLVED] (almost...) lpd and remote users failure


Please, can you post the following to the list? My newsserver is
out-of-work :(.

**begin "article" :) ****

Resume: lpd refuse (silently(1)) to serve print request from remote 
hosts, although the flag :rs: (see man 5 printcap) is *NOT* present 
in the /etc/printcap file.

*Warning*: the proposed solution is a hack, a horrible hack, a
solution that cure only the symptom, not the real problem. But it
works for me and I _need_ a working lpd server. Can anyone send this
to the right redhat mail address? 

Sorry no rpm package, I do not know how to build it correctly. I
solved the problem applying the patch included in this messages 
(way to go: install with  rpm -ivh lpr-0.21-2.src.rpm; 
go to /usr/src/redhat/SPECS, do rpm -bp lpr.spec, 
cd /usr/src/redhat/BUILD, apply with  patch -p0 <this_file, 
cd lpr, make all. Now substitute your lpd with the binary in 
the lpd subdirectory (2)). 

How this solution works: if the remote users does not exist in the 
system were lpd is running, the username is substituted with
"lpdguest". then all is like before. So, you create a "lpdguest" user,
the printing is honored, otherwise it is silently(1) ignored like
before. A warning is issued in the syslog.

(1) This is, in my opinion, a bug. At least when running with -l, 
lpd should say something when dropping a print request.

(2) If you trust me, and if my PC is online (just try), you can
download the binary from ftp://sirio.iet.unipi.it/pub/romano/lpd. Just
get it and chmod +x it in /usr/sbin.

*****Cut here******
diff -ur lpr.orig/lpd/printjob.c lpr/lpd/printjob.c
--- lpr.orig/lpd/printjob.c     Mon Oct 27 23:53:26 1997
+++ lpr/lpd/printjob.c  Thu Mar 19 13:00:45 1998
@@ -322,6 +322,12 @@
 
                case 'P':
                        strncpy(logname, line+1, sizeof(logname)-1);
+                       /* RGtti hack */
+                       if (getpwnam(logname) == (struct passwd *)0) { 
+                               syslog(LOG_INFO, "%s: changed user from %s to 
+lpdguest", 
+                                      printer,logname);
+                               strcpy(logname,"lpdguest");
+                       }                          
                        if (RS) {                       /* restricted */
                                if (getpwnam(logname) == (struct passwd *)0) {
                                        bombed = NOACCT;
****Cut here****

HTH, 
       Romano 

-- 
-----------------------------------------------------------------------
|Dr. Romano Giannetti   | Electronic Engineer | From: address may be  |
|romano @ iet.unipi.it  | University of Pisa  | mangled to avoid spam.|
-----------------------------------------------------------------------


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
         To unsubscribe: mail [EMAIL PROTECTED] with 
                       "unsubscribe" as the Subject.

Reply via email to