Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 231247 - net-dns/bind-tools-9.5.0: lwconfig is a bit too greedy when parsing /etc/resolv.conf
Summary: net-dns/bind-tools-9.5.0: lwconfig is a bit too greedy when parsing /etc/reso...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: BIND Maintainers (DISABLED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-09 00:40 UTC by Martin Walch
Modified: 2008-07-23 19:01 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
the patch mentioned in the first comment (lwconfig.diff,1.81 KB, patch)
2008-07-09 00:41 UTC, Martin Walch
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Walch 2008-07-09 00:40:42 UTC
When given a corrupt resolv.conf, it is possible that the function
lwres_conf_parse in lib/lwres/lwconfig.c eats silently the following line,
which is probably an unexpected and undesired behavior.
This happens whenever a line contains only a single word, immediately followed
by a newline character.

The usual behavior is: the first word of a line is interpreted as a keyword.
If this keyword is known, then the line is being parsed. If everything is
fine, then LWRES_R_SUCCESS is returned. If a problem has occurred then
LWRES_R_FAILURE is the return value and the running program will refuse work.
If the keyword is unknown, then the line is being skipped and LWRES_R_SUCCESS
remains the return value.

However, when the keyword is immediately followed by a newline, the next line
is treated as arguments for the keyword, no matter if the keyword is valid or
not. No error is being returned if the keyword is known or if the keyword is
unknown and ignored, but the next line is broken.

The attached patch tries to fix this problem and also contains a minor optimization for the function getword which IMO also
improves readability.

The patch should be applicable for bind-tools 9.5.0 as well as for 9.5.0-P1 and 9.5.1b1. I have sent this to ISC several weeks ago, but did not get any response.

Reproducible: Always

Steps to Reproduce:
1. create the file /etc/resolv.conf with the following content:

search
nameserver 192.168.0.1

(replace 192.168.0.1 with a valid address)

2. run a tool from bind-tools like dig or host to resolve a hostname that will be dynamically resolved (especially not listed in /etc/hosts):

host gentoo.org

Actual Results:  
host tries to resolve gentoo.org until timeout.

Expected Results:  
host should have been complaining about a malformed /etc/resolv.conf

emerge --info
Portage 2.1.5.6 (default/linux/amd64/2008.0/desktop, gcc-4.2.4, glibc-2.6.1-r0, 2.6.25-gentoo-r6 x86_64)
=================================================================
System uname: 2.6.25-gentoo-r6 x86_64 Intel(R) Core(TM)2 CPU 4300 @ 1.80GHz
Timestamp of tree: Tue, 08 Jul 2008 13:45:03 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.5.2-r5
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.2.4-r1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r2
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -fomit-frame-pointer -pipe -march=native -fgcse-after-reload"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/4.1/env /usr/kde/4.1/share/config /usr/kde/4.1/shutdown /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -fomit-frame-pointer -pipe -march=native -fgcse-after-reload"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks fixpackages metadata-transfer parallel-fetch prelink sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ http://mirror.switch.ch/ftp/mirror/gentoo/"
LANG="de_DE.utf8"
LC_ALL="de_DE.utf8"
LDFLAGS="-Wl,-O1"
LINGUAS="de"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/kdesvn-portage /usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X Xaw3d a52 aac aalib accessibility acl acpi additions agg akode alsa amarok amd64 apache2 arts bash-completion berkdb blender-game bluetooth branding bzip2 cairo cdaudio cdr cdrom cjk cli clucene cracklib crypt cups curl daap dbus dga dri dvd dvdnav dvdr dvdread dxr3 eds emacs emboss encode evo fam fbcon ffmpeg fftw firefox flac fortran gcj gdbm ggi gif glibc-omitfp glitz gpg gpm gstreamer gtk hal hdri iceweasel iconv imagemagick insecure-savers ipv6 isdnlog jabber jack java java5 javascript jingle jms jpeg kde kdeenablefinal kdehiddenvisibility kerberos latex lcms ldap libcaca libnotify libwww lm_sensors lua mad matroska mdnsresponder-compat midi mikmod mmx mng mp3 mpeg mpeg2 mudflap mule multilib musepack mysql ncurses nls noamazon nptl nptlonly nsplugin offensive ogg ogg123 openal openexr opengl openmp oss pam pcre pdf perl plasma png posix povray ppds pppd python qt3 qt3support qt4 quicktime readline reflection reiser4 reiserfs sdl sdl-image sensord session sndfile solver songs sound speex spell spl sse sse2 ssl startup-notification svg tcpd tetex theora tidy tiff timidity truetype type1 unicode visualization vorbis wav wavpack xemacs xine xml xorg xosd xprint xscreensaver xulrunner xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de" USERLAND="GNU" VIDEO_CARDS="i810 nv vesa"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Martin Walch 2008-07-09 00:41:58 UTC
Created attachment 159925 [details, diff]
the patch mentioned in the first comment
Comment 2 Tobias Scherbaum (RETIRED) gentoo-dev 2008-07-23 19:01:02 UTC
Thanks for you patch, this is fixed in bind-tools-9.5.0_p1-r1.