Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 Jun 2001 14:11:24 +0900
From:      horio shoichi <horio@pointer-software.com>
To:        freebsd-stable@FreeBSD.ORG
Subject:   Re: Malformed from address
Message-ID:  <3B19C6FC.9B74A1CF@pointer-software.com>
References:  <000001c0eba9$4f34e1c0$271978d8@cts.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Morgan Davis wrote:
> 
> In looking at the lpd.c code (and netinet/in.h), the logic in lpd.c's
> test seems to be wrong (or is missing a !):
> 
> if (error || atoi(serv) >= IPPORT_RESERVED)
>         fatal(0, "Malformed from address");
> 
> This would imply that any port at or above the IPPORT_RESERVED
> threshhold is illegal, which (I think) is clearly wrong.  Shouldn't it
> be < IPPORT_RESERVED?  Or better still:
> 
> --Morgan
> 

rfc 1179 states:

3.1 Message formats

   LPR is a a TCP-based protocol.  The port on which a line printer
   daemon listens is 515.  The source port must be in the range 721 to
   731, inclusive.  A line printer daemon responds to commands send to
 
so lpd.c implementation is politically correct. (However, to be
religiously
correct, checking the source port number precisely within the range is
necessary. Interestingly CultBSD only checks if source port is 20.)

Since modifying source ends up in political (or religious) war, avoid
using lpd.
instead consider move to LPRng. It has the nice feature
of breaking the rfc, which means connection from ephemeral ports are
allowed,
which in turn means lpr, lprm, and lpq do not require setuid root. In
fact,
a part of my LPRng-3.7.4 directory:

=2=troll/opt1/horio/HOT> ls -l /usr/local/lpr/bin
total 2996
drwxr-xr-x  2 root  wheel     512 Apr 11 06:17 ./
drwxr-xr-x  6 root  wheel     512 Apr 11 06:17 ../
lrwxr-xr-x  1 root  wheel       4 Apr 11 06:17 cancel@ -> lprm
lrwxr-xr-x  1 root  wheel       3 Apr 11 06:17 lp@ -> lpr
-rwxr-xr-x  1 root  wheel  365460 Apr 11 06:17 lpq*
-rwxr-xr-x  1 root  wheel  378388 Apr 11 06:17 lpr*
-rwxr-xr-x  1 root  wheel  363412 Apr 11 06:17 lprm*
-rwxr-xr-x  1 root  wheel  368884 Apr 11 06:17 lpstat*
=3=troll/opt1/horio/HOT> file /usr/local/lpr/bin/lp*
/usr/local/lpr/bin/lp:     symbolic link to lpr
/usr/local/lpr/bin/lpq:    ELF 32-bit LSB executable, Intel 80386,
version 1 (FreeBSD), dynamically linked, stripped
/usr/local/lpr/bin/lpr:    ELF 32-bit LSB executable, Intel 80386,
version 1 (FreeBSD), dynamically linked, stripped
/usr/local/lpr/bin/lprm:   ELF 32-bit LSB executable, Intel 80386,
version 1 (FreeBSD), dynamically linked, stripped
/usr/local/lpr/bin/lpstat: ELF 32-bit LSB executable, Intel 80386,
version 1 (FreeBSD), dynamically linked, stripped
=4=troll/opt1/horio/HOT> 



HTH,

horio shoichi

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B19C6FC.9B74A1CF>