[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#33686: libc6: wrong parsing in __ivaliduser leads to stupid DNS queries



Package: libc6
Version: 2.0.7.19981211-5

Hi.
I have found that there's a problem in __ivaliduser (inet/rcmd.c)
that results in weird side effects in lpd, as it calls that
function to parse the /etc/hosts.lpd file when needed. The
problem arises when that file contains empty lines or comments:
for every such line, the local variable buf ends up containing an
empty string (""). This situation is not checked for, and instead
of going on with the next line, a stupid DNS request is issued:
an A query on the root domain ("", i.e. "."). Under some
circumstances (if the system is not directly connected to the
Internet), this leads to 75 seconds of delay for every empty line
in the hosts.lpd file, i.e., the DNS query timeout. In my case, 5
long minutes. Here is a patch that solves the problem:

­-------------------------------PATCH------------------------------------
--- glibc-2.0.7.19981211.orig/inet/rcmd.c.OLD	Sat Dec 12 05:36:47 1998
+++ glibc-2.0.7.19981211.orig/inet/rcmd.c	Mon Feb 22 02:56:22 1999
@@ -454,6 +454,11 @@
 		} else
 			user = p;
 		*p = '\0';
+		/* If the line is empty, we continue: we don't want to check
+		 * the domain name "".
+		 * Mon Feb 22 02:55:46 CET 1999 <alvaro@lander.es> */
+		if (*buf == '\0')
+		  continue;
 		if (__icheckhost(raddr, buf) &&
 		    strcmp(ruser, *user ? user : luser) == 0) {
 			free (buf);
­-------------------------------PATCH------------------------------------

Regards.

.------------------------------------------------------------------.
|   Alvaro Martínez Echevarría   |      LANDER SISTEMAS            |
|        alvaro@lander.es        |      Pº Castellana, 121         |
`--------------------------------|      28046 Madrid, SPAIN        |
                                 |      Tel: +34-91-5562883        |
                                 |      Fax: +34-91-5563001        |
                                 `---------------------------------'


-- System Information
Debian Release: 2.1
Kernel Version: Linux leon 2.0.33 #434 Sat Apr 18 18:36:18 CEST 1998 i586 unknown

Versions of the packages libc6 depends on:
ii  ldso            1.9.10-1       The Linux dynamic linker, library and utilit


Reply to: