From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <1bdc138212084dfd8cbd043118dfa3f6.axp-list@archive.invalid> X-Archive-Original-Message-ID: <199701280128.JAA00402@tapa.admu.edu.ph> Date: Mon, 27 Jan 1997 20:35:07 -0500 (EST) From: Jeff Odom Subject: Re: remote printing problems In-Reply-To: <199701260508.AAA05960@tikva> On Sun, 26 Jan 1997, Daniel Gruner wrote: > Hi > > I have problems with lpd, when a remote machine tries to print on > my alpha box. I am running lpr-0.13-1.axp.rpm (and its equivalent > on the remote intel box). Local printing is fine, as is printing > from windows boxes using samba. When trying to access the lpd > from the remote machine, the following messages appear in the > /var/log/messages file: > > Jan 26 00:00:02 lior kernel: lpd: memory violation at pc=12000d110 rp=1555570353 > 4 (bad address = 00000000) > > ad infinitum... > > I am running RedHat 4.0, kernel 2.0.27, and I do have proper /etc/hosts.lpd > and /etc/hosts.equiv files. I posted a patch to the 0.13 distribution that fixes the remote printing problem a little while back. I've included it again, below. Basically, the problem lies with a bad call to an undocumented pam routine and a k&r varargs problem (I'm not sure if the problem is with gcc or glibc, so I just converted it to ansi-c). It's a bit ugly with the pam routine. Hopefully I'll get off my lazy butt and clean it up, and post an rpm, but for now, this patch is what I've got... :) Jeff Odom System Administrator The Johns Hopkins Krieger Mind/Brain Institute --- lpd.old/lpd.c Wed Sep 4 16:31:49 1996 +++ 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.old/printjob.c Thu Dec 1 20:59:43 2016 +++ 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