[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RH5.1, RH5.2 lpd problem ( lpr-0.33-1.src.rpm )



Hi,
> This is a bug in lpd. It tries to spawn a process with the UID of the
> sending user. If it doesn't excist, it simply trows then job away....
In the meantime I looked into lpr-0.33-1.src.rpm and created my own
solution ( there is only one file involved ./lpd/printjob.c, please find
the appropriate patch attached ).
The idea it following :
	1. in case the RS attribute is "on" - only users that are "known"
	   to the local systems may print ( logname = Xlogname )
	2. in case the RS attribute is "off", anyone may print, and :
		- if the user is "known" to the local system, lpd spawns
		  processes with the UID of this user (  again logname =
		  Xlogname )
		- if the user is NOT "known" to the local system, lpd
		  spawns processes with the UID of user "nobody"
		  ( logname = dummyuser = "nobody" ), but if any mails
		  are sent back, they are sent to the "remote sending
		  user" ( Xlogname preserved in all sendmail functions )
Hope this is the right solution, and in case it is, please include it in
future lpr packages.
Best regards,
Jacek.
--- printjob.c.000	Fri Jan 29 13:54:59 1999
+++ printjob.c	Fri Jan 29 13:55:00 1999
@@ -78,7 +78,9 @@
 static char	indent[10] = "-i0";
 static char	jobname[100];		/* job or file name */
 static char	length[10] = "-l";	/* page length in lines */
-static char	logname[32];		/* user's login name */
+static char	Xlogname[32] = "nobody";        /* remote user's login name */
+static char	*logname = Xlogname;	/* user's login name */
+const static char dummyuser[32] = "nobody";     /* dummy user's login name*/
 static char	pxlength[10] = "-y";	/* page length in pixels */
 static char	pxwidth[10] = "-x";	/* page width in pixels */
 static char	tempfile[] = "errsXXXXXX"; /* file name for filter errors */
@@ -243,7 +245,7 @@
 				q->q_name[0] = 'd';
 				(void) unlink(q->q_name);
 				if (logname[0])
-					sendmail(logname, FATALERR);
+					sendmail(Xlogname, FATALERR);
 			}
 		}
 	}
@@ -358,14 +360,19 @@
 			continue;
 
 		case 'P':
-			strncpy(logname, line+1, sizeof(logname) - 1);
-			logname[sizeof(logname) - 1] = '\0';
+			strncpy(Xlogname, line+1, sizeof(Xlogname) - 1);
+			Xlogname[sizeof(Xlogname) - 1] = '\0';
+		        logname = Xlogname;
 			if (RS) {			/* restricted */
 				if (getpwnam(logname) == NULL) {
 					bombed = NOACCT;
 					sendmail(line+1, bombed);
 					goto pass2;
 				}
+			} else {
+		                if (getpwnam(logname) == NULL) {
+				        logname = dummyuser;
+				}
 			}
 			continue;
 
@@ -441,7 +448,7 @@
 			case FILTERERR:
 			case ACCESS:
 				bombed = i;
-				sendmail(logname, bombed);
+				sendmail(Xlogname, bombed);
 			}
 			title[0] = '\0';
 			continue;
@@ -890,7 +897,7 @@
 				(void) fclose(cfp);
 				return(REPRINT);
 			case ACCESS:
-				sendmail(logname, ACCESS);
+				sendmail(Xlogname, ACCESS);
 			case ERROR:
 				err = ERROR;
 			}

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]