Package: lpr
Version: 2003.09.23-7
I'm running Debian GNU/Linux 3.1 (sarge) with Linux kernel 2.6.8-2-686.
The bug is that lpd doesn't recognise any hostnames in ``/etc/hosts.lpd''
which do not have a trailing newline. lpd also mis-parses
``/etc/hosts.equiv'' in the same manner.
``/etc/default/lpd'' has been customised so that lpd starts with the
option of ``-b 10.0.0.1''.
I believe the bug lies in the function ``__ivaliduser_sa()'' within the
source file ``lpr-2003.09.23/lpd/rcmd.c''. This function is called by
the function ``chkhost()'' within ``lpr-2003.09.23/lpd/lpd.c''.
I have attached a unified diff below. But as lpd is a network daemon and
the code involves parsing ``/etc/hosts.equiv'', I'd recommend that a
second pair of eyes consider the implication of the changes and to ensure
that I do not introduce additional and more serious bugs.
===
--- rcmd.c~ 2005-08-14 22:46:23.000000000 +1000
+++ rcmd.c 2005-08-14 23:38:27.000000000 +1000
@@ -112,13 +112,13 @@
*p = isupper(*p) ? tolower(*p) : *p;
p++;
}
- if (p >= buf + buflen)
+ if (p > buf + buflen)
continue;
if (*p == ' ' || *p == '\t') {
*p++ = '\0';
while (p < buf + buflen && (*p == ' ' || *p == '\t'))
p++;
- if (p >= buf + buflen)
+ if (p > buf + buflen)
continue;
user = p;
while (p < buf + buflen && *p != '\n' && *p != ' ' &&
===
Alternatively, this bug could be swept under the carpet by simply
asserting that the correct file format of hosts.equiv is to have a
newline at the end of the file.
BTW - closer inspection of the code indicates that ``/etc/hosts.equiv''
and ``/etc/hosts.lpd'' are quite strict in their parsing of the files.
For example, leading whitespaces causes trouble. While this should be
easy to fix (and I'm happy to provide a patch):
1) It should be done in another bug report.
2) It is unclear whether stripping leading whitespace would be considered
by all as the "correct" behaviour.
3) Other packages which also parse ``/etc/hosts.equiv'' should also be
fixed simultaneously.
Regards
Eddie
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]