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>
This commit is contained in:
Jordan K. Hubbard 1999-04-27 07:09:18 +00:00
parent f7a6848306
commit d5483ddfba
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=46110
3 changed files with 25 additions and 3 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)lp.h 8.2 (Berkeley) 4/28/95
* $Id$
* $Id: lp.h,v 1.7 1997/12/02 20:45:21 wollman Exp $
*/
#include <sys/queue.h>
@ -50,6 +50,7 @@ enum lpd_filters { LPF_CIFPLOT, LPF_DVI, LPF_GRAPH, LPF_INPUT,
struct printer {
char *printer; /* printer name */
int remote; /* true if RM points to a remote host */
int rp_matches_local; /* true if rp has same name as us */
int tof; /* true if we are at top-of-form */
/* ------------------------------------------------------ */
char *acct_file; /* AF: accounting file */

View File

@ -40,7 +40,7 @@
#ifndef lint
static const char rcsid[] =
"$Id$";
"$Id: net.c,v 1.1 1997/12/02 20:45:22 wollman Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -160,6 +160,11 @@ checkremote(struct printer *pp)
struct in_addr *localaddrs;
int i, j, nlocaladdrs, ncommonaddrs;
if (!pp->rp_matches_local) { /* Remote printer doesn't match local */
pp->remote = 1;
return NULL;
}
pp->remote = 0; /* assume printer is local */
if (pp->remote_host != NULL) {
/* get the addresses of the local host */

View File

@ -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;
@ -262,6 +264,20 @@ getprintcap_int(bp, pp)
pp->rw = capdb_getaltlog(bp, "rw", "tty.rw");
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:
*/