mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Remove blocks checking whether isc_mem_get() failed using the coccinelle
This commit is contained in:
parent
f63e696967
commit
ae83801e2b
@ -222,8 +222,6 @@ main(int argc, char **argv) {
|
|||||||
if (suffix != NULL) {
|
if (suffix != NULL) {
|
||||||
len = strlen(keyname) + strlen(suffix) + 2;
|
len = strlen(keyname) + strlen(suffix) + 2;
|
||||||
keybuf = isc_mem_get(mctx, len);
|
keybuf = isc_mem_get(mctx, len);
|
||||||
if (keybuf == NULL)
|
|
||||||
fatal("failed to allocate memory for keyname");
|
|
||||||
snprintf(keybuf, len, "%s.%s", keyname, suffix);
|
snprintf(keybuf, len, "%s.%s", keyname, suffix);
|
||||||
keyname = (const char *) keybuf;
|
keyname = (const char *) keybuf;
|
||||||
}
|
}
|
||||||
|
@ -222,8 +222,6 @@ main(int argc, char **argv) {
|
|||||||
char *buf;
|
char *buf;
|
||||||
len = strlen(chrootdir) + strlen(keyfile) + 2;
|
len = strlen(chrootdir) + strlen(keyfile) + 2;
|
||||||
buf = isc_mem_get(mctx, len);
|
buf = isc_mem_get(mctx, len);
|
||||||
if (buf == NULL)
|
|
||||||
fatal("isc_mem_get(%d) failed\n", len);
|
|
||||||
snprintf(buf, len, "%s%s%s", chrootdir,
|
snprintf(buf, len, "%s%s%s", chrootdir,
|
||||||
(*keyfile != '/') ? "/" : "", keyfile);
|
(*keyfile != '/') ? "/" : "", keyfile);
|
||||||
|
|
||||||
|
@ -436,8 +436,6 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner,
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
t = isc_mem_get(mctx, len);
|
t = isc_mem_get(mctx, len);
|
||||||
if (t == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
isc_buffer_init(&target, t, len);
|
isc_buffer_init(&target, t, len);
|
||||||
if (short_form) {
|
if (short_form) {
|
||||||
@ -819,8 +817,6 @@ addserver(dns_client_t *client) {
|
|||||||
fatal("Use of IPv4 disabled by -6");
|
fatal("Use of IPv4 disabled by -6");
|
||||||
}
|
}
|
||||||
sa = isc_mem_get(mctx, sizeof(*sa));
|
sa = isc_mem_get(mctx, sizeof(*sa));
|
||||||
if (sa == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
ISC_LINK_INIT(sa, link);
|
ISC_LINK_INIT(sa, link);
|
||||||
isc_sockaddr_fromin(sa, &in4, destport);
|
isc_sockaddr_fromin(sa, &in4, destport);
|
||||||
ISC_LIST_APPEND(servers, sa, link);
|
ISC_LIST_APPEND(servers, sa, link);
|
||||||
@ -829,8 +825,6 @@ addserver(dns_client_t *client) {
|
|||||||
fatal("Use of IPv6 disabled by -4");
|
fatal("Use of IPv6 disabled by -4");
|
||||||
}
|
}
|
||||||
sa = isc_mem_get(mctx, sizeof(*sa));
|
sa = isc_mem_get(mctx, sizeof(*sa));
|
||||||
if (sa == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
ISC_LINK_INIT(sa, link);
|
ISC_LINK_INIT(sa, link);
|
||||||
isc_sockaddr_fromin6(sa, &in6, destport);
|
isc_sockaddr_fromin6(sa, &in6, destport);
|
||||||
ISC_LIST_APPEND(servers, sa, link);
|
ISC_LIST_APPEND(servers, sa, link);
|
||||||
@ -858,10 +852,6 @@ addserver(dns_client_t *client) {
|
|||||||
cur->ai_family != AF_INET6)
|
cur->ai_family != AF_INET6)
|
||||||
continue;
|
continue;
|
||||||
sa = isc_mem_get(mctx, sizeof(*sa));
|
sa = isc_mem_get(mctx, sizeof(*sa));
|
||||||
if (sa == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
memset(sa, 0, sizeof(*sa));
|
memset(sa, 0, sizeof(*sa));
|
||||||
ISC_LINK_INIT(sa, link);
|
ISC_LINK_INIT(sa, link);
|
||||||
memmove(&sa->type, cur->ai_addr, cur->ai_addrlen);
|
memmove(&sa->type, cur->ai_addr, cur->ai_addrlen);
|
||||||
@ -934,10 +924,6 @@ findserver(dns_client_t *client) {
|
|||||||
struct in_addr localhost;
|
struct in_addr localhost;
|
||||||
localhost.s_addr = htonl(INADDR_LOOPBACK);
|
localhost.s_addr = htonl(INADDR_LOOPBACK);
|
||||||
sa = isc_mem_get(mctx, sizeof(*sa));
|
sa = isc_mem_get(mctx, sizeof(*sa));
|
||||||
if (sa == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
isc_sockaddr_fromin(sa, &localhost, destport);
|
isc_sockaddr_fromin(sa, &localhost, destport);
|
||||||
|
|
||||||
ISC_LINK_INIT(sa, link);
|
ISC_LINK_INIT(sa, link);
|
||||||
@ -946,10 +932,6 @@ findserver(dns_client_t *client) {
|
|||||||
|
|
||||||
if (use_ipv6) {
|
if (use_ipv6) {
|
||||||
sa = isc_mem_get(mctx, sizeof(*sa));
|
sa = isc_mem_get(mctx, sizeof(*sa));
|
||||||
if (sa == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
isc_sockaddr_fromin6(sa, &in6addr_loopback, destport);
|
isc_sockaddr_fromin6(sa, &in6addr_loopback, destport);
|
||||||
|
|
||||||
ISC_LINK_INIT(sa, link);
|
ISC_LINK_INIT(sa, link);
|
||||||
|
@ -530,9 +530,6 @@ match_keyset_dsset(dns_rdataset_t *keyset, dns_rdataset_t *dsset,
|
|||||||
nkey = dns_rdataset_count(keyset);
|
nkey = dns_rdataset_count(keyset);
|
||||||
|
|
||||||
keytable = isc_mem_get(mctx, sizeof(keyinfo_t) * nkey);
|
keytable = isc_mem_get(mctx, sizeof(keyinfo_t) * nkey);
|
||||||
if (keytable == NULL) {
|
|
||||||
fatal("out of memory");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (result = dns_rdataset_first(keyset), i = 0;
|
for (result = dns_rdataset_first(keyset), i = 0;
|
||||||
result == ISC_R_SUCCESS;
|
result == ISC_R_SUCCESS;
|
||||||
@ -610,10 +607,6 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
algo = isc_mem_get(mctx, nkey);
|
algo = isc_mem_get(mctx, nkey);
|
||||||
if (algo == NULL) {
|
|
||||||
fatal("allocating RRSIG/DNSKEY match list: %s",
|
|
||||||
isc_result_totext(ISC_R_NOMEMORY));
|
|
||||||
}
|
|
||||||
memset(algo, 0, nkey);
|
memset(algo, 0, nkey);
|
||||||
|
|
||||||
for (result = dns_rdataset_first(sigset);
|
for (result = dns_rdataset_first(sigset);
|
||||||
@ -747,10 +740,6 @@ rdata_get(void) {
|
|||||||
dns_rdata_t *rdata;
|
dns_rdata_t *rdata;
|
||||||
|
|
||||||
rdata = isc_mem_get(mctx, sizeof(*rdata));
|
rdata = isc_mem_get(mctx, sizeof(*rdata));
|
||||||
if (rdata == NULL) {
|
|
||||||
fatal("allocating DS rdata: %s",
|
|
||||||
isc_result_totext(ISC_R_NOMEMORY));
|
|
||||||
}
|
|
||||||
dns_rdata_init(rdata);
|
dns_rdata_init(rdata);
|
||||||
|
|
||||||
return (rdata);
|
return (rdata);
|
||||||
@ -835,10 +824,6 @@ make_new_ds_set(ds_maker_func_t *ds_from_rdata,
|
|||||||
dns_rdatalist_t *dslist;
|
dns_rdatalist_t *dslist;
|
||||||
|
|
||||||
dslist = isc_mem_get(mctx, sizeof(*dslist));
|
dslist = isc_mem_get(mctx, sizeof(*dslist));
|
||||||
if (dslist == NULL) {
|
|
||||||
fatal("allocating new DS list: %s",
|
|
||||||
isc_result_totext(ISC_R_NOMEMORY));
|
|
||||||
}
|
|
||||||
|
|
||||||
dns_rdatalist_init(dslist);
|
dns_rdatalist_init(dslist);
|
||||||
dslist->rdclass = rdclass;
|
dslist->rdclass = rdclass;
|
||||||
@ -907,10 +892,6 @@ consistent_digests(dns_rdataset_t *dsset) {
|
|||||||
n = dns_rdataset_count(dsset);
|
n = dns_rdataset_count(dsset);
|
||||||
|
|
||||||
arrdata = isc_mem_get(mctx, n * sizeof(dns_rdata_t));
|
arrdata = isc_mem_get(mctx, n * sizeof(dns_rdata_t));
|
||||||
if (arrdata == NULL) {
|
|
||||||
fatal("allocating DS rdata array: %s",
|
|
||||||
isc_result_totext(ISC_R_NOMEMORY));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (result = dns_rdataset_first(dsset), i = 0;
|
for (result = dns_rdataset_first(dsset), i = 0;
|
||||||
result == ISC_R_SUCCESS;
|
result == ISC_R_SUCCESS;
|
||||||
@ -926,10 +907,6 @@ consistent_digests(dns_rdataset_t *dsset) {
|
|||||||
* Convert sorted arrdata to more accessible format
|
* Convert sorted arrdata to more accessible format
|
||||||
*/
|
*/
|
||||||
ds = isc_mem_get(mctx, n * sizeof(dns_rdata_ds_t));
|
ds = isc_mem_get(mctx, n * sizeof(dns_rdata_ds_t));
|
||||||
if (ds == NULL) {
|
|
||||||
fatal("allocating unpacked DS array: %s",
|
|
||||||
isc_result_totext(ISC_R_NOMEMORY));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
result = dns_rdata_tostruct(&arrdata[i], &ds[i], NULL);
|
result = dns_rdata_tostruct(&arrdata[i], &ds[i], NULL);
|
||||||
|
@ -1496,8 +1496,6 @@ assignwork(isc_task_t *task, isc_task_t *worker) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fname = isc_mem_get(mctx, sizeof(dns_fixedname_t));
|
fname = isc_mem_get(mctx, sizeof(dns_fixedname_t));
|
||||||
if (fname == NULL)
|
|
||||||
fatal("out of memory");
|
|
||||||
name = dns_fixedname_initname(fname);
|
name = dns_fixedname_initname(fname);
|
||||||
node = NULL;
|
node = NULL;
|
||||||
found = false;
|
found = false;
|
||||||
@ -2930,8 +2928,6 @@ writeset(const char *prefix, dns_rdatatype_t type) {
|
|||||||
if (dsdir != NULL)
|
if (dsdir != NULL)
|
||||||
filenamelen += strlen(dsdir) + 1;
|
filenamelen += strlen(dsdir) + 1;
|
||||||
filename = isc_mem_get(mctx, filenamelen);
|
filename = isc_mem_get(mctx, filenamelen);
|
||||||
if (filename == NULL)
|
|
||||||
fatal("out of memory");
|
|
||||||
if (dsdir != NULL)
|
if (dsdir != NULL)
|
||||||
snprintf(filename, filenamelen, "%s/", dsdir);
|
snprintf(filename, filenamelen, "%s/", dsdir);
|
||||||
else
|
else
|
||||||
@ -3811,8 +3807,6 @@ main(int argc, char *argv[]) {
|
|||||||
} else {
|
} else {
|
||||||
tempfilelen = strlen(output) + 20;
|
tempfilelen = strlen(output) + 20;
|
||||||
tempfile = isc_mem_get(mctx, tempfilelen);
|
tempfile = isc_mem_get(mctx, tempfilelen);
|
||||||
if (tempfile == NULL)
|
|
||||||
fatal("out of memory");
|
|
||||||
|
|
||||||
result = isc_file_mktemplate(output, tempfile, tempfilelen);
|
result = isc_file_mktemplate(output, tempfile, tempfilelen);
|
||||||
check_result(result, "isc_file_mktemplate");
|
check_result(result, "isc_file_mktemplate");
|
||||||
@ -3842,8 +3836,6 @@ main(int argc, char *argv[]) {
|
|||||||
fatal("failed to create task: %s", isc_result_totext(result));
|
fatal("failed to create task: %s", isc_result_totext(result));
|
||||||
|
|
||||||
tasks = isc_mem_get(mctx, ntasks * sizeof(isc_task_t *));
|
tasks = isc_mem_get(mctx, ntasks * sizeof(isc_task_t *));
|
||||||
if (tasks == NULL)
|
|
||||||
fatal("out of memory");
|
|
||||||
for (i = 0; i < (int)ntasks; i++) {
|
for (i = 0; i < (int)ntasks; i++) {
|
||||||
tasks[i] = NULL;
|
tasks[i] = NULL;
|
||||||
result = isc_task_create(taskmgr, 0, &tasks[i]);
|
result = isc_task_create(taskmgr, 0, &tasks[i]);
|
||||||
|
@ -512,16 +512,9 @@ named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
dscps = isc_mem_get(mctx, count * sizeof(isc_dscp_t));
|
dscps = isc_mem_get(mctx, count * sizeof(isc_dscp_t));
|
||||||
if (dscps == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addrs = isc_mem_get(mctx, count * sizeof(isc_sockaddr_t));
|
addrs = isc_mem_get(mctx, count * sizeof(isc_sockaddr_t));
|
||||||
if (addrs == NULL) {
|
|
||||||
if (dscps != NULL)
|
|
||||||
isc_mem_put(mctx, dscps, count * sizeof(isc_dscp_t));
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (element = cfg_list_first(addrlist);
|
for (element = cfg_list_first(addrlist);
|
||||||
element != NULL;
|
element != NULL;
|
||||||
@ -697,8 +690,6 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
newsize = newlen * sizeof(*lists);
|
newsize = newlen * sizeof(*lists);
|
||||||
oldsize = listcount * sizeof(*lists);
|
oldsize = listcount * sizeof(*lists);
|
||||||
tmp = isc_mem_get(mctx, newsize);
|
tmp = isc_mem_get(mctx, newsize);
|
||||||
if (tmp == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
if (listcount != 0) {
|
if (listcount != 0) {
|
||||||
memmove(tmp, lists, oldsize);
|
memmove(tmp, lists, oldsize);
|
||||||
isc_mem_put(mctx, lists, oldsize);
|
isc_mem_put(mctx, lists, oldsize);
|
||||||
@ -733,8 +724,6 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
newsize = newlen * sizeof(*stack);
|
newsize = newlen * sizeof(*stack);
|
||||||
oldsize = stackcount * sizeof(*stack);
|
oldsize = stackcount * sizeof(*stack);
|
||||||
tmp = isc_mem_get(mctx, newsize);
|
tmp = isc_mem_get(mctx, newsize);
|
||||||
if (tmp == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
if (stackcount != 0) {
|
if (stackcount != 0) {
|
||||||
memmove(tmp, stack, oldsize);
|
memmove(tmp, stack, oldsize);
|
||||||
isc_mem_put(mctx, stack, oldsize);
|
isc_mem_put(mctx, stack, oldsize);
|
||||||
@ -761,8 +750,6 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
newsize = newlen * sizeof(isc_sockaddr_t);
|
newsize = newlen * sizeof(isc_sockaddr_t);
|
||||||
oldsize = addrcount * sizeof(isc_sockaddr_t);
|
oldsize = addrcount * sizeof(isc_sockaddr_t);
|
||||||
tmp = isc_mem_get(mctx, newsize);
|
tmp = isc_mem_get(mctx, newsize);
|
||||||
if (tmp == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
if (addrcount != 0) {
|
if (addrcount != 0) {
|
||||||
memmove(tmp, addrs, oldsize);
|
memmove(tmp, addrs, oldsize);
|
||||||
isc_mem_put(mctx, addrs, oldsize);
|
isc_mem_put(mctx, addrs, oldsize);
|
||||||
@ -773,8 +760,6 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
newsize = newlen * sizeof(isc_dscp_t);
|
newsize = newlen * sizeof(isc_dscp_t);
|
||||||
oldsize = dscpcount * sizeof(isc_dscp_t);
|
oldsize = dscpcount * sizeof(isc_dscp_t);
|
||||||
tmp = isc_mem_get(mctx, newsize);
|
tmp = isc_mem_get(mctx, newsize);
|
||||||
if (tmp == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
if (dscpcount != 0) {
|
if (dscpcount != 0) {
|
||||||
memmove(tmp, dscps, oldsize);
|
memmove(tmp, dscps, oldsize);
|
||||||
isc_mem_put(mctx, dscps, oldsize);
|
isc_mem_put(mctx, dscps, oldsize);
|
||||||
@ -785,8 +770,6 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
newsize = newlen * sizeof(dns_name_t *);
|
newsize = newlen * sizeof(dns_name_t *);
|
||||||
oldsize = keycount * sizeof(dns_name_t *);
|
oldsize = keycount * sizeof(dns_name_t *);
|
||||||
tmp = isc_mem_get(mctx, newsize);
|
tmp = isc_mem_get(mctx, newsize);
|
||||||
if (tmp == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
if (keycount != 0) {
|
if (keycount != 0) {
|
||||||
memmove(tmp, keys, oldsize);
|
memmove(tmp, keys, oldsize);
|
||||||
isc_mem_put(mctx, keys, oldsize);
|
isc_mem_put(mctx, keys, oldsize);
|
||||||
@ -806,8 +789,6 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
if (!cfg_obj_isstring(key))
|
if (!cfg_obj_isstring(key))
|
||||||
continue;
|
continue;
|
||||||
keys[i - 1] = isc_mem_get(mctx, sizeof(dns_name_t));
|
keys[i - 1] = isc_mem_get(mctx, sizeof(dns_name_t));
|
||||||
if (keys[i - 1] == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
dns_name_init(keys[i - 1], NULL);
|
dns_name_init(keys[i - 1], NULL);
|
||||||
|
|
||||||
keystr = cfg_obj_asstring(key);
|
keystr = cfg_obj_asstring(key);
|
||||||
@ -838,8 +819,6 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
oldsize = addrcount * sizeof(isc_sockaddr_t);
|
oldsize = addrcount * sizeof(isc_sockaddr_t);
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
tmp = isc_mem_get(mctx, newsize);
|
tmp = isc_mem_get(mctx, newsize);
|
||||||
if (tmp == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
memmove(tmp, addrs, newsize);
|
memmove(tmp, addrs, newsize);
|
||||||
} else
|
} else
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
@ -851,8 +830,6 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
oldsize = dscpcount * sizeof(isc_dscp_t);
|
oldsize = dscpcount * sizeof(isc_dscp_t);
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
tmp = isc_mem_get(mctx, newsize);
|
tmp = isc_mem_get(mctx, newsize);
|
||||||
if (tmp == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
memmove(tmp, dscps, newsize);
|
memmove(tmp, dscps, newsize);
|
||||||
} else
|
} else
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
@ -864,8 +841,6 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
oldsize = keycount * sizeof(dns_name_t *);
|
oldsize = keycount * sizeof(dns_name_t *);
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
tmp = isc_mem_get(mctx, newsize);
|
tmp = isc_mem_get(mctx, newsize);
|
||||||
if (tmp == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
memmove(tmp, keys, newsize);
|
memmove(tmp, keys, newsize);
|
||||||
} else
|
} else
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
|
@ -369,9 +369,8 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
|
|||||||
|
|
||||||
ccregion.rstart = isc_buffer_base(&conn->ccmsg.buffer);
|
ccregion.rstart = isc_buffer_base(&conn->ccmsg.buffer);
|
||||||
ccregion.rend = isc_buffer_used(&conn->ccmsg.buffer);
|
ccregion.rend = isc_buffer_used(&conn->ccmsg.buffer);
|
||||||
secret.rstart = isc_mem_get(listener->mctx, key->secret.length);
|
secret.rstart = isc_mem_get(listener->mctx,
|
||||||
if (secret.rstart == NULL)
|
key->secret.length);
|
||||||
goto cleanup;
|
|
||||||
memmove(secret.rstart, key->secret.base, key->secret.length);
|
memmove(secret.rstart, key->secret.base, key->secret.length);
|
||||||
secret.rend = secret.rstart + key->secret.length;
|
secret.rend = secret.rstart + key->secret.length;
|
||||||
algorithm = key->algorithm;
|
algorithm = key->algorithm;
|
||||||
@ -561,8 +560,6 @@ newconnection(controllistener_t *listener, isc_socket_t *sock) {
|
|||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
conn = isc_mem_get(listener->mctx, sizeof(*conn));
|
conn = isc_mem_get(listener->mctx, sizeof(*conn));
|
||||||
if (conn == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
conn->sock = sock;
|
conn->sock = sock;
|
||||||
isccc_ccmsg_init(listener->mctx, sock, &conn->ccmsg);
|
isccc_ccmsg_init(listener->mctx, sock, &conn->ccmsg);
|
||||||
@ -729,8 +726,6 @@ controlkeylist_fromcfg(const cfg_obj_t *keylist, isc_mem_t *mctx,
|
|||||||
if (newstr == NULL)
|
if (newstr == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
key = isc_mem_get(mctx, sizeof(*key));
|
key = isc_mem_get(mctx, sizeof(*key));
|
||||||
if (key == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
key->keyname = newstr;
|
key->keyname = newstr;
|
||||||
key->algorithm = DST_ALG_UNKNOWN;
|
key->algorithm = DST_ALG_UNKNOWN;
|
||||||
key->secret.base = NULL;
|
key->secret.base = NULL;
|
||||||
@ -819,15 +814,6 @@ register_keys(const cfg_obj_t *control, const cfg_obj_t *keylist,
|
|||||||
keyid->secret.length = isc_buffer_usedlength(&b);
|
keyid->secret.length = isc_buffer_usedlength(&b);
|
||||||
keyid->secret.base = isc_mem_get(mctx,
|
keyid->secret.base = isc_mem_get(mctx,
|
||||||
keyid->secret.length);
|
keyid->secret.length);
|
||||||
if (keyid->secret.base == NULL) {
|
|
||||||
cfg_obj_log(keydef, named_g_lctx,
|
|
||||||
ISC_LOG_WARNING,
|
|
||||||
"couldn't register key '%s': "
|
|
||||||
"out of memory", keyid->keyname);
|
|
||||||
ISC_LIST_UNLINK(*keyids, keyid, link);
|
|
||||||
free_controlkey(keyid, mctx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
memmove(keyid->secret.base, isc_buffer_base(&b),
|
memmove(keyid->secret.base, isc_buffer_base(&b),
|
||||||
keyid->secret.length);
|
keyid->secret.length);
|
||||||
}
|
}
|
||||||
@ -868,8 +854,6 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) {
|
|||||||
CHECK(cfg_map_get(config, "key", &key));
|
CHECK(cfg_map_get(config, "key", &key));
|
||||||
|
|
||||||
keyid = isc_mem_get(mctx, sizeof(*keyid));
|
keyid = isc_mem_get(mctx, sizeof(*keyid));
|
||||||
if (keyid == NULL)
|
|
||||||
CHECK(ISC_R_NOMEMORY);
|
|
||||||
keyid->keyname = isc_mem_strdup(mctx,
|
keyid->keyname = isc_mem_strdup(mctx,
|
||||||
cfg_obj_asstring(cfg_map_getname(key)));
|
cfg_obj_asstring(cfg_map_getname(key)));
|
||||||
keyid->secret.base = NULL;
|
keyid->secret.base = NULL;
|
||||||
@ -911,14 +895,7 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
keyid->secret.length = isc_buffer_usedlength(&b);
|
keyid->secret.length = isc_buffer_usedlength(&b);
|
||||||
keyid->secret.base = isc_mem_get(mctx,
|
keyid->secret.base = isc_mem_get(mctx, keyid->secret.length);
|
||||||
keyid->secret.length);
|
|
||||||
if (keyid->secret.base == NULL) {
|
|
||||||
cfg_obj_log(key, named_g_lctx, ISC_LOG_WARNING,
|
|
||||||
"couldn't register key '%s': "
|
|
||||||
"out of memory", keyid->keyname);
|
|
||||||
CHECK(ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memmove(keyid->secret.base, isc_buffer_base(&b),
|
memmove(keyid->secret.base, isc_buffer_base(&b),
|
||||||
keyid->secret.length);
|
keyid->secret.length);
|
||||||
ISC_LIST_APPEND(*keyids, keyid, link);
|
ISC_LIST_APPEND(*keyids, keyid, link);
|
||||||
@ -1125,8 +1102,6 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
|||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
|
|
||||||
listener = isc_mem_get(mctx, sizeof(*listener));
|
listener = isc_mem_get(mctx, sizeof(*listener));
|
||||||
if (listener == NULL)
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
|
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
listener->mctx = NULL;
|
listener->mctx = NULL;
|
||||||
|
@ -1945,10 +1945,6 @@ conf_dnsrps_sadd(conf_dnsrps_ctx_t *ctx, const char *p, ...) {
|
|||||||
|
|
||||||
if (ctx->cstr == NULL) {
|
if (ctx->cstr == NULL) {
|
||||||
ctx->cstr = isc_mem_get(ctx->mctx, 256);
|
ctx->cstr = isc_mem_get(ctx->mctx, 256);
|
||||||
if (ctx->cstr == NULL) {
|
|
||||||
ctx->result = ISC_R_NOMEMORY;
|
|
||||||
return (false);
|
|
||||||
}
|
|
||||||
ctx->cstr[0] = '\0';
|
ctx->cstr[0] = '\0';
|
||||||
ctx->cstr_size = 256;
|
ctx->cstr_size = 256;
|
||||||
}
|
}
|
||||||
@ -1964,10 +1960,6 @@ conf_dnsrps_sadd(conf_dnsrps_ctx_t *ctx, const char *p, ...) {
|
|||||||
|
|
||||||
new_cstr_size = ((cur_len + new_len)/256 + 1) * 256;
|
new_cstr_size = ((cur_len + new_len)/256 + 1) * 256;
|
||||||
new_cstr = isc_mem_get(ctx->mctx, new_cstr_size);
|
new_cstr = isc_mem_get(ctx->mctx, new_cstr_size);
|
||||||
if (new_cstr == NULL) {
|
|
||||||
ctx->result = ISC_R_NOMEMORY;
|
|
||||||
return (false);
|
|
||||||
}
|
|
||||||
|
|
||||||
memmove(new_cstr, ctx->cstr, cur_len);
|
memmove(new_cstr, ctx->cstr, cur_len);
|
||||||
isc_mem_put(ctx->mctx, ctx->cstr, ctx->cstr_size);
|
isc_mem_put(ctx->mctx, ctx->cstr, ctx->cstr_size);
|
||||||
@ -4372,10 +4364,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
|
|||||||
isc_mem_detach(&hmctx);
|
isc_mem_detach(&hmctx);
|
||||||
}
|
}
|
||||||
nsc = isc_mem_get(mctx, sizeof(*nsc));
|
nsc = isc_mem_get(mctx, sizeof(*nsc));
|
||||||
if (nsc == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
nsc->cache = NULL;
|
nsc->cache = NULL;
|
||||||
dns_cache_attach(cache, &nsc->cache);
|
dns_cache_attach(cache, &nsc->cache);
|
||||||
nsc->primaryview = view;
|
nsc->primaryview = view;
|
||||||
@ -5796,10 +5784,6 @@ configure_forward(const cfg_obj_t *config, dns_view_t *view,
|
|||||||
{
|
{
|
||||||
const cfg_obj_t *forwarder = cfg_listelt_value(element);
|
const cfg_obj_t *forwarder = cfg_listelt_value(element);
|
||||||
fwd = isc_mem_get(view->mctx, sizeof(dns_forwarder_t));
|
fwd = isc_mem_get(view->mctx, sizeof(dns_forwarder_t));
|
||||||
if (fwd == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
fwd->addr = *cfg_obj_assockaddr(forwarder);
|
fwd->addr = *cfg_obj_assockaddr(forwarder);
|
||||||
if (isc_sockaddr_getport(&fwd->addr) == 0)
|
if (isc_sockaddr_getport(&fwd->addr) == 0)
|
||||||
isc_sockaddr_setport(&fwd->addr, port);
|
isc_sockaddr_setport(&fwd->addr, port);
|
||||||
@ -6857,9 +6841,6 @@ dotat(dns_keytable_t *keytable, dns_keynode_t *keynode, void *arg) {
|
|||||||
view->name, namebuf);
|
view->name, namebuf);
|
||||||
|
|
||||||
tat = isc_mem_get(dotat_arg->view->mctx, sizeof(*tat));
|
tat = isc_mem_get(dotat_arg->view->mctx, sizeof(*tat));
|
||||||
if (tat == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
tat->mctx = NULL;
|
tat->mctx = NULL;
|
||||||
tat->task = NULL;
|
tat->task = NULL;
|
||||||
@ -7326,9 +7307,8 @@ configure_session_key(const cfg_obj_t **maps, named_server_t *server,
|
|||||||
INSIST(server->session_keyalg == DST_ALG_UNKNOWN);
|
INSIST(server->session_keyalg == DST_ALG_UNKNOWN);
|
||||||
INSIST(server->session_keybits == 0);
|
INSIST(server->session_keybits == 0);
|
||||||
|
|
||||||
server->session_keyname = isc_mem_get(mctx, sizeof(dns_name_t));
|
server->session_keyname = isc_mem_get(mctx,
|
||||||
if (server->session_keyname == NULL)
|
sizeof(dns_name_t));
|
||||||
goto cleanup;
|
|
||||||
dns_name_init(server->session_keyname, NULL);
|
dns_name_init(server->session_keyname, NULL);
|
||||||
CHECK(dns_name_dup(keyname, mctx, server->session_keyname));
|
CHECK(dns_name_dup(keyname, mctx, server->session_keyname));
|
||||||
|
|
||||||
@ -7537,10 +7517,6 @@ setup_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nzcfg = isc_mem_get(view->mctx, sizeof(*nzcfg));
|
nzcfg = isc_mem_get(view->mctx, sizeof(*nzcfg));
|
||||||
if (nzcfg == NULL) {
|
|
||||||
dns_view_setnewzones(view, false, NULL, NULL, 0ULL);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We attach the parser that was used for config as well
|
* We attach the parser that was used for config as well
|
||||||
@ -9170,10 +9146,6 @@ load_configuration(const char *filename, named_server_t *server,
|
|||||||
} else {
|
} else {
|
||||||
altsecret = isc_mem_get(server->sctx->mctx,
|
altsecret = isc_mem_get(server->sctx->mctx,
|
||||||
sizeof(*altsecret));
|
sizeof(*altsecret));
|
||||||
if (altsecret == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
isc_buffer_init(&b, altsecret->secret,
|
isc_buffer_init(&b, altsecret->secret,
|
||||||
sizeof(altsecret->secret));
|
sizeof(altsecret->secret));
|
||||||
result = isc_hex_decodestring(str, &b);
|
result = isc_hex_decodestring(str, &b);
|
||||||
@ -9398,9 +9370,7 @@ load_zones(named_server_t *server, bool init, bool reconfig) {
|
|||||||
dns_view_t *view;
|
dns_view_t *view;
|
||||||
ns_zoneload_t *zl;
|
ns_zoneload_t *zl;
|
||||||
|
|
||||||
zl = isc_mem_get(server->mctx, sizeof (*zl));
|
zl = isc_mem_get(server->mctx, sizeof(*zl));
|
||||||
if (zl == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
zl->server = server;
|
zl->server = server;
|
||||||
zl->reconfig = reconfig;
|
zl->reconfig = reconfig;
|
||||||
|
|
||||||
@ -9952,10 +9922,6 @@ named_add_reserved_dispatch(named_server_t *server,
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispatch = isc_mem_get(server->mctx, sizeof(*dispatch));
|
dispatch = isc_mem_get(server->mctx, sizeof(*dispatch));
|
||||||
if (dispatch == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch->addr = *addr;
|
dispatch->addr = *addr;
|
||||||
dispatch->dispatchgen = server->dispatchgen;
|
dispatch->dispatchgen = server->dispatchgen;
|
||||||
@ -10629,8 +10595,6 @@ add_zone_tolist(dns_zone_t *zone, void *uap) {
|
|||||||
struct zonelistentry *zle;
|
struct zonelistentry *zle;
|
||||||
|
|
||||||
zle = isc_mem_get(dctx->mctx, sizeof *zle);
|
zle = isc_mem_get(dctx->mctx, sizeof *zle);
|
||||||
if (zle == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
zle->zone = NULL;
|
zle->zone = NULL;
|
||||||
dns_zone_attach(zone, &zle->zone);
|
dns_zone_attach(zone, &zle->zone);
|
||||||
ISC_LINK_INIT(zle, link);
|
ISC_LINK_INIT(zle, link);
|
||||||
@ -10653,8 +10617,6 @@ add_view_tolist(struct dumpcontext *dctx, dns_view_t *view) {
|
|||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
|
|
||||||
vle = isc_mem_get(dctx->mctx, sizeof *vle);
|
vle = isc_mem_get(dctx->mctx, sizeof *vle);
|
||||||
if (vle == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
vle->view = NULL;
|
vle->view = NULL;
|
||||||
dns_view_attach(view, &vle->view);
|
dns_view_attach(view, &vle->view);
|
||||||
ISC_LINK_INIT(vle, link);
|
ISC_LINK_INIT(vle, link);
|
||||||
@ -10847,8 +10809,6 @@ named_server_dumpdb(named_server_t *server, isc_lex_t *lex,
|
|||||||
return (ISC_R_UNEXPECTEDEND);
|
return (ISC_R_UNEXPECTEDEND);
|
||||||
|
|
||||||
dctx = isc_mem_get(server->mctx, sizeof(*dctx));
|
dctx = isc_mem_get(server->mctx, sizeof(*dctx));
|
||||||
if (dctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
dctx->mctx = server->mctx;
|
dctx->mctx = server->mctx;
|
||||||
dctx->dumpcache = true;
|
dctx->dumpcache = true;
|
||||||
@ -13655,8 +13615,6 @@ named_server_delzone(named_server_t *server, isc_lex_t *lex,
|
|||||||
|
|
||||||
/* Send cleanup event */
|
/* Send cleanup event */
|
||||||
dz = isc_mem_get(named_g_mctx, sizeof(*dz));
|
dz = isc_mem_get(named_g_mctx, sizeof(*dz));
|
||||||
if (dz == NULL)
|
|
||||||
CHECK(ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
dz->cleanup = cleanup;
|
dz->cleanup = cleanup;
|
||||||
dz->zone = NULL;
|
dz->zone = NULL;
|
||||||
|
@ -3403,8 +3403,6 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
|
|||||||
dns_acl_t *new_acl = NULL;
|
dns_acl_t *new_acl = NULL;
|
||||||
|
|
||||||
listener = isc_mem_get(server->mctx, sizeof(*listener));
|
listener = isc_mem_get(server->mctx, sizeof(*listener));
|
||||||
if (listener == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
listener->httpdmgr = NULL;
|
listener->httpdmgr = NULL;
|
||||||
listener->address = *addr;
|
listener->address = *addr;
|
||||||
|
@ -84,10 +84,6 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
|
|||||||
name = dns_fixedname_initname(&fname);
|
name = dns_fixedname_initname(&fname);
|
||||||
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
|
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
|
||||||
tctx->domain = isc_mem_get(mctx, sizeof(dns_name_t));
|
tctx->domain = isc_mem_get(mctx, sizeof(dns_name_t));
|
||||||
if (tctx->domain == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
dns_name_init(tctx->domain, NULL);
|
dns_name_init(tctx->domain, NULL);
|
||||||
RETERR(dns_name_dup(name, mctx, tctx->domain));
|
RETERR(dns_name_dup(name, mctx, tctx->domain));
|
||||||
}
|
}
|
||||||
|
@ -97,10 +97,6 @@ add_initial_keys(const cfg_obj_t *list, dns_tsig_keyring_t *ring,
|
|||||||
secretstr = cfg_obj_asstring(secretobj);
|
secretstr = cfg_obj_asstring(secretobj);
|
||||||
secretalloc = secretlen = strlen(secretstr) * 3 / 4;
|
secretalloc = secretlen = strlen(secretstr) * 3 / 4;
|
||||||
secret = isc_mem_get(mctx, secretlen);
|
secret = isc_mem_get(mctx, secretlen);
|
||||||
if (secret == NULL) {
|
|
||||||
ret = ISC_R_NOMEMORY;
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
isc_buffer_init(&secretbuf, secret, secretlen);
|
isc_buffer_init(&secretbuf, secret, secretlen);
|
||||||
ret = isc_base64_decodestring(secretstr, &secretbuf);
|
ret = isc_base64_decodestring(secretstr, &secretbuf);
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
|
@ -230,10 +230,6 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
return (result);
|
return (result);
|
||||||
|
|
||||||
cd = isc_mem_get(mctx, sizeof(*cd));
|
cd = isc_mem_get(mctx, sizeof(*cd));
|
||||||
if (cd == NULL) {
|
|
||||||
isc_mem_destroy(&mctx);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memset(cd, 0, sizeof(*cd));
|
memset(cd, 0, sizeof(*cd));
|
||||||
|
|
||||||
cd->mctx = mctx;
|
cd->mctx = mctx;
|
||||||
|
@ -227,10 +227,6 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
isc_mem_create(0, 0, &mctx);
|
isc_mem_create(0, 0, &mctx);
|
||||||
|
|
||||||
cd = isc_mem_get(mctx, sizeof(*cd));
|
cd = isc_mem_get(mctx, sizeof(*cd));
|
||||||
if (cd == NULL) {
|
|
||||||
isc_mem_destroy(&mctx);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memset(cd, 0, sizeof(*cd));
|
memset(cd, 0, sizeof(*cd));
|
||||||
|
|
||||||
cd->mctx = mctx;
|
cd->mctx = mctx;
|
||||||
|
@ -287,10 +287,6 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
|
|||||||
types = NULL;
|
types = NULL;
|
||||||
else {
|
else {
|
||||||
types = isc_mem_get(mctx, n * sizeof(dns_rdatatype_t));
|
types = isc_mem_get(mctx, n * sizeof(dns_rdatatype_t));
|
||||||
if (types == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -433,8 +429,6 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rdata = isc_mem_get(mctx, sizeof(*rdata) + region.length);
|
rdata = isc_mem_get(mctx, sizeof(*rdata) + region.length);
|
||||||
if (rdata == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
region.base = (unsigned char *)(rdata + 1);
|
region.base = (unsigned char *)(rdata + 1);
|
||||||
memmove(region.base, &na.type, region.length);
|
memmove(region.base, &na.type, region.length);
|
||||||
dns_rdata_init(rdata);
|
dns_rdata_init(rdata);
|
||||||
@ -455,13 +449,6 @@ configure_staticstub_serveraddrs(const cfg_obj_t *zconfig, dns_zone_t *zone,
|
|||||||
/* Add to the list an apex NS with the ns name being the origin name */
|
/* Add to the list an apex NS with the ns name being the origin name */
|
||||||
dns_name_toregion(dns_zone_getorigin(zone), &sregion);
|
dns_name_toregion(dns_zone_getorigin(zone), &sregion);
|
||||||
rdata = isc_mem_get(mctx, sizeof(*rdata) + sregion.length);
|
rdata = isc_mem_get(mctx, sizeof(*rdata) + sregion.length);
|
||||||
if (rdata == NULL) {
|
|
||||||
/*
|
|
||||||
* Already allocated data will be freed in the caller, so
|
|
||||||
* we can simply return here.
|
|
||||||
*/
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
region.length = sregion.length;
|
region.length = sregion.length;
|
||||||
region.base = (unsigned char *)(rdata + 1);
|
region.base = (unsigned char *)(rdata + 1);
|
||||||
memmove(region.base, sregion.base, region.length);
|
memmove(region.base, sregion.base, region.length);
|
||||||
@ -523,8 +510,6 @@ configure_staticstub_servernames(const cfg_obj_t *zconfig, dns_zone_t *zone,
|
|||||||
|
|
||||||
dns_name_toregion(nsname, &sregion);
|
dns_name_toregion(nsname, &sregion);
|
||||||
rdata = isc_mem_get(mctx, sizeof(*rdata) + sregion.length);
|
rdata = isc_mem_get(mctx, sizeof(*rdata) + sregion.length);
|
||||||
if (rdata == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
region.length = sregion.length;
|
region.length = sregion.length;
|
||||||
region.base = (unsigned char *)(rdata + 1);
|
region.base = (unsigned char *)(rdata + 1);
|
||||||
memmove(region.base, sregion.base, region.length);
|
memmove(region.base, sregion.base, region.length);
|
||||||
@ -718,8 +703,6 @@ strtoargvsub(isc_mem_t *mctx, char *s, unsigned int *argcp,
|
|||||||
/* We have reached the end of the string. */
|
/* We have reached the end of the string. */
|
||||||
*argcp = n;
|
*argcp = n;
|
||||||
*argvp = isc_mem_get(mctx, n * sizeof(char *));
|
*argvp = isc_mem_get(mctx, n * sizeof(char *));
|
||||||
if (*argvp == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
} else {
|
} else {
|
||||||
char *p = s;
|
char *p = s;
|
||||||
while (*p != ' ' && *p != '\t' && *p != '\0')
|
while (*p != ' ' && *p != '\t' && *p != '\0')
|
||||||
@ -1098,8 +1081,6 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
RETERR(dns_zone_setfile(raw, filename,
|
RETERR(dns_zone_setfile(raw, filename,
|
||||||
masterformat, masterstyle));
|
masterformat, masterstyle));
|
||||||
signedname = isc_mem_get(mctx, signedlen);
|
signedname = isc_mem_get(mctx, signedlen);
|
||||||
if (signedname == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
(void)snprintf(signedname, signedlen, "%s" SIGNED, filename);
|
(void)snprintf(signedname, signedlen, "%s" SIGNED, filename);
|
||||||
result = dns_zone_setfile(zone, signedname,
|
result = dns_zone_setfile(zone, signedname,
|
||||||
|
@ -824,9 +824,8 @@ setup_system(void) {
|
|||||||
default_servers = !local_only;
|
default_servers = !local_only;
|
||||||
|
|
||||||
ns_total = ns_alloc = (have_ipv4 ? 1 : 0) + (have_ipv6 ? 1 : 0);
|
ns_total = ns_alloc = (have_ipv4 ? 1 : 0) + (have_ipv6 ? 1 : 0);
|
||||||
servers = isc_mem_get(gmctx, ns_alloc * sizeof(isc_sockaddr_t));
|
servers = isc_mem_get(gmctx,
|
||||||
if (servers == NULL)
|
ns_alloc * sizeof(isc_sockaddr_t));
|
||||||
fatal("out of memory");
|
|
||||||
|
|
||||||
if (have_ipv6) {
|
if (have_ipv6) {
|
||||||
memset(&in6, 0, sizeof(in6));
|
memset(&in6, 0, sizeof(in6));
|
||||||
@ -869,9 +868,8 @@ setup_system(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ns_alloc = ns_total;
|
ns_alloc = ns_total;
|
||||||
servers = isc_mem_get(gmctx, ns_alloc * sizeof(isc_sockaddr_t));
|
servers = isc_mem_get(gmctx,
|
||||||
if (servers == NULL)
|
ns_alloc * sizeof(isc_sockaddr_t));
|
||||||
fatal("out of memory");
|
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (sa = ISC_LIST_HEAD(*nslist);
|
for (sa = ISC_LIST_HEAD(*nslist);
|
||||||
@ -1497,8 +1495,6 @@ evaluate_server(char *cmdline) {
|
|||||||
ns_alloc = MAX_SERVERADDRS;
|
ns_alloc = MAX_SERVERADDRS;
|
||||||
ns_inuse = 0;
|
ns_inuse = 0;
|
||||||
servers = isc_mem_get(gmctx, ns_alloc * sizeof(isc_sockaddr_t));
|
servers = isc_mem_get(gmctx, ns_alloc * sizeof(isc_sockaddr_t));
|
||||||
if (servers == NULL)
|
|
||||||
fatal("out of memory");
|
|
||||||
|
|
||||||
memset(servers, 0, ns_alloc * sizeof(isc_sockaddr_t));
|
memset(servers, 0, ns_alloc * sizeof(isc_sockaddr_t));
|
||||||
ns_total = get_addresses(server, (in_port_t)port, servers, ns_alloc);
|
ns_total = get_addresses(server, (in_port_t)port, servers, ns_alloc);
|
||||||
@ -1541,15 +1537,13 @@ evaluate_local(char *cmdline) {
|
|||||||
|
|
||||||
if (have_ipv6 && inet_pton(AF_INET6, local, &in6) == 1) {
|
if (have_ipv6 && inet_pton(AF_INET6, local, &in6) == 1) {
|
||||||
if (localaddr6 == NULL)
|
if (localaddr6 == NULL)
|
||||||
localaddr6 = isc_mem_get(gmctx, sizeof(isc_sockaddr_t));
|
localaddr6 = isc_mem_get(gmctx,
|
||||||
if (localaddr6 == NULL)
|
sizeof(isc_sockaddr_t));
|
||||||
fatal("out of memory");
|
|
||||||
isc_sockaddr_fromin6(localaddr6, &in6, (in_port_t)port);
|
isc_sockaddr_fromin6(localaddr6, &in6, (in_port_t)port);
|
||||||
} else if (have_ipv4 && inet_pton(AF_INET, local, &in4) == 1) {
|
} else if (have_ipv4 && inet_pton(AF_INET, local, &in4) == 1) {
|
||||||
if (localaddr4 == NULL)
|
if (localaddr4 == NULL)
|
||||||
localaddr4 = isc_mem_get(gmctx, sizeof(isc_sockaddr_t));
|
localaddr4 = isc_mem_get(gmctx,
|
||||||
if (localaddr4 == NULL)
|
sizeof(isc_sockaddr_t));
|
||||||
fatal("out of memory");
|
|
||||||
isc_sockaddr_fromin(localaddr4, &in4, (in_port_t)port);
|
isc_sockaddr_fromin(localaddr4, &in4, (in_port_t)port);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "invalid address %s", local);
|
fprintf(stderr, "invalid address %s", local);
|
||||||
@ -2520,8 +2514,6 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
|
|||||||
ddebug("Destroying request [%p]", request);
|
ddebug("Destroying request [%p]", request);
|
||||||
dns_request_destroy(&request);
|
dns_request_destroy(&request);
|
||||||
reqinfo = isc_mem_get(gmctx, sizeof(nsu_requestinfo_t));
|
reqinfo = isc_mem_get(gmctx, sizeof(nsu_requestinfo_t));
|
||||||
if (reqinfo == NULL)
|
|
||||||
fatal("out of memory");
|
|
||||||
reqinfo->msg = soaquery;
|
reqinfo->msg = soaquery;
|
||||||
reqinfo->addr = addr;
|
reqinfo->addr = addr;
|
||||||
dns_message_renderreset(soaquery);
|
dns_message_renderreset(soaquery);
|
||||||
@ -2659,8 +2651,6 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
|
|||||||
master_alloc = MAX_SERVERADDRS;
|
master_alloc = MAX_SERVERADDRS;
|
||||||
size = master_alloc * sizeof(isc_sockaddr_t);
|
size = master_alloc * sizeof(isc_sockaddr_t);
|
||||||
master_servers = isc_mem_get(gmctx, size);
|
master_servers = isc_mem_get(gmctx, size);
|
||||||
if (master_servers == NULL)
|
|
||||||
fatal("out of memory");
|
|
||||||
|
|
||||||
memset(master_servers, 0, size);
|
memset(master_servers, 0, size);
|
||||||
master_total = get_addresses(serverstr, dnsport,
|
master_total = get_addresses(serverstr, dnsport,
|
||||||
@ -2724,8 +2714,6 @@ sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
|
|||||||
isc_sockaddr_t *srcaddr;
|
isc_sockaddr_t *srcaddr;
|
||||||
|
|
||||||
reqinfo = isc_mem_get(gmctx, sizeof(nsu_requestinfo_t));
|
reqinfo = isc_mem_get(gmctx, sizeof(nsu_requestinfo_t));
|
||||||
if (reqinfo == NULL)
|
|
||||||
fatal("out of memory");
|
|
||||||
reqinfo->msg = msg;
|
reqinfo->msg = msg;
|
||||||
reqinfo->addr = destaddr;
|
reqinfo->addr = destaddr;
|
||||||
|
|
||||||
@ -2835,8 +2823,6 @@ start_gssrequest(dns_name_t *master) {
|
|||||||
dns_name_format(master, namestr, sizeof(namestr));
|
dns_name_format(master, namestr, sizeof(namestr));
|
||||||
if (kserver == NULL) {
|
if (kserver == NULL) {
|
||||||
kserver = isc_mem_get(gmctx, sizeof(isc_sockaddr_t));
|
kserver = isc_mem_get(gmctx, sizeof(isc_sockaddr_t));
|
||||||
if (kserver == NULL)
|
|
||||||
fatal("out of memory");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove(kserver, &master_servers[master_inuse],
|
memmove(kserver, &master_servers[master_inuse],
|
||||||
@ -2920,8 +2906,6 @@ send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
|
|||||||
|
|
||||||
debug("send_gssrequest");
|
debug("send_gssrequest");
|
||||||
reqinfo = isc_mem_get(gmctx, sizeof(nsu_gssinfo_t));
|
reqinfo = isc_mem_get(gmctx, sizeof(nsu_gssinfo_t));
|
||||||
if (reqinfo == NULL)
|
|
||||||
fatal("out of memory");
|
|
||||||
reqinfo->msg = msg;
|
reqinfo->msg = msg;
|
||||||
reqinfo->addr = destaddr;
|
reqinfo->addr = destaddr;
|
||||||
reqinfo->context = context;
|
reqinfo->context = context;
|
||||||
|
@ -968,8 +968,6 @@ main(int argc, char **argv) {
|
|||||||
argslen += strlen(argv[i]) + 1;
|
argslen += strlen(argv[i]) + 1;
|
||||||
|
|
||||||
args = isc_mem_get(rndc_mctx, argslen);
|
args = isc_mem_get(rndc_mctx, argslen);
|
||||||
if (args == NULL)
|
|
||||||
DO("isc_mem_get", ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
p = args;
|
p = args;
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
|
@ -231,8 +231,6 @@ load(const char *filename, const char *origintext, bool cache) {
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
dbi = isc_mem_get(mctx, sizeof(*dbi));
|
dbi = isc_mem_get(mctx, sizeof(*dbi));
|
||||||
if (dbi == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
dbi->db = NULL;
|
dbi->db = NULL;
|
||||||
dbi->version = NULL;
|
dbi->version = NULL;
|
||||||
|
@ -55,10 +55,6 @@ create_name(char *s) {
|
|||||||
* name structure.
|
* name structure.
|
||||||
*/
|
*/
|
||||||
name = isc_mem_get(mctx, sizeof(*name) + DNSNAMELEN);
|
name = isc_mem_get(mctx, sizeof(*name) + DNSNAMELEN);
|
||||||
if (name == NULL) {
|
|
||||||
printf("out of memory!\n");
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
dns_name_init(name, NULL);
|
dns_name_init(name, NULL);
|
||||||
isc_buffer_init(&target, name + 1, DNSNAMELEN);
|
isc_buffer_init(&target, name + 1, DNSNAMELEN);
|
||||||
|
@ -104,11 +104,10 @@ my_recv(isc_task_t *task, isc_event_t *event) {
|
|||||||
snprintf(buf, sizeof(buf), "\r\nReceived: %.*s\r\n\r\n",
|
snprintf(buf, sizeof(buf), "\r\nReceived: %.*s\r\n\r\n",
|
||||||
(int)dev->n, (char *)region.base);
|
(int)dev->n, (char *)region.base);
|
||||||
region.base = isc_mem_get(mctx, strlen(buf) + 1);
|
region.base = isc_mem_get(mctx, strlen(buf) + 1);
|
||||||
if (region.base != NULL) {
|
{
|
||||||
region.length = strlen(buf) + 1;
|
region.length = strlen(buf) + 1;
|
||||||
strlcpy((char *)region.base, buf, region.length);
|
strlcpy((char *)region.base, buf, region.length);
|
||||||
} else
|
}
|
||||||
region.length = 0;
|
|
||||||
isc_socket_send(sock, ®ion, task, my_send, event->ev_arg);
|
isc_socket_send(sock, ®ion, task, my_send, event->ev_arg);
|
||||||
} else {
|
} else {
|
||||||
region = dev->region;
|
region = dev->region;
|
||||||
@ -177,11 +176,9 @@ my_connect(isc_task_t *task, isc_event_t *event) {
|
|||||||
"GET / HTTP/1.1\r\nHost: www.flame.org\r\n"
|
"GET / HTTP/1.1\r\nHost: www.flame.org\r\n"
|
||||||
"Connection: Close\r\n\r\n");
|
"Connection: Close\r\n\r\n");
|
||||||
region.base = isc_mem_get(mctx, strlen(buf) + 1);
|
region.base = isc_mem_get(mctx, strlen(buf) + 1);
|
||||||
if (region.base != NULL) {
|
{
|
||||||
region.length = strlen(buf) + 1;
|
region.length = strlen(buf) + 1;
|
||||||
strlcpy((char *)region.base, buf, region.length);
|
strlcpy((char *)region.base, buf, region.length);
|
||||||
} else {
|
|
||||||
region.length = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_socket_send(sock, ®ion, task, my_http_get, event->ev_arg);
|
isc_socket_send(sock, ®ion, task, my_http_get, event->ev_arg);
|
||||||
|
@ -80,10 +80,6 @@ printmessage(dns_message_t *msg) {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
buf = isc_mem_get(mctx, len);
|
buf = isc_mem_get(mctx, len);
|
||||||
if (buf == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
isc_buffer_init(&b, buf, len);
|
isc_buffer_init(&b, buf, len);
|
||||||
result = dns_message_totext(msg, &dns_master_style_debug,
|
result = dns_message_totext(msg, &dns_master_style_debug,
|
||||||
|
@ -617,13 +617,6 @@ bdb_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
|
|
||||||
/* allocate and zero memory for driver structure */
|
/* allocate and zero memory for driver structure */
|
||||||
db = isc_mem_get(named_g_mctx, sizeof(bdb_instance_t));
|
db = isc_mem_get(named_g_mctx, sizeof(bdb_instance_t));
|
||||||
if (db == NULL) {
|
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
|
||||||
"Could not allocate memory for "
|
|
||||||
"database instance object.");
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memset(db, 0, sizeof(bdb_instance_t));
|
memset(db, 0, sizeof(bdb_instance_t));
|
||||||
|
|
||||||
/* attach to the memory context */
|
/* attach to the memory context */
|
||||||
|
@ -707,13 +707,6 @@ bdbhpt_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
|
|
||||||
/* allocate and zero memory for driver structure */
|
/* allocate and zero memory for driver structure */
|
||||||
db = isc_mem_get(named_g_mctx, sizeof(bdbhpt_instance_t));
|
db = isc_mem_get(named_g_mctx, sizeof(bdbhpt_instance_t));
|
||||||
if (db == NULL) {
|
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
|
||||||
"Could not allocate memory for "
|
|
||||||
"database instance object.");
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memset(db, 0, sizeof(bdbhpt_instance_t));
|
memset(db, 0, sizeof(bdbhpt_instance_t));
|
||||||
|
|
||||||
/* attach to the memory context */
|
/* attach to the memory context */
|
||||||
|
@ -486,11 +486,8 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd,
|
|||||||
* dir list
|
* dir list
|
||||||
*/
|
*/
|
||||||
if (dir_list != NULL) {
|
if (dir_list != NULL) {
|
||||||
direntry =
|
direntry = isc_mem_get(named_g_mctx,
|
||||||
isc_mem_get(named_g_mctx,
|
|
||||||
sizeof(dir_entry_t));
|
sizeof(dir_entry_t));
|
||||||
if (direntry == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
strcpy(direntry->dirpath, tmp);
|
strcpy(direntry->dirpath, tmp);
|
||||||
ISC_LINK_INIT(direntry, link);
|
ISC_LINK_INIT(direntry, link);
|
||||||
ISC_LIST_APPEND(*dir_list, direntry,
|
ISC_LIST_APPEND(*dir_list, direntry,
|
||||||
@ -645,10 +642,6 @@ fs_allnodes(const char *zone, void *driverarg, void *dbdata,
|
|||||||
|
|
||||||
/* allocate memory for list */
|
/* allocate memory for list */
|
||||||
dir_list = isc_mem_get(named_g_mctx, sizeof(dlist_t));
|
dir_list = isc_mem_get(named_g_mctx, sizeof(dlist_t));
|
||||||
if (dir_list == NULL) {
|
|
||||||
result = ISC_R_NOTFOUND;
|
|
||||||
goto complete_allnds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize list */
|
/* initialize list */
|
||||||
ISC_LIST_INIT(*dir_list);
|
ISC_LIST_INIT(*dir_list);
|
||||||
@ -905,8 +898,6 @@ fs_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
|
|
||||||
/* allocate memory for our config data */
|
/* allocate memory for our config data */
|
||||||
cd = isc_mem_get(named_g_mctx, sizeof(config_data_t));
|
cd = isc_mem_get(named_g_mctx, sizeof(config_data_t));
|
||||||
if (cd == NULL)
|
|
||||||
goto no_mem;
|
|
||||||
|
|
||||||
/* zero the memory */
|
/* zero the memory */
|
||||||
memset(cd, 0, sizeof(config_data_t));
|
memset(cd, 0, sizeof(config_data_t));
|
||||||
|
@ -1014,8 +1014,6 @@ dlz_ldap_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
|
|
||||||
/* allocate memory for LDAP instance */
|
/* allocate memory for LDAP instance */
|
||||||
ldap_inst = isc_mem_get(named_g_mctx, sizeof(ldap_instance_t));
|
ldap_inst = isc_mem_get(named_g_mctx, sizeof(ldap_instance_t));
|
||||||
if (ldap_inst == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(ldap_inst, 0, sizeof(ldap_instance_t));
|
memset(ldap_inst, 0, sizeof(ldap_instance_t));
|
||||||
|
|
||||||
/* store info needed to automatically re-connect. */
|
/* store info needed to automatically re-connect. */
|
||||||
@ -1039,10 +1037,6 @@ dlz_ldap_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
|
|
||||||
/* allocate memory for database connection list */
|
/* allocate memory for database connection list */
|
||||||
ldap_inst->db = isc_mem_get(named_g_mctx, sizeof(db_list_t));
|
ldap_inst->db = isc_mem_get(named_g_mctx, sizeof(db_list_t));
|
||||||
if (ldap_inst->db == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize DB connection list */
|
/* initialize DB connection list */
|
||||||
ISC_LIST_INIT(*(ldap_inst->db));
|
ISC_LIST_INIT(*(ldap_inst->db));
|
||||||
|
@ -1219,8 +1219,6 @@ odbc_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
|
|
||||||
/* allocate memory for odbc instance */
|
/* allocate memory for odbc instance */
|
||||||
odbc_inst = isc_mem_get(named_g_mctx, sizeof(odbc_instance_t));
|
odbc_inst = isc_mem_get(named_g_mctx, sizeof(odbc_instance_t));
|
||||||
if (odbc_inst == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(odbc_inst, 0, sizeof(odbc_instance_t));
|
memset(odbc_inst, 0, sizeof(odbc_instance_t));
|
||||||
|
|
||||||
/* parse connection string and get paramters. */
|
/* parse connection string and get paramters. */
|
||||||
@ -1271,10 +1269,6 @@ odbc_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
|
|
||||||
/* allocate memory for database connection list */
|
/* allocate memory for database connection list */
|
||||||
odbc_inst->db = isc_mem_get(named_g_mctx, sizeof(db_list_t));
|
odbc_inst->db = isc_mem_get(named_g_mctx, sizeof(db_list_t));
|
||||||
if (odbc_inst->db == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* initialize DB connection list */
|
/* initialize DB connection list */
|
||||||
|
@ -1087,8 +1087,6 @@ postgres_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
|
|
||||||
/* allocate memory for database connection list */
|
/* allocate memory for database connection list */
|
||||||
dblist = isc_mem_get(named_g_mctx, sizeof(db_list_t));
|
dblist = isc_mem_get(named_g_mctx, sizeof(db_list_t));
|
||||||
if (dblist == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
/* initialize DB connection list */
|
/* initialize DB connection list */
|
||||||
ISC_LIST_INIT(*dblist);
|
ISC_LIST_INIT(*dblist);
|
||||||
|
@ -125,9 +125,6 @@ build_querylist(isc_mem_t *mctx, const char *query_str, char **zone,
|
|||||||
|
|
||||||
/* allocate memory for query list */
|
/* allocate memory for query list */
|
||||||
tql = isc_mem_get(mctx, sizeof(query_list_t));
|
tql = isc_mem_get(mctx, sizeof(query_list_t));
|
||||||
/* couldn't allocate memory. Problem!! */
|
|
||||||
if (tql == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
/* initialize the query segment list */
|
/* initialize the query segment list */
|
||||||
ISC_LIST_INIT(*tql);
|
ISC_LIST_INIT(*tql);
|
||||||
@ -153,10 +150,6 @@ build_querylist(isc_mem_t *mctx, const char *query_str, char **zone,
|
|||||||
|
|
||||||
/* allocate memory for tseg */
|
/* allocate memory for tseg */
|
||||||
tseg = isc_mem_get(mctx, sizeof(query_segment_t));
|
tseg = isc_mem_get(mctx, sizeof(query_segment_t));
|
||||||
if (tseg == NULL) { /* no memory, clean everything up. */
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
tseg->sql = NULL;
|
tseg->sql = NULL;
|
||||||
tseg->direct = false;
|
tseg->direct = false;
|
||||||
/* initialize the query segment link */
|
/* initialize the query segment link */
|
||||||
@ -340,13 +333,6 @@ sdlzh_build_sqldbinstance(isc_mem_t *mctx, const char *allnodes_str,
|
|||||||
|
|
||||||
/* allocate and zero memory for driver structure */
|
/* allocate and zero memory for driver structure */
|
||||||
db = isc_mem_get(mctx, sizeof(dbinstance_t));
|
db = isc_mem_get(mctx, sizeof(dbinstance_t));
|
||||||
if (db == NULL) {
|
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
|
||||||
"Could not allocate memory for "
|
|
||||||
"database instance object.");
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memset(db, 0, sizeof(dbinstance_t));
|
memset(db, 0, sizeof(dbinstance_t));
|
||||||
db->dbconn = NULL;
|
db->dbconn = NULL;
|
||||||
db->client = NULL;
|
db->client = NULL;
|
||||||
|
@ -529,8 +529,6 @@ memory context is freed before all references have been cleaned up.
|
|||||||
REQUIRE(foop != NULL && *foop == NULL);
|
REQUIRE(foop != NULL && *foop == NULL);
|
||||||
|
|
||||||
foo = isc_mem_get(mctx, sizeof(isc_foo_t))
|
foo = isc_mem_get(mctx, sizeof(isc_foo_t))
|
||||||
if (foo == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
/* Attach to memory context */
|
/* Attach to memory context */
|
||||||
isc_mem_attach(mctx, &foo->mctx);
|
isc_mem_attach(mctx, &foo->mctx);
|
||||||
@ -615,8 +613,6 @@ When creating an instance of this structure, initialize the link:
|
|||||||
REQUIRE(foop != NULL && *foop == NULL);
|
REQUIRE(foop != NULL && *foop == NULL);
|
||||||
|
|
||||||
foo = isc_mem_get(mctx, sizeof(isc_foo_t));
|
foo = isc_mem_get(mctx, sizeof(isc_foo_t));
|
||||||
if (foo == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
ISC_LINK_INIT(foo, link);
|
ISC_LINK_INIT(foo, link);
|
||||||
|
|
||||||
|
@ -1619,8 +1619,6 @@ validate_masters(const cfg_obj_t *obj, const cfg_obj_t *config,
|
|||||||
newsize = newlen * sizeof(*stack);
|
newsize = newlen * sizeof(*stack);
|
||||||
oldsize = stackcount * sizeof(*stack);
|
oldsize = stackcount * sizeof(*stack);
|
||||||
newstack = isc_mem_get(mctx, newsize);
|
newstack = isc_mem_get(mctx, newsize);
|
||||||
if (newstack == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
if (stackcount != 0) {
|
if (stackcount != 0) {
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
@ -1638,7 +1636,6 @@ validate_masters(const cfg_obj_t *obj, const cfg_obj_t *config,
|
|||||||
element = stack[--pushed];
|
element = stack[--pushed];
|
||||||
goto resume;
|
goto resume;
|
||||||
}
|
}
|
||||||
cleanup:
|
|
||||||
if (stack != NULL) {
|
if (stack != NULL) {
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
|
@ -40,8 +40,6 @@ dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) {
|
|||||||
n = 1;
|
n = 1;
|
||||||
|
|
||||||
acl = isc_mem_get(mctx, sizeof(*acl));
|
acl = isc_mem_get(mctx, sizeof(*acl));
|
||||||
if (acl == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
acl->mctx = NULL;
|
acl->mctx = NULL;
|
||||||
isc_mem_attach(mctx, &acl->mctx);
|
isc_mem_attach(mctx, &acl->mctx);
|
||||||
@ -68,18 +66,10 @@ dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) {
|
|||||||
acl->magic = DNS_ACL_MAGIC;
|
acl->magic = DNS_ACL_MAGIC;
|
||||||
|
|
||||||
acl->elements = isc_mem_get(mctx, n * sizeof(dns_aclelement_t));
|
acl->elements = isc_mem_get(mctx, n * sizeof(dns_aclelement_t));
|
||||||
if (acl->elements == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
acl->alloc = n;
|
acl->alloc = n;
|
||||||
memset(acl->elements, 0, n * sizeof(dns_aclelement_t));
|
memset(acl->elements, 0, n * sizeof(dns_aclelement_t));
|
||||||
*target = acl;
|
*target = acl;
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
|
|
||||||
cleanup:
|
|
||||||
dns_acl_detach(&acl);
|
|
||||||
return (result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -277,8 +267,6 @@ dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, bool pos)
|
|||||||
|
|
||||||
newmem = isc_mem_get(dest->mctx,
|
newmem = isc_mem_get(dest->mctx,
|
||||||
newalloc * sizeof(dns_aclelement_t));
|
newalloc * sizeof(dns_aclelement_t));
|
||||||
if (newmem == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
/* Zero. */
|
/* Zero. */
|
||||||
memset(newmem, 0, newalloc * sizeof(dns_aclelement_t));
|
memset(newmem, 0, newalloc * sizeof(dns_aclelement_t));
|
||||||
|
@ -2525,8 +2525,6 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr,
|
|||||||
UNUSED(timermgr);
|
UNUSED(timermgr);
|
||||||
|
|
||||||
adb = isc_mem_get(mem, sizeof(dns_adb_t));
|
adb = isc_mem_get(mem, sizeof(dns_adb_t));
|
||||||
if (adb == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize things here that cannot fail, and especially things
|
* Initialize things here that cannot fail, and especially things
|
||||||
@ -4488,7 +4486,6 @@ dns_adb_setcookie(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
|
|||||||
|
|
||||||
if (addr->entry->cookie == NULL && cookie != NULL && len != 0U) {
|
if (addr->entry->cookie == NULL && cookie != NULL && len != 0U) {
|
||||||
addr->entry->cookie = isc_mem_get(adb->mctx, len);
|
addr->entry->cookie = isc_mem_get(adb->mctx, len);
|
||||||
if (addr->entry->cookie != NULL)
|
|
||||||
addr->entry->cookielen = (uint16_t)len;
|
addr->entry->cookielen = (uint16_t)len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,25 +61,18 @@ badcache_resize(dns_badcache_t *bc, isc_time_t *now, bool grow);
|
|||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp) {
|
dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp) {
|
||||||
isc_result_t result;
|
|
||||||
dns_badcache_t *bc = NULL;
|
dns_badcache_t *bc = NULL;
|
||||||
|
|
||||||
REQUIRE(bcp != NULL && *bcp == NULL);
|
REQUIRE(bcp != NULL && *bcp == NULL);
|
||||||
REQUIRE(mctx != NULL);
|
REQUIRE(mctx != NULL);
|
||||||
|
|
||||||
bc = isc_mem_get(mctx, sizeof(dns_badcache_t));
|
bc = isc_mem_get(mctx, sizeof(dns_badcache_t));
|
||||||
if (bc == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(bc, 0, sizeof(dns_badcache_t));
|
memset(bc, 0, sizeof(dns_badcache_t));
|
||||||
|
|
||||||
isc_mem_attach(mctx, &bc->mctx);
|
isc_mem_attach(mctx, &bc->mctx);
|
||||||
isc_mutex_init(&bc->lock);
|
isc_mutex_init(&bc->lock);
|
||||||
|
|
||||||
bc->table = isc_mem_get(bc->mctx, sizeof(*bc->table) * size);
|
bc->table = isc_mem_get(bc->mctx, sizeof(*bc->table) * size);
|
||||||
if (bc->table == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto destroy_lock;
|
|
||||||
}
|
|
||||||
|
|
||||||
bc->size = bc->minsize = size;
|
bc->size = bc->minsize = size;
|
||||||
memset(bc->table, 0, bc->size * sizeof(dns_bcentry_t *));
|
memset(bc->table, 0, bc->size * sizeof(dns_bcentry_t *));
|
||||||
@ -90,11 +83,6 @@ dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp) {
|
|||||||
|
|
||||||
*bcp = bc;
|
*bcp = bc;
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
|
|
||||||
destroy_lock:
|
|
||||||
isc_mutex_destroy(&bc->lock);
|
|
||||||
isc_mem_putanddetach(&bc->mctx, bc, sizeof(dns_badcache_t));
|
|
||||||
return (result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -124,8 +112,6 @@ badcache_resize(dns_badcache_t *bc, isc_time_t *now, bool grow) {
|
|||||||
newsize = (bc->size - 1) / 2;
|
newsize = (bc->size - 1) / 2;
|
||||||
|
|
||||||
newtable = isc_mem_get(bc->mctx, sizeof(dns_bcentry_t *) * newsize);
|
newtable = isc_mem_get(bc->mctx, sizeof(dns_bcentry_t *) * newsize);
|
||||||
if (newtable == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(newtable, 0, sizeof(dns_bcentry_t *) * newsize);
|
memset(newtable, 0, sizeof(dns_bcentry_t *) * newsize);
|
||||||
|
|
||||||
for (i = 0; bc->count > 0 && i < bc->size; i++) {
|
for (i = 0; bc->count > 0 && i < bc->size; i++) {
|
||||||
@ -197,8 +183,6 @@ dns_badcache_add(dns_badcache_t *bc, const dns_name_t *name,
|
|||||||
if (bad == NULL) {
|
if (bad == NULL) {
|
||||||
isc_buffer_t buffer;
|
isc_buffer_t buffer;
|
||||||
bad = isc_mem_get(bc->mctx, sizeof(*bad) + name->length);
|
bad = isc_mem_get(bc->mctx, sizeof(*bad) + name->length);
|
||||||
if (bad == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
bad->type = type;
|
bad->type = type;
|
||||||
bad->hashval = hashval;
|
bad->hashval = hashval;
|
||||||
bad->expire = *expire;
|
bad->expire = *expire;
|
||||||
@ -216,7 +200,6 @@ dns_badcache_add(dns_badcache_t *bc, const dns_name_t *name,
|
|||||||
} else
|
} else
|
||||||
bad->expire = *expire;
|
bad->expire = *expire;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
UNLOCK(&bc->lock);
|
UNLOCK(&bc->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,10 +127,6 @@ copy_ptr_targets(dns_byaddr_t *byaddr, dns_rdataset_t *rdataset) {
|
|||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
name = isc_mem_get(byaddr->mctx, sizeof(*name));
|
name = isc_mem_get(byaddr->mctx, sizeof(*name));
|
||||||
if (name == NULL) {
|
|
||||||
dns_rdata_freestruct(&ptr);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
dns_name_init(name, NULL);
|
dns_name_init(name, NULL);
|
||||||
result = dns_name_dup(&ptr.ptr, byaddr->mctx, name);
|
result = dns_name_dup(&ptr.ptr, byaddr->mctx, name);
|
||||||
dns_rdata_freestruct(&ptr);
|
dns_rdata_freestruct(&ptr);
|
||||||
@ -202,17 +198,11 @@ dns_byaddr_create(isc_mem_t *mctx, const isc_netaddr_t *address,
|
|||||||
isc_event_t *ievent;
|
isc_event_t *ievent;
|
||||||
|
|
||||||
byaddr = isc_mem_get(mctx, sizeof(*byaddr));
|
byaddr = isc_mem_get(mctx, sizeof(*byaddr));
|
||||||
if (byaddr == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
byaddr->mctx = NULL;
|
byaddr->mctx = NULL;
|
||||||
isc_mem_attach(mctx, &byaddr->mctx);
|
isc_mem_attach(mctx, &byaddr->mctx);
|
||||||
byaddr->options = options;
|
byaddr->options = options;
|
||||||
|
|
||||||
byaddr->event = isc_mem_get(mctx, sizeof(*byaddr->event));
|
byaddr->event = isc_mem_get(mctx, sizeof(*byaddr->event));
|
||||||
if (byaddr->event == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_byaddr;
|
|
||||||
}
|
|
||||||
ISC_EVENT_INIT(byaddr->event, sizeof(*byaddr->event), 0, NULL,
|
ISC_EVENT_INIT(byaddr->event, sizeof(*byaddr->event), 0, NULL,
|
||||||
DNS_EVENT_BYADDRDONE, action, arg, byaddr,
|
DNS_EVENT_BYADDRDONE, action, arg, byaddr,
|
||||||
bevent_destroy, mctx);
|
bevent_destroy, mctx);
|
||||||
@ -254,7 +244,6 @@ dns_byaddr_create(isc_mem_t *mctx, const isc_netaddr_t *address,
|
|||||||
|
|
||||||
isc_task_detach(&byaddr->task);
|
isc_task_detach(&byaddr->task);
|
||||||
|
|
||||||
cleanup_byaddr:
|
|
||||||
isc_mem_putanddetach(&mctx, byaddr, sizeof(*byaddr));
|
isc_mem_putanddetach(&mctx, byaddr, sizeof(*byaddr));
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -196,8 +196,6 @@ dns_cache_create(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr,
|
|||||||
REQUIRE(cachename != NULL);
|
REQUIRE(cachename != NULL);
|
||||||
|
|
||||||
cache = isc_mem_get(cmctx, sizeof(*cache));
|
cache = isc_mem_get(cmctx, sizeof(*cache));
|
||||||
if (cache == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
cache->mctx = cache->hmctx = NULL;
|
cache->mctx = cache->hmctx = NULL;
|
||||||
isc_mem_attach(cmctx, &cache->mctx);
|
isc_mem_attach(cmctx, &cache->mctx);
|
||||||
@ -246,10 +244,6 @@ dns_cache_create(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr,
|
|||||||
if (cache->db_argc != 0) {
|
if (cache->db_argc != 0) {
|
||||||
cache->db_argv = isc_mem_get(cmctx,
|
cache->db_argv = isc_mem_get(cmctx,
|
||||||
cache->db_argc * sizeof(char *));
|
cache->db_argc * sizeof(char *));
|
||||||
if (cache->db_argv == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_dbtype;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < cache->db_argc; i++)
|
for (i = 0; i < cache->db_argc; i++)
|
||||||
cache->db_argv[i] = NULL;
|
cache->db_argv[i] = NULL;
|
||||||
@ -317,7 +311,6 @@ cleanup_dbargv:
|
|||||||
if (cache->db_argv != NULL)
|
if (cache->db_argv != NULL)
|
||||||
isc_mem_put(cmctx, cache->db_argv,
|
isc_mem_put(cmctx, cache->db_argv,
|
||||||
cache->db_argc * sizeof(char *));
|
cache->db_argc * sizeof(char *));
|
||||||
cleanup_dbtype:
|
|
||||||
isc_mem_free(cmctx, cache->db_type);
|
isc_mem_free(cmctx, cache->db_type);
|
||||||
cleanup_filelock:
|
cleanup_filelock:
|
||||||
isc_mutex_destroy(&cache->filelock);
|
isc_mutex_destroy(&cache->filelock);
|
||||||
|
@ -206,8 +206,6 @@ dns_catz_entry_new(isc_mem_t *mctx, const dns_name_t *domain,
|
|||||||
REQUIRE(nentryp != NULL && *nentryp == NULL);
|
REQUIRE(nentryp != NULL && *nentryp == NULL);
|
||||||
|
|
||||||
nentry = isc_mem_get(mctx, sizeof(dns_catz_entry_t));
|
nentry = isc_mem_get(mctx, sizeof(dns_catz_entry_t));
|
||||||
if (nentry == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
dns_name_init(&nentry->name, NULL);
|
dns_name_init(&nentry->name, NULL);
|
||||||
if (domain != NULL) {
|
if (domain != NULL) {
|
||||||
@ -593,8 +591,6 @@ dns_catz_new_zones(dns_catz_zones_t **catzsp, dns_catz_zonemodmethods_t *zmm,
|
|||||||
REQUIRE(zmm != NULL);
|
REQUIRE(zmm != NULL);
|
||||||
|
|
||||||
new_zones = isc_mem_get(mctx, sizeof(*new_zones));
|
new_zones = isc_mem_get(mctx, sizeof(*new_zones));
|
||||||
if (new_zones == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(new_zones, 0, sizeof(*new_zones));
|
memset(new_zones, 0, sizeof(*new_zones));
|
||||||
|
|
||||||
isc_mutex_init(&new_zones->lock);
|
isc_mutex_init(&new_zones->lock);
|
||||||
@ -650,8 +646,6 @@ dns_catz_new_zone(dns_catz_zones_t *catzs, dns_catz_zone_t **zonep,
|
|||||||
REQUIRE(ISC_MAGIC_VALID(name, DNS_NAME_MAGIC));
|
REQUIRE(ISC_MAGIC_VALID(name, DNS_NAME_MAGIC));
|
||||||
|
|
||||||
new_zone = isc_mem_get(catzs->mctx, sizeof(*new_zone));
|
new_zone = isc_mem_get(catzs->mctx, sizeof(*new_zone));
|
||||||
if (new_zone == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
memset(new_zone, 0, sizeof(*new_zone));
|
memset(new_zone, 0, sizeof(*new_zone));
|
||||||
|
|
||||||
@ -1130,8 +1124,6 @@ catz_process_masters(dns_catz_zone_t *zone, dns_ipkeylist_t *ipkl,
|
|||||||
|
|
||||||
/* rdatastr.length < DNS_NAME_MAXTEXT */
|
/* rdatastr.length < DNS_NAME_MAXTEXT */
|
||||||
keyname = isc_mem_get(mctx, sizeof(dns_name_t));
|
keyname = isc_mem_get(mctx, sizeof(dns_name_t));
|
||||||
if (keyname == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
dns_name_init(keyname, 0);
|
dns_name_init(keyname, 0);
|
||||||
memmove(keycbuf, rdatastr.data, rdatastr.length);
|
memmove(keycbuf, rdatastr.data, rdatastr.length);
|
||||||
keycbuf[rdatastr.length] = 0;
|
keycbuf[rdatastr.length] = 0;
|
||||||
@ -1171,15 +1163,8 @@ catz_process_masters(dns_catz_zone_t *zone, dns_ipkeylist_t *ipkl,
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
ipkl->labels[i] = isc_mem_get(mctx, sizeof(dns_name_t));
|
ipkl->labels[i] = isc_mem_get(mctx,
|
||||||
if (ipkl->labels[i] == NULL) {
|
|
||||||
if (keyname != NULL) {
|
|
||||||
dns_name_free(keyname, mctx);
|
|
||||||
isc_mem_put(mctx, keyname,
|
|
||||||
sizeof(dns_name_t));
|
sizeof(dns_name_t));
|
||||||
}
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
dns_name_init(ipkl->labels[i], NULL);
|
dns_name_init(ipkl->labels[i], NULL);
|
||||||
result = dns_name_dup(name, mctx, ipkl->labels[i]);
|
result = dns_name_dup(name, mctx, ipkl->labels[i]);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
@ -488,8 +488,6 @@ dns_client_createx(isc_mem_t *mctx, isc_appctx_t *actx,
|
|||||||
REQUIRE(clientp != NULL && *clientp == NULL);
|
REQUIRE(clientp != NULL && *clientp == NULL);
|
||||||
|
|
||||||
client = isc_mem_get(mctx, sizeof(*client));
|
client = isc_mem_get(mctx, sizeof(*client));
|
||||||
if (client == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
isc_mutex_init(&client->lock);
|
isc_mutex_init(&client->lock);
|
||||||
|
|
||||||
@ -753,8 +751,6 @@ getrdataset(isc_mem_t *mctx, dns_rdataset_t **rdatasetp) {
|
|||||||
REQUIRE(rdatasetp != NULL && *rdatasetp == NULL);
|
REQUIRE(rdatasetp != NULL && *rdatasetp == NULL);
|
||||||
|
|
||||||
rdataset = isc_mem_get(mctx, sizeof(*rdataset));
|
rdataset = isc_mem_get(mctx, sizeof(*rdataset));
|
||||||
if (rdataset == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
dns_rdataset_init(rdataset);
|
dns_rdataset_init(rdataset);
|
||||||
|
|
||||||
@ -1285,8 +1281,6 @@ dns_client_resolve(dns_client_t *client, const dns_name_t *name,
|
|||||||
actx = client->actx;
|
actx = client->actx;
|
||||||
|
|
||||||
resarg = isc_mem_get(client->mctx, sizeof(*resarg));
|
resarg = isc_mem_get(client->mctx, sizeof(*resarg));
|
||||||
if (resarg == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
isc_mutex_init(&resarg->lock);
|
isc_mutex_init(&resarg->lock);
|
||||||
|
|
||||||
@ -1688,8 +1682,6 @@ dns_client_request(dns_client_t *client, dns_message_t *qmessage,
|
|||||||
actx = client->actx;
|
actx = client->actx;
|
||||||
|
|
||||||
reqarg = isc_mem_get(client->mctx, sizeof(*reqarg));
|
reqarg = isc_mem_get(client->mctx, sizeof(*reqarg));
|
||||||
if (reqarg == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
isc_mutex_init(&reqarg->lock);
|
isc_mutex_init(&reqarg->lock);
|
||||||
|
|
||||||
@ -2156,14 +2148,6 @@ resolveaddr_done(isc_task_t *task, isc_event_t *event) {
|
|||||||
|
|
||||||
sa = isc_mem_get(uctx->client->mctx,
|
sa = isc_mem_get(uctx->client->mctx,
|
||||||
sizeof(*sa));
|
sizeof(*sa));
|
||||||
if (sa == NULL) {
|
|
||||||
/*
|
|
||||||
* If we fail to get a sockaddr,
|
|
||||||
we simply move forward with the
|
|
||||||
* addresses we've got so far.
|
|
||||||
*/
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
dns_rdata_init(&rdata);
|
dns_rdata_init(&rdata);
|
||||||
switch (family) {
|
switch (family) {
|
||||||
@ -2739,8 +2723,6 @@ dns_client_update(dns_client_t *client, dns_rdataclass_t rdclass,
|
|||||||
actx = client->actx;
|
actx = client->actx;
|
||||||
|
|
||||||
uarg = isc_mem_get(client->mctx, sizeof(*uarg));
|
uarg = isc_mem_get(client->mctx, sizeof(*uarg));
|
||||||
if (uarg == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
isc_mutex_init(&uarg->lock);
|
isc_mutex_init(&uarg->lock);
|
||||||
|
|
||||||
@ -2880,10 +2862,6 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
uctx = isc_mem_get(client->mctx, sizeof(*uctx));
|
uctx = isc_mem_get(client->mctx, sizeof(*uctx));
|
||||||
if (uctx == NULL) {
|
|
||||||
dns_view_detach(&view);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
isc_mutex_init(&uctx->lock);
|
isc_mutex_init(&uctx->lock);
|
||||||
|
|
||||||
@ -2929,8 +2907,6 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
|
|||||||
server != NULL;
|
server != NULL;
|
||||||
server = ISC_LIST_NEXT(server, link)) {
|
server = ISC_LIST_NEXT(server, link)) {
|
||||||
sa = isc_mem_get(client->mctx, sizeof(*sa));
|
sa = isc_mem_get(client->mctx, sizeof(*sa));
|
||||||
if (sa == NULL)
|
|
||||||
goto fail;
|
|
||||||
sa->type = server->type;
|
sa->type = server->type;
|
||||||
sa->length = server->length;
|
sa->length = server->length;
|
||||||
ISC_LINK_INIT(sa, link);
|
ISC_LINK_INIT(sa, link);
|
||||||
@ -3150,8 +3126,6 @@ dns_client_updaterec(dns_client_updateop_t op, const dns_name_t *owner,
|
|||||||
|
|
||||||
if (rdataset == NULL) {
|
if (rdataset == NULL) {
|
||||||
updaterec = isc_mem_get(mctx, size);
|
updaterec = isc_mem_get(mctx, size);
|
||||||
if (updaterec == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
rdataset = &updaterec->rdataset;
|
rdataset = &updaterec->rdataset;
|
||||||
rdatalist = &updaterec->rdatalist;
|
rdatalist = &updaterec->rdatalist;
|
||||||
rdata = &updaterec->rdata;
|
rdata = &updaterec->rdata;
|
||||||
|
@ -408,8 +408,6 @@ dns_compress_add(dns_compress_t *cctx, const dns_name_t *name,
|
|||||||
dns_name_toregion(name, &r);
|
dns_name_toregion(name, &r);
|
||||||
length = r.length;
|
length = r.length;
|
||||||
tmp = isc_mem_get(cctx->mctx, length);
|
tmp = isc_mem_get(cctx->mctx, length);
|
||||||
if (tmp == NULL)
|
|
||||||
return;
|
|
||||||
/*
|
/*
|
||||||
* Copy name data to 'tmp' and make 'r' use 'tmp'.
|
* Copy name data to 'tmp' and make 'r' use 'tmp'.
|
||||||
*/
|
*/
|
||||||
@ -442,8 +440,6 @@ dns_compress_add(dns_compress_t *cctx, const dns_name_t *name,
|
|||||||
else {
|
else {
|
||||||
node = isc_mem_get(cctx->mctx,
|
node = isc_mem_get(cctx->mctx,
|
||||||
sizeof(dns_compressnode_t));
|
sizeof(dns_compressnode_t));
|
||||||
if (node == NULL)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
node->count = cctx->count++;
|
node->count = cctx->count++;
|
||||||
/*
|
/*
|
||||||
|
@ -883,10 +883,6 @@ dns_db_register(const char *name, dns_dbcreatefunc_t create, void *driverarg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
imp = isc_mem_get(mctx, sizeof(dns_dbimplementation_t));
|
imp = isc_mem_get(mctx, sizeof(dns_dbimplementation_t));
|
||||||
if (imp == NULL) {
|
|
||||||
RWUNLOCK(&implock, isc_rwlocktype_write);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
imp->name = name;
|
imp->name = name;
|
||||||
imp->create = create;
|
imp->create = create;
|
||||||
imp->mctx = NULL;
|
imp->mctx = NULL;
|
||||||
@ -1044,8 +1040,6 @@ dns_db_updatenotify_register(dns_db_t *db,
|
|||||||
REQUIRE(fn != NULL);
|
REQUIRE(fn != NULL);
|
||||||
|
|
||||||
listener = isc_mem_get(db->mctx, sizeof(dns_dbonupdatelistener_t));
|
listener = isc_mem_get(db->mctx, sizeof(dns_dbonupdatelistener_t));
|
||||||
if (listener == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
listener->onupdate = fn;
|
listener->onupdate = fn;
|
||||||
listener->onupdate_arg = fn_arg;
|
listener->onupdate_arg = fn_arg;
|
||||||
|
@ -55,9 +55,7 @@ dns_dbtable_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
|||||||
REQUIRE(mctx != NULL);
|
REQUIRE(mctx != NULL);
|
||||||
REQUIRE(dbtablep != NULL && *dbtablep == NULL);
|
REQUIRE(dbtablep != NULL && *dbtablep == NULL);
|
||||||
|
|
||||||
dbtable = (dns_dbtable_t *)isc_mem_get(mctx, sizeof(*dbtable));
|
dbtable = isc_mem_get(mctx, sizeof(*dbtable));
|
||||||
if (dbtable == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
dbtable->rbt = NULL;
|
dbtable->rbt = NULL;
|
||||||
result = dns_rbt_create(mctx, dbdetach, NULL, &dbtable->rbt);
|
result = dns_rbt_create(mctx, dbdetach, NULL, &dbtable->rbt);
|
||||||
|
@ -547,8 +547,6 @@ dns_diff_sort(dns_diff_t *diff, dns_diff_compare_func *compare) {
|
|||||||
if (length == 0)
|
if (length == 0)
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
v = isc_mem_get(diff->mctx, length * sizeof(dns_difftuple_t *));
|
v = isc_mem_get(diff->mctx, length * sizeof(dns_difftuple_t *));
|
||||||
if (v == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
p = ISC_LIST_HEAD(diff->tuples);
|
p = ISC_LIST_HEAD(diff->tuples);
|
||||||
v[i] = p;
|
v[i] = p;
|
||||||
@ -600,8 +598,6 @@ dns_diff_print(dns_diff_t *diff, FILE *file) {
|
|||||||
REQUIRE(DNS_DIFF_VALID(diff));
|
REQUIRE(DNS_DIFF_VALID(diff));
|
||||||
|
|
||||||
mem = isc_mem_get(diff->mctx, size);
|
mem = isc_mem_get(diff->mctx, size);
|
||||||
if (mem == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
for (t = ISC_LIST_HEAD(diff->tuples); t != NULL;
|
for (t = ISC_LIST_HEAD(diff->tuples); t != NULL;
|
||||||
t = ISC_LIST_NEXT(t, link))
|
t = ISC_LIST_NEXT(t, link))
|
||||||
@ -630,10 +626,6 @@ dns_diff_print(dns_diff_t *diff, FILE *file) {
|
|||||||
isc_mem_put(diff->mctx, mem, size);
|
isc_mem_put(diff->mctx, mem, size);
|
||||||
size += 1024;
|
size += 1024;
|
||||||
mem = isc_mem_get(diff->mctx, size);
|
mem = isc_mem_get(diff->mctx, size);
|
||||||
if (mem == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1746,8 +1746,6 @@ dns_dispatchmgr_create(isc_mem_t *mctx, dns_dispatchmgr_t **mgrp)
|
|||||||
REQUIRE(mgrp != NULL && *mgrp == NULL);
|
REQUIRE(mgrp != NULL && *mgrp == NULL);
|
||||||
|
|
||||||
mgr = isc_mem_get(mctx, sizeof(dns_dispatchmgr_t));
|
mgr = isc_mem_get(mctx, sizeof(dns_dispatchmgr_t));
|
||||||
if (mgr == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
mgr->mctx = NULL;
|
mgr->mctx = NULL;
|
||||||
isc_mem_attach(mctx, &mgr->mctx);
|
isc_mem_attach(mctx, &mgr->mctx);
|
||||||
@ -1901,20 +1899,10 @@ dns_dispatchmgr_setavailports(dns_dispatchmgr_t *mgr, isc_portset_t *v4portset,
|
|||||||
v4ports = NULL;
|
v4ports = NULL;
|
||||||
if (nv4ports != 0) {
|
if (nv4ports != 0) {
|
||||||
v4ports = isc_mem_get(mgr->mctx, sizeof(in_port_t) * nv4ports);
|
v4ports = isc_mem_get(mgr->mctx, sizeof(in_port_t) * nv4ports);
|
||||||
if (v4ports == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
}
|
||||||
v6ports = NULL;
|
v6ports = NULL;
|
||||||
if (nv6ports != 0) {
|
if (nv6ports != 0) {
|
||||||
v6ports = isc_mem_get(mgr->mctx, sizeof(in_port_t) * nv6ports);
|
v6ports = isc_mem_get(mgr->mctx, sizeof(in_port_t) * nv6ports);
|
||||||
if (v6ports == NULL) {
|
|
||||||
if (v4ports != NULL) {
|
|
||||||
isc_mem_put(mgr->mctx, v4ports,
|
|
||||||
sizeof(in_port_t) *
|
|
||||||
isc_portset_nports(v4portset));
|
|
||||||
}
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p = 0;
|
p = 0;
|
||||||
@ -2237,26 +2225,14 @@ qid_allocate(dns_dispatchmgr_t *mgr, unsigned int buckets,
|
|||||||
REQUIRE(qidp != NULL && *qidp == NULL);
|
REQUIRE(qidp != NULL && *qidp == NULL);
|
||||||
|
|
||||||
qid = isc_mem_get(mgr->mctx, sizeof(*qid));
|
qid = isc_mem_get(mgr->mctx, sizeof(*qid));
|
||||||
if (qid == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
qid->qid_table = isc_mem_get(mgr->mctx,
|
qid->qid_table = isc_mem_get(mgr->mctx,
|
||||||
buckets * sizeof(dns_displist_t));
|
buckets * sizeof(dns_displist_t));
|
||||||
if (qid->qid_table == NULL) {
|
|
||||||
isc_mem_put(mgr->mctx, qid, sizeof(*qid));
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
qid->sock_table = NULL;
|
qid->sock_table = NULL;
|
||||||
if (needsocktable) {
|
if (needsocktable) {
|
||||||
qid->sock_table = isc_mem_get(mgr->mctx, buckets *
|
qid->sock_table = isc_mem_get(mgr->mctx,
|
||||||
sizeof(dispsocketlist_t));
|
buckets * sizeof(dispsocketlist_t));
|
||||||
if (qid->sock_table == NULL) {
|
|
||||||
isc_mem_put(mgr->mctx, qid->qid_table,
|
|
||||||
buckets * sizeof(dns_displist_t));
|
|
||||||
isc_mem_put(mgr->mctx, qid, sizeof(*qid));
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_mutex_init(&qid->lock);
|
isc_mutex_init(&qid->lock);
|
||||||
@ -2886,11 +2862,7 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
disp->port_table = isc_mem_get(mgr->mctx,
|
disp->port_table = isc_mem_get(mgr->mctx,
|
||||||
sizeof(disp->port_table[0]) *
|
sizeof(disp->port_table[0]) * DNS_DISPATCH_PORTTABLESIZE);
|
||||||
DNS_DISPATCH_PORTTABLESIZE);
|
|
||||||
if (disp->port_table == NULL) {
|
|
||||||
goto deallocate_dispatch;
|
|
||||||
}
|
|
||||||
for (i = 0; i < DNS_DISPATCH_PORTTABLESIZE; i++) {
|
for (i = 0; i < DNS_DISPATCH_PORTTABLESIZE; i++) {
|
||||||
ISC_LIST_INIT(disp->port_table[i]);
|
ISC_LIST_INIT(disp->port_table[i]);
|
||||||
}
|
}
|
||||||
@ -3641,17 +3613,11 @@ dns_dispatchset_create(isc_mem_t *mctx, isc_socketmgr_t *sockmgr,
|
|||||||
mgr = source->mgr;
|
mgr = source->mgr;
|
||||||
|
|
||||||
dset = isc_mem_get(mctx, sizeof(dns_dispatchset_t));
|
dset = isc_mem_get(mctx, sizeof(dns_dispatchset_t));
|
||||||
if (dset == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(dset, 0, sizeof(*dset));
|
memset(dset, 0, sizeof(*dset));
|
||||||
|
|
||||||
isc_mutex_init(&dset->lock);
|
isc_mutex_init(&dset->lock);
|
||||||
|
|
||||||
dset->dispatches = isc_mem_get(mctx, sizeof(dns_dispatch_t *) * n);
|
dset->dispatches = isc_mem_get(mctx, sizeof(dns_dispatch_t *) * n);
|
||||||
if (dset->dispatches == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto fail_lock;
|
|
||||||
}
|
|
||||||
|
|
||||||
isc_mem_attach(mctx, &dset->mctx);
|
isc_mem_attach(mctx, &dset->mctx);
|
||||||
dset->ndisp = n;
|
dset->ndisp = n;
|
||||||
@ -3687,7 +3653,6 @@ dns_dispatchset_create(isc_mem_t *mctx, isc_socketmgr_t *sockmgr,
|
|||||||
if (dset->mctx == mctx)
|
if (dset->mctx == mctx)
|
||||||
isc_mem_detach(&dset->mctx);
|
isc_mem_detach(&dset->mctx);
|
||||||
|
|
||||||
fail_lock:
|
|
||||||
isc_mutex_destroy(&dset->lock);
|
isc_mutex_destroy(&dset->lock);
|
||||||
isc_mem_put(mctx, dset, sizeof(dns_dispatchset_t));
|
isc_mem_put(mctx, dset, sizeof(dns_dispatchset_t));
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -198,10 +198,6 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername,
|
|||||||
|
|
||||||
/* Allocate memory to hold the DLZ database driver */
|
/* Allocate memory to hold the DLZ database driver */
|
||||||
db = isc_mem_get(mctx, sizeof(dns_dlzdb_t));
|
db = isc_mem_get(mctx, sizeof(dns_dlzdb_t));
|
||||||
if (db == NULL) {
|
|
||||||
RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure memory region is set to all 0's */
|
/* Make sure memory region is set to all 0's */
|
||||||
memset(db, 0, sizeof(dns_dlzdb_t));
|
memset(db, 0, sizeof(dns_dlzdb_t));
|
||||||
@ -324,10 +320,6 @@ dns_dlzregister(const char *drivername, const dns_dlzmethods_t *methods,
|
|||||||
* we cannot.
|
* we cannot.
|
||||||
*/
|
*/
|
||||||
dlz_imp = isc_mem_get(mctx, sizeof(dns_dlzimplementation_t));
|
dlz_imp = isc_mem_get(mctx, sizeof(dns_dlzimplementation_t));
|
||||||
if (dlz_imp == NULL) {
|
|
||||||
RWUNLOCK(&dlz_implock, isc_rwlocktype_write);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure memory region is set to all 0's */
|
/* Make sure memory region is set to all 0's */
|
||||||
memset(dlz_imp, 0, sizeof(dns_dlzimplementation_t));
|
memset(dlz_imp, 0, sizeof(dns_dlzimplementation_t));
|
||||||
|
@ -74,8 +74,6 @@ dns_dns64_create(isc_mem_t *mctx, const isc_netaddr_t *prefix,
|
|||||||
}
|
}
|
||||||
|
|
||||||
dns64 = isc_mem_get(mctx, sizeof(dns_dns64_t));
|
dns64 = isc_mem_get(mctx, sizeof(dns_dns64_t));
|
||||||
if (dns64 == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(dns64->bits, 0, sizeof(dns64->bits));
|
memset(dns64->bits, 0, sizeof(dns64->bits));
|
||||||
memmove(dns64->bits, prefix->type.in6.s6_addr, prefixlen / 8);
|
memmove(dns64->bits, prefix->type.in6.s6_addr, prefixlen / 8);
|
||||||
if (suffix != NULL)
|
if (suffix != NULL)
|
||||||
|
@ -251,10 +251,6 @@ dns_dnsrps_rewrite_init(librpz_emsg_t *emsg, dns_rpz_st_t *st,
|
|||||||
rpsdb_t *rpsdb;
|
rpsdb_t *rpsdb;
|
||||||
|
|
||||||
rpsdb = isc_mem_get(mctx, sizeof(*rpsdb));
|
rpsdb = isc_mem_get(mctx, sizeof(*rpsdb));
|
||||||
if (rpsdb == NULL) {
|
|
||||||
strlcpy(emsg->c, "no memory", sizeof(emsg->c));
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memset(rpsdb, 0, sizeof(*rpsdb));
|
memset(rpsdb, 0, sizeof(*rpsdb));
|
||||||
|
|
||||||
if (!librpz->rsp_create(emsg, &rpsdb->rsp, NULL,
|
if (!librpz->rsp_create(emsg, &rpsdb->rsp, NULL,
|
||||||
@ -628,8 +624,6 @@ rpsdb_allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||||||
REQUIRE(node == &rpsdb->origin_node || node == &rpsdb->data_node);
|
REQUIRE(node == &rpsdb->origin_node || node == &rpsdb->data_node);
|
||||||
|
|
||||||
rpsdb_iter = isc_mem_get(rpsdb->common.mctx, sizeof(*rpsdb_iter));
|
rpsdb_iter = isc_mem_get(rpsdb->common.mctx, sizeof(*rpsdb_iter));
|
||||||
if (rpsdb_iter == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
memset(rpsdb_iter, 0, sizeof(*rpsdb_iter));
|
memset(rpsdb_iter, 0, sizeof(*rpsdb_iter));
|
||||||
rpsdb_iter->common.magic = DNS_RDATASETITER_MAGIC;
|
rpsdb_iter->common.magic = DNS_RDATASETITER_MAGIC;
|
||||||
|
@ -103,8 +103,6 @@ rdataset_to_sortedarray(dns_rdataset_t *set, isc_mem_t *mctx,
|
|||||||
n = dns_rdataset_count(set);
|
n = dns_rdataset_count(set);
|
||||||
|
|
||||||
data = isc_mem_get(mctx, n * sizeof(dns_rdata_t));
|
data = isc_mem_get(mctx, n * sizeof(dns_rdata_t));
|
||||||
if (data == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
dns_rdataset_init(&rdataset);
|
dns_rdataset_init(&rdataset);
|
||||||
dns_rdataset_clone(set, &rdataset);
|
dns_rdataset_clone(set, &rdataset);
|
||||||
@ -257,8 +255,6 @@ dns_dnssec_sign(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
|
|||||||
* they're not used in digest_sig().
|
* they're not used in digest_sig().
|
||||||
*/
|
*/
|
||||||
sig.signature = isc_mem_get(mctx, sig.siglen);
|
sig.signature = isc_mem_get(mctx, sig.siglen);
|
||||||
if (sig.signature == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
ret = isc_buffer_allocate(mctx, &databuf, sigsize + 256 + 18);
|
ret = isc_buffer_allocate(mctx, &databuf, sigsize + 256 + 18);
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
@ -960,11 +956,7 @@ dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key) {
|
|||||||
|
|
||||||
RETERR(dst_key_sigsize(key, &sigsize));
|
RETERR(dst_key_sigsize(key, &sigsize));
|
||||||
sig.siglen = sigsize;
|
sig.siglen = sigsize;
|
||||||
sig.signature = (unsigned char *) isc_mem_get(mctx, sig.siglen);
|
sig.signature = isc_mem_get(mctx, sig.siglen);
|
||||||
if (sig.signature == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
isc_buffer_init(&sigbuf, sig.signature, sig.siglen);
|
isc_buffer_init(&sigbuf, sig.signature, sig.siglen);
|
||||||
RETERR(dst_context_sign(ctx, &sigbuf));
|
RETERR(dst_context_sign(ctx, &sigbuf));
|
||||||
@ -1220,8 +1212,6 @@ dns_dnsseckey_create(isc_mem_t *mctx, dst_key_t **dstkey,
|
|||||||
|
|
||||||
REQUIRE(dkp != NULL && *dkp == NULL);
|
REQUIRE(dkp != NULL && *dkp == NULL);
|
||||||
dk = isc_mem_get(mctx, sizeof(dns_dnsseckey_t));
|
dk = isc_mem_get(mctx, sizeof(dns_dnsseckey_t));
|
||||||
if (dk == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
dk->key = *dstkey;
|
dk->key = *dstkey;
|
||||||
*dstkey = NULL;
|
*dstkey = NULL;
|
||||||
|
@ -1005,8 +1005,6 @@ dns_dt_open(const char *filename, dns_dtmode_t mode, isc_mem_t *mctx,
|
|||||||
REQUIRE(handlep != NULL && *handlep == NULL);
|
REQUIRE(handlep != NULL && *handlep == NULL);
|
||||||
|
|
||||||
handle = isc_mem_get(mctx, sizeof(*handle));
|
handle = isc_mem_get(mctx, sizeof(*handle));
|
||||||
if (handle == NULL)
|
|
||||||
CHECK(ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
handle->mode = mode;
|
handle->mode = mode;
|
||||||
handle->mctx = NULL;
|
handle->mctx = NULL;
|
||||||
@ -1107,8 +1105,6 @@ dns_dt_parse(isc_mem_t *mctx, isc_region_t *src, dns_dtdata_t **destp) {
|
|||||||
REQUIRE(destp != NULL && *destp == NULL);
|
REQUIRE(destp != NULL && *destp == NULL);
|
||||||
|
|
||||||
d = isc_mem_get(mctx, sizeof(*d));
|
d = isc_mem_get(mctx, sizeof(*d));
|
||||||
if (d == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
memset(d, 0, sizeof(*d));
|
memset(d, 0, sizeof(*d));
|
||||||
isc_mem_attach(mctx, &d->mctx);
|
isc_mem_attach(mctx, &d->mctx);
|
||||||
|
@ -239,8 +239,6 @@ dst_context_create(dst_key_t *key, isc_mem_t *mctx,
|
|||||||
return (DST_R_NULLKEY);
|
return (DST_R_NULLKEY);
|
||||||
|
|
||||||
dctx = isc_mem_get(mctx, sizeof(dst_context_t));
|
dctx = isc_mem_get(mctx, sizeof(dst_context_t));
|
||||||
if (dctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(dctx, 0, sizeof(*dctx));
|
memset(dctx, 0, sizeof(*dctx));
|
||||||
dst_key_attach(key, &dctx->key);
|
dst_key_attach(key, &dctx->key);
|
||||||
isc_mem_attach(mctx, &dctx->mctx);
|
isc_mem_attach(mctx, &dctx->mctx);
|
||||||
@ -508,8 +506,6 @@ dst_key_fromnamedfile(const char *filename, const char *dirname,
|
|||||||
if (dirname != NULL)
|
if (dirname != NULL)
|
||||||
newfilenamelen += strlen(dirname) + 1;
|
newfilenamelen += strlen(dirname) + 1;
|
||||||
newfilename = isc_mem_get(mctx, newfilenamelen);
|
newfilename = isc_mem_get(mctx, newfilenamelen);
|
||||||
if (newfilename == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
result = addsuffix(newfilename, newfilenamelen,
|
result = addsuffix(newfilename, newfilenamelen,
|
||||||
dirname, filename, ".key");
|
dirname, filename, ".key");
|
||||||
INSIST(result == ISC_R_SUCCESS);
|
INSIST(result == ISC_R_SUCCESS);
|
||||||
@ -552,8 +548,6 @@ dst_key_fromnamedfile(const char *filename, const char *dirname,
|
|||||||
if (dirname != NULL)
|
if (dirname != NULL)
|
||||||
newfilenamelen += strlen(dirname) + 1;
|
newfilenamelen += strlen(dirname) + 1;
|
||||||
newfilename = isc_mem_get(mctx, newfilenamelen);
|
newfilename = isc_mem_get(mctx, newfilenamelen);
|
||||||
if (newfilename == NULL)
|
|
||||||
RETERR(ISC_R_NOMEMORY);
|
|
||||||
result = addsuffix(newfilename, newfilenamelen,
|
result = addsuffix(newfilename, newfilenamelen,
|
||||||
dirname, filename, ".private");
|
dirname, filename, ".private");
|
||||||
INSIST(result == ISC_R_SUCCESS);
|
INSIST(result == ISC_R_SUCCESS);
|
||||||
@ -1275,17 +1269,11 @@ get_key_struct(const dns_name_t *name, unsigned int alg,
|
|||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
key = (dst_key_t *) isc_mem_get(mctx, sizeof(dst_key_t));
|
key = isc_mem_get(mctx, sizeof(dst_key_t));
|
||||||
if (key == NULL)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
memset(key, 0, sizeof(dst_key_t));
|
memset(key, 0, sizeof(dst_key_t));
|
||||||
|
|
||||||
key->key_name = isc_mem_get(mctx, sizeof(dns_name_t));
|
key->key_name = isc_mem_get(mctx, sizeof(dns_name_t));
|
||||||
if (key->key_name == NULL) {
|
|
||||||
isc_mem_put(mctx, key, sizeof(dst_key_t));
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
dns_name_init(key->key_name, NULL);
|
dns_name_init(key->key_name, NULL);
|
||||||
result = dns_name_dup(name, mctx, key->key_name);
|
result = dns_name_dup(name, mctx, key->key_name);
|
||||||
|
@ -541,9 +541,7 @@ dst__privstruct_parse(dst_key_t *key, unsigned int alg, isc_lex_t *lex,
|
|||||||
|
|
||||||
priv->elements[n].tag = tag;
|
priv->elements[n].tag = tag;
|
||||||
|
|
||||||
data = (unsigned char *) isc_mem_get(mctx, MAXFIELDSIZE);
|
data = isc_mem_get(mctx, MAXFIELDSIZE);
|
||||||
if (data == NULL)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
isc_buffer_init(&b, data, MAXFIELDSIZE);
|
isc_buffer_init(&b, data, MAXFIELDSIZE);
|
||||||
ret = isc_base64_tobuffer(lex, &b, -1);
|
ret = isc_base64_tobuffer(lex, &b, -1);
|
||||||
|
@ -161,8 +161,6 @@ load_library(isc_mem_t *mctx, const char *filename, const char *instname,
|
|||||||
(void **)&destroy_func));
|
(void **)&destroy_func));
|
||||||
|
|
||||||
imp = isc_mem_get(mctx, sizeof(dyndb_implementation_t));
|
imp = isc_mem_get(mctx, sizeof(dyndb_implementation_t));
|
||||||
if (imp == NULL)
|
|
||||||
CHECK(ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
imp->mctx = NULL;
|
imp->mctx = NULL;
|
||||||
isc_mem_attach(mctx, &imp->mctx);
|
isc_mem_attach(mctx, &imp->mctx);
|
||||||
@ -277,8 +275,6 @@ load_library(isc_mem_t *mctx, const char *filename, const char *instname,
|
|||||||
(void **)&destroy_func));
|
(void **)&destroy_func));
|
||||||
|
|
||||||
imp = isc_mem_get(mctx, sizeof(dyndb_implementation_t));
|
imp = isc_mem_get(mctx, sizeof(dyndb_implementation_t));
|
||||||
if (imp == NULL)
|
|
||||||
CHECK(ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
imp->mctx = NULL;
|
imp->mctx = NULL;
|
||||||
isc_mem_attach(mctx, &imp->mctx);
|
isc_mem_attach(mctx, &imp->mctx);
|
||||||
@ -419,8 +415,6 @@ dns_dyndb_createctx(isc_mem_t *mctx, const void *hashinit, isc_log_t *lctx,
|
|||||||
REQUIRE(dctxp != NULL && *dctxp == NULL);
|
REQUIRE(dctxp != NULL && *dctxp == NULL);
|
||||||
|
|
||||||
dctx = isc_mem_get(mctx, sizeof(*dctx));
|
dctx = isc_mem_get(mctx, sizeof(*dctx));
|
||||||
if (dctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
memset(dctx, 0, sizeof(*dctx));
|
memset(dctx, 0, sizeof(*dctx));
|
||||||
if (view != NULL)
|
if (view != NULL)
|
||||||
|
@ -343,8 +343,6 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create,
|
|||||||
|
|
||||||
mctx = ecdb->common.mctx;
|
mctx = ecdb->common.mctx;
|
||||||
node = isc_mem_get(mctx, sizeof(*node));
|
node = isc_mem_get(mctx, sizeof(*node));
|
||||||
if (node == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
isc_mutex_init(&node->lock);
|
isc_mutex_init(&node->lock);
|
||||||
|
|
||||||
@ -511,8 +509,6 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||||||
mctx = ecdb->common.mctx;
|
mctx = ecdb->common.mctx;
|
||||||
|
|
||||||
iterator = isc_mem_get(mctx, sizeof(ecdb_rdatasetiter_t));
|
iterator = isc_mem_get(mctx, sizeof(ecdb_rdatasetiter_t));
|
||||||
if (iterator == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
iterator->common.magic = DNS_RDATASETITER_MAGIC;
|
iterator->common.magic = DNS_RDATASETITER_MAGIC;
|
||||||
iterator->common.methods = &rdatasetiter_methods;
|
iterator->common.methods = &rdatasetiter_methods;
|
||||||
@ -596,8 +592,6 @@ dns_ecdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
|||||||
UNUSED(driverarg);
|
UNUSED(driverarg);
|
||||||
|
|
||||||
ecdb = isc_mem_get(mctx, sizeof(*ecdb));
|
ecdb = isc_mem_get(mctx, sizeof(*ecdb));
|
||||||
if (ecdb == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
ecdb->common.attributes = DNS_DBATTR_CACHE;
|
ecdb->common.attributes = DNS_DBATTR_CACHE;
|
||||||
ecdb->common.rdclass = rdclass;
|
ecdb->common.rdclass = rdclass;
|
||||||
|
@ -44,8 +44,6 @@ dns_fwdtable_create(isc_mem_t *mctx, dns_fwdtable_t **fwdtablep) {
|
|||||||
REQUIRE(fwdtablep != NULL && *fwdtablep == NULL);
|
REQUIRE(fwdtablep != NULL && *fwdtablep == NULL);
|
||||||
|
|
||||||
fwdtable = isc_mem_get(mctx, sizeof(dns_fwdtable_t));
|
fwdtable = isc_mem_get(mctx, sizeof(dns_fwdtable_t));
|
||||||
if (fwdtable == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
fwdtable->table = NULL;
|
fwdtable->table = NULL;
|
||||||
result = dns_rbt_create(mctx, auto_detach, fwdtable, &fwdtable->table);
|
result = dns_rbt_create(mctx, auto_detach, fwdtable, &fwdtable->table);
|
||||||
@ -83,8 +81,6 @@ dns_fwdtable_addfwd(dns_fwdtable_t *fwdtable, const dns_name_t *name,
|
|||||||
REQUIRE(VALID_FWDTABLE(fwdtable));
|
REQUIRE(VALID_FWDTABLE(fwdtable));
|
||||||
|
|
||||||
forwarders = isc_mem_get(fwdtable->mctx, sizeof(dns_forwarders_t));
|
forwarders = isc_mem_get(fwdtable->mctx, sizeof(dns_forwarders_t));
|
||||||
if (forwarders == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
ISC_LIST_INIT(forwarders->fwdrs);
|
ISC_LIST_INIT(forwarders->fwdrs);
|
||||||
for (fwd = ISC_LIST_HEAD(*fwdrs);
|
for (fwd = ISC_LIST_HEAD(*fwdrs);
|
||||||
@ -92,10 +88,6 @@ dns_fwdtable_addfwd(dns_fwdtable_t *fwdtable, const dns_name_t *name,
|
|||||||
fwd = ISC_LIST_NEXT(fwd, link))
|
fwd = ISC_LIST_NEXT(fwd, link))
|
||||||
{
|
{
|
||||||
nfwd = isc_mem_get(fwdtable->mctx, sizeof(dns_forwarder_t));
|
nfwd = isc_mem_get(fwdtable->mctx, sizeof(dns_forwarder_t));
|
||||||
if (nfwd == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
*nfwd = *fwd;
|
*nfwd = *fwd;
|
||||||
ISC_LINK_INIT(nfwd, link);
|
ISC_LINK_INIT(nfwd, link);
|
||||||
ISC_LIST_APPEND(forwarders->fwdrs, nfwd, link);
|
ISC_LIST_APPEND(forwarders->fwdrs, nfwd, link);
|
||||||
@ -133,8 +125,6 @@ dns_fwdtable_add(dns_fwdtable_t *fwdtable, const dns_name_t *name,
|
|||||||
REQUIRE(VALID_FWDTABLE(fwdtable));
|
REQUIRE(VALID_FWDTABLE(fwdtable));
|
||||||
|
|
||||||
forwarders = isc_mem_get(fwdtable->mctx, sizeof(dns_forwarders_t));
|
forwarders = isc_mem_get(fwdtable->mctx, sizeof(dns_forwarders_t));
|
||||||
if (forwarders == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
ISC_LIST_INIT(forwarders->fwdrs);
|
ISC_LIST_INIT(forwarders->fwdrs);
|
||||||
for (sa = ISC_LIST_HEAD(*addrs);
|
for (sa = ISC_LIST_HEAD(*addrs);
|
||||||
@ -142,10 +132,6 @@ dns_fwdtable_add(dns_fwdtable_t *fwdtable, const dns_name_t *name,
|
|||||||
sa = ISC_LIST_NEXT(sa, link))
|
sa = ISC_LIST_NEXT(sa, link))
|
||||||
{
|
{
|
||||||
fwd = isc_mem_get(fwdtable->mctx, sizeof(dns_forwarder_t));
|
fwd = isc_mem_get(fwdtable->mctx, sizeof(dns_forwarder_t));
|
||||||
if (fwd == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
fwd->addr = *sa;
|
fwd->addr = *sa;
|
||||||
fwd->dscp = -1;
|
fwd->dscp = -1;
|
||||||
ISC_LINK_INIT(fwd, link);
|
ISC_LINK_INIT(fwd, link);
|
||||||
|
@ -145,8 +145,7 @@ set_state(const MMDB_s *db, const isc_netaddr_t *addr,
|
|||||||
|
|
||||||
state = (geoip_state_t *) isc_thread_key_getspecific(state_key);
|
state = (geoip_state_t *) isc_thread_key_getspecific(state_key);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
state = (geoip_state_t *) isc_mem_get(state_mctx,
|
state = isc_mem_get(state_mctx, sizeof(geoip_state_t));
|
||||||
sizeof(geoip_state_t));
|
|
||||||
memset(state, 0, sizeof(*state));
|
memset(state, 0, sizeof(*state));
|
||||||
|
|
||||||
result = isc_thread_key_setspecific(state_key, state);
|
result = isc_thread_key_setspecific(state_key, state);
|
||||||
|
@ -59,8 +59,6 @@ gssapi_create_signverify_ctx(dst_key_t *key, dst_context_t *dctx) {
|
|||||||
UNUSED(key);
|
UNUSED(key);
|
||||||
|
|
||||||
ctx = isc_mem_get(dctx->mctx, sizeof(dst_gssapi_signverifyctx_t));
|
ctx = isc_mem_get(dctx->mctx, sizeof(dst_gssapi_signverifyctx_t));
|
||||||
if (ctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
ctx->buffer = NULL;
|
ctx->buffer = NULL;
|
||||||
result = isc_buffer_allocate(dctx->mctx, &ctx->buffer,
|
result = isc_buffer_allocate(dctx->mctx, &ctx->buffer,
|
||||||
INITIAL_BUFFER_SIZE);
|
INITIAL_BUFFER_SIZE);
|
||||||
@ -322,10 +320,6 @@ gssapi_dump(dst_key_t *key, isc_mem_t *mctx, char **buffer, int *length) {
|
|||||||
return (ISC_R_FAILURE);
|
return (ISC_R_FAILURE);
|
||||||
len = ((gssbuffer.length + 2)/3) * 4;
|
len = ((gssbuffer.length + 2)/3) * 4;
|
||||||
buf = isc_mem_get(mctx, len);
|
buf = isc_mem_get(mctx, len);
|
||||||
if (buf == NULL) {
|
|
||||||
gss_release_buffer(&minor, &gssbuffer);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
isc_buffer_init(&b, buf, (unsigned int)len);
|
isc_buffer_init(&b, buf, (unsigned int)len);
|
||||||
GBUFFER_TO_REGION(gssbuffer, r);
|
GBUFFER_TO_REGION(gssbuffer, r);
|
||||||
result = isc_base64_totext(&r, 0, "", &b);
|
result = isc_base64_totext(&r, 0, "", &b);
|
||||||
|
@ -348,9 +348,6 @@ hmac_fromdns(isc_md_type_t type, dst_key_t *key, isc_buffer_t *data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hkey = isc_mem_get(key->mctx, sizeof(dst_hmac_key_t));
|
hkey = isc_mem_get(key->mctx, sizeof(dst_hmac_key_t));
|
||||||
if (hkey == NULL) {
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(hkey->key, 0, sizeof(hkey->key));
|
memset(hkey->key, 0, sizeof(hkey->key));
|
||||||
|
|
||||||
|
@ -103,10 +103,6 @@ dns_ipkeylist_copy(isc_mem_t *mctx, const dns_ipkeylist_t *src,
|
|||||||
if (src->keys[i] != NULL) {
|
if (src->keys[i] != NULL) {
|
||||||
dst->keys[i] = isc_mem_get(mctx,
|
dst->keys[i] = isc_mem_get(mctx,
|
||||||
sizeof(dns_name_t));
|
sizeof(dns_name_t));
|
||||||
if (dst->keys[i] == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_keys;
|
|
||||||
}
|
|
||||||
dns_name_init(dst->keys[i], NULL);
|
dns_name_init(dst->keys[i], NULL);
|
||||||
result = dns_name_dup(src->keys[i], mctx,
|
result = dns_name_dup(src->keys[i], mctx,
|
||||||
dst->keys[i]);
|
dst->keys[i]);
|
||||||
@ -123,10 +119,6 @@ dns_ipkeylist_copy(isc_mem_t *mctx, const dns_ipkeylist_t *src,
|
|||||||
if (src->labels[i] != NULL) {
|
if (src->labels[i] != NULL) {
|
||||||
dst->labels[i] = isc_mem_get(mctx,
|
dst->labels[i] = isc_mem_get(mctx,
|
||||||
sizeof(dns_name_t));
|
sizeof(dns_name_t));
|
||||||
if (dst->labels[i] == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_labels;
|
|
||||||
}
|
|
||||||
dns_name_init(dst->labels[i], NULL);
|
dns_name_init(dst->labels[i], NULL);
|
||||||
result = dns_name_dup(src->labels[i], mctx,
|
result = dns_name_dup(src->labels[i], mctx,
|
||||||
dst->labels[i]);
|
dst->labels[i]);
|
||||||
@ -177,17 +169,9 @@ dns_ipkeylist_resize(isc_mem_t *mctx, dns_ipkeylist_t *ipkl, unsigned int n) {
|
|||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
|
|
||||||
addrs = isc_mem_get(mctx, n * sizeof(isc_sockaddr_t));
|
addrs = isc_mem_get(mctx, n * sizeof(isc_sockaddr_t));
|
||||||
if (addrs == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
dscps = isc_mem_get(mctx, n * sizeof(isc_dscp_t));
|
dscps = isc_mem_get(mctx, n * sizeof(isc_dscp_t));
|
||||||
if (dscps == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
keys = isc_mem_get(mctx, n * sizeof(dns_name_t *));
|
keys = isc_mem_get(mctx, n * sizeof(dns_name_t *));
|
||||||
if (keys == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
labels = isc_mem_get(mctx, n * sizeof(dns_name_t *));
|
labels = isc_mem_get(mctx, n * sizeof(dns_name_t *));
|
||||||
if (labels == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
|
|
||||||
if (ipkl->addrs != NULL) {
|
if (ipkl->addrs != NULL) {
|
||||||
memmove(addrs, ipkl->addrs,
|
memmove(addrs, ipkl->addrs,
|
||||||
@ -232,14 +216,9 @@ dns_ipkeylist_resize(isc_mem_t *mctx, dns_ipkeylist_t *ipkl, unsigned int n) {
|
|||||||
ipkl->allocated = n;
|
ipkl->allocated = n;
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
|
|
||||||
nomemory:
|
|
||||||
if (addrs != NULL)
|
|
||||||
isc_mem_put(mctx, addrs, n * sizeof(isc_sockaddr_t));
|
isc_mem_put(mctx, addrs, n * sizeof(isc_sockaddr_t));
|
||||||
if (dscps != NULL)
|
|
||||||
isc_mem_put(mctx, dscps, n * sizeof(isc_dscp_t));
|
isc_mem_put(mctx, dscps, n * sizeof(isc_dscp_t));
|
||||||
if (keys != NULL)
|
|
||||||
isc_mem_put(mctx, keys, n * sizeof(dns_name_t *));
|
isc_mem_put(mctx, keys, n * sizeof(dns_name_t *));
|
||||||
if (labels != NULL)
|
|
||||||
isc_mem_put(mctx, labels, n * sizeof(dns_name_t *));
|
isc_mem_put(mctx, labels, n * sizeof(dns_name_t *));
|
||||||
|
|
||||||
return (ISC_R_NOMEMORY);
|
return (ISC_R_NOMEMORY);
|
||||||
|
@ -29,8 +29,6 @@ dns_iptable_create(isc_mem_t *mctx, dns_iptable_t **target) {
|
|||||||
dns_iptable_t *tab;
|
dns_iptable_t *tab;
|
||||||
|
|
||||||
tab = isc_mem_get(mctx, sizeof(*tab));
|
tab = isc_mem_get(mctx, sizeof(*tab));
|
||||||
if (tab == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
tab->mctx = NULL;
|
tab->mctx = NULL;
|
||||||
isc_mem_attach(mctx, &tab->mctx);
|
isc_mem_attach(mctx, &tab->mctx);
|
||||||
isc_refcount_init(&tab->refcount, 1);
|
isc_refcount_init(&tab->refcount, 1);
|
||||||
|
@ -514,11 +514,6 @@ journal_file_create(isc_mem_t *mctx, const char *filename) {
|
|||||||
index_size * sizeof(journal_rawpos_t);
|
index_size * sizeof(journal_rawpos_t);
|
||||||
|
|
||||||
mem = isc_mem_get(mctx, size);
|
mem = isc_mem_get(mctx, size);
|
||||||
if (mem == NULL) {
|
|
||||||
(void)isc_stdio_close(fp);
|
|
||||||
(void)isc_file_remove(filename);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memset(mem, 0, size);
|
memset(mem, 0, size);
|
||||||
memmove(mem, &rawheader, sizeof(rawheader));
|
memmove(mem, &rawheader, sizeof(rawheader));
|
||||||
|
|
||||||
@ -557,8 +552,6 @@ journal_open(isc_mem_t *mctx, const char *filename, bool writable,
|
|||||||
|
|
||||||
INSIST(journalp != NULL && *journalp == NULL);
|
INSIST(journalp != NULL && *journalp == NULL);
|
||||||
j = isc_mem_get(mctx, sizeof(*j));
|
j = isc_mem_get(mctx, sizeof(*j));
|
||||||
if (j == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
j->mctx = NULL;
|
j->mctx = NULL;
|
||||||
isc_mem_attach(mctx, &j->mctx);
|
isc_mem_attach(mctx, &j->mctx);
|
||||||
@ -624,15 +617,11 @@ journal_open(isc_mem_t *mctx, const char *filename, bool writable,
|
|||||||
|
|
||||||
rawbytes = j->header.index_size * sizeof(journal_rawpos_t);
|
rawbytes = j->header.index_size * sizeof(journal_rawpos_t);
|
||||||
j->rawindex = isc_mem_get(mctx, rawbytes);
|
j->rawindex = isc_mem_get(mctx, rawbytes);
|
||||||
if (j->rawindex == NULL)
|
|
||||||
FAIL(ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
CHECK(journal_read(j, j->rawindex, rawbytes));
|
CHECK(journal_read(j, j->rawindex, rawbytes));
|
||||||
|
|
||||||
j->index = isc_mem_get(mctx, j->header.index_size *
|
j->index = isc_mem_get(mctx,
|
||||||
sizeof(journal_pos_t));
|
j->header.index_size * sizeof(journal_pos_t));
|
||||||
if (j->index == NULL)
|
|
||||||
FAIL(ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
p = j->rawindex;
|
p = j->rawindex;
|
||||||
for (i = 0; i < j->header.index_size; i++) {
|
for (i = 0; i < j->header.index_size; i++) {
|
||||||
@ -1047,8 +1036,6 @@ dns_journal_writediff(dns_journal_t *j, dns_diff_t *diff) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mem = isc_mem_get(j->mctx, size);
|
mem = isc_mem_get(j->mctx, size);
|
||||||
if (mem == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
isc_buffer_init(&buffer, mem, size);
|
isc_buffer_init(&buffer, mem, size);
|
||||||
|
|
||||||
@ -2232,10 +2219,6 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, uint32_t serial,
|
|||||||
if (copy_length < size)
|
if (copy_length < size)
|
||||||
size = copy_length;
|
size = copy_length;
|
||||||
buf = isc_mem_get(mctx, size);
|
buf = isc_mem_get(mctx, size);
|
||||||
if (buf == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
CHECK(journal_seek(j1, best_guess.offset));
|
CHECK(journal_seek(j1, best_guess.offset));
|
||||||
CHECK(journal_seek(j2, indexend));
|
CHECK(journal_seek(j2, indexend));
|
||||||
|
@ -72,9 +72,6 @@ dns_keytable_create(isc_mem_t *mctx, dns_keytable_t **keytablep) {
|
|||||||
REQUIRE(keytablep != NULL && *keytablep == NULL);
|
REQUIRE(keytablep != NULL && *keytablep == NULL);
|
||||||
|
|
||||||
keytable = isc_mem_get(mctx, sizeof(*keytable));
|
keytable = isc_mem_get(mctx, sizeof(*keytable));
|
||||||
if (keytable == NULL) {
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
keytable->table = NULL;
|
keytable->table = NULL;
|
||||||
result = dns_rbt_create(mctx, free_keynode, mctx, &keytable->table);
|
result = dns_rbt_create(mctx, free_keynode, mctx, &keytable->table);
|
||||||
@ -778,8 +775,6 @@ dns_keynode_create(isc_mem_t *mctx, dns_keynode_t **target) {
|
|||||||
REQUIRE(target != NULL && *target == NULL);
|
REQUIRE(target != NULL && *target == NULL);
|
||||||
|
|
||||||
knode = isc_mem_get(mctx, sizeof(dns_keynode_t));
|
knode = isc_mem_get(mctx, sizeof(dns_keynode_t));
|
||||||
if (knode == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
knode->magic = KEYNODE_MAGIC;
|
knode->magic = KEYNODE_MAGIC;
|
||||||
knode->managed = false;
|
knode->managed = false;
|
||||||
|
@ -102,10 +102,6 @@ build_event(dns_lookup_t *lookup) {
|
|||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
name = isc_mem_get(lookup->mctx, sizeof(dns_name_t));
|
name = isc_mem_get(lookup->mctx, sizeof(dns_name_t));
|
||||||
if (name == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
dns_name_init(name, NULL);
|
dns_name_init(name, NULL);
|
||||||
result = dns_name_dup(dns_fixedname_name(&lookup->name),
|
result = dns_name_dup(dns_fixedname_name(&lookup->name),
|
||||||
lookup->mctx, name);
|
lookup->mctx, name);
|
||||||
@ -114,10 +110,6 @@ build_event(dns_lookup_t *lookup) {
|
|||||||
|
|
||||||
if (dns_rdataset_isassociated(&lookup->rdataset)) {
|
if (dns_rdataset_isassociated(&lookup->rdataset)) {
|
||||||
rdataset = isc_mem_get(lookup->mctx, sizeof(dns_rdataset_t));
|
rdataset = isc_mem_get(lookup->mctx, sizeof(dns_rdataset_t));
|
||||||
if (rdataset == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
dns_rdataset_init(rdataset);
|
dns_rdataset_init(rdataset);
|
||||||
dns_rdataset_clone(&lookup->rdataset, rdataset);
|
dns_rdataset_clone(&lookup->rdataset, rdataset);
|
||||||
}
|
}
|
||||||
@ -125,10 +117,6 @@ build_event(dns_lookup_t *lookup) {
|
|||||||
if (dns_rdataset_isassociated(&lookup->sigrdataset)) {
|
if (dns_rdataset_isassociated(&lookup->sigrdataset)) {
|
||||||
sigrdataset = isc_mem_get(lookup->mctx,
|
sigrdataset = isc_mem_get(lookup->mctx,
|
||||||
sizeof(dns_rdataset_t));
|
sizeof(dns_rdataset_t));
|
||||||
if (sigrdataset == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
dns_rdataset_init(sigrdataset);
|
dns_rdataset_init(sigrdataset);
|
||||||
dns_rdataset_clone(&lookup->sigrdataset, sigrdataset);
|
dns_rdataset_clone(&lookup->sigrdataset, sigrdataset);
|
||||||
}
|
}
|
||||||
@ -383,8 +371,6 @@ dns_lookup_create(isc_mem_t *mctx, const dns_name_t *name, dns_rdatatype_t type,
|
|||||||
isc_event_t *ievent;
|
isc_event_t *ievent;
|
||||||
|
|
||||||
lookup = isc_mem_get(mctx, sizeof(*lookup));
|
lookup = isc_mem_get(mctx, sizeof(*lookup));
|
||||||
if (lookup == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
lookup->mctx = NULL;
|
lookup->mctx = NULL;
|
||||||
isc_mem_attach(mctx, &lookup->mctx);
|
isc_mem_attach(mctx, &lookup->mctx);
|
||||||
lookup->options = options;
|
lookup->options = options;
|
||||||
|
@ -469,8 +469,6 @@ incctx_create(isc_mem_t *mctx, dns_name_t *origin, dns_incctx_t **ictxp) {
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
ictx = isc_mem_get(mctx, sizeof(*ictx));
|
ictx = isc_mem_get(mctx, sizeof(*ictx));
|
||||||
if (ictx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
for (i = 0; i < NBUFS; i++) {
|
for (i = 0; i < NBUFS; i++) {
|
||||||
dns_fixedname_init(&ictx->fixed[i]);
|
dns_fixedname_init(&ictx->fixed[i]);
|
||||||
@ -523,8 +521,6 @@ loadctx_create(dns_masterformat_t format, isc_mem_t *mctx,
|
|||||||
(task != NULL && done != NULL));
|
(task != NULL && done != NULL));
|
||||||
|
|
||||||
lctx = isc_mem_get(mctx, sizeof(*lctx));
|
lctx = isc_mem_get(mctx, sizeof(*lctx));
|
||||||
if (lctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
lctx->inc = NULL;
|
lctx->inc = NULL;
|
||||||
result = incctx_create(mctx, origin, &lctx->inc);
|
result = incctx_create(mctx, origin, &lctx->inc);
|
||||||
@ -1082,10 +1078,6 @@ load_text(dns_loadctx_t *lctx) {
|
|||||||
* the maximum individual RR data size.
|
* the maximum individual RR data size.
|
||||||
*/
|
*/
|
||||||
target_mem = isc_mem_get(mctx, target_size);
|
target_mem = isc_mem_get(mctx, target_size);
|
||||||
if (target_mem == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto log_and_cleanup;
|
|
||||||
}
|
|
||||||
isc_buffer_init(&target, target_mem, target_size);
|
isc_buffer_init(&target, target_mem, target_size);
|
||||||
target_save = target;
|
target_save = target;
|
||||||
|
|
||||||
@ -2331,10 +2323,6 @@ load_raw(dns_loadctx_t *lctx) {
|
|||||||
* the maximum individual RR data size.
|
* the maximum individual RR data size.
|
||||||
*/
|
*/
|
||||||
target_mem = isc_mem_get(mctx, target_size);
|
target_mem = isc_mem_get(mctx, target_size);
|
||||||
if (target_mem == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
isc_buffer_init(&target, target_mem, target_size);
|
isc_buffer_init(&target, target_mem, target_size);
|
||||||
|
|
||||||
name = dns_fixedname_initname(&fixed);
|
name = dns_fixedname_initname(&fixed);
|
||||||
|
@ -914,8 +914,6 @@ dump_rdataset(isc_mem_t *mctx, const dns_name_t *name,
|
|||||||
|
|
||||||
newlength = buffer->length * 2;
|
newlength = buffer->length * 2;
|
||||||
newmem = isc_mem_get(mctx, newlength);
|
newmem = isc_mem_get(mctx, newlength);
|
||||||
if (newmem == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
isc_mem_put(mctx, buffer->base, buffer->length);
|
isc_mem_put(mctx, buffer->base, buffer->length);
|
||||||
isc_buffer_init(buffer, newmem, newlength);
|
isc_buffer_init(buffer, newmem, newlength);
|
||||||
}
|
}
|
||||||
@ -1158,8 +1156,6 @@ dump_rdataset_raw(isc_mem_t *mctx, const dns_name_t *name,
|
|||||||
|
|
||||||
newlength = buffer->length * 2;
|
newlength = buffer->length * 2;
|
||||||
newmem = isc_mem_get(mctx, newlength);
|
newmem = isc_mem_get(mctx, newlength);
|
||||||
if (newmem == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
isc_mem_put(mctx, buffer->base, buffer->length);
|
isc_mem_put(mctx, buffer->base, buffer->length);
|
||||||
isc_buffer_init(buffer, newmem, newlength);
|
isc_buffer_init(buffer, newmem, newlength);
|
||||||
goto restart;
|
goto restart;
|
||||||
@ -1456,8 +1452,6 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
|
|||||||
unsigned int options;
|
unsigned int options;
|
||||||
|
|
||||||
dctx = isc_mem_get(mctx, sizeof(*dctx));
|
dctx = isc_mem_get(mctx, sizeof(*dctx));
|
||||||
if (dctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
dctx->mctx = NULL;
|
dctx->mctx = NULL;
|
||||||
dctx->f = f;
|
dctx->f = f;
|
||||||
@ -1557,8 +1551,6 @@ writeheader(dns_dumpctx_t *dctx) {
|
|||||||
uint32_t rawversion, now32;
|
uint32_t rawversion, now32;
|
||||||
|
|
||||||
bufmem = isc_mem_get(dctx->mctx, initial_buffer_length);
|
bufmem = isc_mem_get(dctx->mctx, initial_buffer_length);
|
||||||
if (bufmem == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
isc_buffer_init(&buffer, bufmem, initial_buffer_length);
|
isc_buffer_init(&buffer, bufmem, initial_buffer_length);
|
||||||
|
|
||||||
@ -1632,8 +1624,6 @@ dumptostreaminc(dns_dumpctx_t *dctx) {
|
|||||||
isc_time_t start;
|
isc_time_t start;
|
||||||
|
|
||||||
bufmem = isc_mem_get(dctx->mctx, initial_buffer_length);
|
bufmem = isc_mem_get(dctx->mctx, initial_buffer_length);
|
||||||
if (bufmem == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
isc_buffer_init(&buffer, bufmem, initial_buffer_length);
|
isc_buffer_init(&buffer, bufmem, initial_buffer_length);
|
||||||
|
|
||||||
@ -1953,8 +1943,6 @@ dns_master_dumpnodetostream(isc_mem_t *mctx, dns_db_t *db,
|
|||||||
isc_stdtime_get(&now);
|
isc_stdtime_get(&now);
|
||||||
|
|
||||||
bufmem = isc_mem_get(mctx, initial_buffer_length);
|
bufmem = isc_mem_get(mctx, initial_buffer_length);
|
||||||
if (bufmem == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
isc_buffer_init(&buffer, bufmem, initial_buffer_length);
|
isc_buffer_init(&buffer, bufmem, initial_buffer_length);
|
||||||
|
|
||||||
@ -2031,8 +2019,6 @@ dns_master_stylecreate(dns_master_style_t **stylep,
|
|||||||
|
|
||||||
REQUIRE(stylep != NULL && *stylep == NULL);
|
REQUIRE(stylep != NULL && *stylep == NULL);
|
||||||
style = isc_mem_get(mctx, sizeof(*style));
|
style = isc_mem_get(mctx, sizeof(*style));
|
||||||
if (style == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
style->flags = flags;
|
style->flags = flags;
|
||||||
style->ttl_column = ttl_column;
|
style->ttl_column = ttl_column;
|
||||||
|
@ -189,8 +189,6 @@ msgblock_allocate(isc_mem_t *mctx, unsigned int sizeof_type,
|
|||||||
length = sizeof(dns_msgblock_t) + (sizeof_type * count);
|
length = sizeof(dns_msgblock_t) + (sizeof_type * count);
|
||||||
|
|
||||||
block = isc_mem_get(mctx, length);
|
block = isc_mem_get(mctx, length);
|
||||||
if (block == NULL)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
block->count = count;
|
block->count = count;
|
||||||
block->remaining = count;
|
block->remaining = count;
|
||||||
@ -713,8 +711,6 @@ dns_message_create(isc_mem_t *mctx, unsigned int intent, dns_message_t **msgp)
|
|||||||
|| intent == DNS_MESSAGE_INTENTRENDER);
|
|| intent == DNS_MESSAGE_INTENTRENDER);
|
||||||
|
|
||||||
m = isc_mem_get(mctx, sizeof(dns_message_t));
|
m = isc_mem_get(mctx, sizeof(dns_message_t));
|
||||||
if (m == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* No allocations until further notice. Just initialize all lists
|
* No allocations until further notice. Just initialize all lists
|
||||||
@ -1768,8 +1764,6 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source,
|
|||||||
else {
|
else {
|
||||||
msg->saved.length = isc_buffer_usedlength(&origsource);
|
msg->saved.length = isc_buffer_usedlength(&origsource);
|
||||||
msg->saved.base = isc_mem_get(msg->mctx, msg->saved.length);
|
msg->saved.base = isc_mem_get(msg->mctx, msg->saved.length);
|
||||||
if (msg->saved.base == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memmove(msg->saved.base, isc_buffer_base(&origsource),
|
memmove(msg->saved.base, isc_buffer_base(&origsource),
|
||||||
msg->saved.length);
|
msg->saved.length);
|
||||||
msg->free_saved = 1;
|
msg->free_saved = 1;
|
||||||
@ -4302,8 +4296,6 @@ logfmtpacket(dns_message_t *message, const char *description,
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
buf = isc_mem_get(mctx, len);
|
buf = isc_mem_get(mctx, len);
|
||||||
if (buf == NULL)
|
|
||||||
break;
|
|
||||||
isc_buffer_init(&buffer, buf, len);
|
isc_buffer_init(&buffer, buf, len);
|
||||||
result = dns_message_totext(message, style, 0, &buffer);
|
result = dns_message_totext(message, style, 0, &buffer);
|
||||||
if (result == ISC_R_NOSPACE) {
|
if (result == ISC_R_NOSPACE) {
|
||||||
|
@ -2177,8 +2177,6 @@ dns_name_dup(const dns_name_t *source, isc_mem_t *mctx,
|
|||||||
MAKE_EMPTY(target);
|
MAKE_EMPTY(target);
|
||||||
|
|
||||||
target->ndata = isc_mem_get(mctx, source->length);
|
target->ndata = isc_mem_get(mctx, source->length);
|
||||||
if (target->ndata == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
memmove(target->ndata, source->ndata, source->length);
|
memmove(target->ndata, source->ndata, source->length);
|
||||||
|
|
||||||
@ -2219,8 +2217,6 @@ dns_name_dupwithoffsets(const dns_name_t *source, isc_mem_t *mctx,
|
|||||||
MAKE_EMPTY(target);
|
MAKE_EMPTY(target);
|
||||||
|
|
||||||
target->ndata = isc_mem_get(mctx, source->length + source->labels);
|
target->ndata = isc_mem_get(mctx, source->length + source->labels);
|
||||||
if (target->ndata == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
memmove(target->ndata, source->ndata, source->length);
|
memmove(target->ndata, source->ndata, source->length);
|
||||||
|
|
||||||
@ -2353,8 +2349,6 @@ dns_name_settotextfilter(dns_name_totextfilter_t proc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mem = isc_mem_get(thread_key_mctx, sizeof(*mem));
|
mem = isc_mem_get(thread_key_mctx, sizeof(*mem));
|
||||||
if (mem == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
*mem = proc;
|
*mem = proc;
|
||||||
if (isc_thread_key_setspecific(totext_filter_proc_key, mem) != 0) {
|
if (isc_thread_key_setspecific(totext_filter_proc_key, mem) != 0) {
|
||||||
isc_mem_put(thread_key_mctx, mem, sizeof(*mem));
|
isc_mem_put(thread_key_mctx, mem, sizeof(*mem));
|
||||||
|
@ -110,8 +110,6 @@ dns_ntatable_create(dns_view_t *view,
|
|||||||
REQUIRE(ntatablep != NULL && *ntatablep == NULL);
|
REQUIRE(ntatablep != NULL && *ntatablep == NULL);
|
||||||
|
|
||||||
ntatable = isc_mem_get(view->mctx, sizeof(*ntatable));
|
ntatable = isc_mem_get(view->mctx, sizeof(*ntatable));
|
||||||
if (ntatable == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
ntatable->task = NULL;
|
ntatable->task = NULL;
|
||||||
result = isc_task_create(taskmgr, 0, &ntatable->task);
|
result = isc_task_create(taskmgr, 0, &ntatable->task);
|
||||||
@ -301,8 +299,6 @@ nta_create(dns_ntatable_t *ntatable, const dns_name_t *name,
|
|||||||
view = ntatable->view;
|
view = ntatable->view;
|
||||||
|
|
||||||
nta = isc_mem_get(view->mctx, sizeof(dns_nta_t));
|
nta = isc_mem_get(view->mctx, sizeof(dns_nta_t));
|
||||||
if (nta == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
nta->ntatable = ntatable;
|
nta->ntatable = ntatable;
|
||||||
nta->expiry = 0;
|
nta->expiry = 0;
|
||||||
|
@ -588,10 +588,6 @@ openssldh_tofile(const dst_key_t *key, const char *directory) {
|
|||||||
memset(bufs, 0, sizeof(bufs));
|
memset(bufs, 0, sizeof(bufs));
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
bufs[i] = isc_mem_get(key->mctx, BN_num_bytes(p));
|
bufs[i] = isc_mem_get(key->mctx, BN_num_bytes(p));
|
||||||
if (bufs[i] == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -622,7 +618,7 @@ openssldh_tofile(const dst_key_t *key, const char *directory) {
|
|||||||
|
|
||||||
priv.nelements = i;
|
priv.nelements = i;
|
||||||
result = dst__privstruct_writefile(key, &priv, directory);
|
result = dst__privstruct_writefile(key, &priv, directory);
|
||||||
fail:
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
if (bufs[i] == NULL)
|
if (bufs[i] == NULL)
|
||||||
break;
|
break;
|
||||||
|
@ -488,8 +488,6 @@ opensslecdsa_tofile(const dst_key_t *key, const char *directory) {
|
|||||||
DST_RET (ISC_R_FAILURE);
|
DST_RET (ISC_R_FAILURE);
|
||||||
|
|
||||||
buf = isc_mem_get(key->mctx, BN_num_bytes(privkey));
|
buf = isc_mem_get(key->mctx, BN_num_bytes(privkey));
|
||||||
if (buf == NULL)
|
|
||||||
DST_RET (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
priv.elements[0].tag = TAG_ECDSA_PRIVATEKEY;
|
priv.elements[0].tag = TAG_ECDSA_PRIVATEKEY;
|
||||||
priv.elements[0].length = BN_num_bytes(privkey);
|
priv.elements[0].length = BN_num_bytes(privkey);
|
||||||
|
@ -625,8 +625,6 @@ openssleddsa_tofile(const dst_key_t *key, const char *directory) {
|
|||||||
if (key->key_alg == DST_ALG_ED25519) {
|
if (key->key_alg == DST_ALG_ED25519) {
|
||||||
len = DNS_KEY_ED25519SIZE;
|
len = DNS_KEY_ED25519SIZE;
|
||||||
buf = isc_mem_get(key->mctx, len);
|
buf = isc_mem_get(key->mctx, len);
|
||||||
if (buf == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
priv.elements[0].tag = TAG_EDDSA_PRIVATEKEY;
|
priv.elements[0].tag = TAG_EDDSA_PRIVATEKEY;
|
||||||
priv.elements[0].length = len;
|
priv.elements[0].length = len;
|
||||||
ret = priv_ed25519_from_ossl(pkey, buf);
|
ret = priv_ed25519_from_ossl(pkey, buf);
|
||||||
@ -638,8 +636,6 @@ openssleddsa_tofile(const dst_key_t *key, const char *directory) {
|
|||||||
} else {
|
} else {
|
||||||
len = DNS_KEY_ED448SIZE;
|
len = DNS_KEY_ED448SIZE;
|
||||||
buf = isc_mem_get(key->mctx, len);
|
buf = isc_mem_get(key->mctx, len);
|
||||||
if (buf == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
priv.elements[0].tag = TAG_EDDSA_PRIVATEKEY;
|
priv.elements[0].tag = TAG_EDDSA_PRIVATEKEY;
|
||||||
priv.elements[0].length = len;
|
priv.elements[0].length = len;
|
||||||
ret = priv_ed448_from_ossl(pkey, buf);
|
ret = priv_ed448_from_ossl(pkey, buf);
|
||||||
|
@ -702,10 +702,6 @@ opensslrsa_tofile(const dst_key_t *key, const char *directory) {
|
|||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
bufs[i] = isc_mem_get(key->mctx, BN_num_bytes(n));
|
bufs[i] = isc_mem_get(key->mctx, BN_num_bytes(n));
|
||||||
if (bufs[i] == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -51,8 +51,6 @@ dns_order_create(isc_mem_t *mctx, dns_order_t **orderp) {
|
|||||||
REQUIRE(orderp != NULL && *orderp == NULL);
|
REQUIRE(orderp != NULL && *orderp == NULL);
|
||||||
|
|
||||||
order = isc_mem_get(mctx, sizeof(*order));
|
order = isc_mem_get(mctx, sizeof(*order));
|
||||||
if (order == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
ISC_LIST_INIT(order->ents);
|
ISC_LIST_INIT(order->ents);
|
||||||
|
|
||||||
@ -79,8 +77,6 @@ dns_order_add(dns_order_t *order, const dns_name_t *name,
|
|||||||
mode == DNS_RDATASETATTR_CYCLIC);
|
mode == DNS_RDATASETATTR_CYCLIC);
|
||||||
|
|
||||||
ent = isc_mem_get(order->mctx, sizeof(*ent));
|
ent = isc_mem_get(order->mctx, sizeof(*ent));
|
||||||
if (ent == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
dns_fixedname_init(&ent->name);
|
dns_fixedname_init(&ent->name);
|
||||||
RUNTIME_CHECK(dns_name_copy(name, dns_fixedname_name(&ent->name), NULL)
|
RUNTIME_CHECK(dns_name_copy(name, dns_fixedname_name(&ent->name), NULL)
|
||||||
|
@ -59,8 +59,6 @@ dns_peerlist_new(isc_mem_t *mem, dns_peerlist_t **list) {
|
|||||||
REQUIRE(list != NULL);
|
REQUIRE(list != NULL);
|
||||||
|
|
||||||
l = isc_mem_get(mem, sizeof(*l));
|
l = isc_mem_get(mem, sizeof(*l));
|
||||||
if (l == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
ISC_LIST_INIT(l->elements);
|
ISC_LIST_INIT(l->elements);
|
||||||
l->mem = mem;
|
l->mem = mem;
|
||||||
@ -223,8 +221,6 @@ dns_peer_newprefix(isc_mem_t *mem, const isc_netaddr_t *addr,
|
|||||||
REQUIRE(peerptr != NULL);
|
REQUIRE(peerptr != NULL);
|
||||||
|
|
||||||
peer = isc_mem_get(mem, sizeof(*peer));
|
peer = isc_mem_get(mem, sizeof(*peer));
|
||||||
if (peer == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
peer->magic = DNS_PEER_MAGIC;
|
peer->magic = DNS_PEER_MAGIC;
|
||||||
peer->address = *addr;
|
peer->address = *addr;
|
||||||
@ -653,8 +649,6 @@ dns_peer_setkeybycharp(dns_peer_t *peer, const char *keyval) {
|
|||||||
return (result);
|
return (result);
|
||||||
|
|
||||||
name = isc_mem_get(peer->mem, sizeof(dns_name_t));
|
name = isc_mem_get(peer->mem, sizeof(dns_name_t));
|
||||||
if (name == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
dns_name_init(name, NULL);
|
dns_name_init(name, NULL);
|
||||||
result = dns_name_dup(dns_fixedname_name(&fname), peer->mem, name);
|
result = dns_name_dup(dns_fixedname_name(&fname), peer->mem, name);
|
||||||
@ -684,8 +678,6 @@ dns_peer_settransfersource(dns_peer_t *peer,
|
|||||||
if (transfer_source != NULL) {
|
if (transfer_source != NULL) {
|
||||||
peer->transfer_source = isc_mem_get(peer->mem,
|
peer->transfer_source = isc_mem_get(peer->mem,
|
||||||
sizeof(*peer->transfer_source));
|
sizeof(*peer->transfer_source));
|
||||||
if (peer->transfer_source == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
*peer->transfer_source = *transfer_source;
|
*peer->transfer_source = *transfer_source;
|
||||||
}
|
}
|
||||||
@ -717,8 +709,6 @@ dns_peer_setnotifysource(dns_peer_t *peer,
|
|||||||
if (notify_source != NULL) {
|
if (notify_source != NULL) {
|
||||||
peer->notify_source = isc_mem_get(peer->mem,
|
peer->notify_source = isc_mem_get(peer->mem,
|
||||||
sizeof(*peer->notify_source));
|
sizeof(*peer->notify_source));
|
||||||
if (peer->notify_source == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
*peer->notify_source = *notify_source;
|
*peer->notify_source = *notify_source;
|
||||||
}
|
}
|
||||||
@ -748,8 +738,6 @@ dns_peer_setquerysource(dns_peer_t *peer, const isc_sockaddr_t *query_source) {
|
|||||||
if (query_source != NULL) {
|
if (query_source != NULL) {
|
||||||
peer->query_source = isc_mem_get(peer->mem,
|
peer->query_source = isc_mem_get(peer->mem,
|
||||||
sizeof(*peer->query_source));
|
sizeof(*peer->query_source));
|
||||||
if (peer->query_source == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
*peer->query_source = *query_source;
|
*peer->query_source = *query_source;
|
||||||
}
|
}
|
||||||
|
@ -85,10 +85,7 @@ pkcs11ecdsa_createctx(dst_key_t *key, dst_context_t *dctx) {
|
|||||||
else
|
else
|
||||||
mech.mechanism = CKM_SHA384;
|
mech.mechanism = CKM_SHA384;
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(dctx->mctx,
|
pk11_ctx = isc_mem_get(dctx->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
|
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
|
||||||
if (ec->ontoken && (dctx->use == DO_SIGN))
|
if (ec->ontoken && (dctx->use == DO_SIGN))
|
||||||
slotid = ec->slot;
|
slotid = ec->slot;
|
||||||
@ -210,8 +207,6 @@ pkcs11ecdsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
INSIST(keyTemplate[5].type == attr->type);
|
INSIST(keyTemplate[5].type == attr->type);
|
||||||
keyTemplate[5].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[5].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[5].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[5].pValue, attr->pValue,
|
memmove(keyTemplate[5].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[5].ulValueLen = attr->ulValueLen;
|
keyTemplate[5].ulValueLen = attr->ulValueLen;
|
||||||
@ -220,8 +215,6 @@ pkcs11ecdsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
INSIST(keyTemplate[6].type == attr->type);
|
INSIST(keyTemplate[6].type == attr->type);
|
||||||
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[6].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[6].pValue, attr->pValue,
|
memmove(keyTemplate[6].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
||||||
@ -317,8 +310,6 @@ pkcs11ecdsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
|
|||||||
INSIST(keyTemplate[5].type == attr->type);
|
INSIST(keyTemplate[5].type == attr->type);
|
||||||
keyTemplate[5].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[5].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[5].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[5].pValue, attr->pValue,
|
memmove(keyTemplate[5].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[5].ulValueLen = attr->ulValueLen;
|
keyTemplate[5].ulValueLen = attr->ulValueLen;
|
||||||
@ -327,8 +318,6 @@ pkcs11ecdsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
|
|||||||
INSIST(keyTemplate[6].type == attr->type);
|
INSIST(keyTemplate[6].type == attr->type);
|
||||||
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[6].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[6].pValue, attr->pValue,
|
memmove(keyTemplate[6].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
||||||
@ -425,18 +414,14 @@ pkcs11ecdsa_compare(const dst_key_t *key1, const dst_key_t *key2) {
|
|||||||
|
|
||||||
#define SETCURVE() \
|
#define SETCURVE() \
|
||||||
if (key->key_alg == DST_ALG_ECDSA256) { \
|
if (key->key_alg == DST_ALG_ECDSA256) { \
|
||||||
attr->pValue = isc_mem_get(key->mctx, \
|
attr->pValue = isc_mem_get(key->mctx, sizeof(pk11_ecc_prime256v1)); \
|
||||||
sizeof(pk11_ecc_prime256v1)); \
|
\
|
||||||
if (attr->pValue == NULL) \
|
|
||||||
DST_RET(ISC_R_NOMEMORY); \
|
|
||||||
memmove(attr->pValue, \
|
memmove(attr->pValue, \
|
||||||
pk11_ecc_prime256v1, sizeof(pk11_ecc_prime256v1)); \
|
pk11_ecc_prime256v1, sizeof(pk11_ecc_prime256v1)); \
|
||||||
attr->ulValueLen = sizeof(pk11_ecc_prime256v1); \
|
attr->ulValueLen = sizeof(pk11_ecc_prime256v1); \
|
||||||
} else { \
|
} else { \
|
||||||
attr->pValue = isc_mem_get(key->mctx, \
|
attr->pValue = isc_mem_get(key->mctx, sizeof(pk11_ecc_secp384r1)); \
|
||||||
sizeof(pk11_ecc_secp384r1)); \
|
\
|
||||||
if (attr->pValue == NULL) \
|
|
||||||
DST_RET(ISC_R_NOMEMORY); \
|
|
||||||
memmove(attr->pValue, \
|
memmove(attr->pValue, \
|
||||||
pk11_ecc_secp384r1, sizeof(pk11_ecc_secp384r1)); \
|
pk11_ecc_secp384r1, sizeof(pk11_ecc_secp384r1)); \
|
||||||
attr->ulValueLen = sizeof(pk11_ecc_secp384r1); \
|
attr->ulValueLen = sizeof(pk11_ecc_secp384r1); \
|
||||||
@ -487,23 +472,16 @@ pkcs11ecdsa_generate(dst_key_t *key, int unused, void (*callback)(int)) {
|
|||||||
UNUSED(unused);
|
UNUSED(unused);
|
||||||
UNUSED(callback);
|
UNUSED(callback);
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(key->mctx,
|
pk11_ctx = isc_mem_get(key->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
ret = pk11_get_session(pk11_ctx, OP_ECDSA, true, false,
|
ret = pk11_get_session(pk11_ctx, OP_ECDSA, true, false,
|
||||||
false, NULL, pk11_get_best_token(OP_ECDSA));
|
false, NULL, pk11_get_best_token(OP_ECDSA));
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
ec = (pk11_object_t *) isc_mem_get(key->mctx, sizeof(*ec));
|
ec = isc_mem_get(key->mctx, sizeof(*ec));
|
||||||
if (ec == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(ec, 0, sizeof(*ec));
|
memset(ec, 0, sizeof(*ec));
|
||||||
key->keydata.pkey = ec;
|
key->keydata.pkey = ec;
|
||||||
ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 3);
|
ec->repr = isc_mem_get(key->mctx, sizeof(*attr) * 3);
|
||||||
if (ec->repr == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(ec->repr, 0, sizeof(*attr) * 3);
|
memset(ec->repr, 0, sizeof(*attr) * 3);
|
||||||
ec->attrcnt = 3;
|
ec->attrcnt = 3;
|
||||||
|
|
||||||
@ -533,8 +511,6 @@ pkcs11ecdsa_generate(dst_key_t *key, int unused, void (*callback)(int)) {
|
|||||||
(pk11_ctx->session, pub, attr, 1),
|
(pk11_ctx->session, pub, attr, 1),
|
||||||
DST_R_CRYPTOFAILURE);
|
DST_R_CRYPTOFAILURE);
|
||||||
attr->pValue = isc_mem_get(key->mctx, attr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, attr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(attr->pValue, 0, attr->ulValueLen);
|
memset(attr->pValue, 0, attr->ulValueLen);
|
||||||
PK11_RET(pkcs_C_GetAttributeValue,
|
PK11_RET(pkcs_C_GetAttributeValue,
|
||||||
(pk11_ctx->session, pub, attr, 1),
|
(pk11_ctx->session, pub, attr, 1),
|
||||||
@ -545,8 +521,6 @@ pkcs11ecdsa_generate(dst_key_t *key, int unused, void (*callback)(int)) {
|
|||||||
(pk11_ctx->session, priv, attr, 1),
|
(pk11_ctx->session, priv, attr, 1),
|
||||||
DST_R_CRYPTOFAILURE);
|
DST_R_CRYPTOFAILURE);
|
||||||
attr->pValue = isc_mem_get(key->mctx, attr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, attr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(attr->pValue, 0, attr->ulValueLen);
|
memset(attr->pValue, 0, attr->ulValueLen);
|
||||||
PK11_RET(pkcs_C_GetAttributeValue,
|
PK11_RET(pkcs_C_GetAttributeValue,
|
||||||
(pk11_ctx->session, priv, attr, 1),
|
(pk11_ctx->session, priv, attr, 1),
|
||||||
@ -675,30 +649,22 @@ pkcs11ecdsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
|
|||||||
if (r.length != len)
|
if (r.length != len)
|
||||||
return (DST_R_INVALIDPUBLICKEY);
|
return (DST_R_INVALIDPUBLICKEY);
|
||||||
|
|
||||||
ec = (pk11_object_t *) isc_mem_get(key->mctx, sizeof(*ec));
|
ec = isc_mem_get(key->mctx, sizeof(*ec));
|
||||||
if (ec == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(ec, 0, sizeof(*ec));
|
memset(ec, 0, sizeof(*ec));
|
||||||
ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
ec->repr = isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
||||||
if (ec->repr == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
ec->attrcnt = 2;
|
ec->attrcnt = 2;
|
||||||
|
|
||||||
attr = ec->repr;
|
attr = ec->repr;
|
||||||
attr->type = CKA_EC_PARAMS;
|
attr->type = CKA_EC_PARAMS;
|
||||||
if (key->key_alg == DST_ALG_ECDSA256) {
|
if (key->key_alg == DST_ALG_ECDSA256) {
|
||||||
attr->pValue =
|
attr->pValue = isc_mem_get(key->mctx,
|
||||||
isc_mem_get(key->mctx, sizeof(pk11_ecc_prime256v1));
|
sizeof(pk11_ecc_prime256v1));
|
||||||
if (attr->pValue == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
memmove(attr->pValue,
|
memmove(attr->pValue,
|
||||||
pk11_ecc_prime256v1, sizeof(pk11_ecc_prime256v1));
|
pk11_ecc_prime256v1, sizeof(pk11_ecc_prime256v1));
|
||||||
attr->ulValueLen = sizeof(pk11_ecc_prime256v1);
|
attr->ulValueLen = sizeof(pk11_ecc_prime256v1);
|
||||||
} else {
|
} else {
|
||||||
attr->pValue =
|
attr->pValue = isc_mem_get(key->mctx,
|
||||||
isc_mem_get(key->mctx, sizeof(pk11_ecc_secp384r1));
|
sizeof(pk11_ecc_secp384r1));
|
||||||
if (attr->pValue == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
memmove(attr->pValue,
|
memmove(attr->pValue,
|
||||||
pk11_ecc_secp384r1, sizeof(pk11_ecc_secp384r1));
|
pk11_ecc_secp384r1, sizeof(pk11_ecc_secp384r1));
|
||||||
attr->ulValueLen = sizeof(pk11_ecc_secp384r1);
|
attr->ulValueLen = sizeof(pk11_ecc_secp384r1);
|
||||||
@ -707,8 +673,6 @@ pkcs11ecdsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
|
|||||||
attr++;
|
attr++;
|
||||||
attr->type = CKA_EC_POINT;
|
attr->type = CKA_EC_POINT;
|
||||||
attr->pValue = isc_mem_get(key->mctx, len + 3);
|
attr->pValue = isc_mem_get(key->mctx, len + 3);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
((CK_BYTE_PTR) attr->pValue)[0] = TAG_OCTECT_STRING;
|
((CK_BYTE_PTR) attr->pValue)[0] = TAG_OCTECT_STRING;
|
||||||
((CK_BYTE_PTR) attr->pValue)[1] = len + 1;
|
((CK_BYTE_PTR) attr->pValue)[1] = len + 1;
|
||||||
((CK_BYTE_PTR) attr->pValue)[2] = UNCOMPRESSED;
|
((CK_BYTE_PTR) attr->pValue)[2] = UNCOMPRESSED;
|
||||||
@ -762,8 +726,6 @@ pkcs11ecdsa_tofile(const dst_key_t *key, const char *directory) {
|
|||||||
attr = pk11_attribute_bytype(ec, CKA_VALUE);
|
attr = pk11_attribute_bytype(ec, CKA_VALUE);
|
||||||
if (attr != NULL) {
|
if (attr != NULL) {
|
||||||
buf = isc_mem_get(key->mctx, attr->ulValueLen);
|
buf = isc_mem_get(key->mctx, attr->ulValueLen);
|
||||||
if (buf == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
priv.elements[i].tag = TAG_ECDSA_PRIVATEKEY;
|
priv.elements[i].tag = TAG_ECDSA_PRIVATEKEY;
|
||||||
priv.elements[i].length = (unsigned short) attr->ulValueLen;
|
priv.elements[i].length = (unsigned short) attr->ulValueLen;
|
||||||
memmove(buf, attr->pValue, attr->ulValueLen);
|
memmove(buf, attr->pValue, attr->ulValueLen);
|
||||||
@ -826,9 +788,7 @@ pkcs11ecdsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
ec->object = CK_INVALID_HANDLE;
|
ec->object = CK_INVALID_HANDLE;
|
||||||
ec->ontoken = true;
|
ec->ontoken = true;
|
||||||
ec->reqlogon = true;
|
ec->reqlogon = true;
|
||||||
ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
ec->repr = isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
||||||
if (ec->repr == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(ec->repr, 0, sizeof(*attr) * 2);
|
memset(ec->repr, 0, sizeof(*attr) * 2);
|
||||||
ec->attrcnt = 2;
|
ec->attrcnt = 2;
|
||||||
attr = ec->repr;
|
attr = ec->repr;
|
||||||
@ -837,8 +797,6 @@ pkcs11ecdsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
pubattr = pk11_attribute_bytype(pubec, CKA_EC_PARAMS);
|
pubattr = pk11_attribute_bytype(pubec, CKA_EC_PARAMS);
|
||||||
INSIST(pubattr != NULL);
|
INSIST(pubattr != NULL);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
|
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
|
||||||
attr->ulValueLen = pubattr->ulValueLen;
|
attr->ulValueLen = pubattr->ulValueLen;
|
||||||
attr++;
|
attr++;
|
||||||
@ -847,8 +805,6 @@ pkcs11ecdsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
pubattr = pk11_attribute_bytype(pubec, CKA_EC_POINT);
|
pubattr = pk11_attribute_bytype(pubec, CKA_EC_POINT);
|
||||||
INSIST(pubattr != NULL);
|
INSIST(pubattr != NULL);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
|
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
|
||||||
attr->ulValueLen = pubattr->ulValueLen;
|
attr->ulValueLen = pubattr->ulValueLen;
|
||||||
|
|
||||||
@ -856,10 +812,7 @@ pkcs11ecdsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(key->mctx,
|
pk11_ctx = isc_mem_get(key->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
ret = pk11_get_session(pk11_ctx, OP_ECDSA, true, false,
|
ret = pk11_get_session(pk11_ctx, OP_ECDSA, true, false,
|
||||||
ec->reqlogon, NULL, ec->slot);
|
ec->reqlogon, NULL, ec->slot);
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
@ -957,9 +910,7 @@ pkcs11ecdsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ec = (pk11_object_t *) isc_mem_get(key->mctx, sizeof(*ec));
|
ec = isc_mem_get(key->mctx, sizeof(*ec));
|
||||||
if (ec == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(ec, 0, sizeof(*ec));
|
memset(ec, 0, sizeof(*ec));
|
||||||
key->keydata.pkey = ec;
|
key->keydata.pkey = ec;
|
||||||
|
|
||||||
@ -973,9 +924,7 @@ pkcs11ecdsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 3);
|
ec->repr = isc_mem_get(key->mctx, sizeof(*attr) * 3);
|
||||||
if (ec->repr == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(ec->repr, 0, sizeof(*attr) * 3);
|
memset(ec->repr, 0, sizeof(*attr) * 3);
|
||||||
ec->attrcnt = 3;
|
ec->attrcnt = 3;
|
||||||
|
|
||||||
@ -984,8 +933,6 @@ pkcs11ecdsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
|||||||
pattr = pk11_attribute_bytype(pub->keydata.pkey, CKA_EC_PARAMS);
|
pattr = pk11_attribute_bytype(pub->keydata.pkey, CKA_EC_PARAMS);
|
||||||
INSIST(pattr != NULL);
|
INSIST(pattr != NULL);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
|
memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
|
||||||
attr->ulValueLen = pattr->ulValueLen;
|
attr->ulValueLen = pattr->ulValueLen;
|
||||||
|
|
||||||
@ -994,16 +941,12 @@ pkcs11ecdsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
|||||||
pattr = pk11_attribute_bytype(pub->keydata.pkey, CKA_EC_POINT);
|
pattr = pk11_attribute_bytype(pub->keydata.pkey, CKA_EC_POINT);
|
||||||
INSIST(pattr != NULL);
|
INSIST(pattr != NULL);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
|
memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
|
||||||
attr->ulValueLen = pattr->ulValueLen;
|
attr->ulValueLen = pattr->ulValueLen;
|
||||||
|
|
||||||
attr++;
|
attr++;
|
||||||
attr->type = CKA_VALUE;
|
attr->type = CKA_VALUE;
|
||||||
attr->pValue = isc_mem_get(key->mctx, priv.elements[0].length);
|
attr->pValue = isc_mem_get(key->mctx, priv.elements[0].length);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(attr->pValue, priv.elements[0].data, priv.elements[0].length);
|
memmove(attr->pValue, priv.elements[0].data, priv.elements[0].length);
|
||||||
attr->ulValueLen = priv.elements[0].length;
|
attr->ulValueLen = priv.elements[0].length;
|
||||||
|
|
||||||
@ -1047,18 +990,14 @@ pkcs11ecdsa_fromlabel(dst_key_t *key, const char *engine, const char *label,
|
|||||||
|
|
||||||
UNUSED(pin);
|
UNUSED(pin);
|
||||||
|
|
||||||
ec = (pk11_object_t *) isc_mem_get(key->mctx, sizeof(*ec));
|
ec = isc_mem_get(key->mctx, sizeof(*ec));
|
||||||
if (ec == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(ec, 0, sizeof(*ec));
|
memset(ec, 0, sizeof(*ec));
|
||||||
ec->object = CK_INVALID_HANDLE;
|
ec->object = CK_INVALID_HANDLE;
|
||||||
ec->ontoken = true;
|
ec->ontoken = true;
|
||||||
ec->reqlogon = true;
|
ec->reqlogon = true;
|
||||||
key->keydata.pkey = ec;
|
key->keydata.pkey = ec;
|
||||||
|
|
||||||
ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
ec->repr = isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
||||||
if (ec->repr == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(ec->repr, 0, sizeof(*attr) * 2);
|
memset(ec->repr, 0, sizeof(*attr) * 2);
|
||||||
ec->attrcnt = 2;
|
ec->attrcnt = 2;
|
||||||
attr = ec->repr;
|
attr = ec->repr;
|
||||||
@ -1069,10 +1008,7 @@ pkcs11ecdsa_fromlabel(dst_key_t *key, const char *engine, const char *label,
|
|||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(key->mctx,
|
pk11_ctx = isc_mem_get(key->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
ret = pk11_get_session(pk11_ctx, OP_ECDSA, true, false,
|
ret = pk11_get_session(pk11_ctx, OP_ECDSA, true, false,
|
||||||
ec->reqlogon, NULL, ec->slot);
|
ec->reqlogon, NULL, ec->slot);
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
@ -1105,8 +1041,6 @@ pkcs11ecdsa_fromlabel(dst_key_t *key, const char *engine, const char *label,
|
|||||||
DST_R_CRYPTOFAILURE);
|
DST_R_CRYPTOFAILURE);
|
||||||
for (i = 0; i <= 1; i++) {
|
for (i = 0; i <= 1; i++) {
|
||||||
attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
|
attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
|
||||||
if (attr[i].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(attr[i].pValue, 0, attr[i].ulValueLen);
|
memset(attr[i].pValue, 0, attr[i].ulValueLen);
|
||||||
}
|
}
|
||||||
PK11_RET(pkcs_C_GetAttributeValue,
|
PK11_RET(pkcs_C_GetAttributeValue,
|
||||||
|
@ -158,10 +158,7 @@ pkcs11eddsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
else
|
else
|
||||||
siglen = DNS_SIG_ED448SIZE;
|
siglen = DNS_SIG_ED448SIZE;
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(dctx->mctx,
|
pk11_ctx = isc_mem_get(dctx->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
|
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
|
||||||
if (ec->ontoken && (dctx->use == DO_SIGN))
|
if (ec->ontoken && (dctx->use == DO_SIGN))
|
||||||
slotid = ec->slot;
|
slotid = ec->slot;
|
||||||
@ -190,8 +187,6 @@ pkcs11eddsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
INSIST(keyTemplate[5].type == attr->type);
|
INSIST(keyTemplate[5].type == attr->type);
|
||||||
keyTemplate[5].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[5].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[5].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[5].pValue, attr->pValue,
|
memmove(keyTemplate[5].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[5].ulValueLen = attr->ulValueLen;
|
keyTemplate[5].ulValueLen = attr->ulValueLen;
|
||||||
@ -200,8 +195,6 @@ pkcs11eddsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
INSIST(keyTemplate[6].type == attr->type);
|
INSIST(keyTemplate[6].type == attr->type);
|
||||||
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[6].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[6].pValue, attr->pValue,
|
memmove(keyTemplate[6].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
||||||
@ -284,10 +277,7 @@ pkcs11eddsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
|
|||||||
key->key_alg == DST_ALG_ED448);
|
key->key_alg == DST_ALG_ED448);
|
||||||
REQUIRE(ec != NULL);
|
REQUIRE(ec != NULL);
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(dctx->mctx,
|
pk11_ctx = isc_mem_get(dctx->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
|
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
|
||||||
if (ec->ontoken && (dctx->use == DO_SIGN))
|
if (ec->ontoken && (dctx->use == DO_SIGN))
|
||||||
slotid = ec->slot;
|
slotid = ec->slot;
|
||||||
@ -306,8 +296,6 @@ pkcs11eddsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
|
|||||||
INSIST(keyTemplate[5].type == attr->type);
|
INSIST(keyTemplate[5].type == attr->type);
|
||||||
keyTemplate[5].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[5].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[5].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[5].pValue, attr->pValue,
|
memmove(keyTemplate[5].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[5].ulValueLen = attr->ulValueLen;
|
keyTemplate[5].ulValueLen = attr->ulValueLen;
|
||||||
@ -316,8 +304,6 @@ pkcs11eddsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
|
|||||||
/* keyTemplate[6].type is CKA_VALUE */
|
/* keyTemplate[6].type is CKA_VALUE */
|
||||||
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[6].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[6].pValue, attr->pValue,
|
memmove(keyTemplate[6].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
||||||
@ -417,18 +403,14 @@ pkcs11eddsa_compare(const dst_key_t *key1, const dst_key_t *key2) {
|
|||||||
|
|
||||||
#define SETCURVE() \
|
#define SETCURVE() \
|
||||||
if (key->key_alg == DST_ALG_ED25519) { \
|
if (key->key_alg == DST_ALG_ED25519) { \
|
||||||
attr->pValue = isc_mem_get(key->mctx, \
|
attr->pValue = isc_mem_get(key->mctx, sizeof(pk11_ecc_ed25519)); \
|
||||||
sizeof(pk11_ecc_ed25519)); \
|
\
|
||||||
if (attr->pValue == NULL) \
|
|
||||||
DST_RET(ISC_R_NOMEMORY); \
|
|
||||||
memmove(attr->pValue, \
|
memmove(attr->pValue, \
|
||||||
pk11_ecc_ed25519, sizeof(pk11_ecc_ed25519)); \
|
pk11_ecc_ed25519, sizeof(pk11_ecc_ed25519)); \
|
||||||
attr->ulValueLen = sizeof(pk11_ecc_ed25519); \
|
attr->ulValueLen = sizeof(pk11_ecc_ed25519); \
|
||||||
} else { \
|
} else { \
|
||||||
attr->pValue = isc_mem_get(key->mctx, \
|
attr->pValue = isc_mem_get(key->mctx, sizeof(pk11_ecc_ed448)); \
|
||||||
sizeof(pk11_ecc_ed448)); \
|
\
|
||||||
if (attr->pValue == NULL) \
|
|
||||||
DST_RET(ISC_R_NOMEMORY); \
|
|
||||||
memmove(attr->pValue, \
|
memmove(attr->pValue, \
|
||||||
pk11_ecc_ed448, sizeof(pk11_ecc_ed448)); \
|
pk11_ecc_ed448, sizeof(pk11_ecc_ed448)); \
|
||||||
attr->ulValueLen = sizeof(pk11_ecc_ed448); \
|
attr->ulValueLen = sizeof(pk11_ecc_ed448); \
|
||||||
@ -479,23 +461,16 @@ pkcs11eddsa_generate(dst_key_t *key, int unused, void (*callback)(int)) {
|
|||||||
UNUSED(unused);
|
UNUSED(unused);
|
||||||
UNUSED(callback);
|
UNUSED(callback);
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(key->mctx,
|
pk11_ctx = isc_mem_get(key->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
ret = pk11_get_session(pk11_ctx, OP_EC, true, false,
|
ret = pk11_get_session(pk11_ctx, OP_EC, true, false,
|
||||||
false, NULL, pk11_get_best_token(OP_EC));
|
false, NULL, pk11_get_best_token(OP_EC));
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
ec = (pk11_object_t *) isc_mem_get(key->mctx, sizeof(*ec));
|
ec = isc_mem_get(key->mctx, sizeof(*ec));
|
||||||
if (ec == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(ec, 0, sizeof(*ec));
|
memset(ec, 0, sizeof(*ec));
|
||||||
key->keydata.pkey = ec;
|
key->keydata.pkey = ec;
|
||||||
ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 3);
|
ec->repr = isc_mem_get(key->mctx, sizeof(*attr) * 3);
|
||||||
if (ec->repr == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(ec->repr, 0, sizeof(*attr) * 3);
|
memset(ec->repr, 0, sizeof(*attr) * 3);
|
||||||
ec->attrcnt = 3;
|
ec->attrcnt = 3;
|
||||||
|
|
||||||
@ -525,8 +500,6 @@ pkcs11eddsa_generate(dst_key_t *key, int unused, void (*callback)(int)) {
|
|||||||
(pk11_ctx->session, pub, attr, 1),
|
(pk11_ctx->session, pub, attr, 1),
|
||||||
DST_R_CRYPTOFAILURE);
|
DST_R_CRYPTOFAILURE);
|
||||||
attr->pValue = isc_mem_get(key->mctx, attr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, attr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(attr->pValue, 0, attr->ulValueLen);
|
memset(attr->pValue, 0, attr->ulValueLen);
|
||||||
PK11_RET(pkcs_C_GetAttributeValue,
|
PK11_RET(pkcs_C_GetAttributeValue,
|
||||||
(pk11_ctx->session, pub, attr, 1),
|
(pk11_ctx->session, pub, attr, 1),
|
||||||
@ -538,8 +511,6 @@ pkcs11eddsa_generate(dst_key_t *key, int unused, void (*callback)(int)) {
|
|||||||
(pk11_ctx->session, priv, attr, 1),
|
(pk11_ctx->session, priv, attr, 1),
|
||||||
DST_R_CRYPTOFAILURE);
|
DST_R_CRYPTOFAILURE);
|
||||||
attr->pValue = isc_mem_get(key->mctx, attr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, attr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(attr->pValue, 0, attr->ulValueLen);
|
memset(attr->pValue, 0, attr->ulValueLen);
|
||||||
PK11_RET(pkcs_C_GetAttributeValue,
|
PK11_RET(pkcs_C_GetAttributeValue,
|
||||||
(pk11_ctx->session, priv, attr, 1),
|
(pk11_ctx->session, priv, attr, 1),
|
||||||
@ -664,30 +635,21 @@ pkcs11eddsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
|
|||||||
if (r.length != len)
|
if (r.length != len)
|
||||||
return (DST_R_INVALIDPUBLICKEY);
|
return (DST_R_INVALIDPUBLICKEY);
|
||||||
|
|
||||||
ec = (pk11_object_t *) isc_mem_get(key->mctx, sizeof(*ec));
|
ec = isc_mem_get(key->mctx, sizeof(*ec));
|
||||||
if (ec == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(ec, 0, sizeof(*ec));
|
memset(ec, 0, sizeof(*ec));
|
||||||
ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
ec->repr = isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
||||||
if (ec->repr == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
ec->attrcnt = 2;
|
ec->attrcnt = 2;
|
||||||
|
|
||||||
attr = ec->repr;
|
attr = ec->repr;
|
||||||
attr->type = CKA_EC_PARAMS;
|
attr->type = CKA_EC_PARAMS;
|
||||||
if (key->key_alg == DST_ALG_ED25519) {
|
if (key->key_alg == DST_ALG_ED25519) {
|
||||||
attr->pValue =
|
attr->pValue = isc_mem_get(key->mctx,
|
||||||
isc_mem_get(key->mctx, sizeof(pk11_ecc_ed25519));
|
sizeof(pk11_ecc_ed25519));
|
||||||
if (attr->pValue == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
memmove(attr->pValue,
|
memmove(attr->pValue,
|
||||||
pk11_ecc_ed25519, sizeof(pk11_ecc_ed25519));
|
pk11_ecc_ed25519, sizeof(pk11_ecc_ed25519));
|
||||||
attr->ulValueLen = sizeof(pk11_ecc_ed25519);
|
attr->ulValueLen = sizeof(pk11_ecc_ed25519);
|
||||||
} else {
|
} else {
|
||||||
attr->pValue =
|
attr->pValue = isc_mem_get(key->mctx, sizeof(pk11_ecc_ed448));
|
||||||
isc_mem_get(key->mctx, sizeof(pk11_ecc_ed448));
|
|
||||||
if (attr->pValue == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
memmove(attr->pValue,
|
memmove(attr->pValue,
|
||||||
pk11_ecc_ed448, sizeof(pk11_ecc_ed448));
|
pk11_ecc_ed448, sizeof(pk11_ecc_ed448));
|
||||||
attr->ulValueLen = sizeof(pk11_ecc_ed448);
|
attr->ulValueLen = sizeof(pk11_ecc_ed448);
|
||||||
@ -696,8 +658,6 @@ pkcs11eddsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
|
|||||||
attr++;
|
attr++;
|
||||||
attr->type = CKA_EC_POINT;
|
attr->type = CKA_EC_POINT;
|
||||||
attr->pValue = isc_mem_get(key->mctx, len);
|
attr->pValue = isc_mem_get(key->mctx, len);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
memmove((CK_BYTE_PTR) attr->pValue, r.base, len);
|
memmove((CK_BYTE_PTR) attr->pValue, r.base, len);
|
||||||
attr->ulValueLen = len;
|
attr->ulValueLen = len;
|
||||||
|
|
||||||
@ -748,8 +708,6 @@ pkcs11eddsa_tofile(const dst_key_t *key, const char *directory) {
|
|||||||
attr = pk11_attribute_bytype(ec, CKA_VALUE);
|
attr = pk11_attribute_bytype(ec, CKA_VALUE);
|
||||||
if (attr != NULL) {
|
if (attr != NULL) {
|
||||||
buf = isc_mem_get(key->mctx, attr->ulValueLen);
|
buf = isc_mem_get(key->mctx, attr->ulValueLen);
|
||||||
if (buf == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
priv.elements[i].tag = TAG_EDDSA_PRIVATEKEY;
|
priv.elements[i].tag = TAG_EDDSA_PRIVATEKEY;
|
||||||
priv.elements[i].length = (unsigned short) attr->ulValueLen;
|
priv.elements[i].length = (unsigned short) attr->ulValueLen;
|
||||||
memmove(buf, attr->pValue, attr->ulValueLen);
|
memmove(buf, attr->pValue, attr->ulValueLen);
|
||||||
@ -812,9 +770,7 @@ pkcs11eddsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
ec->object = CK_INVALID_HANDLE;
|
ec->object = CK_INVALID_HANDLE;
|
||||||
ec->ontoken = true;
|
ec->ontoken = true;
|
||||||
ec->reqlogon = true;
|
ec->reqlogon = true;
|
||||||
ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
ec->repr = isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
||||||
if (ec->repr == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(ec->repr, 0, sizeof(*attr) * 2);
|
memset(ec->repr, 0, sizeof(*attr) * 2);
|
||||||
ec->attrcnt = 2;
|
ec->attrcnt = 2;
|
||||||
attr = ec->repr;
|
attr = ec->repr;
|
||||||
@ -822,8 +778,6 @@ pkcs11eddsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
attr->type = CKA_EC_PARAMS;
|
attr->type = CKA_EC_PARAMS;
|
||||||
pubattr = pk11_attribute_bytype(pubec, CKA_EC_PARAMS);
|
pubattr = pk11_attribute_bytype(pubec, CKA_EC_PARAMS);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
|
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
|
||||||
attr->ulValueLen = pubattr->ulValueLen;
|
attr->ulValueLen = pubattr->ulValueLen;
|
||||||
attr++;
|
attr++;
|
||||||
@ -831,8 +785,6 @@ pkcs11eddsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
attr->type = CKA_EC_POINT;
|
attr->type = CKA_EC_POINT;
|
||||||
pubattr = pk11_attribute_bytype(pubec, CKA_EC_POINT);
|
pubattr = pk11_attribute_bytype(pubec, CKA_EC_POINT);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
|
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
|
||||||
attr->ulValueLen = pubattr->ulValueLen;
|
attr->ulValueLen = pubattr->ulValueLen;
|
||||||
|
|
||||||
@ -840,10 +792,7 @@ pkcs11eddsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(key->mctx,
|
pk11_ctx = isc_mem_get(key->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
ret = pk11_get_session(pk11_ctx, OP_EC, true, false,
|
ret = pk11_get_session(pk11_ctx, OP_EC, true, false,
|
||||||
ec->reqlogon, NULL, ec->slot);
|
ec->reqlogon, NULL, ec->slot);
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
@ -941,9 +890,7 @@ pkcs11eddsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ec = (pk11_object_t *) isc_mem_get(key->mctx, sizeof(*ec));
|
ec = isc_mem_get(key->mctx, sizeof(*ec));
|
||||||
if (ec == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(ec, 0, sizeof(*ec));
|
memset(ec, 0, sizeof(*ec));
|
||||||
key->keydata.pkey = ec;
|
key->keydata.pkey = ec;
|
||||||
|
|
||||||
@ -957,9 +904,7 @@ pkcs11eddsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 3);
|
ec->repr = isc_mem_get(key->mctx, sizeof(*attr) * 3);
|
||||||
if (ec->repr == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(ec->repr, 0, sizeof(*attr) * 3);
|
memset(ec->repr, 0, sizeof(*attr) * 3);
|
||||||
ec->attrcnt = 3;
|
ec->attrcnt = 3;
|
||||||
|
|
||||||
@ -968,8 +913,6 @@ pkcs11eddsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
|||||||
pattr = pk11_attribute_bytype(pub->keydata.pkey, CKA_EC_PARAMS);
|
pattr = pk11_attribute_bytype(pub->keydata.pkey, CKA_EC_PARAMS);
|
||||||
INSIST(pattr != NULL);
|
INSIST(pattr != NULL);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
|
memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
|
||||||
attr->ulValueLen = pattr->ulValueLen;
|
attr->ulValueLen = pattr->ulValueLen;
|
||||||
|
|
||||||
@ -978,16 +921,12 @@ pkcs11eddsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
|||||||
pattr = pk11_attribute_bytype(pub->keydata.pkey, CKA_EC_POINT);
|
pattr = pk11_attribute_bytype(pub->keydata.pkey, CKA_EC_POINT);
|
||||||
INSIST(pattr != NULL);
|
INSIST(pattr != NULL);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
|
memmove(attr->pValue, pattr->pValue, pattr->ulValueLen);
|
||||||
attr->ulValueLen = pattr->ulValueLen;
|
attr->ulValueLen = pattr->ulValueLen;
|
||||||
|
|
||||||
attr++;
|
attr++;
|
||||||
attr->type = CKA_VALUE;
|
attr->type = CKA_VALUE;
|
||||||
attr->pValue = isc_mem_get(key->mctx, priv.elements[0].length);
|
attr->pValue = isc_mem_get(key->mctx, priv.elements[0].length);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(attr->pValue, priv.elements[0].data, priv.elements[0].length);
|
memmove(attr->pValue, priv.elements[0].data, priv.elements[0].length);
|
||||||
attr->ulValueLen = priv.elements[0].length;
|
attr->ulValueLen = priv.elements[0].length;
|
||||||
|
|
||||||
@ -1031,18 +970,14 @@ pkcs11eddsa_fromlabel(dst_key_t *key, const char *engine, const char *label,
|
|||||||
|
|
||||||
UNUSED(pin);
|
UNUSED(pin);
|
||||||
|
|
||||||
ec = (pk11_object_t *) isc_mem_get(key->mctx, sizeof(*ec));
|
ec = isc_mem_get(key->mctx, sizeof(*ec));
|
||||||
if (ec == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(ec, 0, sizeof(*ec));
|
memset(ec, 0, sizeof(*ec));
|
||||||
ec->object = CK_INVALID_HANDLE;
|
ec->object = CK_INVALID_HANDLE;
|
||||||
ec->ontoken = true;
|
ec->ontoken = true;
|
||||||
ec->reqlogon = true;
|
ec->reqlogon = true;
|
||||||
key->keydata.pkey = ec;
|
key->keydata.pkey = ec;
|
||||||
|
|
||||||
ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
ec->repr = isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
||||||
if (ec->repr == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(ec->repr, 0, sizeof(*attr) * 2);
|
memset(ec->repr, 0, sizeof(*attr) * 2);
|
||||||
ec->attrcnt = 2;
|
ec->attrcnt = 2;
|
||||||
attr = ec->repr;
|
attr = ec->repr;
|
||||||
@ -1053,10 +988,7 @@ pkcs11eddsa_fromlabel(dst_key_t *key, const char *engine, const char *label,
|
|||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(key->mctx,
|
pk11_ctx = isc_mem_get(key->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
ret = pk11_get_session(pk11_ctx, OP_EC, true, false,
|
ret = pk11_get_session(pk11_ctx, OP_EC, true, false,
|
||||||
ec->reqlogon, NULL, ec->slot);
|
ec->reqlogon, NULL, ec->slot);
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
@ -1089,8 +1021,6 @@ pkcs11eddsa_fromlabel(dst_key_t *key, const char *engine, const char *label,
|
|||||||
DST_R_CRYPTOFAILURE);
|
DST_R_CRYPTOFAILURE);
|
||||||
for (i = 0; i <= 1; i++) {
|
for (i = 0; i <= 1; i++) {
|
||||||
attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
|
attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
|
||||||
if (attr[i].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(attr[i].pValue, 0, attr[i].ulValueLen);
|
memset(attr[i].pValue, 0, attr[i].ulValueLen);
|
||||||
}
|
}
|
||||||
PK11_RET(pkcs_C_GetAttributeValue,
|
PK11_RET(pkcs_C_GetAttributeValue,
|
||||||
|
@ -113,10 +113,7 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
|
|||||||
|
|
||||||
rsa = key->keydata.pkey;
|
rsa = key->keydata.pkey;
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(dctx->mctx,
|
pk11_ctx = isc_mem_get(dctx->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
|
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
|
||||||
if (rsa->ontoken)
|
if (rsa->ontoken)
|
||||||
slotid = rsa->slot;
|
slotid = rsa->slot;
|
||||||
@ -141,8 +138,6 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
|
|||||||
INSIST(keyTemplate[6].type == attr->type);
|
INSIST(keyTemplate[6].type == attr->type);
|
||||||
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[6].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[6].pValue, attr->pValue,
|
memmove(keyTemplate[6].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
||||||
@ -151,8 +146,6 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
|
|||||||
INSIST(keyTemplate[7].type == attr->type);
|
INSIST(keyTemplate[7].type == attr->type);
|
||||||
keyTemplate[7].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[7].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[7].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[7].pValue, attr->pValue,
|
memmove(keyTemplate[7].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[7].ulValueLen = attr->ulValueLen;
|
keyTemplate[7].ulValueLen = attr->ulValueLen;
|
||||||
@ -161,8 +154,6 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
|
|||||||
INSIST(keyTemplate[8].type == attr->type);
|
INSIST(keyTemplate[8].type == attr->type);
|
||||||
keyTemplate[8].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[8].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[8].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[8].pValue, attr->pValue,
|
memmove(keyTemplate[8].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[8].ulValueLen = attr->ulValueLen;
|
keyTemplate[8].ulValueLen = attr->ulValueLen;
|
||||||
@ -171,8 +162,6 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
|
|||||||
INSIST(keyTemplate[9].type == attr->type);
|
INSIST(keyTemplate[9].type == attr->type);
|
||||||
keyTemplate[9].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[9].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[9].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[9].pValue, attr->pValue,
|
memmove(keyTemplate[9].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[9].ulValueLen = attr->ulValueLen;
|
keyTemplate[9].ulValueLen = attr->ulValueLen;
|
||||||
@ -181,8 +170,6 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
|
|||||||
INSIST(keyTemplate[10].type == attr->type);
|
INSIST(keyTemplate[10].type == attr->type);
|
||||||
keyTemplate[10].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[10].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[10].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[10].pValue, attr->pValue,
|
memmove(keyTemplate[10].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[10].ulValueLen = attr->ulValueLen;
|
keyTemplate[10].ulValueLen = attr->ulValueLen;
|
||||||
@ -191,8 +178,6 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
|
|||||||
INSIST(keyTemplate[11].type == attr->type);
|
INSIST(keyTemplate[11].type == attr->type);
|
||||||
keyTemplate[11].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[11].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[11].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[11].pValue, attr->pValue,
|
memmove(keyTemplate[11].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[11].ulValueLen = attr->ulValueLen;
|
keyTemplate[11].ulValueLen = attr->ulValueLen;
|
||||||
@ -201,8 +186,6 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
|
|||||||
INSIST(keyTemplate[12].type == attr->type);
|
INSIST(keyTemplate[12].type == attr->type);
|
||||||
keyTemplate[12].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[12].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[12].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[12].pValue, attr->pValue,
|
memmove(keyTemplate[12].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[12].ulValueLen = attr->ulValueLen;
|
keyTemplate[12].ulValueLen = attr->ulValueLen;
|
||||||
@ -211,8 +194,6 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) {
|
|||||||
INSIST(keyTemplate[13].type == attr->type);
|
INSIST(keyTemplate[13].type == attr->type);
|
||||||
keyTemplate[13].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[13].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[13].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[13].pValue, attr->pValue,
|
memmove(keyTemplate[13].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[13].ulValueLen = attr->ulValueLen;
|
keyTemplate[13].ulValueLen = attr->ulValueLen;
|
||||||
@ -337,10 +318,7 @@ pkcs11rsa_createctx_verify(dst_key_t *key, unsigned int maxbits,
|
|||||||
|
|
||||||
rsa = key->keydata.pkey;
|
rsa = key->keydata.pkey;
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(dctx->mctx,
|
pk11_ctx = isc_mem_get(dctx->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
ret = pk11_get_session(pk11_ctx, OP_RSA, true, false,
|
ret = pk11_get_session(pk11_ctx, OP_RSA, true, false,
|
||||||
rsa->reqlogon, NULL,
|
rsa->reqlogon, NULL,
|
||||||
pk11_get_best_token(OP_RSA));
|
pk11_get_best_token(OP_RSA));
|
||||||
@ -355,8 +333,6 @@ pkcs11rsa_createctx_verify(dst_key_t *key, unsigned int maxbits,
|
|||||||
INSIST(keyTemplate[5].type == attr->type);
|
INSIST(keyTemplate[5].type == attr->type);
|
||||||
keyTemplate[5].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[5].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[5].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[5].pValue, attr->pValue,
|
memmove(keyTemplate[5].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[5].ulValueLen = attr->ulValueLen;
|
keyTemplate[5].ulValueLen = attr->ulValueLen;
|
||||||
@ -365,8 +341,6 @@ pkcs11rsa_createctx_verify(dst_key_t *key, unsigned int maxbits,
|
|||||||
INSIST(keyTemplate[6].type == attr->type);
|
INSIST(keyTemplate[6].type == attr->type);
|
||||||
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[6].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[6].pValue, attr->pValue,
|
memmove(keyTemplate[6].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
||||||
@ -614,10 +588,7 @@ pkcs11rsa_createctx(dst_key_t *key, dst_context_t *dctx) {
|
|||||||
ISC_UNREACHABLE();
|
ISC_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(dctx->mctx,
|
pk11_ctx = isc_mem_get(dctx->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
|
memset(pk11_ctx, 0, sizeof(*pk11_ctx));
|
||||||
if (rsa->ontoken)
|
if (rsa->ontoken)
|
||||||
slotid = rsa->slot;
|
slotid = rsa->slot;
|
||||||
@ -789,8 +760,6 @@ pkcs11rsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
INSIST(keyTemplate[6].type == attr->type);
|
INSIST(keyTemplate[6].type == attr->type);
|
||||||
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[6].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[6].pValue, attr->pValue,
|
memmove(keyTemplate[6].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
||||||
@ -799,8 +768,6 @@ pkcs11rsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
INSIST(keyTemplate[7].type == attr->type);
|
INSIST(keyTemplate[7].type == attr->type);
|
||||||
keyTemplate[7].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[7].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[7].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[7].pValue, attr->pValue,
|
memmove(keyTemplate[7].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[7].ulValueLen = attr->ulValueLen;
|
keyTemplate[7].ulValueLen = attr->ulValueLen;
|
||||||
@ -809,8 +776,6 @@ pkcs11rsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
INSIST(keyTemplate[8].type == attr->type);
|
INSIST(keyTemplate[8].type == attr->type);
|
||||||
keyTemplate[8].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[8].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[8].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[8].pValue, attr->pValue,
|
memmove(keyTemplate[8].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[8].ulValueLen = attr->ulValueLen;
|
keyTemplate[8].ulValueLen = attr->ulValueLen;
|
||||||
@ -819,8 +784,6 @@ pkcs11rsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
INSIST(keyTemplate[9].type == attr->type);
|
INSIST(keyTemplate[9].type == attr->type);
|
||||||
keyTemplate[9].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[9].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[9].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[9].pValue, attr->pValue,
|
memmove(keyTemplate[9].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[9].ulValueLen = attr->ulValueLen;
|
keyTemplate[9].ulValueLen = attr->ulValueLen;
|
||||||
@ -829,8 +792,6 @@ pkcs11rsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
INSIST(keyTemplate[10].type == attr->type);
|
INSIST(keyTemplate[10].type == attr->type);
|
||||||
keyTemplate[10].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[10].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[10].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[10].pValue, attr->pValue,
|
memmove(keyTemplate[10].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[10].ulValueLen = attr->ulValueLen;
|
keyTemplate[10].ulValueLen = attr->ulValueLen;
|
||||||
@ -839,8 +800,6 @@ pkcs11rsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
INSIST(keyTemplate[11].type == attr->type);
|
INSIST(keyTemplate[11].type == attr->type);
|
||||||
keyTemplate[11].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[11].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[11].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[11].pValue, attr->pValue,
|
memmove(keyTemplate[11].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[11].ulValueLen = attr->ulValueLen;
|
keyTemplate[11].ulValueLen = attr->ulValueLen;
|
||||||
@ -849,8 +808,6 @@ pkcs11rsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
INSIST(keyTemplate[12].type == attr->type);
|
INSIST(keyTemplate[12].type == attr->type);
|
||||||
keyTemplate[12].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[12].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[12].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[12].pValue, attr->pValue,
|
memmove(keyTemplate[12].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[12].ulValueLen = attr->ulValueLen;
|
keyTemplate[12].ulValueLen = attr->ulValueLen;
|
||||||
@ -859,8 +816,6 @@ pkcs11rsa_sign(dst_context_t *dctx, isc_buffer_t *sig) {
|
|||||||
INSIST(keyTemplate[13].type == attr->type);
|
INSIST(keyTemplate[13].type == attr->type);
|
||||||
keyTemplate[13].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[13].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[13].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[13].pValue, attr->pValue,
|
memmove(keyTemplate[13].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[13].ulValueLen = attr->ulValueLen;
|
keyTemplate[13].ulValueLen = attr->ulValueLen;
|
||||||
@ -989,8 +944,6 @@ pkcs11rsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
|
|||||||
INSIST(keyTemplate[5].type == attr->type);
|
INSIST(keyTemplate[5].type == attr->type);
|
||||||
keyTemplate[5].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[5].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[5].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[5].pValue, attr->pValue,
|
memmove(keyTemplate[5].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[5].ulValueLen = attr->ulValueLen;
|
keyTemplate[5].ulValueLen = attr->ulValueLen;
|
||||||
@ -999,8 +952,6 @@ pkcs11rsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
|
|||||||
INSIST(keyTemplate[6].type == attr->type);
|
INSIST(keyTemplate[6].type == attr->type);
|
||||||
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
keyTemplate[6].pValue = isc_mem_get(dctx->mctx,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
if (keyTemplate[6].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(keyTemplate[6].pValue, attr->pValue,
|
memmove(keyTemplate[6].pValue, attr->pValue,
|
||||||
attr->ulValueLen);
|
attr->ulValueLen);
|
||||||
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
keyTemplate[6].ulValueLen = attr->ulValueLen;
|
||||||
@ -1165,10 +1116,7 @@ pkcs11rsa_generate(dst_key_t *key, int exp, void (*callback)(int)) {
|
|||||||
ISC_UNREACHABLE();
|
ISC_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(key->mctx,
|
pk11_ctx = isc_mem_get(key->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
ret = pk11_get_session(pk11_ctx, OP_RSA, true, false,
|
ret = pk11_get_session(pk11_ctx, OP_RSA, true, false,
|
||||||
false, NULL, pk11_get_best_token(OP_RSA));
|
false, NULL, pk11_get_best_token(OP_RSA));
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
@ -1198,14 +1146,10 @@ pkcs11rsa_generate(dst_key_t *key, int exp, void (*callback)(int)) {
|
|||||||
&pub, &priv),
|
&pub, &priv),
|
||||||
DST_R_CRYPTOFAILURE);
|
DST_R_CRYPTOFAILURE);
|
||||||
|
|
||||||
rsa = (pk11_object_t *) isc_mem_get(key->mctx, sizeof(*rsa));
|
rsa = isc_mem_get(key->mctx, sizeof(*rsa));
|
||||||
if (rsa == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(rsa, 0, sizeof(*rsa));
|
memset(rsa, 0, sizeof(*rsa));
|
||||||
key->keydata.pkey = rsa;
|
key->keydata.pkey = rsa;
|
||||||
rsa->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 8);
|
rsa->repr = isc_mem_get(key->mctx, sizeof(*attr) * 8);
|
||||||
if (rsa->repr == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(rsa->repr, 0, sizeof(*attr) * 8);
|
memset(rsa->repr, 0, sizeof(*attr) * 8);
|
||||||
rsa->attrcnt = 8;
|
rsa->attrcnt = 8;
|
||||||
|
|
||||||
@ -1224,8 +1168,6 @@ pkcs11rsa_generate(dst_key_t *key, int exp, void (*callback)(int)) {
|
|||||||
DST_R_CRYPTOFAILURE);
|
DST_R_CRYPTOFAILURE);
|
||||||
for (i = 0; i <= 1; i++) {
|
for (i = 0; i <= 1; i++) {
|
||||||
attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
|
attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
|
||||||
if (attr[i].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(attr[i].pValue, 0, attr[i].ulValueLen);
|
memset(attr[i].pValue, 0, attr[i].ulValueLen);
|
||||||
}
|
}
|
||||||
PK11_RET(pkcs_C_GetAttributeValue,
|
PK11_RET(pkcs_C_GetAttributeValue,
|
||||||
@ -1238,8 +1180,6 @@ pkcs11rsa_generate(dst_key_t *key, int exp, void (*callback)(int)) {
|
|||||||
DST_R_CRYPTOFAILURE);
|
DST_R_CRYPTOFAILURE);
|
||||||
for (i = 0; i <= 5; i++) {
|
for (i = 0; i <= 5; i++) {
|
||||||
attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
|
attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
|
||||||
if (attr[i].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(attr[i].pValue, 0, attr[i].ulValueLen);
|
memset(attr[i].pValue, 0, attr[i].ulValueLen);
|
||||||
}
|
}
|
||||||
PK11_RET(pkcs_C_GetAttributeValue,
|
PK11_RET(pkcs_C_GetAttributeValue,
|
||||||
@ -1390,9 +1330,7 @@ pkcs11rsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
|
|||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
length = r.length;
|
length = r.length;
|
||||||
|
|
||||||
rsa = (pk11_object_t *) isc_mem_get(key->mctx, sizeof(*rsa));
|
rsa = isc_mem_get(key->mctx, sizeof(*rsa));
|
||||||
if (rsa == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
memset(rsa, 0, sizeof(*rsa));
|
memset(rsa, 0, sizeof(*rsa));
|
||||||
|
|
||||||
@ -1425,22 +1363,16 @@ pkcs11rsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
|
|||||||
|
|
||||||
isc_buffer_forward(data, length);
|
isc_buffer_forward(data, length);
|
||||||
|
|
||||||
rsa->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
rsa->repr = isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
||||||
if (rsa->repr == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
memset(rsa->repr, 0, sizeof(*attr) * 2);
|
memset(rsa->repr, 0, sizeof(*attr) * 2);
|
||||||
rsa->attrcnt = 2;
|
rsa->attrcnt = 2;
|
||||||
attr = rsa->repr;
|
attr = rsa->repr;
|
||||||
attr[0].type = CKA_MODULUS;
|
attr[0].type = CKA_MODULUS;
|
||||||
attr[0].pValue = isc_mem_get(key->mctx, mod_bytes);
|
attr[0].pValue = isc_mem_get(key->mctx, mod_bytes);
|
||||||
if (attr[0].pValue == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
memmove(attr[0].pValue, modulus, mod_bytes);
|
memmove(attr[0].pValue, modulus, mod_bytes);
|
||||||
attr[0].ulValueLen = (CK_ULONG) mod_bytes;
|
attr[0].ulValueLen = (CK_ULONG) mod_bytes;
|
||||||
attr[1].type = CKA_PUBLIC_EXPONENT;
|
attr[1].type = CKA_PUBLIC_EXPONENT;
|
||||||
attr[1].pValue = isc_mem_get(key->mctx, e_bytes);
|
attr[1].pValue = isc_mem_get(key->mctx, e_bytes);
|
||||||
if (attr[1].pValue == NULL)
|
|
||||||
goto nomemory;
|
|
||||||
memmove(attr[1].pValue, exponent, e_bytes);
|
memmove(attr[1].pValue, exponent, e_bytes);
|
||||||
attr[1].ulValueLen = (CK_ULONG) e_bytes;
|
attr[1].ulValueLen = (CK_ULONG) e_bytes;
|
||||||
|
|
||||||
@ -1534,10 +1466,6 @@ pkcs11rsa_tofile(const dst_key_t *key, const char *directory) {
|
|||||||
|
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
bufs[i] = isc_mem_get(key->mctx, modulus->ulValueLen);
|
bufs[i] = isc_mem_get(key->mctx, modulus->ulValueLen);
|
||||||
if (bufs[i] == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
memset(bufs[i], 0, modulus->ulValueLen);
|
memset(bufs[i], 0, modulus->ulValueLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1662,9 +1590,7 @@ pkcs11rsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
rsa->object = CK_INVALID_HANDLE;
|
rsa->object = CK_INVALID_HANDLE;
|
||||||
rsa->ontoken = true;
|
rsa->ontoken = true;
|
||||||
rsa->reqlogon = true;
|
rsa->reqlogon = true;
|
||||||
rsa->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
rsa->repr = isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
||||||
if (rsa->repr == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(rsa->repr, 0, sizeof(*attr) * 2);
|
memset(rsa->repr, 0, sizeof(*attr) * 2);
|
||||||
rsa->attrcnt = 2;
|
rsa->attrcnt = 2;
|
||||||
attr = rsa->repr;
|
attr = rsa->repr;
|
||||||
@ -1673,8 +1599,6 @@ pkcs11rsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
pubattr = pk11_attribute_bytype(pubrsa, CKA_MODULUS);
|
pubattr = pk11_attribute_bytype(pubrsa, CKA_MODULUS);
|
||||||
INSIST(pubattr != NULL);
|
INSIST(pubattr != NULL);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
|
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
|
||||||
attr->ulValueLen = pubattr->ulValueLen;
|
attr->ulValueLen = pubattr->ulValueLen;
|
||||||
attr++;
|
attr++;
|
||||||
@ -1683,8 +1607,6 @@ pkcs11rsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
pubattr = pk11_attribute_bytype(pubrsa, CKA_PUBLIC_EXPONENT);
|
pubattr = pk11_attribute_bytype(pubrsa, CKA_PUBLIC_EXPONENT);
|
||||||
INSIST(pubattr != NULL);
|
INSIST(pubattr != NULL);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
|
memmove(attr->pValue, pubattr->pValue, pubattr->ulValueLen);
|
||||||
attr->ulValueLen = pubattr->ulValueLen;
|
attr->ulValueLen = pubattr->ulValueLen;
|
||||||
|
|
||||||
@ -1692,10 +1614,7 @@ pkcs11rsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(key->mctx,
|
pk11_ctx = isc_mem_get(key->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
ret = pk11_get_session(pk11_ctx, OP_RSA, true, false,
|
ret = pk11_get_session(pk11_ctx, OP_RSA, true, false,
|
||||||
rsa->reqlogon, NULL, rsa->slot);
|
rsa->reqlogon, NULL, rsa->slot);
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
@ -1858,9 +1777,7 @@ pkcs11rsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rsa = (pk11_object_t *) isc_mem_get(key->mctx, sizeof(*rsa));
|
rsa = isc_mem_get(key->mctx, sizeof(*rsa));
|
||||||
if (rsa == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(rsa, 0, sizeof(*rsa));
|
memset(rsa, 0, sizeof(*rsa));
|
||||||
key->keydata.pkey = rsa;
|
key->keydata.pkey = rsa;
|
||||||
|
|
||||||
@ -1874,9 +1791,7 @@ pkcs11rsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
rsa->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 8);
|
rsa->repr = isc_mem_get(key->mctx, sizeof(*attr) * 8);
|
||||||
if (rsa->repr == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(rsa->repr, 0, sizeof(*attr) * 8);
|
memset(rsa->repr, 0, sizeof(*attr) * 8);
|
||||||
rsa->attrcnt = 8;
|
rsa->attrcnt = 8;
|
||||||
attr = rsa->repr;
|
attr = rsa->repr;
|
||||||
@ -1899,8 +1814,6 @@ pkcs11rsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
|
|||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
bn = isc_mem_get(key->mctx, priv.elements[i].length);
|
bn = isc_mem_get(key->mctx, priv.elements[i].length);
|
||||||
if (bn == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memmove(bn, priv.elements[i].data,
|
memmove(bn, priv.elements[i].data,
|
||||||
priv.elements[i].length);
|
priv.elements[i].length);
|
||||||
}
|
}
|
||||||
@ -2010,18 +1923,14 @@ pkcs11rsa_fromlabel(dst_key_t *key, const char *engine, const char *label,
|
|||||||
|
|
||||||
UNUSED(pin);
|
UNUSED(pin);
|
||||||
|
|
||||||
rsa = (pk11_object_t *) isc_mem_get(key->mctx, sizeof(*rsa));
|
rsa = isc_mem_get(key->mctx, sizeof(*rsa));
|
||||||
if (rsa == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(rsa, 0, sizeof(*rsa));
|
memset(rsa, 0, sizeof(*rsa));
|
||||||
rsa->object = CK_INVALID_HANDLE;
|
rsa->object = CK_INVALID_HANDLE;
|
||||||
rsa->ontoken = true;
|
rsa->ontoken = true;
|
||||||
rsa->reqlogon = true;
|
rsa->reqlogon = true;
|
||||||
key->keydata.pkey = rsa;
|
key->keydata.pkey = rsa;
|
||||||
|
|
||||||
rsa->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
rsa->repr = isc_mem_get(key->mctx, sizeof(*attr) * 2);
|
||||||
if (rsa->repr == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(rsa->repr, 0, sizeof(*attr) * 2);
|
memset(rsa->repr, 0, sizeof(*attr) * 2);
|
||||||
rsa->attrcnt = 2;
|
rsa->attrcnt = 2;
|
||||||
attr = rsa->repr;
|
attr = rsa->repr;
|
||||||
@ -2032,10 +1941,7 @@ pkcs11rsa_fromlabel(dst_key_t *key, const char *engine, const char *label,
|
|||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
pk11_ctx = (pk11_context_t *) isc_mem_get(key->mctx,
|
pk11_ctx = isc_mem_get(key->mctx, sizeof(*pk11_ctx));
|
||||||
sizeof(*pk11_ctx));
|
|
||||||
if (pk11_ctx == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
ret = pk11_get_session(pk11_ctx, OP_RSA, true, false,
|
ret = pk11_get_session(pk11_ctx, OP_RSA, true, false,
|
||||||
rsa->reqlogon, NULL, rsa->slot);
|
rsa->reqlogon, NULL, rsa->slot);
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
@ -2068,8 +1974,6 @@ pkcs11rsa_fromlabel(dst_key_t *key, const char *engine, const char *label,
|
|||||||
DST_R_CRYPTOFAILURE);
|
DST_R_CRYPTOFAILURE);
|
||||||
for (i = 0; i <= 1; i++) {
|
for (i = 0; i <= 1; i++) {
|
||||||
attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
|
attr[i].pValue = isc_mem_get(key->mctx, attr[i].ulValueLen);
|
||||||
if (attr[i].pValue == NULL)
|
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
|
||||||
memset(attr[i].pValue, 0, attr[i].ulValueLen);
|
memset(attr[i].pValue, 0, attr[i].ulValueLen);
|
||||||
}
|
}
|
||||||
PK11_RET(pkcs_C_GetAttributeValue,
|
PK11_RET(pkcs_C_GetAttributeValue,
|
||||||
|
@ -70,8 +70,6 @@ dns_portlist_create(isc_mem_t *mctx, dns_portlist_t **portlistp) {
|
|||||||
REQUIRE(portlistp != NULL && *portlistp == NULL);
|
REQUIRE(portlistp != NULL && *portlistp == NULL);
|
||||||
|
|
||||||
portlist = isc_mem_get(mctx, sizeof(*portlist));
|
portlist = isc_mem_get(mctx, sizeof(*portlist));
|
||||||
if (portlist == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
isc_mutex_init(&portlist->lock);
|
isc_mutex_init(&portlist->lock);
|
||||||
isc_refcount_init(&portlist->refcount, 1);
|
isc_refcount_init(&portlist->refcount, 1);
|
||||||
portlist->list = NULL;
|
portlist->list = NULL;
|
||||||
@ -142,10 +140,6 @@ dns_portlist_add(dns_portlist_t *portlist, int af, in_port_t port) {
|
|||||||
unsigned int allocated;
|
unsigned int allocated;
|
||||||
allocated = portlist->allocated + DNS_PL_ALLOCATE;
|
allocated = portlist->allocated + DNS_PL_ALLOCATE;
|
||||||
el = isc_mem_get(portlist->mctx, sizeof(*el) * allocated);
|
el = isc_mem_get(portlist->mctx, sizeof(*el) * allocated);
|
||||||
if (el == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto unlock;
|
|
||||||
}
|
|
||||||
if (portlist->list != NULL) {
|
if (portlist->list != NULL) {
|
||||||
memmove(el, portlist->list,
|
memmove(el, portlist->list,
|
||||||
portlist->allocated * sizeof(*el));
|
portlist->allocated * sizeof(*el));
|
||||||
|
@ -955,9 +955,7 @@ dns_rbt_create(isc_mem_t *mctx, dns_rbtdeleter_t deleter,
|
|||||||
REQUIRE(rbtp != NULL && *rbtp == NULL);
|
REQUIRE(rbtp != NULL && *rbtp == NULL);
|
||||||
REQUIRE(deleter == NULL ? deleter_arg == NULL : 1);
|
REQUIRE(deleter == NULL ? deleter_arg == NULL : 1);
|
||||||
|
|
||||||
rbt = (dns_rbt_t *)isc_mem_get(mctx, sizeof(*rbt));
|
rbt = isc_mem_get(mctx, sizeof(*rbt));
|
||||||
if (rbt == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
rbt->mctx = NULL;
|
rbt->mctx = NULL;
|
||||||
isc_mem_attach(mctx, &rbt->mctx);
|
isc_mem_attach(mctx, &rbt->mctx);
|
||||||
@ -2188,9 +2186,7 @@ create_node(isc_mem_t *mctx, const dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||||||
* Allocate space for the node structure, the name, and the offsets.
|
* Allocate space for the node structure, the name, and the offsets.
|
||||||
*/
|
*/
|
||||||
nodelen = sizeof(dns_rbtnode_t) + region.length + labels + 1;
|
nodelen = sizeof(dns_rbtnode_t) + region.length + labels + 1;
|
||||||
node = (dns_rbtnode_t *)isc_mem_get(mctx, nodelen);
|
node = isc_mem_get(mctx, nodelen);
|
||||||
if (node == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(node, 0, nodelen);
|
memset(node, 0, nodelen);
|
||||||
|
|
||||||
node->is_root = 0;
|
node->is_root = 0;
|
||||||
@ -2278,9 +2274,6 @@ inithash(dns_rbt_t *rbt) {
|
|||||||
bytes = (unsigned int)rbt->hashsize * sizeof(dns_rbtnode_t *);
|
bytes = (unsigned int)rbt->hashsize * sizeof(dns_rbtnode_t *);
|
||||||
rbt->hashtable = isc_mem_get(rbt->mctx, bytes);
|
rbt->hashtable = isc_mem_get(rbt->mctx, bytes);
|
||||||
|
|
||||||
if (rbt->hashtable == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
memset(rbt->hashtable, 0, bytes);
|
memset(rbt->hashtable, 0, bytes);
|
||||||
|
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
@ -2306,11 +2299,6 @@ rehash(dns_rbt_t *rbt, unsigned int newcount) {
|
|||||||
} while (newcount >= (rbt->hashsize * 3));
|
} while (newcount >= (rbt->hashsize * 3));
|
||||||
rbt->hashtable = isc_mem_get(rbt->mctx,
|
rbt->hashtable = isc_mem_get(rbt->mctx,
|
||||||
rbt->hashsize * sizeof(dns_rbtnode_t *));
|
rbt->hashsize * sizeof(dns_rbtnode_t *));
|
||||||
if (rbt->hashtable == NULL) {
|
|
||||||
rbt->hashtable = oldtable;
|
|
||||||
rbt->hashsize = oldsize;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < rbt->hashsize; i++)
|
for (i = 0; i < rbt->hashsize; i++)
|
||||||
rbt->hashtable[i] = NULL;
|
rbt->hashtable[i] = NULL;
|
||||||
|
@ -1224,8 +1224,6 @@ allocate_version(isc_mem_t *mctx, rbtdb_serial_t serial,
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
version = isc_mem_get(mctx, sizeof(*version));
|
version = isc_mem_get(mctx, sizeof(*version));
|
||||||
if (version == NULL)
|
|
||||||
return (NULL);
|
|
||||||
version->serial = serial;
|
version->serial = serial;
|
||||||
|
|
||||||
isc_refcount_init(&version->references, references);
|
isc_refcount_init(&version->references, references);
|
||||||
@ -1239,15 +1237,8 @@ allocate_version(isc_mem_t *mctx, rbtdb_serial_t serial,
|
|||||||
|
|
||||||
version->glue_table_size = RBTDB_GLUE_TABLE_INIT_SIZE;
|
version->glue_table_size = RBTDB_GLUE_TABLE_INIT_SIZE;
|
||||||
version->glue_table_nodecount = 0U;
|
version->glue_table_nodecount = 0U;
|
||||||
version->glue_table = (rbtdb_glue_table_node_t **)
|
version->glue_table = isc_mem_get(mctx,
|
||||||
isc_mem_get(mctx, (version->glue_table_size *
|
(version->glue_table_size * sizeof(*version->glue_table)));
|
||||||
sizeof(*version->glue_table)));
|
|
||||||
if (version->glue_table == NULL) {
|
|
||||||
isc_rwlock_destroy(&version->glue_rwlock);
|
|
||||||
isc_refcount_destroy(&version->references);
|
|
||||||
isc_mem_put(mctx, version, sizeof(*version));
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
version->writer = writer;
|
version->writer = writer;
|
||||||
version->commit_ok = false;
|
version->commit_ok = false;
|
||||||
@ -1434,8 +1425,6 @@ new_rdataset(dns_rbtdb_t *rbtdb, isc_mem_t *mctx) {
|
|||||||
rdatasetheader_t *h;
|
rdatasetheader_t *h;
|
||||||
|
|
||||||
h = isc_mem_get(mctx, sizeof(*h));
|
h = isc_mem_get(mctx, sizeof(*h));
|
||||||
if (h == NULL)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
#if TRACE_HEADER
|
#if TRACE_HEADER
|
||||||
if (IS_CACHE(rbtdb) && rbtdb->common.rdclass == dns_rdataclass_in)
|
if (IS_CACHE(rbtdb) && rbtdb->common.rdclass == dns_rdataclass_in)
|
||||||
@ -5389,8 +5378,6 @@ createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp)
|
|||||||
REQUIRE(VALID_RBTDB(rbtdb));
|
REQUIRE(VALID_RBTDB(rbtdb));
|
||||||
|
|
||||||
rbtdbiter = isc_mem_get(rbtdb->common.mctx, sizeof(*rbtdbiter));
|
rbtdbiter = isc_mem_get(rbtdb->common.mctx, sizeof(*rbtdbiter));
|
||||||
if (rbtdbiter == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
rbtdbiter->common.methods = &dbiterator_methods;
|
rbtdbiter->common.methods = &dbiterator_methods;
|
||||||
rbtdbiter->common.db = NULL;
|
rbtdbiter->common.db = NULL;
|
||||||
@ -5615,8 +5602,6 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||||||
REQUIRE(VALID_RBTDB(rbtdb));
|
REQUIRE(VALID_RBTDB(rbtdb));
|
||||||
|
|
||||||
iterator = isc_mem_get(rbtdb->common.mctx, sizeof(*iterator));
|
iterator = isc_mem_get(rbtdb->common.mctx, sizeof(*iterator));
|
||||||
if (iterator == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
if ((db->attributes & DNS_DBATTR_CACHE) == 0) {
|
if ((db->attributes & DNS_DBATTR_CACHE) == 0) {
|
||||||
now = 0;
|
now = 0;
|
||||||
@ -6343,10 +6328,6 @@ addnoqname(dns_rbtdb_t *rbtdb, rdatasetheader_t *newheader,
|
|||||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||||
|
|
||||||
noqname = isc_mem_get(mctx, sizeof(*noqname));
|
noqname = isc_mem_get(mctx, sizeof(*noqname));
|
||||||
if (noqname == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
dns_name_init(&noqname->name, NULL);
|
dns_name_init(&noqname->name, NULL);
|
||||||
noqname->neg = NULL;
|
noqname->neg = NULL;
|
||||||
noqname->negsig = NULL;
|
noqname->negsig = NULL;
|
||||||
@ -6394,10 +6375,6 @@ addclosest(dns_rbtdb_t *rbtdb, rdatasetheader_t *newheader,
|
|||||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||||
|
|
||||||
closest = isc_mem_get(mctx, sizeof(*closest));
|
closest = isc_mem_get(mctx, sizeof(*closest));
|
||||||
if (closest == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
dns_name_init(&closest->name, NULL);
|
dns_name_init(&closest->name, NULL);
|
||||||
closest->neg = NULL;
|
closest->neg = NULL;
|
||||||
closest->negsig = NULL;
|
closest->negsig = NULL;
|
||||||
@ -7270,8 +7247,6 @@ beginload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) {
|
|||||||
REQUIRE(VALID_RBTDB(rbtdb));
|
REQUIRE(VALID_RBTDB(rbtdb));
|
||||||
|
|
||||||
loadctx = isc_mem_get(rbtdb->common.mctx, sizeof(*loadctx));
|
loadctx = isc_mem_get(rbtdb->common.mctx, sizeof(*loadctx));
|
||||||
if (loadctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
loadctx->rbtdb = rbtdb;
|
loadctx->rbtdb = rbtdb;
|
||||||
if (IS_CACHE(rbtdb))
|
if (IS_CACHE(rbtdb))
|
||||||
@ -8087,8 +8062,6 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
|||||||
UNUSED(driverarg);
|
UNUSED(driverarg);
|
||||||
|
|
||||||
rbtdb = isc_mem_get(mctx, sizeof(*rbtdb));
|
rbtdb = isc_mem_get(mctx, sizeof(*rbtdb));
|
||||||
if (rbtdb == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If argv[0] exists, it points to a memory context to use for heap
|
* If argv[0] exists, it points to a memory context to use for heap
|
||||||
@ -8136,12 +8109,8 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
|||||||
goto cleanup_tree_lock;
|
goto cleanup_tree_lock;
|
||||||
}
|
}
|
||||||
INSIST(rbtdb->node_lock_count < (1 << DNS_RBT_LOCKLENGTH));
|
INSIST(rbtdb->node_lock_count < (1 << DNS_RBT_LOCKLENGTH));
|
||||||
rbtdb->node_locks = isc_mem_get(mctx, rbtdb->node_lock_count *
|
rbtdb->node_locks = isc_mem_get(mctx,
|
||||||
sizeof(rbtdb_nodelock_t));
|
rbtdb->node_lock_count * sizeof(rbtdb_nodelock_t));
|
||||||
if (rbtdb->node_locks == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_tree_lock;
|
|
||||||
}
|
|
||||||
|
|
||||||
rbtdb->cachestats = NULL;
|
rbtdb->cachestats = NULL;
|
||||||
rbtdb->gluecachestats = NULL;
|
rbtdb->gluecachestats = NULL;
|
||||||
@ -8151,12 +8120,8 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
|||||||
result = dns_rdatasetstats_create(mctx, &rbtdb->rrsetstats);
|
result = dns_rdatasetstats_create(mctx, &rbtdb->rrsetstats);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
goto cleanup_node_locks;
|
goto cleanup_node_locks;
|
||||||
rbtdb->rdatasets = isc_mem_get(mctx, rbtdb->node_lock_count *
|
rbtdb->rdatasets = isc_mem_get(mctx,
|
||||||
sizeof(rdatasetheaderlist_t));
|
rbtdb->node_lock_count * sizeof(rdatasetheaderlist_t));
|
||||||
if (rbtdb->rdatasets == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_rrsetstats;
|
|
||||||
}
|
|
||||||
for (i = 0; i < (int)rbtdb->node_lock_count; i++)
|
for (i = 0; i < (int)rbtdb->node_lock_count; i++)
|
||||||
ISC_LIST_INIT(rbtdb->rdatasets[i]);
|
ISC_LIST_INIT(rbtdb->rdatasets[i]);
|
||||||
} else
|
} else
|
||||||
@ -8165,12 +8130,8 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
|||||||
/*
|
/*
|
||||||
* Create the heaps.
|
* Create the heaps.
|
||||||
*/
|
*/
|
||||||
rbtdb->heaps = isc_mem_get(hmctx, rbtdb->node_lock_count *
|
rbtdb->heaps = isc_mem_get(hmctx,
|
||||||
sizeof(isc_heap_t *));
|
rbtdb->node_lock_count * sizeof(isc_heap_t *));
|
||||||
if (rbtdb->heaps == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_rdatasets;
|
|
||||||
}
|
|
||||||
for (i = 0; i < (int)rbtdb->node_lock_count; i++)
|
for (i = 0; i < (int)rbtdb->node_lock_count; i++)
|
||||||
rbtdb->heaps[i] = NULL;
|
rbtdb->heaps[i] = NULL;
|
||||||
sooner = IS_CACHE(rbtdb) ? ttl_sooner : resign_sooner;
|
sooner = IS_CACHE(rbtdb) ? ttl_sooner : resign_sooner;
|
||||||
@ -8184,12 +8145,8 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
|||||||
/*
|
/*
|
||||||
* Create deadnode lists.
|
* Create deadnode lists.
|
||||||
*/
|
*/
|
||||||
rbtdb->deadnodes = isc_mem_get(mctx, rbtdb->node_lock_count *
|
rbtdb->deadnodes = isc_mem_get(mctx,
|
||||||
sizeof(rbtnodelist_t));
|
rbtdb->node_lock_count * sizeof(rbtnodelist_t));
|
||||||
if (rbtdb->deadnodes == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_heaps;
|
|
||||||
}
|
|
||||||
for (i = 0; i < (int)rbtdb->node_lock_count; i++)
|
for (i = 0; i < (int)rbtdb->node_lock_count; i++)
|
||||||
ISC_LIST_INIT(rbtdb->deadnodes[i]);
|
ISC_LIST_INIT(rbtdb->deadnodes[i]);
|
||||||
|
|
||||||
@ -8376,11 +8333,9 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
|||||||
rbtdb->node_lock_count * sizeof(isc_heap_t *));
|
rbtdb->node_lock_count * sizeof(isc_heap_t *));
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup_rdatasets:
|
|
||||||
if (rbtdb->rdatasets != NULL)
|
if (rbtdb->rdatasets != NULL)
|
||||||
isc_mem_put(mctx, rbtdb->rdatasets, rbtdb->node_lock_count *
|
isc_mem_put(mctx, rbtdb->rdatasets, rbtdb->node_lock_count *
|
||||||
sizeof(rdatasetheaderlist_t));
|
sizeof(rdatasetheaderlist_t));
|
||||||
cleanup_rrsetstats:
|
|
||||||
if (rbtdb->rrsetstats != NULL)
|
if (rbtdb->rrsetstats != NULL)
|
||||||
dns_stats_detach(&rbtdb->rrsetstats);
|
dns_stats_detach(&rbtdb->rrsetstats);
|
||||||
|
|
||||||
@ -9633,10 +9588,8 @@ rehash_gluetable(rbtdb_version_t *version) {
|
|||||||
} while (version->glue_table_nodecount >=
|
} while (version->glue_table_nodecount >=
|
||||||
(version->glue_table_size * 3U));
|
(version->glue_table_size * 3U));
|
||||||
|
|
||||||
version->glue_table = (rbtdb_glue_table_node_t **)
|
version->glue_table = isc_mem_get(version->rbtdb->common.mctx,
|
||||||
isc_mem_get(version->rbtdb->common.mctx,
|
(version->glue_table_size * sizeof(*version->glue_table)));
|
||||||
(version->glue_table_size *
|
|
||||||
sizeof(*version->glue_table)));
|
|
||||||
if (ISC_UNLIKELY(version->glue_table == NULL)) {
|
if (ISC_UNLIKELY(version->glue_table == NULL)) {
|
||||||
version->glue_table = oldtable;
|
version->glue_table = oldtable;
|
||||||
version->glue_table_size = oldsize;
|
version->glue_table_size = oldsize;
|
||||||
@ -9711,10 +9664,6 @@ glue_nsdname_cb(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) {
|
|||||||
&rdataset_a, &sigrdataset_a);
|
&rdataset_a, &sigrdataset_a);
|
||||||
if (result == DNS_R_GLUE) {
|
if (result == DNS_R_GLUE) {
|
||||||
glue = isc_mem_get(ctx->rbtdb->common.mctx, sizeof(*glue));
|
glue = isc_mem_get(ctx->rbtdb->common.mctx, sizeof(*glue));
|
||||||
if (glue == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
gluename = dns_fixedname_initname(&glue->fixedname);
|
gluename = dns_fixedname_initname(&glue->fixedname);
|
||||||
dns_name_copy(name_a, gluename, NULL);
|
dns_name_copy(name_a, gluename, NULL);
|
||||||
@ -9739,10 +9688,6 @@ glue_nsdname_cb(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) {
|
|||||||
if (glue == NULL) {
|
if (glue == NULL) {
|
||||||
glue = isc_mem_get(ctx->rbtdb->common.mctx,
|
glue = isc_mem_get(ctx->rbtdb->common.mctx,
|
||||||
sizeof(*glue));
|
sizeof(*glue));
|
||||||
if (glue == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
gluename = dns_fixedname_initname(&glue->fixedname);
|
gluename = dns_fixedname_initname(&glue->fixedname);
|
||||||
dns_name_copy(name_aaaa, gluename, NULL);
|
dns_name_copy(name_aaaa, gluename, NULL);
|
||||||
@ -9770,7 +9715,6 @@ glue_nsdname_cb(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) {
|
|||||||
|
|
||||||
result = ISC_R_SUCCESS;
|
result = ISC_R_SUCCESS;
|
||||||
|
|
||||||
out:
|
|
||||||
if (dns_rdataset_isassociated(&rdataset_a))
|
if (dns_rdataset_isassociated(&rdataset_a))
|
||||||
rdataset_disassociate(&rdataset_a);
|
rdataset_disassociate(&rdataset_a);
|
||||||
if (dns_rdataset_isassociated(&sigrdataset_a))
|
if (dns_rdataset_isassociated(&sigrdataset_a))
|
||||||
@ -10004,10 +9948,6 @@ no_glue:
|
|||||||
(void)dns_rdataset_additionaldata(rdataset, glue_nsdname_cb, &ctx);
|
(void)dns_rdataset_additionaldata(rdataset, glue_nsdname_cb, &ctx);
|
||||||
|
|
||||||
cur = isc_mem_get(rbtdb->common.mctx, sizeof(*cur));
|
cur = isc_mem_get(rbtdb->common.mctx, sizeof(*cur));
|
||||||
if (cur == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXXMUKS: it looks like the dns_dbversion is not destroyed
|
* XXXMUKS: it looks like the dns_dbversion is not destroyed
|
||||||
@ -10040,17 +9980,12 @@ no_glue:
|
|||||||
rbtversion->glue_table[idx] = cur;
|
rbtversion->glue_table[idx] = cur;
|
||||||
rbtversion->glue_table_nodecount++;
|
rbtversion->glue_table_nodecount++;
|
||||||
|
|
||||||
result = ISC_R_SUCCESS;
|
|
||||||
|
|
||||||
out:
|
|
||||||
RWUNLOCK(&rbtversion->glue_rwlock, isc_rwlocktype_write);
|
RWUNLOCK(&rbtversion->glue_rwlock, isc_rwlocktype_write);
|
||||||
|
|
||||||
if (result == ISC_R_SUCCESS) {
|
|
||||||
restarted = true;
|
restarted = true;
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
|
||||||
|
|
||||||
return (result);
|
/* UNREACHABLE */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
|
@ -148,8 +148,6 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
|
|||||||
if (rdataset->type != 0)
|
if (rdataset->type != 0)
|
||||||
return (ISC_R_FAILURE);
|
return (ISC_R_FAILURE);
|
||||||
rawbuf = isc_mem_get(mctx, buflen);
|
rawbuf = isc_mem_get(mctx, buflen);
|
||||||
if (rawbuf == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
region->base = rawbuf;
|
region->base = rawbuf;
|
||||||
region->length = buflen;
|
region->length = buflen;
|
||||||
rawbuf += reservelen;
|
rawbuf += reservelen;
|
||||||
@ -166,8 +164,6 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
|
|||||||
*/
|
*/
|
||||||
nalloc = nitems;
|
nalloc = nitems;
|
||||||
x = isc_mem_get(mctx, nalloc * sizeof(struct xrdata));
|
x = isc_mem_get(mctx, nalloc * sizeof(struct xrdata));
|
||||||
if (x == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save all of the rdata members into an array.
|
* Save all of the rdata members into an array.
|
||||||
@ -268,19 +264,10 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
|
|||||||
* data.
|
* data.
|
||||||
*/
|
*/
|
||||||
rawbuf = isc_mem_get(mctx, buflen);
|
rawbuf = isc_mem_get(mctx, buflen);
|
||||||
if (rawbuf == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto free_rdatas;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if DNS_RDATASET_FIXED
|
#if DNS_RDATASET_FIXED
|
||||||
/* Allocate temporary offset table. */
|
/* Allocate temporary offset table. */
|
||||||
offsettable = isc_mem_get(mctx, nalloc * sizeof(unsigned int));
|
offsettable = isc_mem_get(mctx, nalloc * sizeof(unsigned int));
|
||||||
if (offsettable == NULL) {
|
|
||||||
isc_mem_put(mctx, rawbuf, buflen);
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto free_rdatas;
|
|
||||||
}
|
|
||||||
memset(offsettable, 0, nalloc * sizeof(unsigned int));
|
memset(offsettable, 0, nalloc * sizeof(unsigned int));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -580,8 +567,6 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab,
|
|||||||
* Copy the reserved area from the new slab.
|
* Copy the reserved area from the new slab.
|
||||||
*/
|
*/
|
||||||
tstart = isc_mem_get(mctx, tlength);
|
tstart = isc_mem_get(mctx, tlength);
|
||||||
if (tstart == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memmove(tstart, nslab, reservelen);
|
memmove(tstart, nslab, reservelen);
|
||||||
tcurrent = tstart + reservelen;
|
tcurrent = tstart + reservelen;
|
||||||
#if DNS_RDATASET_FIXED
|
#if DNS_RDATASET_FIXED
|
||||||
@ -602,10 +587,6 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab,
|
|||||||
|
|
||||||
offsettable = isc_mem_get(mctx,
|
offsettable = isc_mem_get(mctx,
|
||||||
(ocount + oncount) * sizeof(unsigned int));
|
(ocount + oncount) * sizeof(unsigned int));
|
||||||
if (offsettable == NULL) {
|
|
||||||
isc_mem_put(mctx, tstart, tlength);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memset(offsettable, 0, (ocount + oncount) * sizeof(unsigned int));
|
memset(offsettable, 0, (ocount + oncount) * sizeof(unsigned int));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -819,18 +800,12 @@ dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab,
|
|||||||
* Copy the reserved area from the mslab.
|
* Copy the reserved area from the mslab.
|
||||||
*/
|
*/
|
||||||
tstart = isc_mem_get(mctx, tlength);
|
tstart = isc_mem_get(mctx, tlength);
|
||||||
if (tstart == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memmove(tstart, mslab, reservelen);
|
memmove(tstart, mslab, reservelen);
|
||||||
tcurrent = tstart + reservelen;
|
tcurrent = tstart + reservelen;
|
||||||
#if DNS_RDATASET_FIXED
|
#if DNS_RDATASET_FIXED
|
||||||
offsetbase = tcurrent;
|
offsetbase = tcurrent;
|
||||||
|
|
||||||
offsettable = isc_mem_get(mctx, mcount * sizeof(unsigned int));
|
offsettable = isc_mem_get(mctx, mcount * sizeof(unsigned int));
|
||||||
if (offsettable == NULL) {
|
|
||||||
isc_mem_put(mctx, tstart, tlength);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memset(offsettable, 0, mcount * sizeof(unsigned int));
|
memset(offsettable, 0, mcount * sizeof(unsigned int));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -160,8 +160,6 @@ dns_requestmgr_create(isc_mem_t *mctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
requestmgr = isc_mem_get(mctx, sizeof(*requestmgr));
|
requestmgr = isc_mem_get(mctx, sizeof(*requestmgr));
|
||||||
if (requestmgr == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
isc_mutex_init(&requestmgr->lock);
|
isc_mutex_init(&requestmgr->lock);
|
||||||
|
|
||||||
@ -451,8 +449,6 @@ new_request(isc_mem_t *mctx, dns_request_t **requestp)
|
|||||||
dns_request_t *request;
|
dns_request_t *request;
|
||||||
|
|
||||||
request = isc_mem_get(mctx, sizeof(*request));
|
request = isc_mem_get(mctx, sizeof(*request));
|
||||||
if (request == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Zero structure.
|
* Zero structure.
|
||||||
|
@ -856,8 +856,6 @@ valcreate(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, dns_name_t *name,
|
|||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
valarg = isc_mem_get(fctx->mctx, sizeof(*valarg));
|
valarg = isc_mem_get(fctx->mctx, sizeof(*valarg));
|
||||||
if (valarg == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
valarg->fctx = fctx;
|
valarg->fctx = fctx;
|
||||||
valarg->addrinfo = addrinfo;
|
valarg->addrinfo = addrinfo;
|
||||||
@ -1514,16 +1512,13 @@ fcount_incr(fetchctx_t *fctx, bool force) {
|
|||||||
|
|
||||||
if (counter == NULL) {
|
if (counter == NULL) {
|
||||||
counter = isc_mem_get(dbucket->mctx, sizeof(fctxcount_t));
|
counter = isc_mem_get(dbucket->mctx, sizeof(fctxcount_t));
|
||||||
if (counter == NULL)
|
{
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
else {
|
|
||||||
ISC_LINK_INIT(counter, link);
|
ISC_LINK_INIT(counter, link);
|
||||||
counter->count = 1;
|
counter->count = 1;
|
||||||
counter->logged = 0;
|
counter->logged = 0;
|
||||||
counter->allowed = 1;
|
counter->allowed = 1;
|
||||||
counter->dropped = 0;
|
counter->dropped = 0;
|
||||||
counter->domain =
|
counter->domain = dns_fixedname_initname(&counter->fdname);
|
||||||
dns_fixedname_initname(&counter->fdname);
|
|
||||||
dns_name_copy(&fctx->domain, counter->domain, NULL);
|
dns_name_copy(&fctx->domain, counter->domain, NULL);
|
||||||
ISC_LIST_APPEND(dbucket->list, counter, link);
|
ISC_LIST_APPEND(dbucket->list, counter, link);
|
||||||
}
|
}
|
||||||
@ -1950,10 +1945,6 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
|
|||||||
dns_message_reset(fctx->rmessage, DNS_MESSAGE_INTENTPARSE);
|
dns_message_reset(fctx->rmessage, DNS_MESSAGE_INTENTPARSE);
|
||||||
|
|
||||||
query = isc_mem_get(fctx->mctx, sizeof(*query));
|
query = isc_mem_get(fctx->mctx, sizeof(*query));
|
||||||
if (query == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto stop_idle_timer;
|
|
||||||
}
|
|
||||||
query->mctx = fctx->mctx;
|
query->mctx = fctx->mctx;
|
||||||
query->options = options;
|
query->options = options;
|
||||||
query->attributes = 0;
|
query->attributes = 0;
|
||||||
@ -2165,7 +2156,6 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
|
|||||||
isc_mem_put(fctx->mctx, query, sizeof(*query));
|
isc_mem_put(fctx->mctx, query, sizeof(*query));
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_idle_timer:
|
|
||||||
RUNTIME_CHECK(fctx_stopidletimer(fctx) == ISC_R_SUCCESS);
|
RUNTIME_CHECK(fctx_stopidletimer(fctx) == ISC_R_SUCCESS);
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
@ -2197,8 +2187,6 @@ add_bad_edns(fetchctx_t *fctx, isc_sockaddr_t *address) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
sa = isc_mem_get(fctx->mctx, sizeof(*sa));
|
sa = isc_mem_get(fctx->mctx, sizeof(*sa));
|
||||||
if (sa == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
*sa = *address;
|
*sa = *address;
|
||||||
ISC_LIST_INITANDAPPEND(fctx->bad_edns, sa, link);
|
ISC_LIST_INITANDAPPEND(fctx->bad_edns, sa, link);
|
||||||
@ -2229,8 +2217,6 @@ add_triededns(fetchctx_t *fctx, isc_sockaddr_t *address) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tried = isc_mem_get(fctx->mctx, sizeof(*tried));
|
tried = isc_mem_get(fctx->mctx, sizeof(*tried));
|
||||||
if (tried == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tried->addr = *address;
|
tried->addr = *address;
|
||||||
tried->count = 1;
|
tried->count = 1;
|
||||||
@ -2262,8 +2248,6 @@ add_triededns512(fetchctx_t *fctx, isc_sockaddr_t *address) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tried = isc_mem_get(fctx->mctx, sizeof(*tried));
|
tried = isc_mem_get(fctx->mctx, sizeof(*tried));
|
||||||
if (tried == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tried->addr = *address;
|
tried->addr = *address;
|
||||||
tried->count = 1;
|
tried->count = 1;
|
||||||
@ -3218,8 +3202,6 @@ add_bad(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, isc_result_t reason,
|
|||||||
FCTXTRACE("add_bad");
|
FCTXTRACE("add_bad");
|
||||||
|
|
||||||
sa = isc_mem_get(fctx->mctx, sizeof(*sa));
|
sa = isc_mem_get(fctx->mctx, sizeof(*sa));
|
||||||
if (sa == NULL)
|
|
||||||
return;
|
|
||||||
*sa = *address;
|
*sa = *address;
|
||||||
ISC_LIST_INITANDAPPEND(fctx->bad, sa, link);
|
ISC_LIST_INITANDAPPEND(fctx->bad, sa, link);
|
||||||
|
|
||||||
@ -4713,8 +4695,6 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type,
|
|||||||
|
|
||||||
mctx = res->buckets[bucketnum].mctx;
|
mctx = res->buckets[bucketnum].mctx;
|
||||||
fctx = isc_mem_get(mctx, sizeof(*fctx));
|
fctx = isc_mem_get(mctx, sizeof(*fctx));
|
||||||
if (fctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
fctx->qc = NULL;
|
fctx->qc = NULL;
|
||||||
if (qc != NULL) {
|
if (qc != NULL) {
|
||||||
@ -7251,11 +7231,7 @@ log_nsid(isc_buffer_t *opt, size_t nsid_len, resquery_t *query,
|
|||||||
/* Allocate buffer for storing hex version of the NSID */
|
/* Allocate buffer for storing hex version of the NSID */
|
||||||
buflen = (uint16_t)nsid_len * 2 + 1;
|
buflen = (uint16_t)nsid_len * 2 + 1;
|
||||||
buf = isc_mem_get(mctx, buflen);
|
buf = isc_mem_get(mctx, buflen);
|
||||||
if (buf == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
pbuf = isc_mem_get(mctx, nsid_len + 1);
|
pbuf = isc_mem_get(mctx, nsid_len + 1);
|
||||||
if (pbuf == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
/* Convert to hex */
|
/* Convert to hex */
|
||||||
p = buf;
|
p = buf;
|
||||||
@ -7281,7 +7257,7 @@ log_nsid(isc_buffer_t *opt, size_t nsid_len, resquery_t *query,
|
|||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_NSID,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_NSID,
|
||||||
DNS_LOGMODULE_RESOLVER, level,
|
DNS_LOGMODULE_RESOLVER, level,
|
||||||
"received NSID %s (\"%s\") from %s", buf, pbuf, addrbuf);
|
"received NSID %s (\"%s\") from %s", buf, pbuf, addrbuf);
|
||||||
cleanup:
|
|
||||||
if (pbuf != NULL)
|
if (pbuf != NULL)
|
||||||
isc_mem_put(mctx, pbuf, nsid_len + 1);
|
isc_mem_put(mctx, pbuf, nsid_len + 1);
|
||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
@ -9948,8 +9924,6 @@ dns_resolver_create(dns_view_t *view,
|
|||||||
REQUIRE(dispatchv4 != NULL || dispatchv6 != NULL);
|
REQUIRE(dispatchv4 != NULL || dispatchv6 != NULL);
|
||||||
|
|
||||||
res = isc_mem_get(view->mctx, sizeof(*res));
|
res = isc_mem_get(view->mctx, sizeof(*res));
|
||||||
if (res == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
RTRACE("create");
|
RTRACE("create");
|
||||||
res->mctx = view->mctx;
|
res->mctx = view->mctx;
|
||||||
res->rdclass = view->rdclass;
|
res->rdclass = view->rdclass;
|
||||||
@ -9988,12 +9962,7 @@ dns_resolver_create(dns_view_t *view,
|
|||||||
isc_stats_set(view->resstats, ntasks,
|
isc_stats_set(view->resstats, ntasks,
|
||||||
dns_resstatscounter_buckets);
|
dns_resstatscounter_buckets);
|
||||||
res->activebuckets = ntasks;
|
res->activebuckets = ntasks;
|
||||||
res->buckets = isc_mem_get(view->mctx,
|
res->buckets = isc_mem_get(view->mctx, ntasks * sizeof(fctxbucket_t));
|
||||||
ntasks * sizeof(fctxbucket_t));
|
|
||||||
if (res->buckets == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_badcache;
|
|
||||||
}
|
|
||||||
for (i = 0; i < ntasks; i++) {
|
for (i = 0; i < ntasks; i++) {
|
||||||
isc_mutex_init(&res->buckets[i].lock);
|
isc_mutex_init(&res->buckets[i].lock);
|
||||||
|
|
||||||
@ -10030,10 +9999,6 @@ dns_resolver_create(dns_view_t *view,
|
|||||||
|
|
||||||
res->dbuckets = isc_mem_get(view->mctx,
|
res->dbuckets = isc_mem_get(view->mctx,
|
||||||
RES_DOMAIN_BUCKETS * sizeof(zonebucket_t));
|
RES_DOMAIN_BUCKETS * sizeof(zonebucket_t));
|
||||||
if (res->dbuckets == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_buckets;
|
|
||||||
}
|
|
||||||
for (i = 0; i < RES_DOMAIN_BUCKETS; i++) {
|
for (i = 0; i < RES_DOMAIN_BUCKETS; i++) {
|
||||||
ISC_LIST_INIT(res->dbuckets[i].list);
|
ISC_LIST_INIT(res->dbuckets[i].list);
|
||||||
res->dbuckets[i].mctx = NULL;
|
res->dbuckets[i].mctx = NULL;
|
||||||
@ -10142,7 +10107,6 @@ dns_resolver_create(dns_view_t *view,
|
|||||||
isc_mem_put(view->mctx, res->buckets,
|
isc_mem_put(view->mctx, res->buckets,
|
||||||
res->nbuckets * sizeof(fctxbucket_t));
|
res->nbuckets * sizeof(fctxbucket_t));
|
||||||
|
|
||||||
cleanup_badcache:
|
|
||||||
dns_badcache_destroy(&res->badcache);
|
dns_badcache_destroy(&res->badcache);
|
||||||
|
|
||||||
cleanup_res:
|
cleanup_res:
|
||||||
@ -10235,14 +10199,6 @@ dns_resolver_prime(dns_resolver_t *res) {
|
|||||||
*/
|
*/
|
||||||
RTRACE("priming");
|
RTRACE("priming");
|
||||||
rdataset = isc_mem_get(res->mctx, sizeof(*rdataset));
|
rdataset = isc_mem_get(res->mctx, sizeof(*rdataset));
|
||||||
if (rdataset == NULL) {
|
|
||||||
LOCK(&res->lock);
|
|
||||||
INSIST(res->priming);
|
|
||||||
INSIST(res->primefetch == NULL);
|
|
||||||
res->priming = false;
|
|
||||||
UNLOCK(&res->lock);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dns_rdataset_init(rdataset);
|
dns_rdataset_init(rdataset);
|
||||||
LOCK(&res->primelock);
|
LOCK(&res->primelock);
|
||||||
result = dns_resolver_createfetch(res, dns_rootname,
|
result = dns_resolver_createfetch(res, dns_rootname,
|
||||||
@ -10561,8 +10517,6 @@ dns_resolver_createfetch(dns_resolver_t *res, const dns_name_t *name,
|
|||||||
* XXXRTH use a mempool?
|
* XXXRTH use a mempool?
|
||||||
*/
|
*/
|
||||||
fetch = isc_mem_get(res->mctx, sizeof(*fetch));
|
fetch = isc_mem_get(res->mctx, sizeof(*fetch));
|
||||||
if (fetch == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
fetch->mctx = NULL;
|
fetch->mctx = NULL;
|
||||||
isc_mem_attach(res->mctx, &fetch->mctx);
|
isc_mem_attach(res->mctx, &fetch->mctx);
|
||||||
|
|
||||||
@ -10853,8 +10807,6 @@ dns_resolver_addalternate(dns_resolver_t *resolver, const isc_sockaddr_t *alt,
|
|||||||
REQUIRE((alt == NULL) ^ (name == NULL));
|
REQUIRE((alt == NULL) ^ (name == NULL));
|
||||||
|
|
||||||
a = isc_mem_get(resolver->mctx, sizeof(*a));
|
a = isc_mem_get(resolver->mctx, sizeof(*a));
|
||||||
if (a == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
if (alt != NULL) {
|
if (alt != NULL) {
|
||||||
a->isaddress = true;
|
a->isaddress = true;
|
||||||
a->_u.addr = *alt;
|
a->_u.addr = *alt;
|
||||||
@ -10997,10 +10949,6 @@ dns_resolver_disable_algorithm(dns_resolver_t *resolver,
|
|||||||
* into it if one exists.
|
* into it if one exists.
|
||||||
*/
|
*/
|
||||||
tmp = isc_mem_get(resolver->mctx, len);
|
tmp = isc_mem_get(resolver->mctx, len);
|
||||||
if (tmp == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
memset(tmp, 0, len);
|
memset(tmp, 0, len);
|
||||||
if (algorithms != NULL)
|
if (algorithms != NULL)
|
||||||
memmove(tmp, algorithms, *algorithms);
|
memmove(tmp, algorithms, *algorithms);
|
||||||
@ -11133,10 +11081,6 @@ dns_resolver_disable_ds_digest(dns_resolver_t *resolver,
|
|||||||
* into it if one exists.
|
* into it if one exists.
|
||||||
*/
|
*/
|
||||||
tmp = isc_mem_get(resolver->mctx, len);
|
tmp = isc_mem_get(resolver->mctx, len);
|
||||||
if (tmp == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
memset(tmp, 0, len);
|
memset(tmp, 0, len);
|
||||||
if (digests != NULL)
|
if (digests != NULL)
|
||||||
memmove(tmp, digests, *digests);
|
memmove(tmp, digests, *digests);
|
||||||
|
@ -637,8 +637,6 @@ new_node(dns_rpz_zones_t *rpzs,
|
|||||||
int i, words, wlen;
|
int i, words, wlen;
|
||||||
|
|
||||||
node = isc_mem_get(rpzs->mctx, sizeof(*node));
|
node = isc_mem_get(rpzs->mctx, sizeof(*node));
|
||||||
if (node == NULL)
|
|
||||||
return (NULL);
|
|
||||||
memset(node, 0, sizeof(*node));
|
memset(node, 0, sizeof(*node));
|
||||||
|
|
||||||
if (child != NULL)
|
if (child != NULL)
|
||||||
@ -1361,8 +1359,6 @@ add_nm(dns_rpz_zones_t *rpzs, dns_name_t *trig_name,
|
|||||||
nm_data = nmnode->data;
|
nm_data = nmnode->data;
|
||||||
if (nm_data == NULL) {
|
if (nm_data == NULL) {
|
||||||
nm_data = isc_mem_get(rpzs->mctx, sizeof(*nm_data));
|
nm_data = isc_mem_get(rpzs->mctx, sizeof(*nm_data));
|
||||||
if (nm_data == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
*nm_data = *new_data;
|
*nm_data = *new_data;
|
||||||
nmnode->data = nm_data;
|
nmnode->data = nm_data;
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
@ -1440,8 +1436,6 @@ dns_rpz_new_zones(dns_rpz_zones_t **rpzsp, char *rps_cstr,
|
|||||||
REQUIRE(rpzsp != NULL && *rpzsp == NULL);
|
REQUIRE(rpzsp != NULL && *rpzsp == NULL);
|
||||||
|
|
||||||
zones = isc_mem_get(mctx, sizeof(*zones));
|
zones = isc_mem_get(mctx, sizeof(*zones));
|
||||||
if (zones == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(zones, 0, sizeof(*zones));
|
memset(zones, 0, sizeof(*zones));
|
||||||
|
|
||||||
result = isc_rwlock_init(&zones->search_lock, 0, 0);
|
result = isc_rwlock_init(&zones->search_lock, 0, 0);
|
||||||
@ -1508,9 +1502,6 @@ dns_rpz_new_zone(dns_rpz_zones_t *rpzs, dns_rpz_zone_t **rpzp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
zone = isc_mem_get(rpzs->mctx, sizeof(*zone));
|
zone = isc_mem_get(rpzs->mctx, sizeof(*zone));
|
||||||
if (zone == NULL) {
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(zone, 0, sizeof(*zone));
|
memset(zone, 0, sizeof(*zone));
|
||||||
isc_refcount_init(&zone->refs, 1);
|
isc_refcount_init(&zone->refs, 1);
|
||||||
|
@ -228,13 +228,6 @@ expand_entries(dns_rrl_t *rrl, int newsize) {
|
|||||||
|
|
||||||
bsize = sizeof(dns_rrl_block_t) + (newsize-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);
|
b = isc_mem_get(rrl->mctx, bsize);
|
||||||
if (b == NULL) {
|
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_RRL,
|
|
||||||
DNS_LOGMODULE_REQUEST, DNS_RRL_LOG_FAIL,
|
|
||||||
"isc_mem_get(%d) failed for RRL entries",
|
|
||||||
bsize);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memset(b, 0, bsize);
|
memset(b, 0, bsize);
|
||||||
b->size = bsize;
|
b->size = bsize;
|
||||||
|
|
||||||
@ -299,14 +292,6 @@ expand_rrl_hash(dns_rrl_t *rrl, isc_stdtime_t now) {
|
|||||||
|
|
||||||
hsize = sizeof(dns_rrl_hash_t) + (new_bins-1)*sizeof(hash->bins[0]);
|
hsize = sizeof(dns_rrl_hash_t) + (new_bins-1)*sizeof(hash->bins[0]);
|
||||||
hash = isc_mem_get(rrl->mctx, hsize);
|
hash = isc_mem_get(rrl->mctx, hsize);
|
||||||
if (hash == NULL) {
|
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_RRL,
|
|
||||||
DNS_LOGMODULE_REQUEST, DNS_RRL_LOG_FAIL,
|
|
||||||
"isc_mem_get(%d) failed for"
|
|
||||||
" RRL hash table",
|
|
||||||
hsize);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memset(hash, 0, hsize);
|
memset(hash, 0, hsize);
|
||||||
hash->length = new_bins;
|
hash->length = new_bins;
|
||||||
rrl->hash_gen ^= 1;
|
rrl->hash_gen ^= 1;
|
||||||
@ -889,19 +874,11 @@ make_log_buf(dns_rrl_t *rrl, dns_rrl_entry_t *e,
|
|||||||
ISC_LIST_UNLINK(rrl->qname_free, qbuf, link);
|
ISC_LIST_UNLINK(rrl->qname_free, qbuf, link);
|
||||||
} else if (rrl->num_qnames < DNS_RRL_QNAMES) {
|
} else if (rrl->num_qnames < DNS_RRL_QNAMES) {
|
||||||
qbuf = isc_mem_get(rrl->mctx, sizeof(*qbuf));
|
qbuf = isc_mem_get(rrl->mctx, sizeof(*qbuf));
|
||||||
if (qbuf != NULL) {
|
{
|
||||||
memset(qbuf, 0, sizeof(*qbuf));
|
memset(qbuf, 0, sizeof(*qbuf));
|
||||||
ISC_LINK_INIT(qbuf, link);
|
ISC_LINK_INIT(qbuf, link);
|
||||||
qbuf->index = rrl->num_qnames;
|
qbuf->index = rrl->num_qnames;
|
||||||
rrl->qnames[rrl->num_qnames++] = qbuf;
|
rrl->qnames[rrl->num_qnames++] = qbuf;
|
||||||
} else {
|
|
||||||
isc_log_write(dns_lctx,
|
|
||||||
DNS_LOGCATEGORY_RRL,
|
|
||||||
DNS_LOGMODULE_REQUEST,
|
|
||||||
DNS_RRL_LOG_FAIL,
|
|
||||||
"isc_mem_get(%d)"
|
|
||||||
" failed for RRL qname",
|
|
||||||
(int)sizeof(*qbuf));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (qbuf != NULL) {
|
if (qbuf != NULL) {
|
||||||
@ -1290,8 +1267,6 @@ dns_rrl_init(dns_rrl_t **rrlp, dns_view_t *view, int min_entries) {
|
|||||||
*rrlp = NULL;
|
*rrlp = NULL;
|
||||||
|
|
||||||
rrl = isc_mem_get(view->mctx, sizeof(*rrl));
|
rrl = isc_mem_get(view->mctx, sizeof(*rrl));
|
||||||
if (rrl == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(rrl, 0, sizeof(*rrl));
|
memset(rrl, 0, sizeof(*rrl));
|
||||||
isc_mem_attach(view->mctx, &rrl->mctx);
|
isc_mem_attach(view->mctx, &rrl->mctx);
|
||||||
isc_mutex_init(&rrl->lock);
|
isc_mutex_init(&rrl->lock);
|
||||||
|
@ -218,8 +218,6 @@ dns_sdb_register(const char *drivername, const dns_sdbmethods_t *methods,
|
|||||||
DNS_SDBFLAG_DNS64)) == 0);
|
DNS_SDBFLAG_DNS64)) == 0);
|
||||||
|
|
||||||
imp = isc_mem_get(mctx, sizeof(dns_sdbimplementation_t));
|
imp = isc_mem_get(mctx, sizeof(dns_sdbimplementation_t));
|
||||||
if (imp == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
imp->methods = methods;
|
imp->methods = methods;
|
||||||
imp->driverdata = driverdata;
|
imp->driverdata = driverdata;
|
||||||
imp->flags = flags;
|
imp->flags = flags;
|
||||||
@ -293,8 +291,6 @@ dns_sdb_putrdata(dns_sdblookup_t *lookup, dns_rdatatype_t typeval,
|
|||||||
|
|
||||||
if (rdatalist == NULL) {
|
if (rdatalist == NULL) {
|
||||||
rdatalist = isc_mem_get(mctx, sizeof(dns_rdatalist_t));
|
rdatalist = isc_mem_get(mctx, sizeof(dns_rdatalist_t));
|
||||||
if (rdatalist == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
dns_rdatalist_init(rdatalist);
|
dns_rdatalist_init(rdatalist);
|
||||||
rdatalist->rdclass = lookup->sdb->common.rdclass;
|
rdatalist->rdclass = lookup->sdb->common.rdclass;
|
||||||
rdatalist->type = typeval;
|
rdatalist->type = typeval;
|
||||||
@ -305,8 +301,6 @@ dns_sdb_putrdata(dns_sdblookup_t *lookup, dns_rdatatype_t typeval,
|
|||||||
return (DNS_R_BADTTL);
|
return (DNS_R_BADTTL);
|
||||||
|
|
||||||
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
|
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
|
||||||
if (rdata == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
result = isc_buffer_allocate(mctx, &rdatabuf, rdlen);
|
result = isc_buffer_allocate(mctx, &rdatabuf, rdlen);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
@ -379,10 +373,6 @@ dns_sdb_putrr(dns_sdblookup_t *lookup, const char *type, dns_ttl_t ttl,
|
|||||||
if (size >= 65535)
|
if (size >= 65535)
|
||||||
size = 65535;
|
size = 65535;
|
||||||
p = isc_mem_get(mctx, size);
|
p = isc_mem_get(mctx, size);
|
||||||
if (p == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
isc_buffer_init(&rb, p, size);
|
isc_buffer_init(&rb, p, size);
|
||||||
result = dns_rdata_fromtext(NULL,
|
result = dns_rdata_fromtext(NULL,
|
||||||
lookup->sdb->common.rdclass,
|
lookup->sdb->common.rdclass,
|
||||||
@ -456,10 +446,6 @@ getnode(dns_sdballnodes_t *allnodes, const char *name, dns_sdbnode_t **nodep) {
|
|||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
sdbnode->name = isc_mem_get(mctx, sizeof(dns_name_t));
|
sdbnode->name = isc_mem_get(mctx, sizeof(dns_name_t));
|
||||||
if (sdbnode->name == NULL) {
|
|
||||||
destroynode(sdbnode);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
dns_name_init(sdbnode->name, NULL);
|
dns_name_init(sdbnode->name, NULL);
|
||||||
result = dns_name_dup(newname, mctx, sdbnode->name);
|
result = dns_name_dup(newname, mctx, sdbnode->name);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
@ -643,8 +629,6 @@ createnode(dns_sdb_t *sdb, dns_sdbnode_t **nodep) {
|
|||||||
dns_sdbnode_t *node;
|
dns_sdbnode_t *node;
|
||||||
|
|
||||||
node = isc_mem_get(sdb->common.mctx, sizeof(dns_sdbnode_t));
|
node = isc_mem_get(sdb->common.mctx, sizeof(dns_sdbnode_t));
|
||||||
if (node == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
node->sdb = NULL;
|
node->sdb = NULL;
|
||||||
attach((dns_db_t *)sdb, (dns_db_t **)&node->sdb);
|
attach((dns_db_t *)sdb, (dns_db_t **)&node->sdb);
|
||||||
@ -1052,8 +1036,6 @@ createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp)
|
|||||||
return (ISC_R_NOTIMPLEMENTED);
|
return (ISC_R_NOTIMPLEMENTED);
|
||||||
|
|
||||||
sdbiter = isc_mem_get(sdb->common.mctx, sizeof(sdb_dbiterator_t));
|
sdbiter = isc_mem_get(sdb->common.mctx, sizeof(sdb_dbiterator_t));
|
||||||
if (sdbiter == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
sdbiter->common.methods = &dbiterator_methods;
|
sdbiter->common.methods = &dbiterator_methods;
|
||||||
sdbiter->common.db = NULL;
|
sdbiter->common.db = NULL;
|
||||||
@ -1128,8 +1110,6 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||||||
UNUSED(now);
|
UNUSED(now);
|
||||||
|
|
||||||
iterator = isc_mem_get(db->mctx, sizeof(sdb_rdatasetiter_t));
|
iterator = isc_mem_get(db->mctx, sizeof(sdb_rdatasetiter_t));
|
||||||
if (iterator == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
iterator->common.magic = DNS_RDATASETITER_MAGIC;
|
iterator->common.magic = DNS_RDATASETITER_MAGIC;
|
||||||
iterator->common.methods = &rdatasetiter_methods;
|
iterator->common.methods = &rdatasetiter_methods;
|
||||||
@ -1291,8 +1271,6 @@ dns_sdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
|||||||
return (ISC_R_NOTIMPLEMENTED);
|
return (ISC_R_NOTIMPLEMENTED);
|
||||||
|
|
||||||
sdb = isc_mem_get(mctx, sizeof(dns_sdb_t));
|
sdb = isc_mem_get(mctx, sizeof(dns_sdb_t));
|
||||||
if (sdb == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(sdb, 0, sizeof(dns_sdb_t));
|
memset(sdb, 0, sizeof(dns_sdb_t));
|
||||||
|
|
||||||
dns_name_init(&sdb->common.origin, NULL);
|
dns_name_init(&sdb->common.origin, NULL);
|
||||||
|
@ -455,8 +455,6 @@ createnode(dns_sdlz_db_t *sdlz, dns_sdlznode_t **nodep) {
|
|||||||
dns_sdlznode_t *node;
|
dns_sdlznode_t *node;
|
||||||
|
|
||||||
node = isc_mem_get(sdlz->common.mctx, sizeof(dns_sdlznode_t));
|
node = isc_mem_get(sdlz->common.mctx, sizeof(dns_sdlznode_t));
|
||||||
if (node == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
node->sdlz = NULL;
|
node->sdlz = NULL;
|
||||||
attach((dns_db_t *)sdlz, (dns_db_t **)&node->sdlz);
|
attach((dns_db_t *)sdlz, (dns_db_t **)&node->sdlz);
|
||||||
@ -781,8 +779,6 @@ createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp)
|
|||||||
isc_buffer_putuint8(&b, 0);
|
isc_buffer_putuint8(&b, 0);
|
||||||
|
|
||||||
sdlziter = isc_mem_get(sdlz->common.mctx, sizeof(sdlz_dbiterator_t));
|
sdlziter = isc_mem_get(sdlz->common.mctx, sizeof(sdlz_dbiterator_t));
|
||||||
if (sdlziter == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
sdlziter->common.methods = &dbiterator_methods;
|
sdlziter->common.methods = &dbiterator_methods;
|
||||||
sdlziter->common.db = NULL;
|
sdlziter->common.db = NULL;
|
||||||
@ -1050,8 +1046,6 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||||||
UNUSED(now);
|
UNUSED(now);
|
||||||
|
|
||||||
iterator = isc_mem_get(db->mctx, sizeof(sdlz_rdatasetiter_t));
|
iterator = isc_mem_get(db->mctx, sizeof(sdlz_rdatasetiter_t));
|
||||||
if (iterator == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
iterator->common.magic = DNS_RDATASETITER_MAGIC;
|
iterator->common.magic = DNS_RDATASETITER_MAGIC;
|
||||||
iterator->common.methods = &rdatasetiter_methods;
|
iterator->common.methods = &rdatasetiter_methods;
|
||||||
@ -1506,8 +1500,6 @@ dns_sdlzcreateDBP(isc_mem_t *mctx, void *driverarg, void *dbdata,
|
|||||||
|
|
||||||
/* allocate and zero memory for driver structure */
|
/* allocate and zero memory for driver structure */
|
||||||
sdlzdb = isc_mem_get(mctx, sizeof(dns_sdlz_db_t));
|
sdlzdb = isc_mem_get(mctx, sizeof(dns_sdlz_db_t));
|
||||||
if (sdlzdb == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memset(sdlzdb, 0, sizeof(dns_sdlz_db_t));
|
memset(sdlzdb, 0, sizeof(dns_sdlz_db_t));
|
||||||
|
|
||||||
/* initialize and set origin */
|
/* initialize and set origin */
|
||||||
@ -1845,8 +1837,6 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
|
|||||||
|
|
||||||
if (rdatalist == NULL) {
|
if (rdatalist == NULL) {
|
||||||
rdatalist = isc_mem_get(mctx, sizeof(dns_rdatalist_t));
|
rdatalist = isc_mem_get(mctx, sizeof(dns_rdatalist_t));
|
||||||
if (rdatalist == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
dns_rdatalist_init(rdatalist);
|
dns_rdatalist_init(rdatalist);
|
||||||
rdatalist->rdclass = lookup->sdlz->common.rdclass;
|
rdatalist->rdclass = lookup->sdlz->common.rdclass;
|
||||||
rdatalist->type = typeval;
|
rdatalist->type = typeval;
|
||||||
@ -1865,8 +1855,6 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
|
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
|
||||||
if (rdata == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
dns_rdata_init(rdata);
|
dns_rdata_init(rdata);
|
||||||
|
|
||||||
if ((lookup->sdlz->dlzimp->flags & DNS_SDLZFLAG_RELATIVERDATA) != 0)
|
if ((lookup->sdlz->dlzimp->flags & DNS_SDLZFLAG_RELATIVERDATA) != 0)
|
||||||
@ -2030,8 +2018,6 @@ dns_sdlzregister(const char *drivername, const dns_sdlzmethods_t *methods,
|
|||||||
* we cannot.
|
* we cannot.
|
||||||
*/
|
*/
|
||||||
imp = isc_mem_get(mctx, sizeof(dns_sdlzimplementation_t));
|
imp = isc_mem_get(mctx, sizeof(dns_sdlzimplementation_t));
|
||||||
if (imp == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
/* Make sure memory region is set to all 0's */
|
/* Make sure memory region is set to all 0's */
|
||||||
memset(imp, 0, sizeof(dns_sdlzimplementation_t));
|
memset(imp, 0, sizeof(dns_sdlzimplementation_t));
|
||||||
|
@ -148,8 +148,6 @@ dns_ssutable_addrule(dns_ssutable_t *table, bool grant,
|
|||||||
|
|
||||||
mctx = table->mctx;
|
mctx = table->mctx;
|
||||||
rule = isc_mem_get(mctx, sizeof(dns_ssurule_t));
|
rule = isc_mem_get(mctx, sizeof(dns_ssurule_t));
|
||||||
if (rule == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
rule->identity = NULL;
|
rule->identity = NULL;
|
||||||
rule->name = NULL;
|
rule->name = NULL;
|
||||||
@ -158,20 +156,12 @@ dns_ssutable_addrule(dns_ssutable_t *table, bool grant,
|
|||||||
rule->grant = grant;
|
rule->grant = grant;
|
||||||
|
|
||||||
rule->identity = isc_mem_get(mctx, sizeof(dns_name_t));
|
rule->identity = isc_mem_get(mctx, sizeof(dns_name_t));
|
||||||
if (rule->identity == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
dns_name_init(rule->identity, NULL);
|
dns_name_init(rule->identity, NULL);
|
||||||
result = dns_name_dup(identity, mctx, rule->identity);
|
result = dns_name_dup(identity, mctx, rule->identity);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
goto failure;
|
goto failure;
|
||||||
|
|
||||||
rule->name = isc_mem_get(mctx, sizeof(dns_name_t));
|
rule->name = isc_mem_get(mctx, sizeof(dns_name_t));
|
||||||
if (rule->name == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
dns_name_init(rule->name, NULL);
|
dns_name_init(rule->name, NULL);
|
||||||
result = dns_name_dup(name, mctx, rule->name);
|
result = dns_name_dup(name, mctx, rule->name);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
@ -183,10 +173,6 @@ dns_ssutable_addrule(dns_ssutable_t *table, bool grant,
|
|||||||
if (ntypes > 0) {
|
if (ntypes > 0) {
|
||||||
rule->types = isc_mem_get(mctx,
|
rule->types = isc_mem_get(mctx,
|
||||||
ntypes * sizeof(dns_rdatatype_t));
|
ntypes * sizeof(dns_rdatatype_t));
|
||||||
if (rule->types == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
memmove(rule->types, types, ntypes * sizeof(dns_rdatatype_t));
|
memmove(rule->types, types, ntypes * sizeof(dns_rdatatype_t));
|
||||||
} else
|
} else
|
||||||
rule->types = NULL;
|
rule->types = NULL;
|
||||||
@ -619,10 +605,6 @@ dns_ssutable_createdlz(isc_mem_t *mctx, dns_ssutable_t **tablep,
|
|||||||
table->dlzdatabase = dlzdatabase;
|
table->dlzdatabase = dlzdatabase;
|
||||||
|
|
||||||
rule = isc_mem_get(table->mctx, sizeof(dns_ssurule_t));
|
rule = isc_mem_get(table->mctx, sizeof(dns_ssurule_t));
|
||||||
if (rule == NULL) {
|
|
||||||
dns_ssutable_detach(&table);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
rule->identity = NULL;
|
rule->identity = NULL;
|
||||||
rule->name = NULL;
|
rule->name = NULL;
|
||||||
|
@ -127,8 +127,6 @@ create_stats(isc_mem_t *mctx, dns_statstype_t type, int ncounters,
|
|||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
stats = isc_mem_get(mctx, sizeof(*stats));
|
stats = isc_mem_get(mctx, sizeof(*stats));
|
||||||
if (stats == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
stats->counters = NULL;
|
stats->counters = NULL;
|
||||||
isc_refcount_init(&stats->references, 1);
|
isc_refcount_init(&stats->references, 1);
|
||||||
|
@ -135,10 +135,7 @@ add_tsig(dst_context_t *tsigctx, dns_tsigkey_t *key, isc_buffer_t *target) {
|
|||||||
CHECK(dst_context_adddata(tsigctx, &r));
|
CHECK(dst_context_adddata(tsigctx, &r));
|
||||||
|
|
||||||
CHECK(dst_key_sigsize(key->key, &sigsize));
|
CHECK(dst_key_sigsize(key->key, &sigsize));
|
||||||
tsig.signature = (unsigned char *) isc_mem_get(dt_mctx, sigsize);
|
tsig.signature = isc_mem_get(dt_mctx, sigsize);
|
||||||
if (tsig.signature == NULL) {
|
|
||||||
CHECK(ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
isc_buffer_init(&sigbuf, tsig.signature, sigsize);
|
isc_buffer_init(&sigbuf, tsig.signature, sigsize);
|
||||||
CHECK(dst_context_sign(tsigctx, &sigbuf));
|
CHECK(dst_context_sign(tsigctx, &sigbuf));
|
||||||
tsig.siglen = isc_buffer_usedlength(&sigbuf);
|
tsig.siglen = isc_buffer_usedlength(&sigbuf);
|
||||||
|
@ -79,8 +79,6 @@ dumpmessage(dns_message_t *msg) {
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
output = isc_mem_get(msg->mctx, len);
|
output = isc_mem_get(msg->mctx, len);
|
||||||
if (output == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
isc_buffer_init(&outbuf, output, len);
|
isc_buffer_init(&outbuf, output, len);
|
||||||
result = dns_message_totext(msg, &dns_master_style_debug,
|
result = dns_message_totext(msg, &dns_master_style_debug,
|
||||||
@ -114,8 +112,6 @@ dns_tkeyctx_create(isc_mem_t *mctx, dns_tkeyctx_t **tctxp)
|
|||||||
REQUIRE(tctxp != NULL && *tctxp == NULL);
|
REQUIRE(tctxp != NULL && *tctxp == NULL);
|
||||||
|
|
||||||
tctx = isc_mem_get(mctx, sizeof(dns_tkeyctx_t));
|
tctx = isc_mem_get(mctx, sizeof(dns_tkeyctx_t));
|
||||||
if (tctx == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
tctx->mctx = NULL;
|
tctx->mctx = NULL;
|
||||||
isc_mem_attach(mctx, &tctx->mctx);
|
isc_mem_attach(mctx, &tctx->mctx);
|
||||||
tctx->dhkey = NULL;
|
tctx->dhkey = NULL;
|
||||||
@ -456,8 +452,6 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name,
|
|||||||
isc_buffer_init(&secret, secretdata, sizeof(secretdata));
|
isc_buffer_init(&secret, secretdata, sizeof(secretdata));
|
||||||
|
|
||||||
randomdata = isc_mem_get(tkeyout->mctx, TKEY_RANDOM_AMOUNT);
|
randomdata = isc_mem_get(tkeyout->mctx, TKEY_RANDOM_AMOUNT);
|
||||||
if (randomdata == NULL)
|
|
||||||
goto failure;
|
|
||||||
|
|
||||||
isc_nonce_buf(randomdata, TKEY_RANDOM_AMOUNT);
|
isc_nonce_buf(randomdata, TKEY_RANDOM_AMOUNT);
|
||||||
|
|
||||||
@ -601,20 +595,12 @@ process_gsstkey(dns_message_t *msg, dns_name_t *name, dns_rdata_tkey_t *tkeyin,
|
|||||||
if (outtoken) {
|
if (outtoken) {
|
||||||
tkeyout->key = isc_mem_get(tkeyout->mctx,
|
tkeyout->key = isc_mem_get(tkeyout->mctx,
|
||||||
isc_buffer_usedlength(outtoken));
|
isc_buffer_usedlength(outtoken));
|
||||||
if (tkeyout->key == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
tkeyout->keylen = isc_buffer_usedlength(outtoken);
|
tkeyout->keylen = isc_buffer_usedlength(outtoken);
|
||||||
memmove(tkeyout->key, isc_buffer_base(outtoken),
|
memmove(tkeyout->key, isc_buffer_base(outtoken),
|
||||||
isc_buffer_usedlength(outtoken));
|
isc_buffer_usedlength(outtoken));
|
||||||
isc_buffer_free(&outtoken);
|
isc_buffer_free(&outtoken);
|
||||||
} else {
|
} else {
|
||||||
tkeyout->key = isc_mem_get(tkeyout->mctx, tkeyin->keylen);
|
tkeyout->key = isc_mem_get(tkeyout->mctx, tkeyin->keylen);
|
||||||
if (tkeyout->key == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
tkeyout->keylen = tkeyin->keylen;
|
tkeyout->keylen = tkeyin->keylen;
|
||||||
memmove(tkeyout->key, tkeyin->key, tkeyin->keylen);
|
memmove(tkeyout->key, tkeyin->key, tkeyin->keylen);
|
||||||
}
|
}
|
||||||
|
@ -50,8 +50,6 @@ dns_tsec_create(isc_mem_t *mctx, dns_tsectype_t type, dst_key_t *key,
|
|||||||
REQUIRE(tsecp != NULL && *tsecp == NULL);
|
REQUIRE(tsecp != NULL && *tsecp == NULL);
|
||||||
|
|
||||||
tsec = isc_mem_get(mctx, sizeof(*tsec));
|
tsec = isc_mem_get(mctx, sizeof(*tsec));
|
||||||
if (tsec == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
tsec->type = type;
|
tsec->type = type;
|
||||||
tsec->mctx = mctx;
|
tsec->mctx = mctx;
|
||||||
|
@ -263,9 +263,7 @@ dns_tsigkey_createfromkey(const dns_name_t *name, const dns_name_t *algorithm,
|
|||||||
REQUIRE(mctx != NULL);
|
REQUIRE(mctx != NULL);
|
||||||
REQUIRE(key != NULL || ring != NULL);
|
REQUIRE(key != NULL || ring != NULL);
|
||||||
|
|
||||||
tkey = (dns_tsigkey_t *) isc_mem_get(mctx, sizeof(dns_tsigkey_t));
|
tkey = isc_mem_get(mctx, sizeof(dns_tsigkey_t));
|
||||||
if (tkey == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
dns_name_init(&tkey->name, NULL);
|
dns_name_init(&tkey->name, NULL);
|
||||||
ret = dns_name_dup(name, mctx, &tkey->name);
|
ret = dns_name_dup(name, mctx, &tkey->name);
|
||||||
@ -292,10 +290,6 @@ dns_tsigkey_createfromkey(const dns_name_t *name, const dns_name_t *algorithm,
|
|||||||
goto cleanup_name;
|
goto cleanup_name;
|
||||||
}
|
}
|
||||||
tmpname = isc_mem_get(mctx, sizeof(dns_name_t));
|
tmpname = isc_mem_get(mctx, sizeof(dns_name_t));
|
||||||
if (tmpname == NULL) {
|
|
||||||
ret = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_name;
|
|
||||||
}
|
|
||||||
dns_name_init(tmpname, NULL);
|
dns_name_init(tmpname, NULL);
|
||||||
ret = dns_name_dup(algorithm, mctx, tmpname);
|
ret = dns_name_dup(algorithm, mctx, tmpname);
|
||||||
if (ret != ISC_R_SUCCESS) {
|
if (ret != ISC_R_SUCCESS) {
|
||||||
@ -308,10 +302,6 @@ dns_tsigkey_createfromkey(const dns_name_t *name, const dns_name_t *algorithm,
|
|||||||
|
|
||||||
if (creator != NULL) {
|
if (creator != NULL) {
|
||||||
tkey->creator = isc_mem_get(mctx, sizeof(dns_name_t));
|
tkey->creator = isc_mem_get(mctx, sizeof(dns_name_t));
|
||||||
if (tkey->creator == NULL) {
|
|
||||||
ret = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_algorithm;
|
|
||||||
}
|
|
||||||
dns_name_init(tkey->creator, NULL);
|
dns_name_init(tkey->creator, NULL);
|
||||||
ret = dns_name_dup(creator, mctx, tkey->creator);
|
ret = dns_name_dup(creator, mctx, tkey->creator);
|
||||||
if (ret != ISC_R_SUCCESS) {
|
if (ret != ISC_R_SUCCESS) {
|
||||||
@ -955,11 +945,7 @@ dns_tsig_sign(dns_message_t *msg) {
|
|||||||
ret = dst_key_sigsize(key->key, &sigsize);
|
ret = dst_key_sigsize(key->key, &sigsize);
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
goto cleanup_context;
|
goto cleanup_context;
|
||||||
tsig.signature = (unsigned char *) isc_mem_get(mctx, sigsize);
|
tsig.signature = isc_mem_get(mctx, sigsize);
|
||||||
if (tsig.signature == NULL) {
|
|
||||||
ret = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup_context;
|
|
||||||
}
|
|
||||||
|
|
||||||
isc_buffer_init(&sigbuf, tsig.signature, sigsize);
|
isc_buffer_init(&sigbuf, tsig.signature, sigsize);
|
||||||
ret = dst_context_sign(ctx, &sigbuf);
|
ret = dst_context_sign(ctx, &sigbuf);
|
||||||
@ -1775,8 +1761,6 @@ dns_tsigkeyring_create(isc_mem_t *mctx, dns_tsig_keyring_t **ringp) {
|
|||||||
REQUIRE(*ringp == NULL);
|
REQUIRE(*ringp == NULL);
|
||||||
|
|
||||||
ring = isc_mem_get(mctx, sizeof(dns_tsig_keyring_t));
|
ring = isc_mem_get(mctx, sizeof(dns_tsig_keyring_t));
|
||||||
if (ring == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
result = isc_rwlock_init(&ring->lock, 0, 0);
|
result = isc_rwlock_init(&ring->lock, 0, 0);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
@ -1417,8 +1417,6 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db,
|
|||||||
state = &mystate;
|
state = &mystate;
|
||||||
} else {
|
} else {
|
||||||
state = isc_mem_get(diff->mctx, sizeof(*state));
|
state = isc_mem_get(diff->mctx, sizeof(*state));
|
||||||
if (state == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dns_diff_init(diff->mctx, &state->diffnames);
|
dns_diff_init(diff->mctx, &state->diffnames);
|
||||||
|
@ -1591,8 +1591,6 @@ validate(dns_validator_t *val, bool resume) {
|
|||||||
if (val->siginfo == NULL) {
|
if (val->siginfo == NULL) {
|
||||||
val->siginfo = isc_mem_get(val->view->mctx,
|
val->siginfo = isc_mem_get(val->view->mctx,
|
||||||
sizeof(*val->siginfo));
|
sizeof(*val->siginfo));
|
||||||
if (val->siginfo == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
}
|
||||||
result = dns_rdata_tostruct(&rdata, val->siginfo, NULL);
|
result = dns_rdata_tostruct(&rdata, val->siginfo, NULL);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
@ -3735,8 +3733,6 @@ dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
|
|||||||
REQUIRE(validatorp != NULL && *validatorp == NULL);
|
REQUIRE(validatorp != NULL && *validatorp == NULL);
|
||||||
|
|
||||||
val = isc_mem_get(view->mctx, sizeof(*val));
|
val = isc_mem_get(view->mctx, sizeof(*val));
|
||||||
if (val == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
val->view = NULL;
|
val->view = NULL;
|
||||||
dns_view_weakattach(view, &val->view);
|
dns_view_weakattach(view, &val->view);
|
||||||
|
|
||||||
|
@ -91,8 +91,6 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
|||||||
REQUIRE(viewp != NULL && *viewp == NULL);
|
REQUIRE(viewp != NULL && *viewp == NULL);
|
||||||
|
|
||||||
view = isc_mem_get(mctx, sizeof(*view));
|
view = isc_mem_get(mctx, sizeof(*view));
|
||||||
if (view == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
view->nta_file = NULL;
|
view->nta_file = NULL;
|
||||||
view->mctx = NULL;
|
view->mctx = NULL;
|
||||||
@ -1687,10 +1685,7 @@ dns_view_adddelegationonly(dns_view_t *view, const dns_name_t *name) {
|
|||||||
|
|
||||||
if (view->delonly == NULL) {
|
if (view->delonly == NULL) {
|
||||||
view->delonly = isc_mem_get(view->mctx,
|
view->delonly = isc_mem_get(view->mctx,
|
||||||
sizeof(dns_namelist_t) *
|
sizeof(dns_namelist_t) * DNS_VIEW_DELONLYHASH);
|
||||||
DNS_VIEW_DELONLYHASH);
|
|
||||||
if (view->delonly == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
for (hash = 0; hash < DNS_VIEW_DELONLYHASH; hash++)
|
for (hash = 0; hash < DNS_VIEW_DELONLYHASH; hash++)
|
||||||
ISC_LIST_INIT(view->delonly[hash]);
|
ISC_LIST_INIT(view->delonly[hash]);
|
||||||
}
|
}
|
||||||
@ -1701,8 +1696,6 @@ dns_view_adddelegationonly(dns_view_t *view, const dns_name_t *name) {
|
|||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
item = isc_mem_get(view->mctx, sizeof(*item));
|
item = isc_mem_get(view->mctx, sizeof(*item));
|
||||||
if (item == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
dns_name_init(item, NULL);
|
dns_name_init(item, NULL);
|
||||||
result = dns_name_dup(name, view->mctx, item);
|
result = dns_name_dup(name, view->mctx, item);
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
@ -1722,10 +1715,7 @@ dns_view_excludedelegationonly(dns_view_t *view, const dns_name_t *name) {
|
|||||||
|
|
||||||
if (view->rootexclude == NULL) {
|
if (view->rootexclude == NULL) {
|
||||||
view->rootexclude = isc_mem_get(view->mctx,
|
view->rootexclude = isc_mem_get(view->mctx,
|
||||||
sizeof(dns_namelist_t) *
|
sizeof(dns_namelist_t) * DNS_VIEW_DELONLYHASH);
|
||||||
DNS_VIEW_DELONLYHASH);
|
|
||||||
if (view->rootexclude == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
for (hash = 0; hash < DNS_VIEW_DELONLYHASH; hash++)
|
for (hash = 0; hash < DNS_VIEW_DELONLYHASH; hash++)
|
||||||
ISC_LIST_INIT(view->rootexclude[hash]);
|
ISC_LIST_INIT(view->rootexclude[hash]);
|
||||||
}
|
}
|
||||||
@ -1736,8 +1726,6 @@ dns_view_excludedelegationonly(dns_view_t *view, const dns_name_t *name) {
|
|||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
item = isc_mem_get(view->mctx, sizeof(*item));
|
item = isc_mem_get(view->mctx, sizeof(*item));
|
||||||
if (item == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
dns_name_init(item, NULL);
|
dns_name_init(item, NULL);
|
||||||
result = dns_name_dup(name, view->mctx, item);
|
result = dns_name_dup(name, view->mctx, item);
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
|
@ -797,8 +797,6 @@ xfrin_create(isc_mem_t *mctx,
|
|||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
xfr = isc_mem_get(mctx, sizeof(*xfr));
|
xfr = isc_mem_get(mctx, sizeof(*xfr));
|
||||||
if (xfr == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
xfr->mctx = NULL;
|
xfr->mctx = NULL;
|
||||||
isc_mem_attach(mctx, &xfr->mctx);
|
isc_mem_attach(mctx, &xfr->mctx);
|
||||||
xfr->refcount = 0;
|
xfr->refcount = 0;
|
||||||
|
@ -895,9 +895,6 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
|
|||||||
|
|
||||||
TIME_NOW(&now);
|
TIME_NOW(&now);
|
||||||
zone = isc_mem_get(mctx, sizeof(*zone));
|
zone = isc_mem_get(mctx, sizeof(*zone));
|
||||||
if (zone == NULL) {
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
zone->mctx = NULL;
|
zone->mctx = NULL;
|
||||||
isc_mem_attach(mctx, &zone->mctx);
|
isc_mem_attach(mctx, &zone->mctx);
|
||||||
@ -1458,9 +1455,6 @@ dns_zone_setdbtype(dns_zone_t *zone,
|
|||||||
|
|
||||||
/* Set up a new database argument list. */
|
/* Set up a new database argument list. */
|
||||||
argv = isc_mem_get(zone->mctx, dbargc * sizeof(*argv));
|
argv = isc_mem_get(zone->mctx, dbargc * sizeof(*argv));
|
||||||
if (argv == NULL) {
|
|
||||||
goto nomem;
|
|
||||||
}
|
|
||||||
for (i = 0; i < dbargc; i++) {
|
for (i = 0; i < dbargc; i++) {
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
}
|
}
|
||||||
@ -2242,9 +2236,7 @@ dns_zone_asyncload(dns_zone_t *zone, bool newonly,
|
|||||||
return (ISC_R_ALREADYRUNNING);
|
return (ISC_R_ALREADYRUNNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
asl = isc_mem_get(zone->mctx, sizeof (*asl));
|
asl = isc_mem_get(zone->mctx, sizeof(*asl));
|
||||||
if (asl == NULL)
|
|
||||||
CHECK(ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
asl->zone = NULL;
|
asl->zone = NULL;
|
||||||
asl->flags = newonly ? DNS_ZONELOADFLAG_NOSTAT : 0;
|
asl->flags = newonly ? DNS_ZONELOADFLAG_NOSTAT : 0;
|
||||||
@ -2370,8 +2362,6 @@ zone_registerinclude(const char *filename, void *arg) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
inc = isc_mem_get(zone->mctx, sizeof(dns_include_t));
|
inc = isc_mem_get(zone->mctx, sizeof(dns_include_t));
|
||||||
if (inc == NULL)
|
|
||||||
return;
|
|
||||||
inc->name = isc_mem_strdup(zone->mctx, filename);
|
inc->name = isc_mem_strdup(zone->mctx, filename);
|
||||||
if (inc->name == NULL) {
|
if (inc->name == NULL) {
|
||||||
isc_mem_put(zone->mctx, inc, sizeof(dns_include_t));
|
isc_mem_put(zone->mctx, inc, sizeof(dns_include_t));
|
||||||
@ -2536,8 +2526,6 @@ zone_startload(dns_db_t *db, dns_zone_t *zone, isc_time_t loadtime) {
|
|||||||
|
|
||||||
if (zone->zmgr != NULL && zone->db != NULL && zone->loadtask != NULL) {
|
if (zone->zmgr != NULL && zone->db != NULL && zone->loadtask != NULL) {
|
||||||
load = isc_mem_get(zone->mctx, sizeof(*load));
|
load = isc_mem_get(zone->mctx, sizeof(*load));
|
||||||
if (load == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
load->mctx = NULL;
|
load->mctx = NULL;
|
||||||
load->zone = NULL;
|
load->zone = NULL;
|
||||||
@ -3438,10 +3426,6 @@ zone_addnsec3chain(dns_zone_t *zone, dns_rdata_nsec3param_t *nsec3param) {
|
|||||||
* separate zone_nsec3chain() calls.
|
* separate zone_nsec3chain() calls.
|
||||||
*/
|
*/
|
||||||
nsec3chain = isc_mem_get(zone->mctx, sizeof *nsec3chain);
|
nsec3chain = isc_mem_get(zone->mctx, sizeof *nsec3chain);
|
||||||
if (nsec3chain == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsec3chain->magic = 0;
|
nsec3chain->magic = 0;
|
||||||
nsec3chain->done = false;
|
nsec3chain->done = false;
|
||||||
@ -5904,42 +5888,26 @@ set_addrkeylist(unsigned int count,
|
|||||||
REQUIRE(newnamesp != NULL && *newnamesp == NULL);
|
REQUIRE(newnamesp != NULL && *newnamesp == NULL);
|
||||||
|
|
||||||
newaddrs = isc_mem_get(mctx, count * sizeof(*newaddrs));
|
newaddrs = isc_mem_get(mctx, count * sizeof(*newaddrs));
|
||||||
if (newaddrs == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
memmove(newaddrs, addrs, count * sizeof(*newaddrs));
|
memmove(newaddrs, addrs, count * sizeof(*newaddrs));
|
||||||
|
|
||||||
if (dscp != NULL) {
|
if (dscp != NULL) {
|
||||||
newdscp = isc_mem_get(mctx, count * sizeof(*newdscp));
|
newdscp = isc_mem_get(mctx, count * sizeof(*newdscp));
|
||||||
if (newdscp == NULL) {
|
|
||||||
isc_mem_put(mctx, newaddrs, count * sizeof(*newaddrs));
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memmove(newdscp, dscp, count * sizeof(*newdscp));
|
memmove(newdscp, dscp, count * sizeof(*newdscp));
|
||||||
} else
|
} else
|
||||||
newdscp = NULL;
|
newdscp = NULL;
|
||||||
|
|
||||||
if (names != NULL) {
|
if (names != NULL) {
|
||||||
newnames = isc_mem_get(mctx, count * sizeof(*newnames));
|
newnames = isc_mem_get(mctx, count * sizeof(*newnames));
|
||||||
if (newnames == NULL) {
|
|
||||||
if (newdscp != NULL)
|
|
||||||
isc_mem_put(mctx, newdscp,
|
|
||||||
count * sizeof(*newdscp));
|
|
||||||
isc_mem_put(mctx, newaddrs, count * sizeof(*newaddrs));
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
newnames[i] = NULL;
|
newnames[i] = NULL;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (names[i] != NULL) {
|
if (names[i] != NULL) {
|
||||||
newnames[i] = isc_mem_get(mctx,
|
newnames[i] = isc_mem_get(mctx,
|
||||||
sizeof(dns_name_t));
|
sizeof(dns_name_t));
|
||||||
if (newnames[i] == NULL)
|
|
||||||
goto allocfail;
|
|
||||||
dns_name_init(newnames[i], NULL);
|
dns_name_init(newnames[i], NULL);
|
||||||
result = dns_name_dup(names[i], mctx,
|
result = dns_name_dup(names[i], mctx,
|
||||||
newnames[i]);
|
newnames[i]);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
allocfail:
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
if (newnames[i] != NULL)
|
if (newnames[i] != NULL)
|
||||||
dns_name_free(
|
dns_name_free(
|
||||||
@ -6113,11 +6081,7 @@ dns_zone_setmasterswithkeys(dns_zone_t *zone,
|
|||||||
* mastersok must contain count elements
|
* mastersok must contain count elements
|
||||||
*/
|
*/
|
||||||
newok = isc_mem_get(zone->mctx, count * sizeof(*newok));
|
newok = isc_mem_get(zone->mctx, count * sizeof(*newok));
|
||||||
if (newok == NULL) {
|
;
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
isc_mem_put(zone->mctx, newaddrs, count * sizeof(*newaddrs));
|
|
||||||
goto unlock;
|
|
||||||
};
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
newok[i] = false;
|
newok[i] = false;
|
||||||
|
|
||||||
@ -10286,10 +10250,6 @@ zone_refreshkeys(dns_zone_t *zone) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kfetch = isc_mem_get(zone->mctx, sizeof(dns_keyfetch_t));
|
kfetch = isc_mem_get(zone->mctx, sizeof(dns_keyfetch_t));
|
||||||
if (kfetch == NULL) {
|
|
||||||
fetch_err = true;
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
zone->refreshkeycount++;
|
zone->refreshkeycount++;
|
||||||
kfetch->zone = zone;
|
kfetch->zone = zone;
|
||||||
@ -11340,8 +11300,6 @@ notify_create(isc_mem_t *mctx, unsigned int flags, dns_notify_t **notifyp) {
|
|||||||
REQUIRE(notifyp != NULL && *notifyp == NULL);
|
REQUIRE(notifyp != NULL && *notifyp == NULL);
|
||||||
|
|
||||||
notify = isc_mem_get(mctx, sizeof(*notify));
|
notify = isc_mem_get(mctx, sizeof(*notify));
|
||||||
if (notify == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
notify->mctx = NULL;
|
notify->mctx = NULL;
|
||||||
isc_mem_attach(mctx, ¬ify->mctx);
|
isc_mem_attach(mctx, ¬ify->mctx);
|
||||||
@ -13060,8 +13018,6 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
|
|||||||
|
|
||||||
if (stub == NULL) {
|
if (stub == NULL) {
|
||||||
stub = isc_mem_get(zone->mctx, sizeof(*stub));
|
stub = isc_mem_get(zone->mctx, sizeof(*stub));
|
||||||
if (stub == NULL)
|
|
||||||
goto cleanup;
|
|
||||||
stub->magic = STUB_MAGIC;
|
stub->magic = STUB_MAGIC;
|
||||||
stub->mctx = zone->mctx;
|
stub->mctx = zone->mctx;
|
||||||
stub->zone = NULL;
|
stub->zone = NULL;
|
||||||
@ -15070,8 +15026,6 @@ save_nsec3param(dns_zone_t *zone, nsec3paramlist_t *nsec3list) {
|
|||||||
DNS_LOGMODULE_ZONE, ISC_LOG_DEBUG(3),
|
DNS_LOGMODULE_ZONE, ISC_LOG_DEBUG(3),
|
||||||
"looping through nsec3param data");
|
"looping through nsec3param data");
|
||||||
nsec3param = isc_mem_get(zone->mctx, sizeof(nsec3param_t));
|
nsec3param = isc_mem_get(zone->mctx, sizeof(nsec3param_t));
|
||||||
if (nsec3param == NULL)
|
|
||||||
CHECK(ISC_R_NOMEMORY);
|
|
||||||
ISC_LINK_INIT(nsec3param, link);
|
ISC_LINK_INIT(nsec3param, link);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -15143,8 +15097,6 @@ save_nsec3param(dns_zone_t *zone, nsec3paramlist_t *nsec3list) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsec3param = isc_mem_get(zone->mctx, sizeof(nsec3param_t));
|
nsec3param = isc_mem_get(zone->mctx, sizeof(nsec3param_t));
|
||||||
if (nsec3param == NULL)
|
|
||||||
CHECK(ISC_R_NOMEMORY);
|
|
||||||
ISC_LINK_INIT(nsec3param, link);
|
ISC_LINK_INIT(nsec3param, link);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -16451,8 +16403,6 @@ dns_zone_forwardupdate(dns_zone_t *zone, dns_message_t *msg,
|
|||||||
REQUIRE(callback != NULL);
|
REQUIRE(callback != NULL);
|
||||||
|
|
||||||
forward = isc_mem_get(zone->mctx, sizeof(*forward));
|
forward = isc_mem_get(zone->mctx, sizeof(*forward));
|
||||||
if (forward == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
forward->request = NULL;
|
forward->request = NULL;
|
||||||
forward->zone = NULL;
|
forward->zone = NULL;
|
||||||
@ -16532,8 +16482,6 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
|
|||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
zmgr = isc_mem_get(mctx, sizeof(*zmgr));
|
zmgr = isc_mem_get(mctx, sizeof(*zmgr));
|
||||||
if (zmgr == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
zmgr->mctx = NULL;
|
zmgr->mctx = NULL;
|
||||||
zmgr->refs = 1;
|
zmgr->refs = 1;
|
||||||
isc_mem_attach(mctx, &zmgr->mctx);
|
isc_mem_attach(mctx, &zmgr->mctx);
|
||||||
@ -17174,8 +17122,6 @@ zonemgr_getio(dns_zonemgr_t *zmgr, bool high,
|
|||||||
REQUIRE(iop != NULL && *iop == NULL);
|
REQUIRE(iop != NULL && *iop == NULL);
|
||||||
|
|
||||||
io = isc_mem_get(zmgr->mctx, sizeof(*io));
|
io = isc_mem_get(zmgr->mctx, sizeof(*io));
|
||||||
if (io == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
io->event = isc_event_allocate(zmgr->mctx, task, DNS_EVENT_IOREADY,
|
io->event = isc_event_allocate(zmgr->mctx, task, DNS_EVENT_IOREADY,
|
||||||
action, arg, sizeof(*io->event));
|
action, arg, sizeof(*io->event));
|
||||||
@ -17281,8 +17227,6 @@ zone_saveunique(dns_zone_t *zone, const char *path, const char *templat) {
|
|||||||
buflen = strlen(path) + strlen(templat) + 2;
|
buflen = strlen(path) + strlen(templat) + 2;
|
||||||
|
|
||||||
buf = isc_mem_get(zone->mctx, buflen);
|
buf = isc_mem_get(zone->mctx, buflen);
|
||||||
if (buf == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
result = isc_file_template(path, templat, buf, buflen);
|
result = isc_file_template(path, templat, buf, buflen);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
@ -17952,8 +17896,6 @@ zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, uint16_t keyid,
|
|||||||
dns_db_t *db = NULL;
|
dns_db_t *db = NULL;
|
||||||
|
|
||||||
signing = isc_mem_get(zone->mctx, sizeof *signing);
|
signing = isc_mem_get(zone->mctx, sizeof *signing);
|
||||||
if (signing == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
signing->magic = 0;
|
signing->magic = 0;
|
||||||
signing->db = NULL;
|
signing->db = NULL;
|
||||||
|
@ -444,9 +444,6 @@ record_nsec3(const vctx_t *vctx, const unsigned char *rawhash,
|
|||||||
len = sizeof(*element) + nsec3->next_length * 2 + nsec3->salt_length;
|
len = sizeof(*element) + nsec3->next_length * 2 + nsec3->salt_length;
|
||||||
|
|
||||||
element = isc_mem_get(vctx->mctx, len);
|
element = isc_mem_get(vctx->mctx, len);
|
||||||
if (element == NULL) {
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
memset(element, 0, len);
|
memset(element, 0, len);
|
||||||
element->hash = nsec3->hash;
|
element->hash = nsec3->hash;
|
||||||
element->salt_length = nsec3->salt_length;
|
element->salt_length = nsec3->salt_length;
|
||||||
|
@ -83,8 +83,6 @@ dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **ztp) {
|
|||||||
REQUIRE(ztp != NULL && *ztp == NULL);
|
REQUIRE(ztp != NULL && *ztp == NULL);
|
||||||
|
|
||||||
zt = isc_mem_get(mctx, sizeof(*zt));
|
zt = isc_mem_get(mctx, sizeof(*zt));
|
||||||
if (zt == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
zt->table = NULL;
|
zt->table = NULL;
|
||||||
result = dns_rbt_create(mctx, auto_detach, zt, &zt->table);
|
result = dns_rbt_create(mctx, auto_detach, zt, &zt->table);
|
||||||
@ -295,9 +293,6 @@ dns_zt_asyncload(dns_zt_t *zt, bool newonly,
|
|||||||
|
|
||||||
REQUIRE(VALID_ZT(zt));
|
REQUIRE(VALID_ZT(zt));
|
||||||
zt->loadparams = isc_mem_get(zt->mctx, sizeof(struct zt_load_params));
|
zt->loadparams = isc_mem_get(zt->mctx, sizeof(struct zt_load_params));
|
||||||
if (zt->loadparams == NULL) {
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
zt->loadparams->dl = doneloading;
|
zt->loadparams->dl = doneloading;
|
||||||
zt->loadparams->newonly = newonly;
|
zt->loadparams->newonly = newonly;
|
||||||
|
|
||||||
|
@ -217,10 +217,6 @@ irs_context_create(irs_context_t **contextp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
context = isc_mem_get(mctx, sizeof(*context));
|
context = isc_mem_get(mctx, sizeof(*context));
|
||||||
if (context == NULL) {
|
|
||||||
ctxs_destroy(&mctx, &actx, &taskmgr, &socketmgr, &timermgr);
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
context->mctx = mctx;
|
context->mctx = mctx;
|
||||||
context->actx = actx;
|
context->actx = actx;
|
||||||
|
@ -130,10 +130,6 @@ configure_key(isc_mem_t *mctx, const cfg_obj_t *key, irs_dnsconf_t *conf,
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
keyname = isc_mem_get(mctx, sizeof(*keyname));
|
keyname = isc_mem_get(mctx, sizeof(*keyname));
|
||||||
if (keyname == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
dns_name_init(keyname, NULL);
|
dns_name_init(keyname, NULL);
|
||||||
result = dns_name_dup(keyname_base, mctx, keyname);
|
result = dns_name_dup(keyname_base, mctx, keyname);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
@ -142,11 +138,6 @@ configure_key(isc_mem_t *mctx, const cfg_obj_t *key, irs_dnsconf_t *conf,
|
|||||||
|
|
||||||
/* Add the key data to the list */
|
/* Add the key data to the list */
|
||||||
keyent = isc_mem_get(mctx, sizeof(*keyent));
|
keyent = isc_mem_get(mctx, sizeof(*keyent));
|
||||||
if (keyent == NULL) {
|
|
||||||
dns_name_free(keyname, mctx);
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
keyent->keyname = keyname;
|
keyent->keyname = keyname;
|
||||||
keyent->keydatabuf = keydatabuf;
|
keyent->keydatabuf = keydatabuf;
|
||||||
|
|
||||||
@ -245,8 +236,6 @@ irs_dnsconf_load(isc_mem_t *mctx, const char *filename, irs_dnsconf_t **confp)
|
|||||||
REQUIRE(confp != NULL && *confp == NULL);
|
REQUIRE(confp != NULL && *confp == NULL);
|
||||||
|
|
||||||
conf = isc_mem_get(mctx, sizeof(*conf));
|
conf = isc_mem_get(mctx, sizeof(*conf));
|
||||||
if (conf == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
conf->mctx = mctx;
|
conf->mctx = mctx;
|
||||||
ISC_LIST_INIT(conf->trusted_keylist);
|
ISC_LIST_INIT(conf->trusted_keylist);
|
||||||
|
@ -592,8 +592,6 @@ make_resstate(isc_mem_t *mctx, gai_statehead_t *head, const char *hostname,
|
|||||||
bool need_v6 = false;
|
bool need_v6 = false;
|
||||||
|
|
||||||
state = isc_mem_get(mctx, sizeof(*state));
|
state = isc_mem_get(mctx, sizeof(*state));
|
||||||
if (state == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
/* Construct base domain name */
|
/* Construct base domain name */
|
||||||
namelen = strlen(domain);
|
namelen = strlen(domain);
|
||||||
@ -626,10 +624,6 @@ make_resstate(isc_mem_t *mctx, gai_statehead_t *head, const char *hostname,
|
|||||||
state->trans4 = NULL;
|
state->trans4 = NULL;
|
||||||
if (need_v4) {
|
if (need_v4) {
|
||||||
state->trans4 = isc_mem_get(mctx, sizeof(gai_restrans_t));
|
state->trans4 = isc_mem_get(mctx, sizeof(gai_restrans_t));
|
||||||
if (state->trans4 == NULL) {
|
|
||||||
isc_mem_put(mctx, state, sizeof(*state));
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
state->trans4->error = 0;
|
state->trans4->error = 0;
|
||||||
state->trans4->xid = NULL;
|
state->trans4->xid = NULL;
|
||||||
state->trans4->resstate = state;
|
state->trans4->resstate = state;
|
||||||
@ -638,13 +632,6 @@ make_resstate(isc_mem_t *mctx, gai_statehead_t *head, const char *hostname,
|
|||||||
}
|
}
|
||||||
if (need_v6) {
|
if (need_v6) {
|
||||||
state->trans6 = isc_mem_get(mctx, sizeof(gai_restrans_t));
|
state->trans6 = isc_mem_get(mctx, sizeof(gai_restrans_t));
|
||||||
if (state->trans6 == NULL) {
|
|
||||||
if (state->trans4 != NULL)
|
|
||||||
isc_mem_put(mctx, state->trans4,
|
|
||||||
sizeof(*state->trans4));
|
|
||||||
isc_mem_put(mctx, state, sizeof(*state));
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
}
|
|
||||||
state->trans6->error = 0;
|
state->trans6->error = 0;
|
||||||
state->trans6->xid = NULL;
|
state->trans6->xid = NULL;
|
||||||
state->trans6->resstate = state;
|
state->trans6->resstate = state;
|
||||||
|
@ -229,10 +229,6 @@ add_server(isc_mem_t *mctx, const char *address_str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
address = isc_mem_get(mctx, sizeof(*address));
|
address = isc_mem_get(mctx, sizeof(*address));
|
||||||
if (address == NULL) {
|
|
||||||
result = ISC_R_NOMEMORY;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
if (res->ai_addrlen > sizeof(address->type)) {
|
if (res->ai_addrlen > sizeof(address->type)) {
|
||||||
isc_mem_put(mctx, address, sizeof(*address));
|
isc_mem_put(mctx, address, sizeof(*address));
|
||||||
result = ISC_R_RANGE;
|
result = ISC_R_RANGE;
|
||||||
@ -473,8 +469,6 @@ add_search(irs_resconf_t *conf, char *domain) {
|
|||||||
irs_resconf_search_t *entry;
|
irs_resconf_search_t *entry;
|
||||||
|
|
||||||
entry = isc_mem_get(conf->mctx, sizeof(*entry));
|
entry = isc_mem_get(conf->mctx, sizeof(*entry));
|
||||||
if (entry == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
entry->domain = domain;
|
entry->domain = domain;
|
||||||
ISC_LINK_INIT(entry, link);
|
ISC_LINK_INIT(entry, link);
|
||||||
@ -500,8 +494,6 @@ irs_resconf_load(isc_mem_t *mctx, const char *filename, irs_resconf_t **confp)
|
|||||||
REQUIRE(confp != NULL && *confp == NULL);
|
REQUIRE(confp != NULL && *confp == NULL);
|
||||||
|
|
||||||
conf = isc_mem_get(mctx, sizeof(*conf));
|
conf = isc_mem_get(mctx, sizeof(*conf));
|
||||||
if (conf == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
|
|
||||||
conf->mctx = mctx;
|
conf->mctx = mctx;
|
||||||
ISC_LIST_INIT(conf->nameservers);
|
ISC_LIST_INIT(conf->nameservers);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user