diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1998-06-28 02:22:14 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1998-06-28 02:22:14 +0000 |
commit | a635aafa43e713440306af221604efe0f8966311 (patch) | |
tree | 4ab6fdcc0f08d8942dbf6adbcd8be074da35a4aa /usr.sbin | |
parent | 5ee815aafb8744f993dc1bcd88b788ec9c8f01e2 (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')
-rw-r--r-- | usr.sbin/lpr/common_source/common.c | 19 |
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; } |