Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Jeff Odom <zeus@jhu.edu>
Subject: Re: remote printing problems
Date: Mon, 27 Jan 1997 20:35:07 -0500 (EST)	[thread overview]
Message-ID: <1bdc138212084dfd8cbd043118dfa3f6.axp-list@archive.invalid> (raw)
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 <stdarg.h>
 #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

       reply	other threads:[~1997-01-28  1:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <199701260508.AAA05960@tikva>
1997-01-28  1:35 ` Jeff Odom [this message]
1997-01-26 12:44 remote printing problems Jeff Hutchison
  -- strict thread matches above, loose matches on Subject: below --
1997-01-26  5:08 Daniel Gruner
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox