Commit bca16e31 authored by Mark Andrews's avatar Mark Andrews
Browse files

2113. [bug] nsupdate: if a zone is specified it should be used

                        for server discover. [RT# 16455]
parent 58ea8fb1
2113. [bug] nsupdate: if a zone is specified it should be used
for server discover. [RT# 16455]
2112. [security] Warn if weak RSA exponent is used. [RT #16460]
2111. [bug] Fix a number of errors reported by Coverity.
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nsupdate.c,v 1.145 2006/12/04 01:52:45 marka Exp $ */
/* $Id: nsupdate.c,v 1.146 2006/12/07 05:39:41 marka Exp $ */
/*! \file */
......@@ -201,6 +201,9 @@ static void
recvgss(isc_task_t *task, isc_event_t *event);
#endif /* GSSAPI */
static void
error(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
#define STATUS_MORE (isc_uint16_t)0
#define STATUS_SEND (isc_uint16_t)1
#define STATUS_QUIT (isc_uint16_t)2
......@@ -234,6 +237,16 @@ fatal(const char *format, ...) {
exit(1);
}
static void
error(const char *format, ...) {
va_list args;
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
fprintf(stderr, "\n");
}
static void
debug(const char *format, ...) {
va_list args;
......@@ -1893,8 +1906,9 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
setzoneclass(dns_rdataclass_none);
return;
}
isc_mem_put(mctx, reqinfo, sizeof(nsu_requestinfo_t));
isc_mem_put(mctx, reqinfo, sizeof(nsu_requestinfo_t));
reqinfo = NULL;
isc_event_free(&event);
reqev = NULL;
......@@ -1933,6 +1947,19 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
rcvmsg->rcode != dns_rcode_nxdomain)
fatal("response to SOA query was unsuccessful");
if (userzone != NULL && rcvmsg->rcode == dns_rcode_nxdomain) {
char namebuf[DNS_NAME_FORMATSIZE];
dns_name_format(userzone, namebuf, sizeof(namebuf));
error("specified zone '%s' does not exist (NXDOMAIN)",
namebuf);
dns_message_destroy(&rcvmsg);
dns_request_destroy(&request);
dns_message_destroy(&soaquery);
ddebug("Out of recvsoa");
done_update();
return;
}
lookforsoa:
if (pass == 0)
section = DNS_SECTION_ANSWER;
......@@ -2357,15 +2384,6 @@ start_update(void) {
if (answer != NULL)
dns_message_destroy(&answer);
result = dns_message_firstname(updatemsg, section);
if (result == ISC_R_NOMORE) {
section = DNS_SECTION_PREREQUISITE;
result = dns_message_firstname(updatemsg, section);
}
if (result != ISC_R_SUCCESS) {
done_update();
return;
}
if (userzone != NULL && userserver != NULL && ! usegsstsig) {
send_update(userzone, userserver, localaddr);
......@@ -2377,7 +2395,8 @@ start_update(void) {
&soaquery);
check_result(result, "dns_message_create");
soaquery->flags |= DNS_MESSAGEFLAG_RD;
if (userserver == NULL)
soaquery->flags |= DNS_MESSAGEFLAG_RD;
result = dns_message_gettempname(soaquery, &name);
check_result(result, "dns_message_gettempname");
......@@ -2387,10 +2406,24 @@ start_update(void) {
dns_rdataset_makequestion(rdataset, getzoneclass(), dns_rdatatype_soa);
firstname = NULL;
dns_message_currentname(updatemsg, section, &firstname);
dns_name_init(name, NULL);
dns_name_clone(firstname, name);
if (userzone != NULL) {
dns_name_init(name, NULL);
dns_name_clone(userzone, name);
} else {
result = dns_message_firstname(updatemsg, section);
if (result == ISC_R_NOMORE) {
section = DNS_SECTION_PREREQUISITE;
result = dns_message_firstname(updatemsg, section);
}
if (result != ISC_R_SUCCESS) {
done_update();
return;
}
firstname = NULL;
dns_message_currentname(updatemsg, section, &firstname);
dns_name_init(name, NULL);
dns_name_clone(firstname, name);
}
ISC_LIST_INIT(name->list);
ISC_LIST_APPEND(name->list, rdataset, link);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment