summaryrefslogtreecommitdiff
path: root/usr.sbin/lpr/common_source/common.c
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1998-06-28 02:22:14 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1998-06-28 02:22:14 +0000
commita635aafa43e713440306af221604efe0f8966311 (patch)
tree4ab6fdcc0f08d8942dbf6adbcd8be074da35a4aa /usr.sbin/lpr/common_source/common.c
parent5ee815aafb8744f993dc1bcd88b788ec9c8f01e2 (diff)
Treat a printer as remote iff RM is not us or RP is set and it doesn't match the
current printer;dwmalone@maths.tcd.ie
Diffstat (limited to 'usr.sbin/lpr/common_source/common.c')
-rw-r--r--usr.sbin/lpr/common_source/common.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c
index 07da9b3240f..d1c8f68ce40 100644
--- a/usr.sbin/lpr/common_source/common.c
+++ b/usr.sbin/lpr/common_source/common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.c,v 1.8 1998/02/15 15:51:48 niklas Exp $ */
+/* $OpenBSD: common.c,v 1.9 1998/06/28 02:22:13 angelos Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)common.c 8.5 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: common.c,v 1.8 1998/02/15 15:51:48 niklas Exp $";
+static char rcsid[] = "$OpenBSD: common.c,v 1.9 1998/06/28 02:22:13 angelos Exp $";
#endif
#endif /* not lint */
@@ -316,6 +316,7 @@ checkremote()
char name[MAXHOSTNAMELEN];
register struct hostent *hp;
static char errbuf[128];
+ char *rp, *rp_b;
remote = 0; /* assume printer is local */
if (RM != NULL) {
@@ -345,6 +346,20 @@ checkremote()
*/
if (strcasecmp(name, hp->h_name) != 0)
remote = 1;
+ else if (cgetstr(bp, "rp", &rp) > 0) {
+ if (cgetent(&rp_b, printcapdb, rp) == 0) {
+ if (cgetmatch(rp_b, printer) != 0)
+ remote = 1;
+ free(rp_b);
+ } else {
+ (void) snprintf(errbuf, sizeof(errbuf),
+ "can't find (local) remote printer %s",
+ rp);
+ free(rp);
+ return errbuf;
+ }
+ free(rp);
+ }
}
return NULL;
}