Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* lpr
@ 1996-12-30 20:05 Tim Waugh
  0 siblings, 0 replies; 2+ messages in thread
From: Tim Waugh @ 1996-12-30 20:05 UTC (permalink / raw)


I think I remember a while back someone mentioned that they'd had a go at
fixing lpr on the alpha so that it didn't dump core with each remote print
request -- is there a patch anywhere?

Tim.

--
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: lpr
       [not found] <Pine.LNX.3.95.961230200405.1369A-100000@cyberelk.elk.co.uk>
@ 1997-01-09  3:01 ` Jeff Odom
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Odom @ 1997-01-09  3:01 UTC (permalink / raw)


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 <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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-01-09  3:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Pine.LNX.3.95.961230200405.1369A-100000@cyberelk.elk.co.uk>
1997-01-09  3:01 ` lpr Jeff Odom
1996-12-30 20:05 lpr Tim Waugh

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