1030. [bug] On systems with no resolv.conf file, nsupdate
exited with an error rather than defaulting
to using the loopback address. [RT #1836]
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -1,4 +1,8 @@
|
||||
|
||||
1030. [bug] On systems with no resolv.conf file, nsupdate
|
||||
exited with an error rather than defaulting
|
||||
to using the loopback address. [RT #1836]
|
||||
|
||||
1029. [bug] Some named.conf errors did not cause the loading
|
||||
of the configuration file to return a failure
|
||||
status even though they were logged. [RT #1847]
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: nsupdate.c,v 1.106 2001/09/27 17:53:39 bwelling Exp $ */
|
||||
/* $Id: nsupdate.c,v 1.107 2001/10/04 23:29:41 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -457,29 +457,34 @@ setup_system(void) {
|
||||
if (lwresult != LWRES_R_SUCCESS)
|
||||
fatal("lwres_context_create failed");
|
||||
|
||||
lwresult = lwres_conf_parse(lwctx, RESOLV_CONF);
|
||||
if (lwresult != LWRES_R_SUCCESS)
|
||||
fprintf(stderr,
|
||||
"an error was encountered in %s\n", RESOLV_CONF);
|
||||
|
||||
(void)lwres_conf_parse(lwctx, RESOLV_CONF);
|
||||
lwconf = lwres_conf_get(lwctx);
|
||||
|
||||
ns_total = lwconf->nsnext;
|
||||
if (ns_total <= 0)
|
||||
fatal("no valid servers found");
|
||||
servers = isc_mem_get(mctx, ns_total * sizeof(isc_sockaddr_t));
|
||||
if (servers == NULL)
|
||||
fatal("out of memory");
|
||||
for (i = 0; i < ns_total; i++) {
|
||||
if (lwconf->nameservers[i].family == LWRES_ADDRTYPE_V4) {
|
||||
struct in_addr in4;
|
||||
memcpy(&in4, lwconf->nameservers[i].address, 4);
|
||||
isc_sockaddr_fromin(&servers[i], &in4, DNSDEFAULTPORT);
|
||||
} else {
|
||||
struct in6_addr in6;
|
||||
memcpy(&in6, lwconf->nameservers[i].address, 16);
|
||||
isc_sockaddr_fromin6(&servers[i], &in6,
|
||||
DNSDEFAULTPORT);
|
||||
if (ns_total <= 0) {
|
||||
/* No name servers in resolv.conf; default to loopback. */
|
||||
struct in_addr localhost;
|
||||
ns_total = 1;
|
||||
servers = isc_mem_get(mctx, ns_total * sizeof(isc_sockaddr_t));
|
||||
if (servers == NULL)
|
||||
fatal("out of memory");
|
||||
localhost.s_addr = htonl(INADDR_LOOPBACK);
|
||||
isc_sockaddr_fromin(&servers[0], &localhost, DNSDEFAULTPORT);
|
||||
} else {
|
||||
servers = isc_mem_get(mctx, ns_total * sizeof(isc_sockaddr_t));
|
||||
if (servers == NULL)
|
||||
fatal("out of memory");
|
||||
for (i = 0; i < ns_total; i++) {
|
||||
if (lwconf->nameservers[i].family == LWRES_ADDRTYPE_V4) {
|
||||
struct in_addr in4;
|
||||
memcpy(&in4, lwconf->nameservers[i].address, 4);
|
||||
isc_sockaddr_fromin(&servers[i], &in4, DNSDEFAULTPORT);
|
||||
} else {
|
||||
struct in6_addr in6;
|
||||
memcpy(&in6, lwconf->nameservers[i].address, 16);
|
||||
isc_sockaddr_fromin6(&servers[i], &in6,
|
||||
DNSDEFAULTPORT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user