Bug 12923 - Comments in /etc/resolv.conf starting in the middle of a line are interpreted
Summary: Comments in /etc/resolv.conf starting in the middle of a line are interpreted
Status: RESOLVED INVALID
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.14
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-23 12:40 UTC by Markus Gagliardi
Modified: 2014-06-27 13:05 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Gagliardi 2011-06-23 12:40:49 UTC
Example:

With the following line in /etc/resolv.conf, libc tries to resolv myhost.somedomain.ch.by if the DNS server is not available during the try on myhost.somedomain.ch. It even succeeds, since ch.by resolves everything with this suffix..

search somedomain.ch # Generated by udhcpc eth0

Best regards
Markus
Comment 1 Markus Gagliardi 2011-06-23 12:41:43 UTC
Problem is in res_init.c (247 ff.):

	    while (fgets_unlocked(buf, sizeof(buf), fp) != NULL) {
		/* skip comments */
		if (*buf == ';' || *buf == '#')
			continue;
Comment 2 Andreas Jaeger 2011-07-03 12:27:53 UTC
/etc/resolv.conf only allows complete comment lines but not mixing of options and comments.
Comment 3 Ulrich Drepper 2011-07-03 13:18:32 UTC
Fix the program which generates these incorrect lines.

Even if I'd change that this would still create problems elsewhere because ever since the firs appearance of this code comments aren't supported like this.
Comment 4 Markus Gagliardi 2011-07-04 06:19:06 UTC
(In reply to comment #3)
> Fix the program which generates these incorrect lines.
> 
> Even if I'd change that this would still create problems elsewhere because ever
> since the firs appearance of this code comments aren't supported like this.

No problem.

I was just confused by an OpenBSD manpage
http://resin.csoft.net/cgi-bin/man.cgi?section=5&topic=resolv.conf
where comments beginning in the middle of a line are allowed.