From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <931ecb36b952d15074e892a9ae47b32b.axp-list@archive.invalid> X-Archive-Original-Message-ID: <32D45BF9.62CD@aod.com> Date: Wed, 8 Jan 1997 22:01:58 -0500 (EST) From: Jeff Odom Subject: Re: lpr In-Reply-To: Okay, here's a patch to the lpr-0.13 sources that fix the problem of printing to a remote printer. Basically, one patch fixes the (improper?) use of __ivailduser, the other a problem with k&r varargs. It's kinda an ugly patch, but hey, it works...:) Simply cd to /usr/src/redhat/SOURCES/lpr and apply the patch. Jeff Odom System Administrator The Johns Hopkins Krieger Mind/Brain Institute --- lpd/lpd.c Wed Sep 4 16:31:49 1996 +++ ../lpr.new/lpd/lpd.c Tue Jan 7 22:28:25 1997 @@ -450,8 +450,11 @@ hostf = fopen(_PATH_HOSTSEQUIV, "r"); again: if (hostf) { -#ifdef __alpha__ +#ifdef __alpha__ + if (!checkuser(hostf,fromb,baselen)) { +/* if (!__ivaliduser(hostf, fromb, DUMMY, DUMMY, baselen)) { +*/ (void) fclose(hostf); return; } @@ -470,3 +473,17 @@ } fatal("Your host does not have line printer access"); } + +int checkuser(FILE *fd, char *name, int baselen) { + char basename[100],buf[100]; + strcpy(basename,name); + basename[baselen]='\0'; + + while (fgets(buf,100,fd)!=NULL) { + buf[strlen(buf)-1]='\0'; + if (!strcmp(buf,name) || !strcmp(buf,basename)) + return 0; + } + return 1; +} + --- lpd/printjob.c Thu Dec 1 20:59:43 2016 +++ ../lpr.new/lpd/printjob.c Tue Jan 7 22:37:25 1997 @@ -45,7 +45,7 @@ #include "lp.h" #include "pathnames.h" - +#include #define DORETURN 0 /* absorb fork error */ #define DOABORT 1 /* abort if dofork fails */ @@ -1289,9 +1289,37 @@ } /*VARARGS1*/ +/* status(msg, a1, a2, a3) char *msg; void *a1, *a2, *a3; +*/ +void status(char *msg, ...) +{ + register int fd; + char buf[BUFSIZ]; + char *s1=NULL, *s2=NULL; + + va_list vlist; + va_start(vlist, msg); + s1=va_arg(vlist,char *); + if (s1!=NULL) + s2=va_arg(vlist,char *); + + umask(0); + fd = open(ST, O_WRONLY|O_CREAT, 0664); + if (fd < 0 || flock(fd, LOCK_EX) < 0) { + syslog(LOG_ERR, "%s: %s: %m", printer, ST); + exit(1); + } + ftruncate(fd, 0); + sprintf(buf, msg, s1, s2); + strcat(buf, "\n"); + (void) write(fd, buf, strlen(buf)); + (void) close(fd); + va_end(dummy); +} +/* { register int fd; char buf[BUFSIZ]; @@ -1308,3 +1336,4 @@ (void) write(fd, buf, strlen(buf)); (void) close(fd); } +*/ -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com