Subject: bin/9392: lpq and friends segfault when remote printer has no hostname
To: None <gnats-bugs@gnats.netbsd.org>
From: None <erik@mediator.uni-c.dk>
List: netbsd-bugs
Date: 02/11/2000 13:15:42
>Number:         9392
>Category:       bin
>Synopsis:       lpq and friends segfault when remote printer has no hostname
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 11 13:15:01 2000
>Last-Modified:
>Originator:     Erik Bertelsen
>Organization:
	
>Release:        NetBSD-current 11 Feb 2000
>Environment:
	
System: NetBSD rlanarh108.uni-c.dk 1.4S NetBSD 1.4S (HJEMME) #308: Fri Feb 11 19:07:04 CET 2000 erik@rlanarh108.uni-c.dk:/home/src/sys/arch/macppc/compile/HJEMME macppc


>Description:
	lpq and other lpr-related programs will segfault when querying a remote printer,
	whose rm-entry in /etc/printcap is given as a dotted-decimal IP address instead of
	as a symbolic name (from dns or /etc/hosts).

	The culprit is the following code in lpr/common_source/common.c, where ai_canonname
	will be NULL in this case:


		/*
		 * if the two hosts are not the same,
		 * then the printer must be remote.
		 */
		if (strcasecmp(hname, res->ai_canonname) != 0)
			remote = 1;

	This code was changed about 27 January (IPv6 support, IIRC), but I don't know whether
	this problem existed before that date.
>How-To-Repeat:
>Fix:

best regards
Erik Bertelsen
>Audit-Trail:
>Unformatted: