Commit d9849bb5 authored by Evan Hunt's avatar Evan Hunt Committed by Mark Andrews
Browse files

make update_log() work if zone is not set

- update_log() is called to log update errors, but if those errors
  occur before the zone is set (for example, when returning NOTAUTH)
  it returns without logging anything.

(cherry picked from commit 395f6a14)
parent f8453f45
Pipeline #5058 passed with stages
in 20 minutes and 18 seconds
......@@ -267,24 +267,34 @@ update_log(ns_client_t *client, dns_zone_t *zone,
char namebuf[DNS_NAME_FORMATSIZE];
char classbuf[DNS_RDATACLASS_FORMATSIZE];
if (client == NULL || zone == NULL)
if (client == NULL) {
return;
}
if (isc_log_wouldlog(ns_g_lctx, level) == false)
if (isc_log_wouldlog(ns_g_lctx, level) == false) {
return;
dns_name_format(dns_zone_getorigin(zone), namebuf,
sizeof(namebuf));
dns_rdataclass_format(dns_zone_getclass(zone), classbuf,
sizeof(classbuf));
}
va_start(ap, fmt);
vsnprintf(message, sizeof(message), fmt, ap);
va_end(ap);
ns_client_log(client, NS_LOGCATEGORY_UPDATE, NS_LOGMODULE_UPDATE,
level, "updating zone '%s/%s': %s",
namebuf, classbuf, message);
if (zone != NULL) {
dns_name_format(dns_zone_getorigin(zone), namebuf,
sizeof(namebuf));
dns_rdataclass_format(dns_zone_getclass(zone), classbuf,
sizeof(classbuf));
ns_client_log(client, NS_LOGCATEGORY_UPDATE,
NS_LOGMODULE_UPDATE,
level, "updating zone '%s/%s': %s",
namebuf, classbuf, message);
} else {
ns_client_log(client, NS_LOGCATEGORY_UPDATE,
NS_LOGMODULE_UPDATE,
level, "%s", message);
}
}
static void
......
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