summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/common_source/printcap.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1999-04-27 07:09:18 +0000
committerjkh <jkh@FreeBSD.org>1999-04-27 07:09:18 +0000
commitaba5e776bb95610ea3e3355cbf47aadb844773eb (patch)
treef694a1be41be9a102fed7c6f8993388aa612b95b /usr.sbin/lpr/common_source/printcap.c
parentd3809450efbb1bc19acc8a7c487c2fe2b536e366 (diff)
downloadFreeBSD-src-aba5e776bb95610ea3e3355cbf47aadb844773eb.zip
FreeBSD-src-aba5e776bb95610ea3e3355cbf47aadb844773eb.tar.gz
lpd tries to be clever and checks if RM == my_hostname.
However, it doesn't check if the remote printer name it is sending it to is the same as the local printer name, and so chokes 'cos "laser" is not a real printer. PR: 7081 Submitted by: David Malone <dwmalone@maths.tcd.ie>
Diffstat (limited to 'usr.sbin/lpr/common_source/printcap.c')
-rw-r--r--usr.sbin/lpr/common_source/printcap.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.sbin/lpr/common_source/printcap.c b/usr.sbin/lpr/common_source/printcap.c
index a061c0e..ff82589 100644
--- a/usr.sbin/lpr/common_source/printcap.c
+++ b/usr.sbin/lpr/common_source/printcap.c
@@ -40,7 +40,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: printcap.c,v 1.3 1997/12/02 20:45:25 wollman Exp $";
+ "$Id: printcap.c,v 1.4 1997/12/27 20:49:39 wollman Exp $";
#endif /* not lint */
#include <errno.h>
@@ -215,6 +215,8 @@ getprintcap_int(bp, pp)
struct printer *pp;
{
enum lpd_filters filt;
+ char *rp_name;
+ int error;
if ((pp->printer = capdb_canonical_name(bp)) == 0)
return PCAPERR_OSERR;
@@ -263,6 +265,20 @@ getprintcap_int(bp, pp)
pp->tof = !capdb_getaltlog(bp, "fo", "job.topofform");
/*
+ * Decide if the remote printer name matches the local printer name.
+ * If no name is given then we assume they mean them to match.
+ * If a name is given see if the rp_name is one of the names for
+ * this printer.
+ */
+ pp->rp_matches_local = 1;
+ CHK((error = capdb_getaltstr(bp, "rp", "remote.queue", 0, &rp_name)));
+ if (error != PCAPERR_NOTFOUND && rp_name != NULL) {
+ if (cgetmatch(bp,rp_name) != 0)
+ pp->rp_matches_local = 0;
+ free(rp_name);
+ }
+
+ /*
* Filters:
*/
for (filt = 0; filt < LPF_COUNT; filt++) {
OpenPOWER on IntegriCloud