non-existance of resolv.conf should not be fatal
Resolves rhbz#1052343 Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
14a63be5be
commit
01ddf2c8af
113
bind-9.9.5-nonexistence-of-resolv-conf.patch
Normal file
113
bind-9.9.5-nonexistence-of-resolv-conf.patch
Normal file
@ -0,0 +1,113 @@
|
||||
From e3d1d75a58dcc6bdb7fa7a9a3147ffd297407c76 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Andrews via RT <dhcp-bugs@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@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
|
||||
|
@ -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@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@redhat.com> 32:9.9.5-0.2.b1
|
||||
- Fix CVE-2014-0591
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user