mirror of
https://github.com/isc-projects/bind9.git
synced 2026-04-28 17:46:40 -04:00
4654. [cleanup] Don't use C++ keywords delete, new and namespace.
[RT #45538]
This commit is contained in:
parent
0297ebcc89
commit
4bf32aa587
36 changed files with 586 additions and 579 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
4654. [cleanup] Don't use C++ keywords delete, new and namespace.
|
||||
[RT #45538]
|
||||
|
||||
4653. [bug] Reorder includes to move @DST_OPENSSL_INC@ and
|
||||
@ISC_OPENSSL_INC@ after shipped include directories.
|
||||
[RT #45581]
|
||||
|
|
|
|||
|
|
@ -2321,10 +2321,10 @@ setup_lookup(dig_lookup_t *lookup) {
|
|||
check_result(result, "dns_message_gettempname");
|
||||
dns_name_init(lookup->name, NULL);
|
||||
|
||||
isc_buffer_init(&lookup->namebuf, lookup->namespace,
|
||||
sizeof(lookup->namespace));
|
||||
isc_buffer_init(&lookup->onamebuf, lookup->onamespace,
|
||||
sizeof(lookup->onamespace));
|
||||
isc_buffer_init(&lookup->namebuf, lookup->name_space,
|
||||
sizeof(lookup->name_space));
|
||||
isc_buffer_init(&lookup->onamebuf, lookup->oname_space,
|
||||
sizeof(lookup->oname_space));
|
||||
|
||||
#ifdef WITH_IDN
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -164,8 +164,8 @@ isc_boolean_t sigchase;
|
|||
dns_rdataclass_t rdclass;
|
||||
isc_boolean_t rdtypeset;
|
||||
isc_boolean_t rdclassset;
|
||||
char namespace[BUFSIZE];
|
||||
char onamespace[BUFSIZE];
|
||||
char name_space[BUFSIZE];
|
||||
char oname_space[BUFSIZE];
|
||||
isc_buffer_t namebuf;
|
||||
isc_buffer_t onamebuf;
|
||||
isc_buffer_t renderbuf;
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ main(int argc, char **argv) {
|
|||
char *label = NULL;
|
||||
dns_ttl_t ttl = 0;
|
||||
isc_stdtime_t publish = 0, activate = 0, revoke = 0;
|
||||
isc_stdtime_t inactive = 0, delete = 0;
|
||||
isc_stdtime_t inactive = 0, deltime = 0;
|
||||
isc_stdtime_t now;
|
||||
int prepub = -1;
|
||||
isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE;
|
||||
|
|
@ -317,8 +317,8 @@ main(int argc, char **argv) {
|
|||
if (setdel || unsetdel)
|
||||
fatal("-D specified more than once");
|
||||
|
||||
delete = strtotime(isc_commandline_argument,
|
||||
now, now, &setdel);
|
||||
deltime = strtotime(isc_commandline_argument,
|
||||
now, now, &setdel);
|
||||
unsetdel = !setdel;
|
||||
break;
|
||||
case 'S':
|
||||
|
|
@ -662,7 +662,7 @@ main(int argc, char **argv) {
|
|||
dst_key_settime(key, DST_TIME_INACTIVE, inactive);
|
||||
|
||||
if (setdel)
|
||||
dst_key_settime(key, DST_TIME_DELETE, delete);
|
||||
dst_key_settime(key, DST_TIME_DELETE, deltime);
|
||||
if (setsyncadd)
|
||||
dst_key_settime(key, DST_TIME_SYNCPUBLISH, syncadd);
|
||||
if (setsyncdel)
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ main(int argc, char **argv) {
|
|||
dns_ttl_t ttl = 0;
|
||||
isc_boolean_t use_default = ISC_FALSE, use_nsec3 = ISC_FALSE;
|
||||
isc_stdtime_t publish = 0, activate = 0, revokekey = 0;
|
||||
isc_stdtime_t inactive = 0, delete = 0;
|
||||
isc_stdtime_t inactive = 0, deltime = 0;
|
||||
isc_stdtime_t now;
|
||||
int prepub = -1;
|
||||
isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE;
|
||||
|
|
@ -467,8 +467,8 @@ main(int argc, char **argv) {
|
|||
if (setdel || unsetdel)
|
||||
fatal("-D specified more than once");
|
||||
|
||||
delete = strtotime(isc_commandline_argument,
|
||||
now, now, &setdel);
|
||||
deltime = strtotime(isc_commandline_argument,
|
||||
now, now, &setdel);
|
||||
unsetdel = !setdel;
|
||||
break;
|
||||
case 'S':
|
||||
|
|
@ -1007,13 +1007,13 @@ main(int argc, char **argv) {
|
|||
inactive);
|
||||
|
||||
if (setdel) {
|
||||
if (setinact && delete < inactive)
|
||||
if (setinact && deltime < inactive)
|
||||
fprintf(stderr, "%s: warning: Key is "
|
||||
"scheduled to be deleted "
|
||||
"before it is scheduled to be "
|
||||
"made inactive.\n",
|
||||
program);
|
||||
dst_key_settime(key, DST_TIME_DELETE, delete);
|
||||
dst_key_settime(key, DST_TIME_DELETE, deltime);
|
||||
}
|
||||
|
||||
if (setsyncadd)
|
||||
|
|
|
|||
|
|
@ -662,20 +662,20 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||
|
||||
/* Grow lists? */
|
||||
if (listcount == l) {
|
||||
void * new;
|
||||
void * tmp;
|
||||
isc_uint32_t newlen = listcount + 16;
|
||||
size_t newsize, oldsize;
|
||||
|
||||
newsize = newlen * sizeof(*lists);
|
||||
oldsize = listcount * sizeof(*lists);
|
||||
new = isc_mem_get(mctx, newsize);
|
||||
if (new == NULL)
|
||||
tmp = isc_mem_get(mctx, newsize);
|
||||
if (tmp == NULL)
|
||||
goto cleanup;
|
||||
if (listcount != 0) {
|
||||
memmove(new, lists, oldsize);
|
||||
memmove(tmp, lists, oldsize);
|
||||
isc_mem_put(mctx, lists, oldsize);
|
||||
}
|
||||
lists = new;
|
||||
lists = tmp;
|
||||
listcount = newlen;
|
||||
}
|
||||
/* Seen? */
|
||||
|
|
@ -697,20 +697,20 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||
lists[l++].name = listname;
|
||||
/* Grow stack? */
|
||||
if (stackcount == pushed) {
|
||||
void * new;
|
||||
void * tmp;
|
||||
isc_uint32_t newlen = stackcount + 16;
|
||||
size_t newsize, oldsize;
|
||||
|
||||
newsize = newlen * sizeof(*stack);
|
||||
oldsize = stackcount * sizeof(*stack);
|
||||
new = isc_mem_get(mctx, newsize);
|
||||
if (new == NULL)
|
||||
tmp = isc_mem_get(mctx, newsize);
|
||||
if (tmp == NULL)
|
||||
goto cleanup;
|
||||
if (stackcount != 0) {
|
||||
memmove(new, stack, oldsize);
|
||||
memmove(tmp, stack, oldsize);
|
||||
isc_mem_put(mctx, stack, oldsize);
|
||||
}
|
||||
stack = new;
|
||||
stack = tmp;
|
||||
stackcount = newlen;
|
||||
}
|
||||
/*
|
||||
|
|
@ -725,44 +725,44 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||
}
|
||||
|
||||
if (i == addrcount) {
|
||||
void * new;
|
||||
void * tmp;
|
||||
isc_uint32_t newlen = addrcount + 16;
|
||||
size_t newsize, oldsize;
|
||||
|
||||
newsize = newlen * sizeof(isc_sockaddr_t);
|
||||
oldsize = addrcount * sizeof(isc_sockaddr_t);
|
||||
new = isc_mem_get(mctx, newsize);
|
||||
if (new == NULL)
|
||||
tmp = isc_mem_get(mctx, newsize);
|
||||
if (tmp == NULL)
|
||||
goto cleanup;
|
||||
if (addrcount != 0) {
|
||||
memmove(new, addrs, oldsize);
|
||||
memmove(tmp, addrs, oldsize);
|
||||
isc_mem_put(mctx, addrs, oldsize);
|
||||
}
|
||||
addrs = new;
|
||||
addrs = tmp;
|
||||
addrcount = newlen;
|
||||
|
||||
newsize = newlen * sizeof(isc_dscp_t);
|
||||
oldsize = dscpcount * sizeof(isc_dscp_t);
|
||||
new = isc_mem_get(mctx, newsize);
|
||||
if (new == NULL)
|
||||
tmp = isc_mem_get(mctx, newsize);
|
||||
if (tmp == NULL)
|
||||
goto cleanup;
|
||||
if (dscpcount != 0) {
|
||||
memmove(new, dscps, oldsize);
|
||||
memmove(tmp, dscps, oldsize);
|
||||
isc_mem_put(mctx, dscps, oldsize);
|
||||
}
|
||||
dscps = new;
|
||||
dscps = tmp;
|
||||
dscpcount = newlen;
|
||||
|
||||
newsize = newlen * sizeof(dns_name_t *);
|
||||
oldsize = keycount * sizeof(dns_name_t *);
|
||||
new = isc_mem_get(mctx, newsize);
|
||||
if (new == NULL)
|
||||
tmp = isc_mem_get(mctx, newsize);
|
||||
if (tmp == NULL)
|
||||
goto cleanup;
|
||||
if (keycount != 0) {
|
||||
memmove(new, keys, oldsize);
|
||||
memmove(tmp, keys, oldsize);
|
||||
isc_mem_put(mctx, keys, oldsize);
|
||||
}
|
||||
keys = new;
|
||||
keys = tmp;
|
||||
keycount = newlen;
|
||||
}
|
||||
|
||||
|
|
@ -802,46 +802,46 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||
goto resume;
|
||||
}
|
||||
if (i < addrcount) {
|
||||
void * new;
|
||||
void * tmp;
|
||||
size_t newsize, oldsize;
|
||||
|
||||
newsize = i * sizeof(isc_sockaddr_t);
|
||||
oldsize = addrcount * sizeof(isc_sockaddr_t);
|
||||
if (i != 0) {
|
||||
new = isc_mem_get(mctx, newsize);
|
||||
if (new == NULL)
|
||||
tmp = isc_mem_get(mctx, newsize);
|
||||
if (tmp == NULL)
|
||||
goto cleanup;
|
||||
memmove(new, addrs, newsize);
|
||||
memmove(tmp, addrs, newsize);
|
||||
} else
|
||||
new = NULL;
|
||||
tmp = NULL;
|
||||
isc_mem_put(mctx, addrs, oldsize);
|
||||
addrs = new;
|
||||
addrs = tmp;
|
||||
addrcount = i;
|
||||
|
||||
newsize = i * sizeof(isc_dscp_t);
|
||||
oldsize = dscpcount * sizeof(isc_dscp_t);
|
||||
if (i != 0) {
|
||||
new = isc_mem_get(mctx, newsize);
|
||||
if (new == NULL)
|
||||
tmp = isc_mem_get(mctx, newsize);
|
||||
if (tmp == NULL)
|
||||
goto cleanup;
|
||||
memmove(new, dscps, newsize);
|
||||
memmove(tmp, dscps, newsize);
|
||||
} else
|
||||
new = NULL;
|
||||
tmp = NULL;
|
||||
isc_mem_put(mctx, dscps, oldsize);
|
||||
dscps = new;
|
||||
dscps = tmp;
|
||||
dscpcount = i;
|
||||
|
||||
newsize = i * sizeof(dns_name_t *);
|
||||
oldsize = keycount * sizeof(dns_name_t *);
|
||||
if (i != 0) {
|
||||
new = isc_mem_get(mctx, newsize);
|
||||
if (new == NULL)
|
||||
tmp = isc_mem_get(mctx, newsize);
|
||||
if (tmp == NULL)
|
||||
goto cleanup;
|
||||
memmove(new, keys, newsize);
|
||||
memmove(tmp, keys, newsize);
|
||||
} else
|
||||
new = NULL;
|
||||
tmp = NULL;
|
||||
isc_mem_put(mctx, keys, oldsize);
|
||||
keys = new;
|
||||
keys = tmp;
|
||||
keycount = i;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ int
|
|||
main(int argc, char **argv) {
|
||||
isc_result_t result;
|
||||
char *origin, *file1, *file2, *journal;
|
||||
dns_db_t *old = NULL, *new = NULL;
|
||||
dns_db_t *olddb = NULL, *newdb = NULL;
|
||||
isc_logdestination_t destination;
|
||||
isc_logconfig_t *logconfig = NULL;
|
||||
|
||||
|
|
@ -121,28 +121,28 @@ main(int argc, char **argv) {
|
|||
|
||||
dns_result_register();
|
||||
|
||||
result = loadzone(&old, origin, file1);
|
||||
result = loadzone(&olddb, origin, file1);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "Couldn't load %s: ", file1);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
result = loadzone(&new, origin, file2);
|
||||
result = loadzone(&newdb, origin, file2);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "Couldn't load %s: ", file2);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
result = dns_db_diff(mctx, new, NULL, old, NULL, journal);
|
||||
result = dns_db_diff(mctx, newdb, NULL, olddb, NULL, journal);
|
||||
|
||||
cleanup:
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fprintf(stderr, "%s\n", isc_result_totext(result));
|
||||
|
||||
if (new != NULL)
|
||||
dns_db_detach(&new);
|
||||
if (old != NULL)
|
||||
dns_db_detach(&old);
|
||||
if (newdb != NULL)
|
||||
dns_db_detach(&newdb);
|
||||
if (olddb != NULL)
|
||||
dns_db_detach(&olddb);
|
||||
|
||||
if (lctx != NULL)
|
||||
isc_log_destroy(&lctx);
|
||||
|
|
|
|||
|
|
@ -1609,23 +1609,23 @@ validate_masters(const cfg_obj_t *obj, const cfg_obj_t *config,
|
|||
}
|
||||
/* Grow stack? */
|
||||
if (stackcount == pushed) {
|
||||
void * new;
|
||||
void * newstack;
|
||||
isc_uint32_t newlen = stackcount + 16;
|
||||
size_t newsize, oldsize;
|
||||
|
||||
newsize = newlen * sizeof(*stack);
|
||||
oldsize = stackcount * sizeof(*stack);
|
||||
new = isc_mem_get(mctx, newsize);
|
||||
if (new == NULL)
|
||||
newstack = isc_mem_get(mctx, newsize);
|
||||
if (newstack == NULL)
|
||||
goto cleanup;
|
||||
if (stackcount != 0) {
|
||||
void *ptr;
|
||||
|
||||
DE_CONST(stack, ptr);
|
||||
memmove(new, stack, oldsize);
|
||||
memmove(newstack, stack, oldsize);
|
||||
isc_mem_put(mctx, ptr, oldsize);
|
||||
}
|
||||
stack = new;
|
||||
stack = newstack;
|
||||
stackcount = newlen;
|
||||
}
|
||||
stack[pushed++] = cfg_list_next(element);
|
||||
|
|
|
|||
|
|
@ -619,7 +619,7 @@ dns_client_destroy(dns_client_t **clientp) {
|
|||
|
||||
isc_result_t
|
||||
dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
|
||||
const dns_name_t *namespace, isc_sockaddrlist_t *addrs)
|
||||
const dns_name_t *name_space, isc_sockaddrlist_t *addrs)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_view_t *view = NULL;
|
||||
|
|
@ -627,8 +627,8 @@ dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
|
|||
REQUIRE(DNS_CLIENT_VALID(client));
|
||||
REQUIRE(addrs != NULL);
|
||||
|
||||
if (namespace == NULL)
|
||||
namespace = dns_rootname;
|
||||
if (name_space == NULL)
|
||||
name_space = dns_rootname;
|
||||
|
||||
LOCK(&client->lock);
|
||||
result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
|
||||
|
|
@ -639,7 +639,7 @@ dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
|
|||
}
|
||||
UNLOCK(&client->lock);
|
||||
|
||||
result = dns_fwdtable_add(view->fwdtable, namespace, addrs,
|
||||
result = dns_fwdtable_add(view->fwdtable, name_space, addrs,
|
||||
dns_fwdpolicy_only);
|
||||
|
||||
dns_view_detach(&view);
|
||||
|
|
@ -649,15 +649,15 @@ dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
|
|||
|
||||
isc_result_t
|
||||
dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
|
||||
const dns_name_t *namespace)
|
||||
const dns_name_t *name_space)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_view_t *view = NULL;
|
||||
|
||||
REQUIRE(DNS_CLIENT_VALID(client));
|
||||
|
||||
if (namespace == NULL)
|
||||
namespace = dns_rootname;
|
||||
if (name_space == NULL)
|
||||
name_space = dns_rootname;
|
||||
|
||||
LOCK(&client->lock);
|
||||
result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
|
||||
|
|
@ -668,7 +668,7 @@ dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
|
|||
}
|
||||
UNLOCK(&client->lock);
|
||||
|
||||
result = dns_fwdtable_delete(view->fwdtable, namespace);
|
||||
result = dns_fwdtable_delete(view->fwdtable, name_space);
|
||||
|
||||
dns_view_detach(&view);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ isc_result_t
|
|||
dns_dns64_create(isc_mem_t *mctx, const isc_netaddr_t *prefix,
|
||||
unsigned int prefixlen, const isc_netaddr_t *suffix,
|
||||
dns_acl_t *clients, dns_acl_t *mapped, dns_acl_t *excluded,
|
||||
unsigned int flags, dns_dns64_t **dns64)
|
||||
unsigned int flags, dns_dns64_t **dns64p)
|
||||
{
|
||||
dns_dns64_t *new;
|
||||
dns_dns64_t *dns64;
|
||||
unsigned int nbytes = 16;
|
||||
|
||||
REQUIRE(prefix != NULL && prefix->family == AF_INET6);
|
||||
|
|
@ -59,7 +59,7 @@ dns_dns64_create(isc_mem_t *mctx, const isc_netaddr_t *prefix,
|
|||
REQUIRE(prefixlen == 32 || prefixlen == 40 || prefixlen == 48 ||
|
||||
prefixlen == 56 || prefixlen == 64 || prefixlen == 96);
|
||||
REQUIRE(isc_netaddr_prefixok(prefix, prefixlen) == ISC_R_SUCCESS);
|
||||
REQUIRE(dns64 != NULL && *dns64 == NULL);
|
||||
REQUIRE(dns64p != NULL && *dns64p == NULL);
|
||||
|
||||
if (suffix != NULL) {
|
||||
static const unsigned char zeros[16];
|
||||
|
|
@ -71,29 +71,29 @@ dns_dns64_create(isc_mem_t *mctx, const isc_netaddr_t *prefix,
|
|||
REQUIRE(memcmp(suffix->type.in6.s6_addr, zeros, nbytes) == 0);
|
||||
}
|
||||
|
||||
new = isc_mem_get(mctx, sizeof(dns_dns64_t));
|
||||
if (new == NULL)
|
||||
dns64 = isc_mem_get(mctx, sizeof(dns_dns64_t));
|
||||
if (dns64 == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
memset(new->bits, 0, sizeof(new->bits));
|
||||
memmove(new->bits, prefix->type.in6.s6_addr, prefixlen / 8);
|
||||
memset(dns64->bits, 0, sizeof(dns64->bits));
|
||||
memmove(dns64->bits, prefix->type.in6.s6_addr, prefixlen / 8);
|
||||
if (suffix != NULL)
|
||||
memmove(new->bits + nbytes, suffix->type.in6.s6_addr + nbytes,
|
||||
memmove(dns64->bits + nbytes, suffix->type.in6.s6_addr + nbytes,
|
||||
16 - nbytes);
|
||||
new->clients = NULL;
|
||||
dns64->clients = NULL;
|
||||
if (clients != NULL)
|
||||
dns_acl_attach(clients, &new->clients);
|
||||
new->mapped = NULL;
|
||||
dns_acl_attach(clients, &dns64->clients);
|
||||
dns64->mapped = NULL;
|
||||
if (mapped != NULL)
|
||||
dns_acl_attach(mapped, &new->mapped);
|
||||
new->excluded = NULL;
|
||||
dns_acl_attach(mapped, &dns64->mapped);
|
||||
dns64->excluded = NULL;
|
||||
if (excluded != NULL)
|
||||
dns_acl_attach(excluded, &new->excluded);
|
||||
new->prefixlen = prefixlen;
|
||||
new->flags = flags;
|
||||
ISC_LINK_INIT(new, link);
|
||||
new->mctx = NULL;
|
||||
isc_mem_attach(mctx, &new->mctx);
|
||||
*dns64 = new;
|
||||
dns_acl_attach(excluded, &dns64->excluded);
|
||||
dns64->prefixlen = prefixlen;
|
||||
dns64->flags = flags;
|
||||
ISC_LINK_INIT(dns64, link);
|
||||
dns64->mctx = NULL;
|
||||
isc_mem_attach(mctx, &dns64->mctx);
|
||||
*dns64p = dns64;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ dns_dnssec_verify(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
|
|||
isc_boolean_t
|
||||
dns_dnssec_keyactive(dst_key_t *key, isc_stdtime_t now) {
|
||||
isc_result_t result;
|
||||
isc_stdtime_t publish, active, revoke, inactive, delete;
|
||||
isc_stdtime_t publish, active, revoke, inactive, deltime;
|
||||
isc_boolean_t pubset = ISC_FALSE, actset = ISC_FALSE;
|
||||
isc_boolean_t revset = ISC_FALSE, inactset = ISC_FALSE;
|
||||
isc_boolean_t delset = ISC_FALSE;
|
||||
|
|
@ -637,11 +637,11 @@ dns_dnssec_keyactive(dst_key_t *key, isc_stdtime_t now) {
|
|||
if (result == ISC_R_SUCCESS)
|
||||
inactset = ISC_TRUE;
|
||||
|
||||
result = dst_key_gettime(key, DST_TIME_DELETE, &delete);
|
||||
result = dst_key_gettime(key, DST_TIME_DELETE, &deltime);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
delset = ISC_TRUE;
|
||||
|
||||
if ((inactset && inactive <= now) || (delset && delete <= now))
|
||||
if ((inactset && inactive <= now) || (delset && deltime <= now))
|
||||
return (ISC_FALSE);
|
||||
|
||||
if (revset && revoke <= now && pubset && publish <= now)
|
||||
|
|
@ -1309,7 +1309,7 @@ dns_dnsseckey_destroy(isc_mem_t *mctx, dns_dnsseckey_t **dkp) {
|
|||
static void
|
||||
get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) {
|
||||
isc_result_t result;
|
||||
isc_stdtime_t publish, active, revoke, inactive, delete;
|
||||
isc_stdtime_t publish, active, revoke, inactive, deltime;
|
||||
isc_boolean_t pubset = ISC_FALSE, actset = ISC_FALSE;
|
||||
isc_boolean_t revset = ISC_FALSE, inactset = ISC_FALSE;
|
||||
isc_boolean_t delset = ISC_FALSE;
|
||||
|
|
@ -1332,7 +1332,7 @@ get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) {
|
|||
if (result == ISC_R_SUCCESS)
|
||||
inactset = ISC_TRUE;
|
||||
|
||||
result = dst_key_gettime(key->key, DST_TIME_DELETE, &delete);
|
||||
result = dst_key_gettime(key->key, DST_TIME_DELETE, &deltime);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
delset = ISC_TRUE;
|
||||
|
||||
|
|
@ -1392,7 +1392,7 @@ get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) {
|
|||
/*
|
||||
* Metadata says delete, so don't publish this key or sign with it.
|
||||
*/
|
||||
if (delset && delete <= now) {
|
||||
if (delset && deltime <= now) {
|
||||
key->hint_publish = ISC_FALSE;
|
||||
key->hint_sign = ISC_FALSE;
|
||||
key->hint_remove = ISC_TRUE;
|
||||
|
|
@ -1839,8 +1839,8 @@ publish(dns_rdata_t *rdata, dns_diff_t *diff, dns_name_t *origin,
|
|||
}
|
||||
|
||||
static isc_result_t
|
||||
delete(dns_rdata_t *rdata, dns_diff_t *diff, dns_name_t *origin,
|
||||
dns_ttl_t ttl, isc_mem_t *mctx)
|
||||
delrdata(dns_rdata_t *rdata, dns_diff_t *diff, dns_name_t *origin,
|
||||
dns_ttl_t ttl, isc_mem_t *mctx)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_difftuple_t *tuple = NULL;
|
||||
|
|
@ -2002,18 +2002,18 @@ dns_dnssec_syncupdate(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *rmkeys,
|
|||
if (dns_rdataset_isassociated(cds) &&
|
||||
syncdelete(key->key, now)) {
|
||||
if (exists(cds, &cdsrdata1))
|
||||
RETERR(delete(&cdsrdata1, diff, origin,
|
||||
cds->ttl, mctx));
|
||||
RETERR(delrdata(&cdsrdata1, diff, origin,
|
||||
cds->ttl, mctx));
|
||||
if (exists(cds, &cdsrdata2))
|
||||
RETERR(delete(&cdsrdata2, diff, origin,
|
||||
cds->ttl, mctx));
|
||||
RETERR(delrdata(&cdsrdata2, diff, origin,
|
||||
cds->ttl, mctx));
|
||||
}
|
||||
|
||||
if (dns_rdataset_isassociated(cdnskey) &&
|
||||
syncdelete(key->key, now)) {
|
||||
if (exists(cdnskey, &cdnskeyrdata))
|
||||
RETERR(delete(&cdnskeyrdata, diff, origin,
|
||||
cdnskey->ttl, mctx));
|
||||
RETERR(delrdata(&cdnskeyrdata, diff, origin,
|
||||
cdnskey->ttl, mctx));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2043,17 +2043,17 @@ dns_dnssec_syncupdate(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *rmkeys,
|
|||
DNS_DSDIGEST_SHA256, dsbuf2,
|
||||
&cdsrdata2));
|
||||
if (exists(cds, &cdsrdata1))
|
||||
RETERR(delete(&cdsrdata1, diff, origin,
|
||||
cds->ttl, mctx));
|
||||
RETERR(delrdata(&cdsrdata1, diff, origin,
|
||||
cds->ttl, mctx));
|
||||
if (exists(cds, &cdsrdata2))
|
||||
RETERR(delete(&cdsrdata2, diff, origin,
|
||||
cds->ttl, mctx));
|
||||
RETERR(delrdata(&cdsrdata2, diff, origin,
|
||||
cds->ttl, mctx));
|
||||
}
|
||||
|
||||
if (dns_rdataset_isassociated(cdnskey)) {
|
||||
if (exists(cdnskey, &cdnskeyrdata))
|
||||
RETERR(delete(&cdnskeyrdata, diff, origin,
|
||||
cdnskey->ttl, mctx));
|
||||
RETERR(delrdata(&cdnskeyrdata, diff, origin,
|
||||
cdnskey->ttl, mctx));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -222,22 +222,22 @@ dns_client_destroy(dns_client_t **clientp);
|
|||
|
||||
isc_result_t
|
||||
dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
|
||||
const dns_name_t *namespace, isc_sockaddrlist_t *addrs);
|
||||
const dns_name_t *name_space, isc_sockaddrlist_t *addrs);
|
||||
/*%<
|
||||
* Specify a list of addresses of recursive name servers that the client will
|
||||
* use for name resolution. A view for the 'rdclass' class must be created
|
||||
* beforehand. If 'namespace' is non NULL, the specified server will be used
|
||||
* if and only if the query name is a subdomain of 'namespace'. When servers
|
||||
* for multiple 'namespace's are provided, and a query name is covered by
|
||||
* more than one 'namespace', the servers for the best (longest) matching
|
||||
* namespace will be used. If 'namespace' is NULL, it works as if
|
||||
* beforehand. If 'name_space' is non NULL, the specified server will be used
|
||||
* if and only if the query name is a subdomain of 'name_space'. When servers
|
||||
* for multiple 'name_space's are provided, and a query name is covered by
|
||||
* more than one 'name_space', the servers for the best (longest) matching
|
||||
* name_space will be used. If 'name_space' is NULL, it works as if
|
||||
* dns_rootname (.) were specified.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'client' is a valid client.
|
||||
*
|
||||
*\li 'namespace' is NULL or a valid name.
|
||||
*\li 'name_space' is NULL or a valid name.
|
||||
*
|
||||
*\li 'addrs' != NULL.
|
||||
*
|
||||
|
|
@ -250,17 +250,17 @@ dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
|
|||
|
||||
isc_result_t
|
||||
dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
|
||||
const dns_name_t *namespace);
|
||||
const dns_name_t *name_space);
|
||||
/*%<
|
||||
* Remove configured recursive name servers for the 'rdclass' and 'namespace'
|
||||
* Remove configured recursive name servers for the 'rdclass' and 'name_space'
|
||||
* from the client. See the description of dns_client_setservers() for
|
||||
* the requirements about 'rdclass' and 'namespace'.
|
||||
* the requirements about 'rdclass' and 'name_space'.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'client' is a valid client.
|
||||
*
|
||||
*\li 'namespace' is NULL or a valid name.
|
||||
*\li 'name_space' is NULL or a valid name.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2089,8 +2089,8 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
|
|||
unsigned int i;
|
||||
journal_pos_t best_guess;
|
||||
journal_pos_t current_pos;
|
||||
dns_journal_t *j = NULL;
|
||||
dns_journal_t *new = NULL;
|
||||
dns_journal_t *j1 = NULL;
|
||||
dns_journal_t *j2 = NULL;
|
||||
journal_rawheader_t rawheader;
|
||||
unsigned int copy_length;
|
||||
size_t namelen;
|
||||
|
|
@ -2118,22 +2118,22 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
|
|||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
result = journal_open(mctx, filename, ISC_FALSE, ISC_FALSE, &j);
|
||||
result = journal_open(mctx, filename, ISC_FALSE, ISC_FALSE, &j1);
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
is_backup = ISC_TRUE;
|
||||
result = journal_open(mctx, backup, ISC_FALSE, ISC_FALSE, &j);
|
||||
result = journal_open(mctx, backup, ISC_FALSE, ISC_FALSE, &j1);
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
if (JOURNAL_EMPTY(&j->header)) {
|
||||
dns_journal_destroy(&j);
|
||||
if (JOURNAL_EMPTY(&j1->header)) {
|
||||
dns_journal_destroy(&j1);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
if (DNS_SERIAL_GT(j->header.begin.serial, serial) ||
|
||||
DNS_SERIAL_GT(serial, j->header.end.serial)) {
|
||||
dns_journal_destroy(&j);
|
||||
if (DNS_SERIAL_GT(j1->header.begin.serial, serial) ||
|
||||
DNS_SERIAL_GT(serial, j1->header.end.serial)) {
|
||||
dns_journal_destroy(&j1);
|
||||
return (ISC_R_RANGE);
|
||||
}
|
||||
|
||||
|
|
@ -2141,7 +2141,7 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
|
|||
* Cope with very small target sizes.
|
||||
*/
|
||||
indexend = sizeof(journal_rawheader_t) +
|
||||
j->header.index_size * sizeof(journal_rawpos_t);
|
||||
j1->header.index_size * sizeof(journal_rawpos_t);
|
||||
if (target_size < DNS_JOURNAL_SIZE_MIN)
|
||||
target_size = DNS_JOURNAL_SIZE_MIN;
|
||||
if (target_size < indexend * 2)
|
||||
|
|
@ -2150,12 +2150,12 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
|
|||
/*
|
||||
* See if there is any work to do.
|
||||
*/
|
||||
if ((isc_uint32_t) j->header.end.offset < target_size) {
|
||||
dns_journal_destroy(&j);
|
||||
if ((isc_uint32_t) j1->header.end.offset < target_size) {
|
||||
dns_journal_destroy(&j1);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
CHECK(journal_open(mctx, newname, ISC_TRUE, ISC_TRUE, &new));
|
||||
CHECK(journal_open(mctx, newname, ISC_TRUE, ISC_TRUE, &j2));
|
||||
|
||||
/*
|
||||
* Remove overhead so space test below can succeed.
|
||||
|
|
@ -2166,24 +2166,24 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
|
|||
/*
|
||||
* Find if we can create enough free space.
|
||||
*/
|
||||
best_guess = j->header.begin;
|
||||
for (i = 0; i < j->header.index_size; i++) {
|
||||
if (POS_VALID(j->index[i]) &&
|
||||
DNS_SERIAL_GE(serial, j->index[i].serial) &&
|
||||
((isc_uint32_t)(j->header.end.offset - j->index[i].offset)
|
||||
best_guess = j1->header.begin;
|
||||
for (i = 0; i < j1->header.index_size; i++) {
|
||||
if (POS_VALID(j1->index[i]) &&
|
||||
DNS_SERIAL_GE(serial, j1->index[i].serial) &&
|
||||
((isc_uint32_t)(j1->header.end.offset - j1->index[i].offset)
|
||||
>= target_size / 2) &&
|
||||
j->index[i].offset > best_guess.offset)
|
||||
best_guess = j->index[i];
|
||||
j1->index[i].offset > best_guess.offset)
|
||||
best_guess = j1->index[i];
|
||||
}
|
||||
|
||||
current_pos = best_guess;
|
||||
while (current_pos.serial != serial) {
|
||||
CHECK(journal_next(j, ¤t_pos));
|
||||
if (current_pos.serial == j->header.end.serial)
|
||||
CHECK(journal_next(j1, ¤t_pos));
|
||||
if (current_pos.serial == j1->header.end.serial)
|
||||
break;
|
||||
|
||||
if (DNS_SERIAL_GE(serial, current_pos.serial) &&
|
||||
((isc_uint32_t)(j->header.end.offset - current_pos.offset)
|
||||
((isc_uint32_t)(j1->header.end.offset - current_pos.offset)
|
||||
>= (target_size / 2)) &&
|
||||
current_pos.offset > best_guess.offset)
|
||||
best_guess = current_pos;
|
||||
|
|
@ -2191,16 +2191,16 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
|
|||
break;
|
||||
}
|
||||
|
||||
INSIST(best_guess.serial != j->header.end.serial);
|
||||
INSIST(best_guess.serial != j1->header.end.serial);
|
||||
if (best_guess.serial != serial)
|
||||
CHECK(journal_next(j, &best_guess));
|
||||
CHECK(journal_next(j1, &best_guess));
|
||||
|
||||
/*
|
||||
* We should now be roughly half target_size provided
|
||||
* we did not reach 'serial'. If not we will just copy
|
||||
* all uncommitted deltas regardless of the size.
|
||||
*/
|
||||
copy_length = j->header.end.offset - best_guess.offset;
|
||||
copy_length = j1->header.end.offset - best_guess.offset;
|
||||
|
||||
if (copy_length != 0) {
|
||||
/*
|
||||
|
|
@ -2215,51 +2215,51 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
|
|||
goto failure;
|
||||
}
|
||||
|
||||
CHECK(journal_seek(j, best_guess.offset));
|
||||
CHECK(journal_seek(new, indexend));
|
||||
CHECK(journal_seek(j1, best_guess.offset));
|
||||
CHECK(journal_seek(j2, indexend));
|
||||
for (i = 0; i < copy_length; i += size) {
|
||||
unsigned int len = (copy_length - i) > size ? size :
|
||||
(copy_length - i);
|
||||
CHECK(journal_read(j, buf, len));
|
||||
CHECK(journal_write(new, buf, len));
|
||||
CHECK(journal_read(j1, buf, len));
|
||||
CHECK(journal_write(j2, buf, len));
|
||||
}
|
||||
|
||||
CHECK(journal_fsync(new));
|
||||
CHECK(journal_fsync(j2));
|
||||
|
||||
/*
|
||||
* Compute new header.
|
||||
*/
|
||||
new->header.begin.serial = best_guess.serial;
|
||||
new->header.begin.offset = indexend;
|
||||
new->header.end.serial = j->header.end.serial;
|
||||
new->header.end.offset = indexend + copy_length;
|
||||
new->header.sourceserial = j->header.sourceserial;
|
||||
new->header.serialset = j->header.serialset;
|
||||
j2->header.begin.serial = best_guess.serial;
|
||||
j2->header.begin.offset = indexend;
|
||||
j2->header.end.serial = j1->header.end.serial;
|
||||
j2->header.end.offset = indexend + copy_length;
|
||||
j2->header.sourceserial = j1->header.sourceserial;
|
||||
j2->header.serialset = j1->header.serialset;
|
||||
|
||||
/*
|
||||
* Update the journal header.
|
||||
*/
|
||||
journal_header_encode(&new->header, &rawheader);
|
||||
CHECK(journal_seek(new, 0));
|
||||
CHECK(journal_write(new, &rawheader, sizeof(rawheader)));
|
||||
CHECK(journal_fsync(new));
|
||||
journal_header_encode(&j2->header, &rawheader);
|
||||
CHECK(journal_seek(j2, 0));
|
||||
CHECK(journal_write(j2, &rawheader, sizeof(rawheader)));
|
||||
CHECK(journal_fsync(j2));
|
||||
|
||||
/*
|
||||
* Build new index.
|
||||
*/
|
||||
current_pos = new->header.begin;
|
||||
while (current_pos.serial != new->header.end.serial) {
|
||||
index_add(new, ¤t_pos);
|
||||
CHECK(journal_next(new, ¤t_pos));
|
||||
current_pos = j2->header.begin;
|
||||
while (current_pos.serial != j2->header.end.serial) {
|
||||
index_add(j2, ¤t_pos);
|
||||
CHECK(journal_next(j2, ¤t_pos));
|
||||
}
|
||||
|
||||
/*
|
||||
* Write index.
|
||||
*/
|
||||
CHECK(index_to_disk(new));
|
||||
CHECK(journal_fsync(new));
|
||||
CHECK(index_to_disk(j2));
|
||||
CHECK(journal_fsync(j2));
|
||||
|
||||
indexend = new->header.end.offset;
|
||||
indexend = j2->header.end.offset;
|
||||
POST(indexend);
|
||||
}
|
||||
|
||||
|
|
@ -2267,8 +2267,8 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
|
|||
* Close both journals before trying to rename files (this is
|
||||
* necessary on WIN32).
|
||||
*/
|
||||
dns_journal_destroy(&j);
|
||||
dns_journal_destroy(&new);
|
||||
dns_journal_destroy(&j1);
|
||||
dns_journal_destroy(&j2);
|
||||
|
||||
/*
|
||||
* With a UFS file system this should just succeed and be atomic.
|
||||
|
|
@ -2305,10 +2305,10 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,
|
|||
(void)isc_file_remove(newname);
|
||||
if (buf != NULL)
|
||||
isc_mem_put(mctx, buf, size);
|
||||
if (j != NULL)
|
||||
dns_journal_destroy(&j);
|
||||
if (new != NULL)
|
||||
dns_journal_destroy(&new);
|
||||
if (j1 != NULL)
|
||||
dns_journal_destroy(&j1);
|
||||
if (j2 != NULL)
|
||||
dns_journal_destroy(&j2);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2053,7 +2053,7 @@ static isc_result_t
|
|||
pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t *lctx) {
|
||||
isc_result_t result;
|
||||
dns_incctx_t *ictx;
|
||||
dns_incctx_t *new = NULL;
|
||||
dns_incctx_t *newctx = NULL;
|
||||
isc_region_t r;
|
||||
int new_in_use;
|
||||
|
||||
|
|
@ -2063,43 +2063,43 @@ pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t *lctx) {
|
|||
ictx = lctx->inc;
|
||||
lctx->seen_include = ISC_TRUE;
|
||||
|
||||
result = incctx_create(lctx->mctx, origin, &new);
|
||||
result = incctx_create(lctx->mctx, origin, &newctx);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
/*
|
||||
* Push origin_changed.
|
||||
*/
|
||||
new->origin_changed = ictx->origin_changed;
|
||||
newctx->origin_changed = ictx->origin_changed;
|
||||
|
||||
/* Set current domain. */
|
||||
if (ictx->glue != NULL || ictx->current != NULL) {
|
||||
for (new_in_use = 0; new_in_use < NBUFS; new_in_use++)
|
||||
if (!new->in_use[new_in_use])
|
||||
if (!newctx->in_use[new_in_use])
|
||||
break;
|
||||
INSIST(new_in_use < NBUFS);
|
||||
new->current_in_use = new_in_use;
|
||||
new->current =
|
||||
dns_fixedname_name(&new->fixed[new->current_in_use]);
|
||||
new->in_use[new->current_in_use] = ISC_TRUE;
|
||||
newctx->current_in_use = new_in_use;
|
||||
newctx->current =
|
||||
dns_fixedname_name(&newctx->fixed[newctx->current_in_use]);
|
||||
newctx->in_use[newctx->current_in_use] = ISC_TRUE;
|
||||
dns_name_toregion((ictx->glue != NULL) ?
|
||||
ictx->glue : ictx->current, &r);
|
||||
dns_name_fromregion(new->current, &r);
|
||||
new->drop = ictx->drop;
|
||||
dns_name_fromregion(newctx->current, &r);
|
||||
newctx->drop = ictx->drop;
|
||||
}
|
||||
|
||||
result = (lctx->openfile)(lctx, master_file);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
new->parent = ictx;
|
||||
lctx->inc = new;
|
||||
newctx->parent = ictx;
|
||||
lctx->inc = newctx;
|
||||
|
||||
if (lctx->include_cb != NULL)
|
||||
lctx->include_cb(master_file, lctx->include_arg);
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
incctx_destroy(lctx->mctx, new);
|
||||
incctx_destroy(lctx->mctx, newctx);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
|
@ -2928,17 +2928,17 @@ dns_master_loadlexerinc(isc_lex_t *lex, dns_name_t *top,
|
|||
* Re-link glue and current list.
|
||||
*/
|
||||
static dns_rdatalist_t *
|
||||
grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,
|
||||
grow_rdatalist(int new_len, dns_rdatalist_t *oldlist, int old_len,
|
||||
rdatalist_head_t *current, rdatalist_head_t *glue,
|
||||
isc_mem_t *mctx)
|
||||
{
|
||||
dns_rdatalist_t *new;
|
||||
dns_rdatalist_t *newlist;
|
||||
int rdlcount = 0;
|
||||
ISC_LIST(dns_rdatalist_t) save;
|
||||
dns_rdatalist_t *this;
|
||||
|
||||
new = isc_mem_get(mctx, new_len * sizeof(*new));
|
||||
if (new == NULL)
|
||||
newlist = isc_mem_get(mctx, new_len * sizeof(*newlist));
|
||||
if (newlist == NULL)
|
||||
return (NULL);
|
||||
|
||||
ISC_LIST_INIT(save);
|
||||
|
|
@ -2949,8 +2949,8 @@ grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,
|
|||
while ((this = ISC_LIST_HEAD(save)) != NULL) {
|
||||
ISC_LIST_UNLINK(save, this, link);
|
||||
INSIST(rdlcount < new_len);
|
||||
new[rdlcount] = *this;
|
||||
ISC_LIST_APPEND(*current, &new[rdlcount], link);
|
||||
newlist[rdlcount] = *this;
|
||||
ISC_LIST_APPEND(*current, &newlist[rdlcount], link);
|
||||
rdlcount++;
|
||||
}
|
||||
|
||||
|
|
@ -2962,15 +2962,15 @@ grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,
|
|||
while ((this = ISC_LIST_HEAD(save)) != NULL) {
|
||||
ISC_LIST_UNLINK(save, this, link);
|
||||
INSIST(rdlcount < new_len);
|
||||
new[rdlcount] = *this;
|
||||
ISC_LIST_APPEND(*glue, &new[rdlcount], link);
|
||||
newlist[rdlcount] = *this;
|
||||
ISC_LIST_APPEND(*glue, &newlist[rdlcount], link);
|
||||
rdlcount++;
|
||||
}
|
||||
|
||||
INSIST(rdlcount == old_len);
|
||||
if (old != NULL)
|
||||
isc_mem_put(mctx, old, old_len * sizeof(*old));
|
||||
return (new);
|
||||
if (oldlist != NULL)
|
||||
isc_mem_put(mctx, oldlist, old_len * sizeof(*oldlist));
|
||||
return (newlist);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -2978,20 +2978,20 @@ grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,
|
|||
* Re-link the current and glue chains.
|
||||
*/
|
||||
static dns_rdata_t *
|
||||
grow_rdata(int new_len, dns_rdata_t *old, int old_len,
|
||||
grow_rdata(int new_len, dns_rdata_t *oldlist, int old_len,
|
||||
rdatalist_head_t *current, rdatalist_head_t *glue,
|
||||
isc_mem_t *mctx)
|
||||
{
|
||||
dns_rdata_t *new;
|
||||
dns_rdata_t *newlist;
|
||||
int rdcount = 0;
|
||||
ISC_LIST(dns_rdata_t) save;
|
||||
dns_rdatalist_t *this;
|
||||
dns_rdata_t *rdata;
|
||||
|
||||
new = isc_mem_get(mctx, new_len * sizeof(*new));
|
||||
if (new == NULL)
|
||||
newlist = isc_mem_get(mctx, new_len * sizeof(*newlist));
|
||||
if (newlist == NULL)
|
||||
return (NULL);
|
||||
memset(new, 0, new_len * sizeof(*new));
|
||||
memset(newlist, 0, new_len * sizeof(*newlist));
|
||||
|
||||
/*
|
||||
* Copy current relinking.
|
||||
|
|
@ -3006,8 +3006,8 @@ grow_rdata(int new_len, dns_rdata_t *old, int old_len,
|
|||
while ((rdata = ISC_LIST_HEAD(save)) != NULL) {
|
||||
ISC_LIST_UNLINK(save, rdata, link);
|
||||
INSIST(rdcount < new_len);
|
||||
new[rdcount] = *rdata;
|
||||
ISC_LIST_APPEND(this->rdata, &new[rdcount], link);
|
||||
newlist[rdcount] = *rdata;
|
||||
ISC_LIST_APPEND(this->rdata, &newlist[rdcount], link);
|
||||
rdcount++;
|
||||
}
|
||||
this = ISC_LIST_NEXT(this, link);
|
||||
|
|
@ -3026,16 +3026,16 @@ grow_rdata(int new_len, dns_rdata_t *old, int old_len,
|
|||
while ((rdata = ISC_LIST_HEAD(save)) != NULL) {
|
||||
ISC_LIST_UNLINK(save, rdata, link);
|
||||
INSIST(rdcount < new_len);
|
||||
new[rdcount] = *rdata;
|
||||
ISC_LIST_APPEND(this->rdata, &new[rdcount], link);
|
||||
newlist[rdcount] = *rdata;
|
||||
ISC_LIST_APPEND(this->rdata, &newlist[rdcount], link);
|
||||
rdcount++;
|
||||
}
|
||||
this = ISC_LIST_NEXT(this, link);
|
||||
}
|
||||
INSIST(rdcount == old_len || rdcount == 0);
|
||||
if (old != NULL)
|
||||
isc_mem_put(mctx, old, old_len * sizeof(*old));
|
||||
return (new);
|
||||
if (oldlist != NULL)
|
||||
isc_mem_put(mctx, oldlist, old_len * sizeof(*oldlist));
|
||||
return (newlist);
|
||||
}
|
||||
|
||||
static isc_uint32_t
|
||||
|
|
|
|||
|
|
@ -376,8 +376,8 @@ match_nsec3param(const dns_rdata_nsec3_t *nsec3,
|
|||
* change in "diff".
|
||||
*/
|
||||
static isc_result_t
|
||||
delete(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name,
|
||||
const dns_rdata_nsec3param_t *nsec3param, dns_diff_t *diff)
|
||||
delnsec3(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name,
|
||||
const dns_rdata_nsec3param_t *nsec3param, dns_diff_t *diff)
|
||||
{
|
||||
dns_dbnode_t *node = NULL ;
|
||||
dns_difftuple_t *tuple = NULL;
|
||||
|
|
@ -671,7 +671,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version,
|
|||
/*
|
||||
* Delete the old previous NSEC3.
|
||||
*/
|
||||
CHECK(delete(db, version, prev, nsec3param, diff));
|
||||
CHECK(delnsec3(db, version, prev, nsec3param, diff));
|
||||
|
||||
/*
|
||||
* Fixup the previous NSEC3.
|
||||
|
|
@ -707,7 +707,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version,
|
|||
/*
|
||||
* Delete the old NSEC3 and record the change.
|
||||
*/
|
||||
CHECK(delete(db, version, hashname, nsec3param, diff));
|
||||
CHECK(delnsec3(db, version, hashname, nsec3param, diff));
|
||||
/*
|
||||
* Add the new NSEC3 and record the change.
|
||||
*/
|
||||
|
|
@ -790,7 +790,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version,
|
|||
/*
|
||||
* Delete the old previous NSEC3.
|
||||
*/
|
||||
CHECK(delete(db, version, prev, nsec3param, diff));
|
||||
CHECK(delnsec3(db, version, prev, nsec3param, diff));
|
||||
|
||||
/*
|
||||
* Fixup the previous NSEC3.
|
||||
|
|
@ -827,7 +827,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version,
|
|||
/*
|
||||
* Delete the old NSEC3 and record the change.
|
||||
*/
|
||||
CHECK(delete(db, version, hashname, nsec3param, diff));
|
||||
CHECK(delnsec3(db, version, hashname, nsec3param, diff));
|
||||
|
||||
/*
|
||||
* Add the new NSEC3 and record the change.
|
||||
|
|
@ -1394,7 +1394,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version,
|
|||
/*
|
||||
* Delete the old previous NSEC3.
|
||||
*/
|
||||
CHECK(delete(db, version, prev, nsec3param, diff));
|
||||
CHECK(delnsec3(db, version, prev, nsec3param, diff));
|
||||
|
||||
/*
|
||||
* Fixup the previous NSEC3.
|
||||
|
|
@ -1418,7 +1418,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version,
|
|||
/*
|
||||
* Delete the old NSEC3 and record the change.
|
||||
*/
|
||||
CHECK(delete(db, version, hashname, nsec3param, diff));
|
||||
CHECK(delnsec3(db, version, hashname, nsec3param, diff));
|
||||
|
||||
/*
|
||||
* Delete NSEC3 records for now non active nodes.
|
||||
|
|
@ -1494,7 +1494,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version,
|
|||
/*
|
||||
* Delete the old previous NSEC3.
|
||||
*/
|
||||
CHECK(delete(db, version, prev, nsec3param, diff));
|
||||
CHECK(delnsec3(db, version, prev, nsec3param, diff));
|
||||
|
||||
/*
|
||||
* Fixup the previous NSEC3.
|
||||
|
|
@ -1520,7 +1520,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version,
|
|||
/*
|
||||
* Delete the old NSEC3 and record the change.
|
||||
*/
|
||||
CHECK(delete(db, version, hashname, nsec3param, diff));
|
||||
CHECK(delnsec3(db, version, hashname, nsec3param, diff));
|
||||
} while (1);
|
||||
|
||||
success:
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ dns_ntatable_add(dns_ntatable_t *ntatable, const dns_name_t *name,
|
|||
* Caller must hold a write lock on rwlock.
|
||||
*/
|
||||
static isc_result_t
|
||||
delete(dns_ntatable_t *ntatable, const dns_name_t *name) {
|
||||
deletenode(dns_ntatable_t *ntatable, const dns_name_t *name) {
|
||||
isc_result_t result;
|
||||
dns_rbtnode_t *node = NULL;
|
||||
|
||||
|
|
@ -419,7 +419,7 @@ dns_ntatable_delete(dns_ntatable_t *ntatable, const dns_name_t *name) {
|
|||
isc_result_t result;
|
||||
|
||||
RWLOCK(&ntatable->rwlock, isc_rwlocktype_write);
|
||||
result = delete(ntatable, name);
|
||||
result = deletenode(ntatable, name);
|
||||
RWUNLOCK(&ntatable->rwlock, isc_rwlocktype_write);
|
||||
|
||||
return (result);
|
||||
|
|
@ -483,7 +483,7 @@ dns_ntatable_covered(dns_ntatable_t *ntatable, isc_stdtime_t now,
|
|||
isc_timer_detach(&nta->timer);
|
||||
}
|
||||
|
||||
result = delete(ntatable, foundname);
|
||||
result = deletenode(ntatable, foundname);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DNSSEC,
|
||||
DNS_LOGMODULE_NTA, ISC_LOG_INFO,
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ dns_private_totext(dns_rdata_t *private, isc_buffer_t *buf) {
|
|||
unsigned char newbuf[DNS_NSEC3PARAM_BUFFERSIZE];
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
dns_rdata_nsec3param_t nsec3param;
|
||||
isc_boolean_t delete, init, nonsec;
|
||||
isc_boolean_t del, init, nonsec;
|
||||
isc_buffer_t b;
|
||||
|
||||
if (!dns_nsec3param_fromprivate(private, &rdata, nsec3buf,
|
||||
|
|
@ -308,7 +308,7 @@ dns_private_totext(dns_rdata_t *private, isc_buffer_t *buf) {
|
|||
|
||||
CHECK(dns_rdata_tostruct(&rdata, &nsec3param, NULL));
|
||||
|
||||
delete = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_REMOVE) != 0);
|
||||
del = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_REMOVE) != 0);
|
||||
init = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_INITIAL) != 0);
|
||||
nonsec = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_NONSEC) != 0);
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ dns_private_totext(dns_rdata_t *private, isc_buffer_t *buf) {
|
|||
|
||||
if (init)
|
||||
isc_buffer_putstr(buf, "Pending NSEC3 chain ");
|
||||
else if (delete)
|
||||
else if (del)
|
||||
isc_buffer_putstr(buf, "Removing NSEC3 chain ");
|
||||
else
|
||||
isc_buffer_putstr(buf, "Creating NSEC3 chain ");
|
||||
|
|
@ -332,18 +332,18 @@ dns_private_totext(dns_rdata_t *private, isc_buffer_t *buf) {
|
|||
|
||||
CHECK(dns_rdata_totext(&rdata, NULL, buf));
|
||||
|
||||
if (delete && !nonsec)
|
||||
if (del && !nonsec)
|
||||
isc_buffer_putstr(buf, " / creating NSEC chain");
|
||||
} else if (private->length == 5) {
|
||||
unsigned char alg = private->data[0];
|
||||
dns_keytag_t keyid = (private->data[2] | private->data[1] << 8);
|
||||
char keybuf[BUFSIZ], algbuf[DNS_SECALG_FORMATSIZE];
|
||||
isc_boolean_t delete = ISC_TF(private->data[3] != 0);
|
||||
isc_boolean_t del = ISC_TF(private->data[3] != 0);
|
||||
isc_boolean_t complete = ISC_TF(private->data[4] != 0);
|
||||
|
||||
if (delete && complete)
|
||||
if (del && complete)
|
||||
isc_buffer_putstr(buf, "Done removing signatures for ");
|
||||
else if (delete)
|
||||
else if (del)
|
||||
isc_buffer_putstr(buf, "Removing signatures for ");
|
||||
else if (complete)
|
||||
isc_buffer_putstr(buf, "Done signing with ");
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ addonlevel(dns_rbtnode_t *node, dns_rbtnode_t *current, int order,
|
|||
dns_rbtnode_t **rootp);
|
||||
|
||||
static void
|
||||
deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp);
|
||||
deletefromlevel(dns_rbtnode_t *item, dns_rbtnode_t **rootp);
|
||||
|
||||
static isc_result_t
|
||||
treefix(dns_rbt_t *rbt, void *base, size_t size,
|
||||
|
|
@ -2554,25 +2554,25 @@ addonlevel(dns_rbtnode_t *node, dns_rbtnode_t *current, int order,
|
|||
* true red/black tree on a single level.
|
||||
*/
|
||||
static void
|
||||
deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
|
||||
deletefromlevel(dns_rbtnode_t *item, dns_rbtnode_t **rootp) {
|
||||
dns_rbtnode_t *child, *sibling, *parent;
|
||||
dns_rbtnode_t *successor;
|
||||
|
||||
REQUIRE(delete != NULL);
|
||||
REQUIRE(item != NULL);
|
||||
|
||||
/*
|
||||
* Verify that the parent history is (apparently) correct.
|
||||
*/
|
||||
INSIST((IS_ROOT(delete) && *rootp == delete) ||
|
||||
(! IS_ROOT(delete) &&
|
||||
(LEFT(PARENT(delete)) == delete ||
|
||||
RIGHT(PARENT(delete)) == delete)));
|
||||
INSIST((IS_ROOT(item) && *rootp == item) ||
|
||||
(! IS_ROOT(item) &&
|
||||
(LEFT(PARENT(item)) == item ||
|
||||
RIGHT(PARENT(item)) == item)));
|
||||
|
||||
child = NULL;
|
||||
|
||||
if (LEFT(delete) == NULL) {
|
||||
if (RIGHT(delete) == NULL) {
|
||||
if (IS_ROOT(delete)) {
|
||||
if (LEFT(item) == NULL) {
|
||||
if (RIGHT(item) == NULL) {
|
||||
if (IS_ROOT(item)) {
|
||||
/*
|
||||
* This is the only item in the tree.
|
||||
*/
|
||||
|
|
@ -2583,13 +2583,13 @@ deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
|
|||
/*
|
||||
* This node has one child, on the right.
|
||||
*/
|
||||
child = RIGHT(delete);
|
||||
child = RIGHT(item);
|
||||
|
||||
} else if (RIGHT(delete) == NULL)
|
||||
} else if (RIGHT(item) == NULL)
|
||||
/*
|
||||
* This node has one child, on the left.
|
||||
*/
|
||||
child = LEFT(delete);
|
||||
child = LEFT(item);
|
||||
else {
|
||||
dns_rbtnode_t holder, *tmp = &holder;
|
||||
|
||||
|
|
@ -2599,7 +2599,7 @@ deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
|
|||
* move it to this location, then do the deletion at the
|
||||
* old site of the successor.
|
||||
*/
|
||||
successor = RIGHT(delete);
|
||||
successor = RIGHT(item);
|
||||
while (LEFT(successor) != NULL)
|
||||
successor = LEFT(successor);
|
||||
|
||||
|
|
@ -2627,21 +2627,21 @@ deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
|
|||
*/
|
||||
memmove(tmp, successor, sizeof(dns_rbtnode_t));
|
||||
|
||||
if (IS_ROOT(delete)) {
|
||||
if (IS_ROOT(item)) {
|
||||
*rootp = successor;
|
||||
successor->is_root = ISC_TRUE;
|
||||
delete->is_root = ISC_FALSE;
|
||||
item->is_root = ISC_FALSE;
|
||||
|
||||
} else
|
||||
if (LEFT(PARENT(delete)) == delete)
|
||||
LEFT(PARENT(delete)) = successor;
|
||||
if (LEFT(PARENT(item)) == item)
|
||||
LEFT(PARENT(item)) = successor;
|
||||
else
|
||||
RIGHT(PARENT(delete)) = successor;
|
||||
RIGHT(PARENT(item)) = successor;
|
||||
|
||||
PARENT(successor) = PARENT(delete);
|
||||
LEFT(successor) = LEFT(delete);
|
||||
RIGHT(successor) = RIGHT(delete);
|
||||
COLOR(successor) = COLOR(delete);
|
||||
PARENT(successor) = PARENT(item);
|
||||
LEFT(successor) = LEFT(item);
|
||||
RIGHT(successor) = RIGHT(item);
|
||||
COLOR(successor) = COLOR(item);
|
||||
|
||||
if (LEFT(successor) != NULL)
|
||||
PARENT(LEFT(successor)) = successor;
|
||||
|
|
@ -2653,39 +2653,39 @@ deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
|
|||
* successor's previous tree location. PARENT(tmp)
|
||||
* is the successor's original parent.
|
||||
*/
|
||||
INSIST(! IS_ROOT(delete));
|
||||
INSIST(! IS_ROOT(item));
|
||||
|
||||
if (PARENT(tmp) == delete) {
|
||||
if (PARENT(tmp) == item) {
|
||||
/*
|
||||
* Node being deleted was successor's parent.
|
||||
*/
|
||||
RIGHT(successor) = delete;
|
||||
PARENT(delete) = successor;
|
||||
RIGHT(successor) = item;
|
||||
PARENT(item) = successor;
|
||||
|
||||
} else {
|
||||
LEFT(PARENT(tmp)) = delete;
|
||||
PARENT(delete) = PARENT(tmp);
|
||||
LEFT(PARENT(tmp)) = item;
|
||||
PARENT(item) = PARENT(tmp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Original location of successor node has no left.
|
||||
*/
|
||||
LEFT(delete) = NULL;
|
||||
RIGHT(delete) = RIGHT(tmp);
|
||||
COLOR(delete) = COLOR(tmp);
|
||||
LEFT(item) = NULL;
|
||||
RIGHT(item) = RIGHT(tmp);
|
||||
COLOR(item) = COLOR(tmp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the node by removing the links from its parent.
|
||||
*/
|
||||
if (! IS_ROOT(delete)) {
|
||||
if (LEFT(PARENT(delete)) == delete)
|
||||
LEFT(PARENT(delete)) = child;
|
||||
if (! IS_ROOT(item)) {
|
||||
if (LEFT(PARENT(item)) == item)
|
||||
LEFT(PARENT(item)) = child;
|
||||
else
|
||||
RIGHT(PARENT(delete)) = child;
|
||||
RIGHT(PARENT(item)) = child;
|
||||
|
||||
if (child != NULL)
|
||||
PARENT(child) = PARENT(delete);
|
||||
PARENT(child) = PARENT(item);
|
||||
|
||||
} else {
|
||||
/*
|
||||
|
|
@ -2694,14 +2694,14 @@ deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) {
|
|||
*/
|
||||
*rootp = child;
|
||||
child->is_root = 1;
|
||||
PARENT(child) = PARENT(delete);
|
||||
PARENT(child) = PARENT(item);
|
||||
}
|
||||
|
||||
/*
|
||||
* Fix color violations.
|
||||
*/
|
||||
if (IS_BLACK(delete)) {
|
||||
parent = PARENT(delete);
|
||||
if (IS_BLACK(item)) {
|
||||
parent = PARENT(item);
|
||||
|
||||
while (child != *rootp && IS_BLACK(child)) {
|
||||
INSIST(child == NULL || ! IS_ROOT(child));
|
||||
|
|
|
|||
|
|
@ -851,7 +851,7 @@ typedef struct rbtdb_dbiterator {
|
|||
dns_rbtnodechain_t *current;
|
||||
dns_rbtnode_t *node;
|
||||
dns_rbtnode_t *deletions[DELETION_BATCH_MAX];
|
||||
int delete;
|
||||
int delcnt;
|
||||
isc_boolean_t nsec3only;
|
||||
isc_boolean_t nonsec3;
|
||||
} rbtdb_dbiterator_t;
|
||||
|
|
@ -1088,7 +1088,7 @@ adjust_quantum(unsigned int old, isc_time_t *start) {
|
|||
unsigned int interval;
|
||||
isc_uint64_t usecs;
|
||||
isc_time_t end;
|
||||
unsigned int new;
|
||||
unsigned int nodes;
|
||||
|
||||
if (pps < 100)
|
||||
pps = 100;
|
||||
|
|
@ -1108,22 +1108,22 @@ adjust_quantum(unsigned int old, isc_time_t *start) {
|
|||
old = 1000;
|
||||
return (old);
|
||||
}
|
||||
new = old * interval;
|
||||
new /= (unsigned int)usecs;
|
||||
if (new == 0)
|
||||
new = 1;
|
||||
else if (new > 1000)
|
||||
new = 1000;
|
||||
nodes = old * interval;
|
||||
nodes /= (unsigned int)usecs;
|
||||
if (nodes == 0)
|
||||
nodes = 1;
|
||||
else if (nodes > 1000)
|
||||
nodes = 1000;
|
||||
|
||||
/* Smooth */
|
||||
new = (new + old * 3) / 4;
|
||||
nodes = (nodes + old * 3) / 4;
|
||||
|
||||
if (new != old)
|
||||
if (nodes != old)
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||
DNS_LOGMODULE_CACHE, ISC_LOG_DEBUG(1),
|
||||
"adjust_quantum: old=%d, new=%d", old, new);
|
||||
"adjust_quantum: old=%d, new=%d", old, nodes);
|
||||
|
||||
return (new);
|
||||
return (nodes);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1583,26 +1583,26 @@ init_rdataset(dns_rbtdb_t *rbtdb, rdatasetheader_t *h) {
|
|||
* Update the copied values of 'next' and 'node' if they are relative.
|
||||
*/
|
||||
static void
|
||||
update_newheader(rdatasetheader_t *new, rdatasetheader_t *old) {
|
||||
update_newheader(rdatasetheader_t *newh, rdatasetheader_t *old) {
|
||||
char *p;
|
||||
|
||||
if (old->next_is_relative) {
|
||||
p = (char *) old;
|
||||
p += (uintptr_t)old->next;
|
||||
new->next = (rdatasetheader_t *)p;
|
||||
newh->next = (rdatasetheader_t *)p;
|
||||
}
|
||||
if (old->node_is_relative) {
|
||||
p = (char *) old;
|
||||
p += (uintptr_t)old->node;
|
||||
new->node = (dns_rbtnode_t *)p;
|
||||
newh->node = (dns_rbtnode_t *)p;
|
||||
}
|
||||
if (CASESET(old)) {
|
||||
isc_uint16_t attr;
|
||||
|
||||
memmove(new->upper, old->upper, sizeof(old->upper));
|
||||
memmove(newh->upper, old->upper, sizeof(old->upper));
|
||||
attr = old->attributes & (RDATASET_ATTR_CASESET |
|
||||
RDATASET_ATTR_CASEFULLYLOWER);
|
||||
new->attributes |= attr;
|
||||
newh->attributes |= attr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5566,7 +5566,7 @@ createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp)
|
|||
dns_fixedname_init(&rbtdbiter->name);
|
||||
dns_fixedname_init(&rbtdbiter->origin);
|
||||
rbtdbiter->node = NULL;
|
||||
rbtdbiter->delete = 0;
|
||||
rbtdbiter->delcnt = 0;
|
||||
rbtdbiter->nsec3only = ISC_TF((options & DNS_DB_NSEC3ONLY) != 0);
|
||||
rbtdbiter->nonsec3 = ISC_TF((options & DNS_DB_NONSEC3) != 0);
|
||||
memset(rbtdbiter->deletions, 0, sizeof(rbtdbiter->deletions));
|
||||
|
|
@ -8968,7 +8968,7 @@ flush_deletions(rbtdb_dbiterator_t *rbtdbiter) {
|
|||
nodelock_t *lock;
|
||||
int i;
|
||||
|
||||
if (rbtdbiter->delete != 0) {
|
||||
if (rbtdbiter->delcnt != 0) {
|
||||
/*
|
||||
* Note that "%d node of %d in tree" can report things like
|
||||
* "flush_deletions: 59 nodes of 41 in tree". This means
|
||||
|
|
@ -8978,7 +8978,7 @@ flush_deletions(rbtdb_dbiterator_t *rbtdbiter) {
|
|||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||
DNS_LOGMODULE_CACHE, ISC_LOG_DEBUG(1),
|
||||
"flush_deletions: %d nodes of %d in tree",
|
||||
rbtdbiter->delete,
|
||||
rbtdbiter->delcnt,
|
||||
dns_rbt_nodecount(rbtdb->tree));
|
||||
|
||||
if (rbtdbiter->tree_locked == isc_rwlocktype_read) {
|
||||
|
|
@ -8988,7 +8988,7 @@ flush_deletions(rbtdb_dbiterator_t *rbtdbiter) {
|
|||
RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
|
||||
rbtdbiter->tree_locked = isc_rwlocktype_write;
|
||||
|
||||
for (i = 0; i < rbtdbiter->delete; i++) {
|
||||
for (i = 0; i < rbtdbiter->delcnt; i++) {
|
||||
node = rbtdbiter->deletions[i];
|
||||
lock = &rbtdb->node_locks[node->locknum].lock;
|
||||
|
||||
|
|
@ -8999,7 +8999,7 @@ flush_deletions(rbtdb_dbiterator_t *rbtdbiter) {
|
|||
NODE_UNLOCK(lock, isc_rwlocktype_read);
|
||||
}
|
||||
|
||||
rbtdbiter->delete = 0;
|
||||
rbtdbiter->delcnt = 0;
|
||||
|
||||
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
|
||||
if (was_read_locked) {
|
||||
|
|
@ -9368,7 +9368,7 @@ dbiterator_current(dns_dbiterator_t *iterator, dns_dbnode_t **nodep,
|
|||
* to expire the current node. The current node can't
|
||||
* fully deleted while the iteration cursor is still on it.
|
||||
*/
|
||||
if (rbtdbiter->delete == DELETION_BATCH_MAX)
|
||||
if (rbtdbiter->delcnt == DELETION_BATCH_MAX)
|
||||
flush_deletions(rbtdbiter);
|
||||
|
||||
expire_result = expirenode(iterator->db, *nodep, 0);
|
||||
|
|
@ -9379,7 +9379,7 @@ dbiterator_current(dns_dbiterator_t *iterator, dns_dbnode_t **nodep,
|
|||
if (expire_result == ISC_R_SUCCESS && node->down == NULL) {
|
||||
unsigned int refs;
|
||||
|
||||
rbtdbiter->deletions[rbtdbiter->delete++] = node;
|
||||
rbtdbiter->deletions[rbtdbiter->delcnt++] = node;
|
||||
NODE_STRONGLOCK(&rbtdb->node_locks[node->locknum].lock);
|
||||
dns_rbtnode_refincrement(node, &refs);
|
||||
INSIST(refs != 0);
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ totext_keydata(ARGS_TOTEXT) {
|
|||
char buf[sizeof("64000")];
|
||||
unsigned int flags;
|
||||
unsigned char algorithm;
|
||||
unsigned long refresh, add, delete;
|
||||
unsigned long refresh, add, deltime;
|
||||
char algbuf[DNS_NAME_FORMATSIZE];
|
||||
const char *keyinfo;
|
||||
|
||||
|
|
@ -114,9 +114,9 @@ totext_keydata(ARGS_TOTEXT) {
|
|||
RETERR(str_totext(" ", target));
|
||||
|
||||
/* remove hold-down */
|
||||
delete = uint32_fromregion(&sr);
|
||||
deltime = uint32_fromregion(&sr);
|
||||
isc_region_consume(&sr, 4);
|
||||
RETERR(dns_time32_totext(delete, target));
|
||||
RETERR(dns_time32_totext(deltime, target));
|
||||
RETERR(str_totext(" ", target));
|
||||
|
||||
/* flags */
|
||||
|
|
@ -216,11 +216,11 @@ totext_keydata(ARGS_TOTEXT) {
|
|||
RETERR(str_totext(abuf, target));
|
||||
}
|
||||
|
||||
if (delete != 0U) {
|
||||
if (deltime != 0U) {
|
||||
RETERR(str_totext(tctx->linebreak, target));
|
||||
RETERR(str_totext("; removal pending: ",
|
||||
target));
|
||||
isc_time_set(&t, delete, 0);
|
||||
isc_time_set(&t, deltime, 0);
|
||||
isc_time_formathttptimestamp(&t, dbuf,
|
||||
sizeof(dbuf));
|
||||
RETERR(str_totext(dbuf, target));
|
||||
|
|
|
|||
|
|
@ -318,10 +318,10 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
|
|||
unsigned int headlen;
|
||||
isc_boolean_t question = ISC_FALSE;
|
||||
isc_boolean_t shuffle = ISC_FALSE, sort = ISC_FALSE;
|
||||
dns_rdata_t orig_fixed[MAX_SHUFFLE];
|
||||
dns_rdata_t *orig = orig_fixed;
|
||||
struct towire_sort new_fixed[MAX_SHUFFLE];
|
||||
struct towire_sort *new = new_fixed;
|
||||
dns_rdata_t in_fixed[MAX_SHUFFLE];
|
||||
dns_rdata_t *in = in_fixed;
|
||||
struct towire_sort out_fixed[MAX_SHUFFLE];
|
||||
struct towire_sort *out = out_fixed;
|
||||
dns_fixedname_t fixed;
|
||||
dns_name_t *name;
|
||||
|
||||
|
|
@ -374,9 +374,9 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
|
|||
}
|
||||
|
||||
if ((shuffle || sort) && count > MAX_SHUFFLE) {
|
||||
orig = isc_mem_get(cctx->mctx, count * sizeof(*orig));
|
||||
new = isc_mem_get(cctx->mctx, count * sizeof(*new));
|
||||
if (orig == NULL || new == NULL)
|
||||
in = isc_mem_get(cctx->mctx, count * sizeof(*in));
|
||||
out = isc_mem_get(cctx->mctx, count * sizeof(*out));
|
||||
if (in == NULL || out == NULL)
|
||||
shuffle = sort = ISC_FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -387,8 +387,8 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
|
|||
i = 0;
|
||||
do {
|
||||
INSIST(i < count);
|
||||
dns_rdata_init(&orig[i]);
|
||||
dns_rdataset_current(rdataset, &orig[i]);
|
||||
dns_rdata_init(&in[i]);
|
||||
dns_rdataset_current(rdataset, &in[i]);
|
||||
i++;
|
||||
result = dns_rdataset_next(rdataset);
|
||||
} while (result == ISC_R_SUCCESS);
|
||||
|
|
@ -407,15 +407,15 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
|
|||
|
||||
isc_random_get(&val);
|
||||
choice = i + (val % (count - i));
|
||||
rdata = orig[i];
|
||||
orig[i] = orig[choice];
|
||||
orig[choice] = rdata;
|
||||
rdata = in[i];
|
||||
in[i] = in[choice];
|
||||
in[choice] = rdata;
|
||||
if (order != NULL)
|
||||
new[i].key = (*order)(&orig[i],
|
||||
out[i].key = (*order)(&in[i],
|
||||
order_arg);
|
||||
else
|
||||
new[i].key = 0; /* Unused */
|
||||
new[i].rdata = &orig[i];
|
||||
out[i].key = 0; /* Unused */
|
||||
out[i].rdata = &in[i];
|
||||
}
|
||||
} else if (WANT_CYCLIC(rdataset)) {
|
||||
/*
|
||||
|
|
@ -430,11 +430,11 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
|
|||
j = val % count;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (order != NULL)
|
||||
new[i].key = (*order)(&orig[j],
|
||||
out[i].key = (*order)(&in[j],
|
||||
order_arg);
|
||||
else
|
||||
new[i].key = 0; /* Unused */
|
||||
new[i].rdata = &orig[j];
|
||||
out[i].key = 0; /* Unused */
|
||||
out[i].rdata = &in[j];
|
||||
j++;
|
||||
if (j == count)
|
||||
j = 0; /* Wrap around. */
|
||||
|
|
@ -443,10 +443,10 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
|
|||
} else if (sort) {
|
||||
for (i = 0; i < count; i++) {
|
||||
if (order != NULL)
|
||||
new[i].key = (*order)(&orig[i], order_arg);
|
||||
out[i].key = (*order)(&in[i], order_arg);
|
||||
else
|
||||
new[i].key = 0; /* Unused */
|
||||
new[i].rdata = &orig[i];
|
||||
out[i].key = 0; /* Unused */
|
||||
out[i].rdata = &in[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -454,7 +454,7 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
|
|||
* Sortlist order.
|
||||
*/
|
||||
if (sort) {
|
||||
qsort(new, count, sizeof(new[0]), towire_compare);
|
||||
qsort(out, count, sizeof(out[0]), towire_compare);
|
||||
}
|
||||
|
||||
savedbuffer = *target;
|
||||
|
|
@ -500,7 +500,7 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
|
|||
* Copy out the rdata
|
||||
*/
|
||||
if (shuffle || sort) {
|
||||
rdata = *(new[i].rdata);
|
||||
rdata = *(out[i].rdata);
|
||||
} else {
|
||||
dns_rdata_reset(&rdata);
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
|
|
@ -549,10 +549,10 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
|
|||
*target = savedbuffer;
|
||||
|
||||
cleanup:
|
||||
if (new != NULL && new != new_fixed)
|
||||
isc_mem_put(cctx->mctx, new, count * sizeof(*new));
|
||||
if (orig != NULL && orig != orig_fixed)
|
||||
isc_mem_put(cctx->mctx, orig, count * sizeof(*orig));
|
||||
if (out != NULL && out != out_fixed)
|
||||
isc_mem_put(cctx->mctx, out, count * sizeof(*out));
|
||||
if (in != NULL && in != in_fixed)
|
||||
isc_mem_put(cctx->mctx, in, count * sizeof(*in));
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9755,7 +9755,7 @@ dns_resolver_disable_algorithm(dns_resolver_t *resolver,
|
|||
unsigned int alg)
|
||||
{
|
||||
unsigned int len, mask;
|
||||
unsigned char *new;
|
||||
unsigned char *tmp;
|
||||
unsigned char *algorithms;
|
||||
isc_result_t result;
|
||||
dns_rbtnode_t *node = NULL;
|
||||
|
|
@ -9798,18 +9798,18 @@ dns_resolver_disable_algorithm(dns_resolver_t *resolver,
|
|||
* bitfield and copy the old (smaller) bitfield
|
||||
* into it if one exists.
|
||||
*/
|
||||
new = isc_mem_get(resolver->mctx, len);
|
||||
if (new == NULL) {
|
||||
tmp = isc_mem_get(resolver->mctx, len);
|
||||
if (tmp == NULL) {
|
||||
result = ISC_R_NOMEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
memset(new, 0, len);
|
||||
memset(tmp, 0, len);
|
||||
if (algorithms != NULL)
|
||||
memmove(new, algorithms, *algorithms);
|
||||
new[len-1] |= mask;
|
||||
/* new[0] should contain the length of new. */
|
||||
*new = len;
|
||||
node->data = new;
|
||||
memmove(tmp, algorithms, *algorithms);
|
||||
tmp[len-1] |= mask;
|
||||
/* 'tmp[0]' should contain the length of 'tmp'. */
|
||||
*tmp = len;
|
||||
node->data = tmp;
|
||||
/* Free the older bitfield. */
|
||||
if (algorithms != NULL)
|
||||
isc_mem_put(resolver->mctx, algorithms,
|
||||
|
|
@ -9895,7 +9895,7 @@ dns_resolver_disable_ds_digest(dns_resolver_t *resolver,
|
|||
unsigned int digest_type)
|
||||
{
|
||||
unsigned int len, mask;
|
||||
unsigned char *new;
|
||||
unsigned char *tmp;
|
||||
unsigned char *digests;
|
||||
isc_result_t result;
|
||||
dns_rbtnode_t *node = NULL;
|
||||
|
|
@ -9934,18 +9934,18 @@ dns_resolver_disable_ds_digest(dns_resolver_t *resolver,
|
|||
* bitfield and copy the old (smaller) bitfield
|
||||
* into it if one exists.
|
||||
*/
|
||||
new = isc_mem_get(resolver->mctx, len);
|
||||
if (new == NULL) {
|
||||
tmp = isc_mem_get(resolver->mctx, len);
|
||||
if (tmp == NULL) {
|
||||
result = ISC_R_NOMEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
memset(new, 0, len);
|
||||
memset(tmp, 0, len);
|
||||
if (digests != NULL)
|
||||
memmove(new, digests, *digests);
|
||||
new[len-1] |= mask;
|
||||
/* new[0] should contain the length of new. */
|
||||
*new = len;
|
||||
node->data = new;
|
||||
memmove(tmp, digests, *digests);
|
||||
tmp[len-1] |= mask;
|
||||
/* tmp[0] should contain the length of 'tmp'. */
|
||||
*tmp = len;
|
||||
node->data = tmp;
|
||||
/* Free the older bitfield. */
|
||||
if (digests != NULL)
|
||||
isc_mem_put(resolver->mctx, digests,
|
||||
|
|
|
|||
|
|
@ -631,33 +631,33 @@ new_node(dns_rpz_zones_t *rpzs,
|
|||
const dns_rpz_cidr_key_t *ip, dns_rpz_prefix_t prefix,
|
||||
const dns_rpz_cidr_node_t *child)
|
||||
{
|
||||
dns_rpz_cidr_node_t *new;
|
||||
dns_rpz_cidr_node_t *node;
|
||||
int i, words, wlen;
|
||||
|
||||
new = isc_mem_get(rpzs->mctx, sizeof(*new));
|
||||
if (new == NULL)
|
||||
node = isc_mem_get(rpzs->mctx, sizeof(*node));
|
||||
if (node == NULL)
|
||||
return (NULL);
|
||||
memset(new, 0, sizeof(*new));
|
||||
memset(node, 0, sizeof(*node));
|
||||
|
||||
if (child != NULL)
|
||||
new->sum = child->sum;
|
||||
node->sum = child->sum;
|
||||
|
||||
new->prefix = prefix;
|
||||
node->prefix = prefix;
|
||||
words = prefix / DNS_RPZ_CIDR_WORD_BITS;
|
||||
wlen = prefix % DNS_RPZ_CIDR_WORD_BITS;
|
||||
i = 0;
|
||||
while (i < words) {
|
||||
new->ip.w[i] = ip->w[i];
|
||||
node->ip.w[i] = ip->w[i];
|
||||
++i;
|
||||
}
|
||||
if (wlen != 0) {
|
||||
new->ip.w[i] = ip->w[i] & DNS_RPZ_WORD_MASK(wlen);
|
||||
node->ip.w[i] = ip->w[i] & DNS_RPZ_WORD_MASK(wlen);
|
||||
++i;
|
||||
}
|
||||
while (i < DNS_RPZ_CIDR_WORDS)
|
||||
new->ip.w[i++] = 0;
|
||||
node->ip.w[i++] = 0;
|
||||
|
||||
return (new);
|
||||
return (node);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -188,18 +188,18 @@ set_age(dns_rrl_t *rrl, dns_rrl_entry_t *e, isc_stdtime_t now) {
|
|||
}
|
||||
|
||||
static isc_result_t
|
||||
expand_entries(dns_rrl_t *rrl, int new) {
|
||||
expand_entries(dns_rrl_t *rrl, int newsize) {
|
||||
unsigned int bsize;
|
||||
dns_rrl_block_t *b;
|
||||
dns_rrl_entry_t *e;
|
||||
double rate;
|
||||
int i;
|
||||
|
||||
if (rrl->num_entries + new >= rrl->max_entries &&
|
||||
if (rrl->num_entries + newsize >= rrl->max_entries &&
|
||||
rrl->max_entries != 0)
|
||||
{
|
||||
new = rrl->max_entries - rrl->num_entries;
|
||||
if (new <= 0)
|
||||
newsize = rrl->max_entries - rrl->num_entries;
|
||||
if (newsize <= 0)
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
@ -216,11 +216,11 @@ expand_entries(dns_rrl_t *rrl, int new) {
|
|||
DNS_LOGMODULE_REQUEST, DNS_RRL_LOG_DROP,
|
||||
"increase from %d to %d RRL entries with"
|
||||
" %d bins; average search length %.1f",
|
||||
rrl->num_entries, rrl->num_entries+new,
|
||||
rrl->num_entries, rrl->num_entries+newsize,
|
||||
rrl->hash->length, rate);
|
||||
}
|
||||
|
||||
bsize = sizeof(dns_rrl_block_t) + (new-1)*sizeof(dns_rrl_entry_t);
|
||||
bsize = sizeof(dns_rrl_block_t) + (newsize-1)*sizeof(dns_rrl_entry_t);
|
||||
b = isc_mem_get(rrl->mctx, bsize);
|
||||
if (b == NULL) {
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_RRL,
|
||||
|
|
@ -233,11 +233,11 @@ expand_entries(dns_rrl_t *rrl, int new) {
|
|||
b->size = bsize;
|
||||
|
||||
e = b->entries;
|
||||
for (i = 0; i < new; ++i, ++e) {
|
||||
for (i = 0; i < newsize; ++i, ++e) {
|
||||
ISC_LINK_INIT(e, hlink);
|
||||
ISC_LIST_INITANDAPPEND(rrl->lru, e, lru);
|
||||
}
|
||||
rrl->num_entries += new;
|
||||
rrl->num_entries += newsize;
|
||||
ISC_LIST_INITANDAPPEND(rrl->blocks, b, link);
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@
|
|||
#define TEST_ORIGIN "test"
|
||||
|
||||
static void
|
||||
test_create(const atf_tc_t *tc, dns_db_t **old, dns_db_t **new) {
|
||||
test_create(const atf_tc_t *tc, dns_db_t **old, dns_db_t **newdb) {
|
||||
isc_result_t result;
|
||||
|
||||
result = dns_test_loaddb(old, dns_dbtype_zone, TEST_ORIGIN,
|
||||
atf_tc_get_md_var(tc, "X-old"));
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_test_loaddb(new, dns_dbtype_zone, TEST_ORIGIN,
|
||||
result = dns_test_loaddb(newdb, dns_dbtype_zone, TEST_ORIGIN,
|
||||
atf_tc_get_md_var(tc, "X-new"));
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
}
|
||||
|
|
@ -55,25 +55,25 @@ ATF_TC_HEAD(diffx_same, tc) {
|
|||
atf_tc_set_md_var(tc, "X-old", "testdata/diff/zone1.data");
|
||||
atf_tc_set_md_var(tc, "X-new", "testdata/diff/zone1.data"); }
|
||||
ATF_TC_BODY(diffx_same, tc) {
|
||||
dns_db_t *new = NULL, *old = NULL;
|
||||
dns_db_t *newdb = NULL, *olddb = NULL;
|
||||
isc_result_t result;
|
||||
dns_diff_t diff;
|
||||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
test_create(tc, &old, &new);
|
||||
test_create(tc, &olddb, &newdb);
|
||||
|
||||
dns_diff_init(mctx, &diff);
|
||||
|
||||
result = dns_db_diffx(&diff, new, NULL, old, NULL, NULL);
|
||||
result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), ISC_TRUE);
|
||||
|
||||
dns_diff_clear(&diff);
|
||||
dns_db_detach(&new);
|
||||
dns_db_detach(&old);
|
||||
dns_db_detach(&newdb);
|
||||
dns_db_detach(&olddb);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ ATF_TC_HEAD(diffx_add, tc) {
|
|||
atf_tc_set_md_var(tc, "X-new", "testdata/diff/zone2.data");
|
||||
}
|
||||
ATF_TC_BODY(diffx_add, tc) {
|
||||
dns_db_t *new = NULL, *old = NULL;
|
||||
dns_db_t *newdb = NULL, *olddb = NULL;
|
||||
dns_difftuple_t *tuple;
|
||||
isc_result_t result;
|
||||
dns_diff_t diff;
|
||||
|
|
@ -94,11 +94,11 @@ ATF_TC_BODY(diffx_add, tc) {
|
|||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
test_create(tc, &old, &new);
|
||||
test_create(tc, &olddb, &newdb);
|
||||
|
||||
dns_diff_init(mctx, &diff);
|
||||
|
||||
result = dns_db_diffx(&diff, new, NULL, old, NULL, NULL);
|
||||
result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), ISC_FALSE);
|
||||
|
|
@ -110,8 +110,8 @@ ATF_TC_BODY(diffx_add, tc) {
|
|||
ATF_REQUIRE_EQ(count, 1);
|
||||
|
||||
dns_diff_clear(&diff);
|
||||
dns_db_detach(&new);
|
||||
dns_db_detach(&old);
|
||||
dns_db_detach(&newdb);
|
||||
dns_db_detach(&olddb);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ ATF_TC_HEAD(diffx_remove, tc) {
|
|||
atf_tc_set_md_var(tc, "X-new", "testdata/diff/zone3.data");
|
||||
}
|
||||
ATF_TC_BODY(diffx_remove, tc) {
|
||||
dns_db_t *new = NULL, *old = NULL;
|
||||
dns_db_t *newdb = NULL, *olddb = NULL;
|
||||
dns_difftuple_t *tuple;
|
||||
isc_result_t result;
|
||||
dns_diff_t diff;
|
||||
|
|
@ -132,11 +132,11 @@ ATF_TC_BODY(diffx_remove, tc) {
|
|||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
test_create(tc, &old, &new);
|
||||
test_create(tc, &olddb, &newdb);
|
||||
|
||||
dns_diff_init(mctx, &diff);
|
||||
|
||||
result = dns_db_diffx(&diff, new, NULL, old, NULL, NULL);
|
||||
result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), ISC_FALSE);
|
||||
|
|
@ -148,8 +148,8 @@ ATF_TC_BODY(diffx_remove, tc) {
|
|||
ATF_REQUIRE_EQ(count, 1);
|
||||
|
||||
dns_diff_clear(&diff);
|
||||
dns_db_detach(&new);
|
||||
dns_db_detach(&old);
|
||||
dns_db_detach(&newdb);
|
||||
dns_db_detach(&olddb);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,17 +50,17 @@ ATF_TC_HEAD(increment, tc) {
|
|||
}
|
||||
ATF_TC_BODY(increment, tc) {
|
||||
isc_uint32_t old = 50;
|
||||
isc_uint32_t new;
|
||||
isc_uint32_t serial;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(tc);
|
||||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
new = dns_update_soaserial(old, dns_updatemethod_increment);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
|
||||
ATF_CHECK_MSG(new != 0, "new (%d) should not equal 0", new);
|
||||
ATF_REQUIRE_EQ(new, 51);
|
||||
serial = dns_update_soaserial(old, dns_updatemethod_increment);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
|
||||
ATF_CHECK_MSG(serial != 0, "serial (%d) should not equal 0", serial);
|
||||
ATF_REQUIRE_EQ(serial, 51);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -71,17 +71,17 @@ ATF_TC_HEAD(increment_past_zero, tc) {
|
|||
}
|
||||
ATF_TC_BODY(increment_past_zero, tc) {
|
||||
isc_uint32_t old = 0xffffffffu;
|
||||
isc_uint32_t new;
|
||||
isc_uint32_t serial;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(tc);
|
||||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
new = dns_update_soaserial(old, dns_updatemethod_increment);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
|
||||
ATF_CHECK(new != 0);
|
||||
ATF_REQUIRE_EQ(new, 1u);
|
||||
serial = dns_update_soaserial(old, dns_updatemethod_increment);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
|
||||
ATF_CHECK(serial != 0);
|
||||
ATF_REQUIRE_EQ(serial, 1u);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ ATF_TC_HEAD(past_to_unix, tc) {
|
|||
}
|
||||
ATF_TC_BODY(past_to_unix, tc) {
|
||||
isc_uint32_t old;
|
||||
isc_uint32_t new;
|
||||
isc_uint32_t serial;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(tc);
|
||||
|
|
@ -101,10 +101,10 @@ ATF_TC_BODY(past_to_unix, tc) {
|
|||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
|
||||
ATF_CHECK(new != 0);
|
||||
ATF_REQUIRE_EQ(new, mystdtime);
|
||||
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
|
||||
ATF_CHECK(serial != 0);
|
||||
ATF_REQUIRE_EQ(serial, mystdtime);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ ATF_TC_HEAD(now_to_unix, tc) {
|
|||
}
|
||||
ATF_TC_BODY(now_to_unix, tc) {
|
||||
isc_uint32_t old;
|
||||
isc_uint32_t new;
|
||||
isc_uint32_t serial;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(tc);
|
||||
|
|
@ -124,10 +124,10 @@ ATF_TC_BODY(now_to_unix, tc) {
|
|||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
|
||||
ATF_CHECK(new != 0);
|
||||
ATF_REQUIRE_EQ(new, old + 1);
|
||||
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
|
||||
ATF_CHECK(serial != 0);
|
||||
ATF_REQUIRE_EQ(serial, old + 1);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ ATF_TC_HEAD(future_to_unix, tc) {
|
|||
}
|
||||
ATF_TC_BODY(future_to_unix, tc) {
|
||||
isc_uint32_t old;
|
||||
isc_uint32_t new;
|
||||
isc_uint32_t serial;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(tc);
|
||||
|
|
@ -147,10 +147,10 @@ ATF_TC_BODY(future_to_unix, tc) {
|
|||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
|
||||
ATF_CHECK(new != 0);
|
||||
ATF_REQUIRE_EQ(new, old + 1);
|
||||
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
|
||||
ATF_CHECK(serial != 0);
|
||||
ATF_REQUIRE_EQ(serial, old + 1);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ ATF_TC_HEAD(undefined_plus1_to_unix, tc) {
|
|||
}
|
||||
ATF_TC_BODY(undefined_plus1_to_unix, tc) {
|
||||
isc_uint32_t old;
|
||||
isc_uint32_t new;
|
||||
isc_uint32_t serial;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(tc);
|
||||
|
|
@ -171,10 +171,10 @@ ATF_TC_BODY(undefined_plus1_to_unix, tc) {
|
|||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
|
||||
ATF_CHECK(new != 0);
|
||||
ATF_REQUIRE_EQ(new, mystdtime);
|
||||
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
|
||||
ATF_CHECK(serial != 0);
|
||||
ATF_REQUIRE_EQ(serial, mystdtime);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ ATF_TC_HEAD(undefined_minus1_to_unix, tc) {
|
|||
}
|
||||
ATF_TC_BODY(undefined_minus1_to_unix, tc) {
|
||||
isc_uint32_t old;
|
||||
isc_uint32_t new;
|
||||
isc_uint32_t serial;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(tc);
|
||||
|
|
@ -195,10 +195,10 @@ ATF_TC_BODY(undefined_minus1_to_unix, tc) {
|
|||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
|
||||
ATF_CHECK(new != 0);
|
||||
ATF_REQUIRE_EQ(new, old + 1);
|
||||
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
|
||||
ATF_CHECK(serial != 0);
|
||||
ATF_REQUIRE_EQ(serial, old + 1);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ ATF_TC_HEAD(undefined_to_unix, tc) {
|
|||
}
|
||||
ATF_TC_BODY(undefined_to_unix, tc) {
|
||||
isc_uint32_t old;
|
||||
isc_uint32_t new;
|
||||
isc_uint32_t serial;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(tc);
|
||||
|
|
@ -218,10 +218,10 @@ ATF_TC_BODY(undefined_to_unix, tc) {
|
|||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
|
||||
ATF_CHECK(new != 0);
|
||||
ATF_REQUIRE_EQ(new, old + 1);
|
||||
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
|
||||
ATF_CHECK(serial != 0);
|
||||
ATF_REQUIRE_EQ(serial, old + 1);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ ATF_TC_HEAD(unixtime_zero, tc) {
|
|||
}
|
||||
ATF_TC_BODY(unixtime_zero, tc) {
|
||||
isc_uint32_t old;
|
||||
isc_uint32_t new;
|
||||
isc_uint32_t serial;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(tc);
|
||||
|
|
@ -241,10 +241,10 @@ ATF_TC_BODY(unixtime_zero, tc) {
|
|||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
new = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
|
||||
ATF_CHECK(new != 0);
|
||||
ATF_REQUIRE_EQ(new, old + 1);
|
||||
serial = dns_update_soaserial(old, dns_updatemethod_unixtime);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
|
||||
ATF_CHECK(serial != 0);
|
||||
ATF_REQUIRE_EQ(serial, old + 1);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -253,7 +253,7 @@ ATF_TC_HEAD(past_to_date, tc) {
|
|||
atf_tc_set_md_var(tc, "descr", "past to date");
|
||||
}
|
||||
ATF_TC_BODY(past_to_date, tc) {
|
||||
isc_uint32_t old, new;
|
||||
isc_uint32_t old, serial;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(tc);
|
||||
|
|
@ -264,10 +264,10 @@ ATF_TC_BODY(past_to_date, tc) {
|
|||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
new = dns_update_soaserial(old, dns_updatemethod_date);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
|
||||
ATF_CHECK(new != 0);
|
||||
ATF_REQUIRE_EQ(new, 2014040100);
|
||||
serial = dns_update_soaserial(old, dns_updatemethod_date);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
|
||||
ATF_CHECK(serial != 0);
|
||||
ATF_REQUIRE_EQ(serial, 2014040100);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ ATF_TC_HEAD(now_to_date, tc) {
|
|||
}
|
||||
ATF_TC_BODY(now_to_date, tc) {
|
||||
isc_uint32_t old;
|
||||
isc_uint32_t new;
|
||||
isc_uint32_t serial;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(tc);
|
||||
|
|
@ -287,10 +287,10 @@ ATF_TC_BODY(now_to_date, tc) {
|
|||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
new = dns_update_soaserial(old, dns_updatemethod_date);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
|
||||
ATF_CHECK(new != 0);
|
||||
ATF_REQUIRE_EQ(new, 2014040101);
|
||||
serial = dns_update_soaserial(old, dns_updatemethod_date);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
|
||||
ATF_CHECK(serial != 0);
|
||||
ATF_REQUIRE_EQ(serial, 2014040101);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ ATF_TC_HEAD(future_to_date, tc) {
|
|||
}
|
||||
ATF_TC_BODY(future_to_date, tc) {
|
||||
isc_uint32_t old;
|
||||
isc_uint32_t new;
|
||||
isc_uint32_t serial;
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(tc);
|
||||
|
|
@ -311,10 +311,10 @@ ATF_TC_BODY(future_to_date, tc) {
|
|||
|
||||
result = dns_test_begin(NULL, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
new = dns_update_soaserial(old, dns_updatemethod_date);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, new), ISC_TRUE);
|
||||
ATF_CHECK(new != 0);
|
||||
ATF_REQUIRE_EQ(new, 2014040101);
|
||||
serial = dns_update_soaserial(old, dns_updatemethod_date);
|
||||
ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE);
|
||||
ATF_CHECK(serial != 0);
|
||||
ATF_REQUIRE_EQ(serial, 2014040101);
|
||||
dns_test_end();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1676,7 +1676,7 @@ dns_view_flushnode(dns_view_t *view, const dns_name_t *name,
|
|||
isc_result_t
|
||||
dns_view_adddelegationonly(dns_view_t *view, const dns_name_t *name) {
|
||||
isc_result_t result;
|
||||
dns_name_t *new;
|
||||
dns_name_t *item;
|
||||
isc_uint32_t hash;
|
||||
|
||||
REQUIRE(DNS_VIEW_VALID(view));
|
||||
|
|
@ -1691,27 +1691,27 @@ dns_view_adddelegationonly(dns_view_t *view, const dns_name_t *name) {
|
|||
ISC_LIST_INIT(view->delonly[hash]);
|
||||
}
|
||||
hash = dns_name_hash(name, ISC_FALSE) % DNS_VIEW_DELONLYHASH;
|
||||
new = ISC_LIST_HEAD(view->delonly[hash]);
|
||||
while (new != NULL && !dns_name_equal(new, name))
|
||||
new = ISC_LIST_NEXT(new, link);
|
||||
if (new != NULL)
|
||||
item = ISC_LIST_HEAD(view->delonly[hash]);
|
||||
while (item != NULL && !dns_name_equal(item, name))
|
||||
item = ISC_LIST_NEXT(item, link);
|
||||
if (item != NULL)
|
||||
return (ISC_R_SUCCESS);
|
||||
new = isc_mem_get(view->mctx, sizeof(*new));
|
||||
if (new == NULL)
|
||||
item = isc_mem_get(view->mctx, sizeof(*item));
|
||||
if (item == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
dns_name_init(new, NULL);
|
||||
result = dns_name_dup(name, view->mctx, new);
|
||||
dns_name_init(item, NULL);
|
||||
result = dns_name_dup(name, view->mctx, item);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
ISC_LIST_APPEND(view->delonly[hash], new, link);
|
||||
ISC_LIST_APPEND(view->delonly[hash], item, link);
|
||||
else
|
||||
isc_mem_put(view->mctx, new, sizeof(*new));
|
||||
isc_mem_put(view->mctx, item, sizeof(*item));
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_view_excludedelegationonly(dns_view_t *view, const dns_name_t *name) {
|
||||
isc_result_t result;
|
||||
dns_name_t *new;
|
||||
dns_name_t *item;
|
||||
isc_uint32_t hash;
|
||||
|
||||
REQUIRE(DNS_VIEW_VALID(view));
|
||||
|
|
@ -1726,26 +1726,26 @@ dns_view_excludedelegationonly(dns_view_t *view, const dns_name_t *name) {
|
|||
ISC_LIST_INIT(view->rootexclude[hash]);
|
||||
}
|
||||
hash = dns_name_hash(name, ISC_FALSE) % DNS_VIEW_DELONLYHASH;
|
||||
new = ISC_LIST_HEAD(view->rootexclude[hash]);
|
||||
while (new != NULL && !dns_name_equal(new, name))
|
||||
new = ISC_LIST_NEXT(new, link);
|
||||
if (new != NULL)
|
||||
item = ISC_LIST_HEAD(view->rootexclude[hash]);
|
||||
while (item != NULL && !dns_name_equal(item, name))
|
||||
item = ISC_LIST_NEXT(item, link);
|
||||
if (item != NULL)
|
||||
return (ISC_R_SUCCESS);
|
||||
new = isc_mem_get(view->mctx, sizeof(*new));
|
||||
if (new == NULL)
|
||||
item = isc_mem_get(view->mctx, sizeof(*item));
|
||||
if (item == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
dns_name_init(new, NULL);
|
||||
result = dns_name_dup(name, view->mctx, new);
|
||||
dns_name_init(item, NULL);
|
||||
result = dns_name_dup(name, view->mctx, item);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
ISC_LIST_APPEND(view->rootexclude[hash], new, link);
|
||||
ISC_LIST_APPEND(view->rootexclude[hash], item, link);
|
||||
else
|
||||
isc_mem_put(view->mctx, new, sizeof(*new));
|
||||
isc_mem_put(view->mctx, item, sizeof(*item));
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_boolean_t
|
||||
dns_view_isdelegationonly(dns_view_t *view, const dns_name_t *name) {
|
||||
dns_name_t *new;
|
||||
dns_name_t *item;
|
||||
isc_uint32_t hash;
|
||||
|
||||
REQUIRE(DNS_VIEW_VALID(view));
|
||||
|
|
@ -1757,20 +1757,20 @@ dns_view_isdelegationonly(dns_view_t *view, const dns_name_t *name) {
|
|||
if (view->rootdelonly && dns_name_countlabels(name) <= 2) {
|
||||
if (view->rootexclude == NULL)
|
||||
return (ISC_TRUE);
|
||||
new = ISC_LIST_HEAD(view->rootexclude[hash]);
|
||||
while (new != NULL && !dns_name_equal(new, name))
|
||||
new = ISC_LIST_NEXT(new, link);
|
||||
if (new == NULL)
|
||||
item = ISC_LIST_HEAD(view->rootexclude[hash]);
|
||||
while (item != NULL && !dns_name_equal(item, name))
|
||||
item = ISC_LIST_NEXT(item, link);
|
||||
if (item == NULL)
|
||||
return (ISC_TRUE);
|
||||
}
|
||||
|
||||
if (view->delonly == NULL)
|
||||
return (ISC_FALSE);
|
||||
|
||||
new = ISC_LIST_HEAD(view->delonly[hash]);
|
||||
while (new != NULL && !dns_name_equal(new, name))
|
||||
new = ISC_LIST_NEXT(new, link);
|
||||
if (new == NULL)
|
||||
item = ISC_LIST_HEAD(view->delonly[hash]);
|
||||
while (item != NULL && !dns_name_equal(item, name))
|
||||
item = ISC_LIST_NEXT(item, link);
|
||||
if (item == NULL)
|
||||
return (ISC_FALSE);
|
||||
return (ISC_TRUE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ struct dns_signing {
|
|||
dns_dbiterator_t *dbiterator;
|
||||
dns_secalg_t algorithm;
|
||||
isc_uint16_t keyid;
|
||||
isc_boolean_t delete;
|
||||
isc_boolean_t deleteit;
|
||||
isc_boolean_t done;
|
||||
ISC_LINK(dns_signing_t) link;
|
||||
};
|
||||
|
|
@ -809,7 +809,7 @@ static void zone_maintenance(dns_zone_t *zone);
|
|||
static void zone_notify(dns_zone_t *zone, isc_time_t *now);
|
||||
static void dump_done(void *arg, isc_result_t result);
|
||||
static isc_result_t zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm,
|
||||
isc_uint16_t keyid, isc_boolean_t delete);
|
||||
isc_uint16_t keyid, isc_boolean_t deleteit);
|
||||
static isc_result_t delete_nsec(dns_db_t *db, dns_dbversion_t *ver,
|
||||
dns_dbnode_t *node, dns_name_t *name,
|
||||
dns_diff_t *diff);
|
||||
|
|
@ -1401,9 +1401,10 @@ dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx) {
|
|||
|
||||
isc_result_t
|
||||
dns_zone_setdbtype(dns_zone_t *zone,
|
||||
unsigned int dbargc, const char * const *dbargv) {
|
||||
unsigned int dbargc, const char * const *dbargv)
|
||||
{
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
char **new = NULL;
|
||||
char **argv = NULL;
|
||||
unsigned int i;
|
||||
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
|
|
@ -1413,14 +1414,14 @@ dns_zone_setdbtype(dns_zone_t *zone,
|
|||
LOCK_ZONE(zone);
|
||||
|
||||
/* Set up a new database argument list. */
|
||||
new = isc_mem_get(zone->mctx, dbargc * sizeof(*new));
|
||||
if (new == NULL)
|
||||
argv = isc_mem_get(zone->mctx, dbargc * sizeof(*argv));
|
||||
if (argv == NULL)
|
||||
goto nomem;
|
||||
for (i = 0; i < dbargc; i++)
|
||||
new[i] = NULL;
|
||||
argv[i] = NULL;
|
||||
for (i = 0; i < dbargc; i++) {
|
||||
new[i] = isc_mem_strdup(zone->mctx, dbargv[i]);
|
||||
if (new[i] == NULL)
|
||||
argv[i] = isc_mem_strdup(zone->mctx, dbargv[i]);
|
||||
if (argv[i] == NULL)
|
||||
goto nomem;
|
||||
}
|
||||
|
||||
|
|
@ -1428,16 +1429,16 @@ dns_zone_setdbtype(dns_zone_t *zone,
|
|||
zone_freedbargs(zone);
|
||||
|
||||
zone->db_argc = dbargc;
|
||||
zone->db_argv = new;
|
||||
zone->db_argv = argv;
|
||||
result = ISC_R_SUCCESS;
|
||||
goto unlock;
|
||||
|
||||
nomem:
|
||||
if (new != NULL) {
|
||||
if (argv != NULL) {
|
||||
for (i = 0; i < dbargc; i++)
|
||||
if (new[i] != NULL)
|
||||
isc_mem_free(zone->mctx, new[i]);
|
||||
isc_mem_put(zone->mctx, new, dbargc * sizeof(*new));
|
||||
if (argv[i] != NULL)
|
||||
isc_mem_free(zone->mctx, argv[i]);
|
||||
isc_mem_put(zone->mctx, argv, dbargc * sizeof(*argv));
|
||||
}
|
||||
result = ISC_R_NOMEMORY;
|
||||
|
||||
|
|
@ -5451,31 +5452,33 @@ dns_zone_getnotifysrc6(dns_zone_t *zone) {
|
|||
}
|
||||
|
||||
static isc_boolean_t
|
||||
same_addrs(const isc_sockaddr_t *old, const isc_sockaddr_t *new,
|
||||
isc_uint32_t count)
|
||||
same_addrs(isc_sockaddr_t const *oldlist, isc_sockaddr_t const *newlist,
|
||||
isc_uint32_t count)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
if (!isc_sockaddr_equal(&old[i], &new[i]))
|
||||
if (!isc_sockaddr_equal(&oldlist[i], &newlist[i]))
|
||||
return (ISC_FALSE);
|
||||
return (ISC_TRUE);
|
||||
}
|
||||
|
||||
static isc_boolean_t
|
||||
same_keynames(dns_name_t **old, dns_name_t **new, isc_uint32_t count) {
|
||||
same_keynames(dns_name_t * const *oldlist, dns_name_t * const *newlist,
|
||||
isc_uint32_t count)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (old == NULL && new == NULL)
|
||||
if (oldlist == NULL && newlist == NULL)
|
||||
return (ISC_TRUE);
|
||||
if (old == NULL || new == NULL)
|
||||
if (oldlist == NULL || newlist == NULL)
|
||||
return (ISC_FALSE);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (old[i] == NULL && new[i] == NULL)
|
||||
if (oldlist[i] == NULL && newlist[i] == NULL)
|
||||
continue;
|
||||
if (old[i] == NULL || new[i] == NULL ||
|
||||
!dns_name_equal(old[i], new[i]))
|
||||
if (oldlist[i] == NULL || newlist[i] == NULL ||
|
||||
!dns_name_equal(oldlist[i], newlist[i]))
|
||||
return (ISC_FALSE);
|
||||
}
|
||||
return (ISC_TRUE);
|
||||
|
|
@ -6763,17 +6766,17 @@ updatesignwithkey(dns_zone_t *zone, dns_signing_t *signing,
|
|||
continue;
|
||||
}
|
||||
/*
|
||||
* We have a match. If we were signing (!signing->delete)
|
||||
* We have a match. If we were signing (!signing->deleteit)
|
||||
* and we already have a record indicating that we have
|
||||
* finished signing (rdata.data[4] != 0) then keep it.
|
||||
* Otherwise it needs to be deleted as we have removed all
|
||||
* the signatures (signing->delete), so any record indicating
|
||||
* the signatures (signing->deleteit), so any record indicating
|
||||
* completion is now out of date, or we have finished signing
|
||||
* with the new record so we no longer need to remember that
|
||||
* we need to sign the zone with the matching key across a
|
||||
* nameserver re-start.
|
||||
*/
|
||||
if (!signing->delete && rdata.data[4] != 0) {
|
||||
if (!signing->deleteit && rdata.data[4] != 0) {
|
||||
seen_done = ISC_TRUE;
|
||||
have_rr = ISC_TRUE;
|
||||
} else
|
||||
|
|
@ -6784,7 +6787,7 @@ updatesignwithkey(dns_zone_t *zone, dns_signing_t *signing,
|
|||
}
|
||||
if (result == ISC_R_NOMORE)
|
||||
result = ISC_R_SUCCESS;
|
||||
if (!signing->delete && !seen_done) {
|
||||
if (!signing->deleteit && !seen_done) {
|
||||
/*
|
||||
* If we were signing then we need to indicate that we have
|
||||
* finished signing the zone with this key. If it is already
|
||||
|
|
@ -8153,7 +8156,7 @@ zone_sign(dns_zone_t *zone) {
|
|||
|
||||
delegation = ISC_FALSE;
|
||||
|
||||
if (first && signing->delete) {
|
||||
if (first && signing->deleteit) {
|
||||
/*
|
||||
* Remove the key we are deleting from consideration.
|
||||
*/
|
||||
|
|
@ -8176,7 +8179,7 @@ zone_sign(dns_zone_t *zone) {
|
|||
|
||||
dns_dbiterator_current(signing->dbiterator, &node, name);
|
||||
|
||||
if (signing->delete) {
|
||||
if (signing->deleteit) {
|
||||
dns_dbiterator_pause(signing->dbiterator);
|
||||
CHECK(del_sig(db, version, name, node, nkeys,
|
||||
signing->algorithm, signing->keyid,
|
||||
|
|
@ -8225,7 +8228,7 @@ zone_sign(dns_zone_t *zone) {
|
|||
/*
|
||||
* When adding look for the specific key.
|
||||
*/
|
||||
if (!signing->delete &&
|
||||
if (!signing->deleteit &&
|
||||
(dst_key_alg(zone_keys[i]) != signing->algorithm ||
|
||||
dst_key_id(zone_keys[i]) != signing->keyid))
|
||||
continue;
|
||||
|
|
@ -8234,7 +8237,7 @@ zone_sign(dns_zone_t *zone) {
|
|||
* When deleting make sure we are properly signed
|
||||
* with the algorithm that was being removed.
|
||||
*/
|
||||
if (signing->delete &&
|
||||
if (signing->deleteit &&
|
||||
ALG(zone_keys[i]) != signing->algorithm)
|
||||
continue;
|
||||
|
||||
|
|
@ -8281,7 +8284,7 @@ zone_sign(dns_zone_t *zone) {
|
|||
* If we are adding we are done. Look for other keys
|
||||
* of the same algorithm if deleting.
|
||||
*/
|
||||
if (!signing->delete)
|
||||
if (!signing->deleteit)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -10725,7 +10728,7 @@ notify_send(dns_notify_t *notify) {
|
|||
dns_adbaddrinfo_t *ai;
|
||||
isc_sockaddr_t dst;
|
||||
isc_result_t result;
|
||||
dns_notify_t *new = NULL;
|
||||
dns_notify_t *newnotify = NULL;
|
||||
unsigned int flags;
|
||||
isc_boolean_t startup;
|
||||
|
||||
|
|
@ -10747,24 +10750,24 @@ notify_send(dns_notify_t *notify) {
|
|||
continue;
|
||||
if (notify_isself(notify->zone, &dst))
|
||||
continue;
|
||||
new = NULL;
|
||||
newnotify = NULL;
|
||||
flags = notify->flags & DNS_NOTIFY_NOSOA;
|
||||
result = notify_create(notify->mctx, flags, &new);
|
||||
result = notify_create(notify->mctx, flags, &newnotify);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
zone_iattach(notify->zone, &new->zone);
|
||||
ISC_LIST_APPEND(new->zone->notifies, new, link);
|
||||
new->dst = dst;
|
||||
zone_iattach(notify->zone, &newnotify->zone);
|
||||
ISC_LIST_APPEND(newnotify->zone->notifies, newnotify, link);
|
||||
newnotify->dst = dst;
|
||||
startup = ISC_TF((notify->flags & DNS_NOTIFY_STARTUP) != 0);
|
||||
result = notify_send_queue(new, startup);
|
||||
result = notify_send_queue(newnotify, startup);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
new = NULL;
|
||||
newnotify = NULL;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (new != NULL)
|
||||
notify_destroy(new, ISC_TRUE);
|
||||
if (newnotify != NULL)
|
||||
notify_destroy(newnotify, ISC_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -16931,7 +16934,7 @@ dns_zone_getnotifydelay(dns_zone_t *zone) {
|
|||
|
||||
isc_result_t
|
||||
dns_zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm,
|
||||
isc_uint16_t keyid, isc_boolean_t delete)
|
||||
isc_uint16_t keyid, isc_boolean_t deleteit)
|
||||
{
|
||||
isc_result_t result;
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
|
|
@ -16940,7 +16943,7 @@ dns_zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm,
|
|||
"dns_zone_signwithkey(algorithm=%u, keyid=%u)",
|
||||
algorithm, keyid);
|
||||
LOCK_ZONE(zone);
|
||||
result = zone_signwithkey(zone, algorithm, keyid, delete);
|
||||
result = zone_signwithkey(zone, algorithm, keyid, deleteit);
|
||||
UNLOCK_ZONE(zone);
|
||||
|
||||
return (result);
|
||||
|
|
@ -17020,7 +17023,7 @@ dns_zone_getprivatetype(dns_zone_t *zone) {
|
|||
|
||||
static isc_result_t
|
||||
zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, isc_uint16_t keyid,
|
||||
isc_boolean_t delete)
|
||||
isc_boolean_t deleteit)
|
||||
{
|
||||
dns_signing_t *signing;
|
||||
dns_signing_t *current;
|
||||
|
|
@ -17037,7 +17040,7 @@ zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, isc_uint16_t keyid,
|
|||
signing->dbiterator = NULL;
|
||||
signing->algorithm = algorithm;
|
||||
signing->keyid = keyid;
|
||||
signing->delete = delete;
|
||||
signing->deleteit = deleteit;
|
||||
signing->done = ISC_FALSE;
|
||||
|
||||
TIME_NOW(&now);
|
||||
|
|
@ -17060,7 +17063,7 @@ zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, isc_uint16_t keyid,
|
|||
if (current->db == signing->db &&
|
||||
current->algorithm == signing->algorithm &&
|
||||
current->keyid == signing->keyid) {
|
||||
if (current->delete != signing->delete)
|
||||
if (current->deleteit != signing->deleteit)
|
||||
current->done = ISC_TRUE;
|
||||
else
|
||||
goto cleanup;
|
||||
|
|
|
|||
|
|
@ -82,14 +82,14 @@ inet_pton4(const char *src, unsigned char *dst) {
|
|||
const char *pch;
|
||||
|
||||
if ((pch = strchr(digits, ch)) != NULL) {
|
||||
unsigned int new = *tp * 10;
|
||||
unsigned int byte = *tp * 10;
|
||||
|
||||
new += (int)(pch - digits);
|
||||
byte += (int)(pch - digits);
|
||||
if (saw_digit && *tp == 0)
|
||||
return (0);
|
||||
if (new > 255)
|
||||
if (byte > 255)
|
||||
return (0);
|
||||
*tp = new;
|
||||
*tp = byte;
|
||||
if (!saw_digit) {
|
||||
if (++octets > 4)
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -63,17 +63,17 @@ struct isc_lex {
|
|||
|
||||
static inline isc_result_t
|
||||
grow_data(isc_lex_t *lex, size_t *remainingp, char **currp, char **prevp) {
|
||||
char *new;
|
||||
char *tmp;
|
||||
|
||||
new = isc_mem_get(lex->mctx, lex->max_token * 2 + 1);
|
||||
if (new == NULL)
|
||||
tmp = isc_mem_get(lex->mctx, lex->max_token * 2 + 1);
|
||||
if (tmp == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
memmove(new, lex->data, lex->max_token + 1);
|
||||
*currp = new + (*currp - lex->data);
|
||||
memmove(tmp, lex->data, lex->max_token + 1);
|
||||
*currp = tmp + (*currp - lex->data);
|
||||
if (*prevp != NULL)
|
||||
*prevp = new + (*prevp - lex->data);
|
||||
*prevp = tmp + (*prevp - lex->data);
|
||||
isc_mem_put(lex->mctx, lex->data, lex->max_token + 1);
|
||||
lex->data = new;
|
||||
lex->data = tmp;
|
||||
*remainingp += lex->max_token;
|
||||
lex->max_token *= 2;
|
||||
return (ISC_R_SUCCESS);
|
||||
|
|
|
|||
|
|
@ -1735,7 +1735,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
|||
* Check for duplicates.
|
||||
*/
|
||||
if (write_once) {
|
||||
isc_logmessage_t *message, *new;
|
||||
isc_logmessage_t *message, *next;
|
||||
isc_time_t oldest;
|
||||
isc_interval_t interval;
|
||||
|
||||
|
|
@ -1748,7 +1748,8 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
|||
* range.
|
||||
*/
|
||||
TIME_NOW(&oldest);
|
||||
if (isc_time_subtract(&oldest, &interval, &oldest)
|
||||
if (isc_time_subtract(&oldest, &interval,
|
||||
&oldest)
|
||||
!= ISC_R_SUCCESS)
|
||||
/*
|
||||
* Can't effectively do the checking
|
||||
|
|
@ -1756,7 +1757,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
|||
*/
|
||||
message = NULL;
|
||||
else
|
||||
message =ISC_LIST_HEAD(lctx->messages);
|
||||
message = ISC_LIST_HEAD(lctx->messages);
|
||||
|
||||
while (message != NULL) {
|
||||
if (isc_time_compare(&message->time,
|
||||
|
|
@ -1773,8 +1774,8 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
|||
* message to spring back into
|
||||
* existence.
|
||||
*/
|
||||
new = ISC_LIST_NEXT(message,
|
||||
link);
|
||||
next = ISC_LIST_NEXT(message,
|
||||
link);
|
||||
|
||||
ISC_LIST_UNLINK(lctx->messages,
|
||||
message, link);
|
||||
|
|
@ -1784,7 +1785,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
|||
sizeof(*message) + 1 +
|
||||
strlen(message->text));
|
||||
|
||||
message = new;
|
||||
message = next;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1810,22 +1811,22 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
|||
* It wasn't in the duplicate interval,
|
||||
* so add it to the message list.
|
||||
*/
|
||||
new = isc_mem_get(lctx->mctx,
|
||||
sizeof(isc_logmessage_t) +
|
||||
strlen(lctx->buffer) + 1);
|
||||
if (new != NULL) {
|
||||
message = isc_mem_get(lctx->mctx,
|
||||
sizeof(isc_logmessage_t) +
|
||||
strlen(lctx->buffer) + 1);
|
||||
if (message != NULL) {
|
||||
/*
|
||||
* Put the text immediately after
|
||||
* the struct. The strcpy is safe.
|
||||
*/
|
||||
new->text = (char *)(new + 1);
|
||||
strcpy(new->text, lctx->buffer);
|
||||
message->text = (char *)(message + 1);
|
||||
strcpy(message->text, lctx->buffer);
|
||||
|
||||
TIME_NOW(&new->time);
|
||||
TIME_NOW(&message->time);
|
||||
|
||||
ISC_LINK_INIT(new, link);
|
||||
ISC_LINK_INIT(message, link);
|
||||
ISC_LIST_APPEND(lctx->messages,
|
||||
new, link);
|
||||
message, link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ quantize(size_t size) {
|
|||
|
||||
static inline isc_boolean_t
|
||||
more_basic_blocks(isc__mem_t *ctx) {
|
||||
void *new;
|
||||
void *tmp;
|
||||
unsigned char *curr, *next;
|
||||
unsigned char *first, *last;
|
||||
unsigned char **table;
|
||||
|
|
@ -558,19 +558,19 @@ more_basic_blocks(isc__mem_t *ctx) {
|
|||
ctx->basic_table_size = table_size;
|
||||
}
|
||||
|
||||
new = (ctx->memalloc)(ctx->arg, NUM_BASIC_BLOCKS * ctx->mem_target);
|
||||
if (new == NULL) {
|
||||
tmp = (ctx->memalloc)(ctx->arg, NUM_BASIC_BLOCKS * ctx->mem_target);
|
||||
if (tmp == NULL) {
|
||||
ctx->memalloc_failures++;
|
||||
return (ISC_FALSE);
|
||||
}
|
||||
ctx->total += increment;
|
||||
ctx->basic_table[ctx->basic_table_count] = new;
|
||||
ctx->basic_table[ctx->basic_table_count] = tmp;
|
||||
ctx->basic_table_count++;
|
||||
ctx->malloced += NUM_BASIC_BLOCKS * ctx->mem_target;
|
||||
if (ctx->malloced > ctx->maxmalloced)
|
||||
ctx->maxmalloced = ctx->malloced;
|
||||
|
||||
curr = new;
|
||||
curr = tmp;
|
||||
next = curr + ctx->mem_target;
|
||||
for (i = 0; i < (NUM_BASIC_BLOCKS - 1); i++) {
|
||||
((element *)curr)->next = (element *)next;
|
||||
|
|
@ -582,13 +582,13 @@ more_basic_blocks(isc__mem_t *ctx) {
|
|||
* array.
|
||||
*/
|
||||
((element *)curr)->next = NULL;
|
||||
first = new;
|
||||
first = tmp;
|
||||
last = first + NUM_BASIC_BLOCKS * ctx->mem_target - 1;
|
||||
if (first < ctx->lowest || ctx->lowest == NULL)
|
||||
ctx->lowest = first;
|
||||
if (last > ctx->highest)
|
||||
ctx->highest = last;
|
||||
ctx->basic_blocks = new;
|
||||
ctx->basic_blocks = tmp;
|
||||
|
||||
return (ISC_TRUE);
|
||||
}
|
||||
|
|
@ -597,7 +597,7 @@ static inline isc_boolean_t
|
|||
more_frags(isc__mem_t *ctx, size_t new_size) {
|
||||
int i, frags;
|
||||
size_t total_size;
|
||||
void *new;
|
||||
void *tmp;
|
||||
unsigned char *curr, *next;
|
||||
|
||||
/*!
|
||||
|
|
@ -618,7 +618,7 @@ more_frags(isc__mem_t *ctx, size_t new_size) {
|
|||
}
|
||||
|
||||
total_size = ctx->mem_target;
|
||||
new = ctx->basic_blocks;
|
||||
tmp = ctx->basic_blocks;
|
||||
ctx->basic_blocks = ctx->basic_blocks->next;
|
||||
frags = (int)(total_size / new_size);
|
||||
ctx->stats[new_size].blocks++;
|
||||
|
|
@ -627,7 +627,7 @@ more_frags(isc__mem_t *ctx, size_t new_size) {
|
|||
* Set up a linked-list of blocks of size
|
||||
* "new_size".
|
||||
*/
|
||||
curr = new;
|
||||
curr = tmp;
|
||||
next = curr + new_size;
|
||||
total_size -= new_size;
|
||||
for (i = 0; i < (frags - 1); i++) {
|
||||
|
|
@ -650,7 +650,7 @@ more_frags(isc__mem_t *ctx, size_t new_size) {
|
|||
* array.
|
||||
*/
|
||||
((element *)curr)->next = NULL;
|
||||
ctx->freelists[new_size] = new;
|
||||
ctx->freelists[new_size] = tmp;
|
||||
|
||||
return (ISC_TRUE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ static inline int
|
|||
#else
|
||||
static int
|
||||
#endif
|
||||
isc_atomic_cmpxchg(atomic_p p, int old, int new) {
|
||||
isc_atomic_cmpxchg(atomic_p p, int old, int replacement) {
|
||||
int orig = old;
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
|
@ -78,7 +78,7 @@ isc_atomic_cmpxchg(atomic_p p, int old, int new) {
|
|||
#else
|
||||
__isync();
|
||||
#endif
|
||||
if (compare_and_swap(p, &orig, new))
|
||||
if (compare_and_swap(p, &orig, replacement))
|
||||
orig = old;
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
|
|
|||
|
|
@ -2655,20 +2655,20 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock,
|
|||
*/
|
||||
if (manager->reserved != 0 && sock->type == isc_sockettype_udp &&
|
||||
sock->fd >= 0 && sock->fd < manager->reserved) {
|
||||
int new, tmp;
|
||||
new = fcntl(sock->fd, F_DUPFD, manager->reserved);
|
||||
int newfd, tmp;
|
||||
newfd = fcntl(sock->fd, F_DUPFD, manager->reserved);
|
||||
tmp = errno;
|
||||
(void)close(sock->fd);
|
||||
errno = tmp;
|
||||
sock->fd = new;
|
||||
sock->fd = newfd;
|
||||
err = "isc_socket_create: fcntl/reserved";
|
||||
} else if (sock->fd >= 0 && sock->fd < 20) {
|
||||
int new, tmp;
|
||||
new = fcntl(sock->fd, F_DUPFD, 20);
|
||||
int newfd, tmp;
|
||||
newfd = fcntl(sock->fd, F_DUPFD, 20);
|
||||
tmp = errno;
|
||||
(void)close(sock->fd);
|
||||
errno = tmp;
|
||||
sock->fd = new;
|
||||
sock->fd = newfd;
|
||||
err = "isc_socket_create: fcntl";
|
||||
}
|
||||
#endif
|
||||
|
|
@ -3582,12 +3582,12 @@ internal_accept(isc_task_t *me, isc_event_t *ev) {
|
|||
* Leave a space for stdio to work in.
|
||||
*/
|
||||
if (fd >= 0 && fd < 20) {
|
||||
int new, tmp;
|
||||
new = fcntl(fd, F_DUPFD, 20);
|
||||
int newfd, tmp;
|
||||
newfd = fcntl(fd, F_DUPFD, 20);
|
||||
tmp = errno;
|
||||
(void)close(fd);
|
||||
errno = tmp;
|
||||
fd = new;
|
||||
fd = newfd;
|
||||
err = "accept/fcntl";
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -81,12 +81,12 @@ inet_pton4(const char *src, unsigned char *dst) {
|
|||
const char *pch;
|
||||
|
||||
if ((pch = strchr(digits, ch)) != NULL) {
|
||||
unsigned int new = *tp * 10;
|
||||
unsigned int byte = *tp * 10;
|
||||
|
||||
new += (unsigned int)(pch - digits);
|
||||
if (new > 255)
|
||||
byte += (unsigned int)(pch - digits);
|
||||
if (byte > 255)
|
||||
return (0);
|
||||
*tp = new;
|
||||
*tp = byte;
|
||||
if (! saw_digit) {
|
||||
if (++octets > 4)
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ set_key(dns_client_t *client, char *keynamestr, char *keystr,
|
|||
|
||||
static void
|
||||
addserver(dns_client_t *client, const char *addrstr, const char *port,
|
||||
const char *namespace)
|
||||
const char *name_space)
|
||||
{
|
||||
struct addrinfo hints, *res;
|
||||
int gaierror;
|
||||
|
|
@ -206,9 +206,9 @@ addserver(dns_client_t *client, const char *addrstr, const char *port,
|
|||
ISC_LIST_INIT(servers);
|
||||
ISC_LIST_APPEND(servers, &sa, link);
|
||||
|
||||
if (namespace != NULL) {
|
||||
namelen = strlen(namespace);
|
||||
isc_buffer_constinit(&b, namespace, namelen);
|
||||
if (name_space != NULL) {
|
||||
namelen = strlen(name_space);
|
||||
isc_buffer_constinit(&b, name_space, namelen);
|
||||
isc_buffer_add(&b, namelen);
|
||||
dns_fixedname_init(&fname);
|
||||
name = dns_fixedname_name(&fname);
|
||||
|
|
|
|||
Loading…
Reference in a new issue