[bind] non-existance of resolv.conf should not be fatal
Tomas Hozza
thozza at fedoraproject.org
Wed Jan 15 09:18:30 UTC 2014
commit 01ddf2c8af1a6dc5c38b5cf9737c3a551f292cb0
Author: Tomas Hozza <thozza at redhat.com>
Date: Wed Jan 15 10:17:36 2014 +0100
non-existance of resolv.conf should not be fatal
Resolves rhbz#1052343
Signed-off-by: Tomas Hozza <thozza at redhat.com>
bind-9.9.5-nonexistence-of-resolv-conf.patch | 113 ++++++++++++++++++++++++++
bind.spec | 7 ++-
2 files changed, 119 insertions(+), 1 deletions(-)
---
diff --git a/bind-9.9.5-nonexistence-of-resolv-conf.patch b/bind-9.9.5-nonexistence-of-resolv-conf.patch
new file mode 100644
index 0000000..00453ba
--- /dev/null
+++ b/bind-9.9.5-nonexistence-of-resolv-conf.patch
@@ -0,0 +1,113 @@
+From e3d1d75a58dcc6bdb7fa7a9a3147ffd297407c76 Mon Sep 17 00:00:00 2001
+From: Mark Andrews via RT <dhcp-bugs at isc.org>
+Date: Wed, 15 Jan 2014 02:30:27 +0000
+Subject: [PATCH] non-existance of resolv.conf should not be fatal
+
+I've just put the following in for review. The open question is whether
+we should return ISC_R_SUCCESS or some error code, when the file does not
+exist, and fix the callers.
+
+This should be enough to allow you to continue testing.
+
+Mark
+
+commit 1992f682728798ef73db89351285f03de6d52043
+Author: Mark Andrews <marka at isc.org>
+Date: Wed Jan 15 13:25:22 2014 +1100
+---
+ lib/irs/resconf.c | 75 +++++++++++++++++++++++++++++--------------------------
+ 1 file changed, 40 insertions(+), 35 deletions(-)
+
+diff --git a/lib/irs/resconf.c b/lib/irs/resconf.c
+index 88bdac1..8319dc6 100644
+--- a/lib/irs/resconf.c
++++ b/lib/irs/resconf.c
+@@ -507,45 +507,50 @@ irs_resconf_load(isc_mem_t *mctx, const char *filename, irs_resconf_t **confp)
+ conf->search[i] = NULL;
+
+ errno = 0;
+- if ((fp = fopen(filename, "r")) == NULL) {
+- isc_mem_put(mctx, conf, sizeof(*conf));
+- return (ISC_R_INVALIDFILE);
+- }
+-
+- ret = ISC_R_SUCCESS;
+- do {
+- stopchar = getword(fp, word, sizeof(word));
+- if (stopchar == EOF) {
+- rval = ISC_R_SUCCESS;
+- POST(rval);
+- break;
+- }
+-
+- if (strlen(word) == 0U)
+- rval = ISC_R_SUCCESS;
+- else if (strcmp(word, "nameserver") == 0)
+- rval = resconf_parsenameserver(conf, fp);
+- else if (strcmp(word, "domain") == 0)
+- rval = resconf_parsedomain(conf, fp);
+- else if (strcmp(word, "search") == 0)
+- rval = resconf_parsesearch(conf, fp);
+- else if (strcmp(word, "sortlist") == 0)
+- rval = resconf_parsesortlist(conf, fp);
+- else if (strcmp(word, "options") == 0)
+- rval = resconf_parseoption(conf, fp);
+- else {
+- /* unrecognised word. Ignore entire line */
+- rval = ISC_R_SUCCESS;
+- stopchar = eatline(fp);
++ if ((fp = fopen(filename, "r")) != NULL) {
++ ret = ISC_R_SUCCESS;
++ do {
++ stopchar = getword(fp, word, sizeof(word));
+ if (stopchar == EOF) {
++ rval = ISC_R_SUCCESS;
++ POST(rval);
+ break;
+ }
+- }
+- if (ret == ISC_R_SUCCESS && rval != ISC_R_SUCCESS)
+- ret = rval;
+- } while (1);
+
+- fclose(fp);
++ if (strlen(word) == 0U)
++ rval = ISC_R_SUCCESS;
++ else if (strcmp(word, "nameserver") == 0)
++ rval = resconf_parsenameserver(conf, fp);
++ else if (strcmp(word, "domain") == 0)
++ rval = resconf_parsedomain(conf, fp);
++ else if (strcmp(word, "search") == 0)
++ rval = resconf_parsesearch(conf, fp);
++ else if (strcmp(word, "sortlist") == 0)
++ rval = resconf_parsesortlist(conf, fp);
++ else if (strcmp(word, "options") == 0)
++ rval = resconf_parseoption(conf, fp);
++ else {
++ /* unrecognised word. Ignore entire line */
++ rval = ISC_R_SUCCESS;
++ stopchar = eatline(fp);
++ if (stopchar == EOF) {
++ break;
++ }
++ }
++ if (ret == ISC_R_SUCCESS && rval != ISC_R_SUCCESS)
++ ret = rval;
++ } while (1);
++
++ fclose(fp);
++ } else {
++ switch (errno) {
++ case ENOENT:
++ break;
++ default:
++ isc_mem_put(mctx, conf, sizeof(*conf));
++ return (ISC_R_INVALIDFILE);
++ }
++ }
+
+ /* If we don't find a nameserver fall back to localhost */
+ if (conf->numns == 0) {
+--
+1.8.4.2
+
diff --git a/bind.spec b/bind.spec
index d53ee2a..e53f06d 100644
--- a/bind.spec
+++ b/bind.spec
@@ -30,7 +30,7 @@ Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv
Name: bind
License: ISC
Version: 9.9.5
-Release: 0.2.%{?PATCHVER}%{?PREVER}%{?dist}
+Release: 0.3.%{?PATCHVER}%{?PREVER}%{?dist}
Epoch: 32
Url: http://www.isc.org/products/BIND/
Buildroot:%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -91,6 +91,7 @@ Patch137:bind99-rrl.patch
Patch138:bind-9.9.3-include-update-h.patch
Patch142:bind99-ISC-Bugs-35080.patch
Patch143:bind-9.9.4-CVE-2014-0591.patch
+Patch144:bind-9.9.5-nonexistence-of-resolv-conf.patch
# SDB patches
Patch11: bind-9.3.2b2-sdbsrc.patch
@@ -306,6 +307,7 @@ popd
%patch138 -p1 -b .update
%patch142 -p1 -b .rbtdb_crash
%patch143 -p1 -b .CVE-2014-0591
+%patch144 -p1 -b .resolv-conf
%if %{SDB}
%patch101 -p1 -b .old-api
@@ -920,6 +922,9 @@ rm -rf ${RPM_BUILD_ROOT}
%endif
%changelog
+* Wed Jan 15 2014 Tomas Hozza <thozza at redhat.com> 32:9.9.5-0.3.b1
+- non-existance of resolv.conf should not be fatal (#1052343)
+
* Tue Jan 14 2014 Tomas Hozza <thozza at redhat.com> 32:9.9.5-0.2.b1
- Fix CVE-2014-0591
More information about the scm-commits
mailing list