+3390. [bug] Silence clang compiler warnings. [RT #30417]
+
3389. [bug] Always return NOERROR (not 0) in TSIG. [RT #31275]
3388. [bug] Fixed several Coverity warnings. [RT #30996]
static void
connect_timeout(isc_task_t *task, isc_event_t *event) {
dig_lookup_t *l = NULL;
- dig_query_t *query = NULL, *cq;
+ dig_query_t *query = NULL, *next, *cq;
UNUSED(task);
REQUIRE(event->ev_type == ISC_TIMEREVENT_IDLE);
if (query->sock != NULL)
isc_socket_cancel(query->sock, NULL,
ISC_SOCKCANCEL_ALL);
- send_tcp_connect(ISC_LIST_NEXT(cq, link));
+ next = ISC_LIST_NEXT(cq, link);
+ if (next != NULL)
+ send_tcp_connect(next);
}
UNLOCK_LOOKUP;
return;
*/
void
do_lookup(dig_lookup_t *lookup) {
+ dig_query_t *query;
REQUIRE(lookup != NULL);
debug("do_lookup()");
lookup->pending = ISC_TRUE;
- if (lookup->tcp_mode)
- send_tcp_connect(ISC_LIST_HEAD(lookup->q));
- else
- send_udp(ISC_LIST_HEAD(lookup->q));
+ query = ISC_LIST_HEAD(lookup->q);
+ if (query != NULL) {
+ if (lookup->tcp_mode)
+ send_tcp_connect(query);
+ else
+ send_udp(query);
+ }
}
/*%
fprintf(stderr, "The use of RSA (RSAMD5) is not recommended.\n"
"If you still wish to use RSA (RSAMD5) please "
"specify \"-a RSAMD5\"\n");
+ if (freeit != NULL)
+ free(freeit);
return (1);
} else {
r.base = algname;
argc -= 1;
argv += 1;
+ POST(argc);
+ POST(argv);
+
if (origin == NULL)
origin = file;
dst_key_t *dstkey = NULL;
isc_result_t result;
- dns_rdata_tostruct(sigrdata, &sig, NULL);
+ result = dns_rdata_tostruct(sigrdata, &sig, NULL);
+ check_result(result, "dns_rdata_tostruct()");
for (result = dns_rdataset_first(keyrdataset);
result == ISC_R_SUCCESS;
result = dns_rdataset_next(keyrdataset)) {
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_rdataset_current(keyrdataset, &rdata);
- dns_rdata_tostruct(&rdata, &key, NULL);
+ result = dns_rdata_tostruct(&rdata, &key, NULL);
+ check_result(result, "dns_rdata_tostruct()");
result = dns_dnssec_keyfromrdata(origin, &rdata, mctx,
&dstkey);
if (result != ISC_R_SUCCESS)
dns_rdataset_current(nsec3paramset, &rdata);
result = dns_rdata_tostruct(&rdata, &nsec3param, NULL);
+ check_result(result, "dns_rdata_tostruct()");
if (nsec3param.flags == 0 &&
nsec3param.hash == nsec3->hash &&
nsec3param.iterations == nsec3->iterations &&
dns_rdata_rrsig_t sig;
dns_rdataset_current(&sigrdataset, &rdata);
- dns_rdata_tostruct(&rdata, &sig, NULL);
+ result = dns_rdata_tostruct(&rdata, &sig, NULL);
+ check_result(result, "dns_rdata_tostruct()");
if (rdataset->ttl != sig.originalttl) {
dns_name_format(name, namebuf, sizeof(namebuf));
type_format(rdataset->type, typebuf, sizeof(typebuf));
CTRACE("replace");
+ REQUIRE(client != NULL);
+ REQUIRE(client->manager != NULL);
+
result = get_client(client->manager, client->interface,
client->dispatch, TCP_CLIENT(client));
if (result != ISC_R_SUCCESS)
isc_result_t
ns_control_docommand(isccc_sexpr_t *message, isc_buffer_t *text) {
isccc_sexpr_t *data;
- char *command;
+ char *command = NULL;
isc_result_t result;
int log_level;
#ifdef HAVE_LIBSCF
# cishm is 0 if a case insensitive hash of testname1 should match a
# case insensitive hash of testname2, otherwise cishm != 0
#
-a.b.c.d a.b.c.d. 0 0
+a.b.c.d A.B.C.D 0 1
#include <isc/string.h>
#include <dns/compress.h>
+#include <dns/fixedname.h>
#include <dns/name.h>
#include <dns/result.h>
else {
t_info("bad data at position %lu, "
"got 0x%.2x, expected 0x%.2x\n",
- (unsigned long)cnt, *p, *q);
+ (unsigned long)cnt, *p, *v);
result = cnt + 1;
}
(void)free(data);
#endif /* NEED_HNAME_TO_TNAME */
-/*%
- * initialize a dns_name_t from a text name, hiding all
- * buffer and other object initialization from the caller
- *
- */
-
-static isc_result_t
-dname_from_tname(char *name, dns_name_t *dns_name) {
- int len;
- isc_buffer_t txtbuf;
- isc_buffer_t *binbuf;
- unsigned char *junk;
- isc_result_t result;
-
- len = strlen(name);
- isc_buffer_init(&txtbuf, name, len);
- isc_buffer_add(&txtbuf, len);
- junk = (unsigned char *)malloc(sizeof(unsigned char) * BUFLEN);
- binbuf = (isc_buffer_t *)malloc(sizeof(isc_buffer_t));
- if ((junk != NULL) && (binbuf != NULL)) {
- isc_buffer_init(binbuf, junk, BUFLEN);
- dns_name_init(dns_name, NULL);
- dns_name_setbuffer(dns_name, binbuf);
- result = dns_name_fromtext(dns_name, &txtbuf, NULL, 0, NULL);
- } else {
- result = ISC_R_NOSPACE;
- if (junk != NULL)
- (void)free(junk);
- if (binbuf != NULL)
- (void)free(binbuf);
- }
- return (result);
-}
-
static const char *a3 = "dns_name_init initializes 'name' to the empty name";
static void
isc_boolean_t match;
unsigned int hash1;
unsigned int hash2;
- dns_name_t dns_name1;
- dns_name_t dns_name2;
+ dns_fixedname_t fixed1;
+ dns_fixedname_t fixed2;
+ dns_name_t *dns_name1;
+ dns_name_t *dns_name2;
isc_result_t result;
rval = T_UNRESOLVED;
t_info("testing names %s and %s\n", test_name1, test_name2);
- result = dname_from_tname(test_name1, &dns_name1);
+ dns_fixedname_init(&fixed1);
+ dns_fixedname_init(&fixed2);
+ dns_name1 = dns_fixedname_name(&fixed1);
+ dns_name2 = dns_fixedname_name(&fixed2);
+ result = dns_name_fromstring2(dns_name1, test_name1, NULL, 0, NULL);
if (result == ISC_R_SUCCESS) {
- result = dname_from_tname(test_name2, &dns_name2);
+ result = dns_name_fromstring2(dns_name2, test_name2, NULL,
+ 0, NULL);
if (result == ISC_R_SUCCESS) {
- hash1 = dns_name_hash(&dns_name1, ISC_TRUE);
- hash2 = dns_name_hash(&dns_name2, ISC_TRUE);
+ hash1 = dns_name_hash(dns_name1, ISC_TRUE);
+ hash2 = dns_name_hash(dns_name2, ISC_TRUE);
match = ISC_FALSE;
if (hash1 == hash2)
match = ISC_TRUE;
++failures;
t_info("hash mismatch when ISC_TRUE\n");
}
- hash1 = dns_name_hash(&dns_name1, ISC_FALSE);
- hash2 = dns_name_hash(&dns_name2, ISC_FALSE);
+ hash1 = dns_name_hash(dns_name1, ISC_FALSE);
+ hash2 = dns_name_hash(dns_name2, ISC_FALSE);
match = ISC_FALSE;
if (hash1 == hash2)
match = ISC_TRUE;
else
rval = T_FAIL;
} else {
- t_info("dns_fromtext %s failed, result = %s\n",
+ t_info("dns_name_fromstring2 %s failed, result = %s\n",
test_name2, dns_result_totext(result));
}
} else {
- t_info("dns_fromtext %s failed, result = %s\n",
+ t_info("dns_name_fromstring2 %s failed, result = %s\n",
test_name1, dns_result_totext(result));
}
return (rval);
int nfails;
int order;
unsigned int nlabels;
- dns_name_t dns_name1;
- dns_name_t dns_name2;
+ dns_fixedname_t fixed1;
+ dns_fixedname_t fixed2;
+ dns_name_t *dns_name1;
+ dns_name_t *dns_name2;
isc_result_t dns_result;
dns_namereln_t dns_reln;
t_info("testing names %s and %s for relation %s\n", name1, name2,
dns_namereln_to_text(exp_dns_reln));
- dns_result = dname_from_tname(name1, &dns_name1);
+ dns_fixedname_init(&fixed1);
+ dns_fixedname_init(&fixed2);
+ dns_name1 = dns_fixedname_name(&fixed1);
+ dns_name2 = dns_fixedname_name(&fixed2);
+ dns_result = dns_name_fromstring2(dns_name1, name1, NULL, 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- dns_result = dname_from_tname(name2, &dns_name2);
+ dns_result = dns_name_fromstring2(dns_name2, name2, NULL,
+ 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- dns_reln = dns_name_fullcompare(&dns_name1, &dns_name2,
+ dns_reln = dns_name_fullcompare(dns_name1, dns_name2,
&order, &nlabels);
if (dns_reln != exp_dns_reln) {
else
result = T_FAIL;
} else {
- t_info("dname_from_tname failed, result == %s\n",
+ t_info("dns_name_fromstring2 failed, result == %s\n",
dns_result_totext(result));
}
} else {
- t_info("dname_from_tname failed, result == %s\n",
+ t_info("dns_name_fromstring2 failed, result == %s\n",
dns_result_totext(result));
}
int result;
int order;
isc_result_t dns_result;
- dns_name_t dns_name1;
- dns_name_t dns_name2;
+ dns_fixedname_t fixed1;
+ dns_fixedname_t fixed2;
+ dns_name_t *dns_name1;
+ dns_name_t *dns_name2;
result = T_UNRESOLVED;
exp_order == 0 ? "==": (exp_order == -1 ? "<" : ">"),
name2);
- dns_result = dname_from_tname(name1, &dns_name1);
+ dns_fixedname_init(&fixed1);
+ dns_fixedname_init(&fixed2);
+ dns_name1 = dns_fixedname_name(&fixed1);
+ dns_name2 = dns_fixedname_name(&fixed2);
+ dns_result = dns_name_fromstring2(dns_name1, name1, NULL, 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- dns_result = dname_from_tname(name2, &dns_name2);
+ dns_result = dns_name_fromstring2(dns_name2, name2, NULL,
+ 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- order = dns_name_compare(&dns_name1, &dns_name2);
+ order = dns_name_compare(dns_name1, dns_name2);
/*
* Normalize order.
*/
} else
result = T_PASS;
} else {
- t_info("dname_from_tname failed, result == %s\n",
+ t_info("dns_name_fromstring2 failed, result == %s\n",
dns_result_totext(result));
}
} else {
- t_info("dname_from_tname failed, result == %s\n",
+ t_info("dns_name_fromstring2 failed, result == %s\n",
dns_result_totext(result));
}
int result;
int order;
isc_result_t dns_result;
- dns_name_t dns_name1;
- dns_name_t dns_name2;
+ dns_fixedname_t fixed1;
+ dns_fixedname_t fixed2;
+ dns_name_t *dns_name1;
+ dns_name_t *dns_name2;
result = T_UNRESOLVED;
t_info("testing %s %s %s\n", name1,
exp_order == 0 ? "==": (exp_order == -1 ? "<" : ">"), name2);
- dns_result = dname_from_tname(name1, &dns_name1);
+ dns_fixedname_init(&fixed1);
+ dns_fixedname_init(&fixed2);
+ dns_name1 = dns_fixedname_name(&fixed1);
+ dns_name2 = dns_fixedname_name(&fixed2);
+ dns_result = dns_name_fromstring2(dns_name1, name1, NULL, 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- dns_result = dname_from_tname(name2, &dns_name2);
+ dns_result = dns_name_fromstring2(dns_name2, name2, NULL,
+ 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- order = dns_name_rdatacompare(&dns_name1, &dns_name2);
+ order = dns_name_rdatacompare(dns_name1, dns_name2);
/*
* Normalize order.
*/
} else
result = T_PASS;
} else {
- t_info("dname_from_tname failed, result == %s\n",
+ t_info("dns_name_fromstring2 failed, result == %s\n",
dns_result_totext(result));
}
} else {
- t_info("dname_from_tname failed, result == %s\n",
+ t_info("dns_name_fromstring2 failed, result == %s\n",
dns_result_totext(result));
}
int result;
isc_boolean_t rval;
isc_result_t dns_result;
- dns_name_t dns_name1;
- dns_name_t dns_name2;
+ dns_fixedname_t fixed1;
+ dns_fixedname_t fixed2;
+ dns_name_t *dns_name1;
+ dns_name_t *dns_name2;
result = T_UNRESOLVED;
t_info("testing %s %s a subdomain of %s\n", name1,
exp_rval == 0 ? "is not" : "is", name2);
- dns_result = dname_from_tname(name1, &dns_name1);
+ dns_fixedname_init(&fixed1);
+ dns_fixedname_init(&fixed2);
+ dns_name1 = dns_fixedname_name(&fixed1);
+ dns_name2 = dns_fixedname_name(&fixed2);
+ dns_result = dns_name_fromstring2(dns_name1, name1, NULL, 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- dns_result = dname_from_tname(name2, &dns_name2);
+ dns_result = dns_name_fromstring2(dns_name2, name2, NULL,
+ 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- rval = dns_name_issubdomain(&dns_name1, &dns_name2);
+ rval = dns_name_issubdomain(dns_name1, dns_name2);
if (rval != exp_rval) {
t_info("expected return value of %s, got %s\n",
} else
result = T_PASS;
} else {
- t_info("dname_from_tname failed, result == %s\n",
+ t_info("dns_name_fromstring2 failed, result == %s\n",
dns_result_totext(result));
}
} else {
- t_info("dname_from_tname failed, result == %s\n",
+ t_info("dns_name_fromstring2 failed, result == %s\n",
dns_result_totext(result));
}
int result;
unsigned int nlabels;
isc_result_t dns_result;
- dns_name_t dns_name;
+ dns_fixedname_t fixed;
+ dns_name_t *dns_name;
result = T_UNRESOLVED;
t_info("testing %s\n", test_name);
- dns_result = dname_from_tname(test_name, &dns_name);
+ dns_fixedname_init(&fixed);
+ dns_name = dns_fixedname_name(&fixed);
+ dns_result = dns_name_fromstring2(dns_name, test_name, NULL, 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- nlabels = dns_name_countlabels(&dns_name);
+ nlabels = dns_name_countlabels(dns_name);
if (nlabels != exp_nlabels) {
t_info("expected %d, got %d\n", exp_nlabels, nlabels);
} else
result = T_PASS;
} else {
- t_info("dname_from_tname failed, result == %s\n",
+ t_info("dns_name_fromstring2 failed, result == %s\n",
dns_result_totext(dns_result));
}
unsigned int cnt;
unsigned char *p;
unsigned char *q;
- dns_name_t dns_name1;
- dns_name_t dns_name2;
+ dns_fixedname_t fixed1;
+ dns_fixedname_t fixed2;
+ dns_name_t *dns_name1;
+ dns_name_t *dns_name2;
dns_label_t dns_label1;
dns_label_t dns_label2;
isc_result_t dns_result;
t_info("testing with %s and %s\n", test_name1, test_name2);
- dns_result = dname_from_tname(test_name1, &dns_name1);
+ dns_fixedname_init(&fixed1);
+ dns_fixedname_init(&fixed2);
+ dns_name1 = dns_fixedname_name(&fixed1);
+ dns_name2 = dns_fixedname_name(&fixed2);
+ dns_result = dns_name_fromstring2(dns_name1, test_name1, NULL,
+ 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- dns_result = dname_from_tname(test_name2, &dns_name2);
+ dns_result = dns_name_fromstring2(dns_name2, test_name2, NULL,
+ 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- dns_name_getlabel(&dns_name1, label1_pos, &dns_label1);
- dns_name_getlabel(&dns_name2, label2_pos, &dns_label2);
+ dns_name_getlabel(dns_name1, label1_pos, &dns_label1);
+ dns_name_getlabel(dns_name2, label2_pos, &dns_label2);
if (dns_label1.length != dns_label2.length) {
t_info("label lengths differ\n");
++nfails;
else
result = T_FAIL;
} else {
- t_info("dname_from_tname failed, result == %s",
+ t_info("dns_name_fromstring2 failed, result == %s",
dns_result_totext(result));
}
} else {
- t_info("dname_from_tname failed, result == %s",
+ t_info("dns_name_fromstring2 failed, result == %s",
dns_result_totext(result));
}
return (result);
unsigned int cnt;
unsigned char *p;
unsigned char *q;
- dns_name_t dns_name1;
- dns_name_t dns_name2;
+ dns_fixedname_t fixed1;
+ dns_fixedname_t fixed2;
+ dns_name_t *dns_name1;
+ dns_name_t *dns_name2;
dns_name_t dns_targetname1;
dns_name_t dns_targetname2;
isc_result_t dns_result;
nfails = 0;
result = T_UNRESOLVED;
- dns_result = dname_from_tname(test_name1, &dns_name1);
+ dns_fixedname_init(&fixed1);
+ dns_fixedname_init(&fixed2);
+ dns_name1 = dns_fixedname_name(&fixed1);
+ dns_name2 = dns_fixedname_name(&fixed2);
+ dns_result = dns_name_fromstring2(dns_name1, test_name1, NULL,
+ 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- dns_result = dname_from_tname(test_name2, &dns_name2);
+ dns_result = dns_name_fromstring2(dns_name2, test_name2, NULL,
+ 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
t_info("testing %s %s\n", test_name1, test_name2);
dns_name_init(&dns_targetname1, NULL);
dns_name_init(&dns_targetname2, NULL);
- dns_name_getlabelsequence(&dns_name1, label1_start,
+ dns_name_getlabelsequence(dns_name1, label1_start,
range, &dns_targetname1);
- dns_name_getlabelsequence(&dns_name2, label2_start,
+ dns_name_getlabelsequence(dns_name2, label2_start,
range, &dns_targetname2);
/*
else
result = T_FAIL;
} else {
- t_info("dname_from_tname failed, result == %s",
+ t_info("dns_name_fromstring2 failed, result == %s",
dns_result_totext(dns_result));
}
} else {
- t_info("dname_from_tname failed, result == %s",
+ t_info("dns_name_fromstring2 failed, result == %s",
dns_result_totext(dns_result));
}
return (result);
int order;
unsigned int nlabels;
isc_result_t dns_result;
- dns_name_t dns_name1;
+ dns_fixedname_t fixed1;
+ dns_name_t *dns_name1;
dns_name_t dns_name2;
dns_namereln_t dns_namereln;
isc_region_t region;
t_info("testing %s\n", test_name);
- dns_result = dname_from_tname(test_name, &dns_name1);
+ dns_fixedname_init(&fixed1);
+ dns_name1 = dns_fixedname_name(&fixed1);
+ dns_result = dns_name_fromstring2(dns_name1, test_name, NULL, 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
- dns_name_toregion(&dns_name1, ®ion);
+ dns_name_toregion(dns_name1, ®ion);
dns_name_init(&dns_name2, NULL);
dns_name_fromregion(&dns_name2, ®ion);
- dns_namereln = dns_name_fullcompare(&dns_name1, &dns_name2,
+ dns_namereln = dns_name_fullcompare(dns_name1, &dns_name2,
&order, &nlabels);
if (dns_namereln == dns_namereln_equal)
result = T_PASS;
else
result = T_FAIL;
} else {
- t_info("dname_from_tname failed, result == %s\n",
+ t_info("dns_name_fromstring2 failed, result == %s\n",
dns_result_totext(result));
}
return (result);
char buf2[BUFLEN];
isc_buffer_t iscbuf1;
isc_buffer_t iscbuf2;
+ dns_fixedname_t fixed2;
dns_name_t dns_name1;
- dns_name_t dns_name2;
+ dns_name_t *dns_name2;
isc_result_t dns_result;
dns_namereln_t dns_namereln;
dns_decompress_t dctx;
if ((dns_result == exp_result) && (exp_result == ISC_R_SUCCESS)) {
- dns_result = dname_from_tname(exp_name, &dns_name2);
+ dns_fixedname_init(&fixed2);
+ dns_name2 = dns_fixedname_name(&fixed2);
+ dns_result = dns_name_fromstring2(dns_name2, exp_name, NULL,
+ 0, NULL);
if (dns_result == ISC_R_SUCCESS) {
dns_namereln = dns_name_fullcompare(&dns_name1,
- &dns_name2,
+ dns_name2,
&order, &nlabels);
if (dns_namereln != dns_namereln_equal) {
t_info("dns_name_fullcompare returned %s\n",
dns_fixedname_t dns_origin;
isc_result_t expected_result;
+ REQUIRE(dbfile != NULL);
+ REQUIRE(expected_firstname != NULL);
+ REQUIRE(expected_firstorigin != NULL);
+ REQUIRE(expected_nextname != NULL);
+ REQUIRE(expected_nextorigin != NULL);
+
result = T_UNRESOLVED;
nfails = 0;
dns_fixedname_t dns_origin;
isc_result_t expected_result;
+ REQUIRE(dbfile != NULL);
+ REQUIRE(expected_lastname != NULL);
+ REQUIRE(expected_lastorigin != NULL);
+ REQUIRE(expected_prevname != NULL);
+ REQUIRE(expected_prevorigin != NULL);
+
result = T_UNRESOLVED;
nfails = 0;
i = first_empty;
}
if (i == MAX_RECORDS) {
- state->log(ISC_LOG_ERROR, "dlz_example: out of record space");
+ if (state->log != NULL)
+ state->log(ISC_LOG_ERROR,
+ "dlz_example: out of record space");
return (ISC_R_FAILURE);
}
strcpy(list[i].name, name);
state->writeable_zone = (dns_dlz_writeablezone_t *)ptr;
}
-
/*
* Called to initialize the driver
*/
/* Fill in the helper functions */
va_start(ap, dbdata);
while ((helper_name = va_arg(ap, const char *)) != NULL) {
- b9_add_helper(state, helper_name, va_arg(ap, void*));
+ b9_add_helper(state, helper_name, va_arg(ap, void *));
}
va_end(ap);
if (argc < 2) {
- state->log(ISC_LOG_ERROR,
- "dlz_example: please specify a zone name");
+ if (state->log != NULL)
+ state->log(ISC_LOG_ERROR,
+ "dlz_example: please specify a zone name");
dlz_destroy(state);
return (ISC_R_FAILURE);
}
state->zone_name = strdup(argv[1]);
+ if (state->zone_name == NULL) {
+ free(state);
+ return (ISC_R_NOMEMORY);
+ }
sprintf(soa_data, "%s hostmaster.%s 123 900 600 86400 3600",
state->zone_name, state->zone_name);
add_name(state, &state->current[0], state->zone_name,
"a", 1800, "10.53.0.1");
- state->log(ISC_LOG_INFO,
- "dlz_example: started for zone %s",
- state->zone_name);
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO, "dlz_example: started for zone %s",
+ state->zone_name);
*dbdata = state;
return (ISC_R_SUCCESS);
dlz_destroy(void *dbdata) {
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
- state->log(ISC_LOG_INFO,
- "dlz_example: shutting down zone %s",
- state->zone_name);
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO,
+ "dlz_example: shutting down zone %s",
+ state->zone_name);
free(state->zone_name);
free(state);
}
UNUSED(zone);
+ if (state->putrr == NULL)
+ return (ISC_R_NOTIMPLEMENTED);
+
if (strcmp(name, "@") == 0)
strcpy(full_name, state->zone_name);
else
int i;
UNUSED(zone);
+
+ if (state->putnamedrr == NULL)
+ return (ISC_R_NOTIMPLEMENTED);
for (i = 0; i < MAX_RECORDS; i++) {
isc_result_t result;
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
if (state->transaction_started) {
- state->log(ISC_LOG_INFO,
- "dlz_example: transaction already "
- "started for zone %s", zone);
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO,
+ "dlz_example: transaction already "
+ "started for zone %s", zone);
return (ISC_R_FAILURE);
}
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
if (!state->transaction_started) {
- state->log(ISC_LOG_INFO,
- "dlz_example: transaction not started for zone %s",
- zone);
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO, "dlz_example: transaction not "
+ "started for zone %s", zone);
*versionp = NULL;
return;
}
if (commit) {
int i;
- state->log(ISC_LOG_INFO,
- "dlz_example: committing transaction on zone %s",
- zone);
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO, "dlz_example: committing "
+ "transaction on zone %s", zone);
for (i = 0; i < MAX_RECORDS; i++) {
if (strlen(state->adds[i].name) > 0U) {
add_name(state, &state->current[0],
}
}
} else {
- state->log(ISC_LOG_INFO,
- "dlz_example: cancelling transaction on zone %s",
- zone);
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO, "dlz_example: cancelling "
+ "transaction on zone %s", zone);
}
memset(state->adds, 0, sizeof(state->adds));
memset(state->deletes, 0, sizeof(state->deletes));
isc_result_t result;
- state->log(ISC_LOG_INFO, "dlz_example: starting configure");
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO, "dlz_example: starting configure");
+
if (state->writeable_zone == NULL) {
- state->log(ISC_LOG_INFO,
- "dlz_example: no writeable_zone method available");
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO, "dlz_example: no "
+ "writeable_zone method available");
return (ISC_R_FAILURE);
}
result = state->writeable_zone(view, state->zone_name);
if (result != ISC_R_SUCCESS) {
- state->log(ISC_LOG_ERROR,
- "dlz_example: failed to configure zone %s",
- state->zone_name);
+ if (state->log != NULL)
+ state->log(ISC_LOG_ERROR, "dlz_example: failed to "
+ "configure zone %s", state->zone_name);
return (result);
}
- state->log(ISC_LOG_INFO,
- "dlz_example: configured writeable zone %s",
- state->zone_name);
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO, "dlz_example: configured writeable "
+ "zone %s", state->zone_name);
return (ISC_R_SUCCESS);
}
UNUSED(keydata);
if (strncmp(name, "deny.", 5) == 0) {
- state->log(ISC_LOG_INFO,
- "dlz_example: denying update of name=%s by %s",
- name, signer);
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO, "dlz_example: denying update "
+ "of name=%s by %s", name, signer);
return (ISC_FALSE);
}
- state->log(ISC_LOG_INFO,
- "dlz_example: allowing update of name=%s by %s",
- name, signer);
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO, "dlz_example: allowing update of "
+ "name=%s by %s", name, signer);
return (ISC_TRUE);
}
if (version != (void *) &state->transaction_started)
return (ISC_R_FAILURE);
- state->log(ISC_LOG_INFO,
- "dlz_example: adding rdataset %s '%s'",
- name, rdatastr);
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO, "dlz_example: adding rdataset %s '%s'",
+ name, rdatastr);
return (modrdataset(state, name, rdatastr, &state->adds[0]));
}
if (version != (void *) &state->transaction_started)
return (ISC_R_FAILURE);
- state->log(ISC_LOG_INFO,
- "dlz_example: subtracting rdataset %s '%s'",
- name, rdatastr);
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO, "dlz_example: subtracting rdataset "
+ "%s '%s'", name, rdatastr);
return (modrdataset(state, name, rdatastr, &state->deletes[0]));
}
if (version != (void *) &state->transaction_started)
return (ISC_R_FAILURE);
- state->log(ISC_LOG_INFO,
- "dlz_example: deleting rdataset %s of type %s",
- name, type);
+ if (state->log != NULL)
+ state->log(ISC_LOG_INFO, "dlz_example: deleting rdataset %s "
+ "of type %s", name, type);
return (ISC_R_SUCCESS);
}
return;
}
} else {
- if (strcmp(hp->h_name, name) != 0) {
+ if (name != NULL && strcmp(hp->h_name, name) != 0) {
printf("I:gethostbyname(%s) returned %s, "
"expected %s\n", address, hp->h_name, name);
fails++;
return;
}
} else {
- if (strcmp(hp->h_name, name) != 0) {
+ if (name != NULL && strcmp(hp->h_name, name) != 0) {
printf("I:getipnodebyaddr(%s) returned %s, "
"expected %s\n", address, hp->h_name, name);
freehostent(hp);
if (qs == NULL)
return NULL;
+ *qs = 0;
/* start at the top of the list again */
tseg = ISC_LIST_HEAD(*querylist);
- /* copy the first item in the list to the query string */
- if (tseg->direct == isc_boolean_true) /* query segment */
- strcpy(qs, tseg->sql);
- else
- strcpy(qs, * (char**) tseg->sql); /* dynamic segment */
-
- /* concatonate the rest of the segments */
- while ((tseg = ISC_LIST_NEXT(tseg, link)) != NULL) {
+ while (tseg != NULL) {
if (tseg->direct == isc_boolean_true)
/* query segments */
strcat(qs, tseg->sql);
else
/* dynamic segments */
strcat(qs, * (char**) tseg->sql);
+ /* get the next segment */
+ tseg = ISC_LIST_NEXT(tseg, link);
}
return qs;
}
estr = gss_error_tostring(major, minor, buf, sizeof(buf));
- if (estr)
+ if (estr != NULL)
(*err_message) = isc_mem_strdup(mctx, estr);
}
#endif
if (gret != GSS_S_COMPLETE && gret != GSS_S_CONTINUE_NEEDED) {
gss_err_message(mctx, gret, minor, err_message);
- gss_log(3, "Failure initiating security context: %s",
- *err_message);
+ if (err_message != NULL && *err_message != NULL)
+ gss_log(3, "Failure initiating security context: %s",
+ *err_message);
+ else
+ gss_log(3, "Failure initiating security context");
+
result = ISC_R_FAILURE;
goto out;
}
#define DNS_NAME_INIT(n, o) \
do { \
- (n)->magic = DNS_NAME_MAGIC; \
- (n)->ndata = NULL; \
- (n)->length = 0; \
- (n)->labels = 0; \
- (n)->attributes = 0; \
- (n)->offsets = (o); \
- (n)->buffer = NULL; \
- ISC_LINK_INIT((n), link); \
- ISC_LIST_INIT((n)->list); \
+ dns_name_t *_n = (n); \
+ /* memset(_n, 0, sizeof(*_n)); */ \
+ _n->magic = DNS_NAME_MAGIC; \
+ _n->ndata = NULL; \
+ _n->length = 0; \
+ _n->labels = 0; \
+ _n->attributes = 0; \
+ _n->offsets = (o); \
+ _n->buffer = NULL; \
+ ISC_LINK_INIT(_n, link); \
+ ISC_LIST_INIT(_n->list); \
} while (0)
#define DNS_NAME_RESET(n) \
nlabels = 0;
l1 = name1->labels;
l2 = name2->labels;
- ldiff = (int)l1 - (int)l2;
- if (ldiff < 0)
+ if (l2 > l1) {
l = l1;
- else
+ ldiff = 0 - (l2 - l1);
+ } else {
l = l2;
+ ldiff = l1 - l2;
+ }
while (l > 0) {
l--;
REQUIRE(digest != NULL);
DNS_NAME_INIT(&downname, NULL);
+
isc_buffer_init(&buffer, data, sizeof(data));
result = dns_name_downcase(name, &downname, &buffer);
cleanup:
dns_rdataset_disassociate(&neg);
dns_rdataset_disassociate(&negsig);
- free_noqname(mctx, &noqname);
+ if (noqname != NULL)
+ free_noqname(mctx, &noqname);
return(result);
}
octet_string *data, size_t *size)
{
data->length = len;
- data->data = malloc(len);
- if (data->data == NULL && data->length != 0U)
- return (ENOMEM);
- memcpy(data->data, p, len);
+ if (len != 0) {
+ data->data = malloc(len);
+ if (data->data == NULL)
+ return (ENOMEM);
+ memcpy(data->data, p, len);
+ } else
+ data->data = NULL;
if (size)
*size = len;
return (0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_parse_uint32(&output, "1234567890", 10);
+ ATF_CHECK_EQ(ISC_R_SUCCESS, result);
ATF_CHECK_EQ(1234567890, output);
result = isc_parse_uint32(&output, "123456789012345", 10);
isccc_cc_createresponse(isccc_sexpr_t *message, isccc_time_t now,
isccc_time_t expires, isccc_sexpr_t **alistp)
{
- char *_frm, *_to, *type;
+ char *_frm, *_to, *type = NULL;
isc_uint32_t serial;
isccc_sexpr_t *alist, *_ctrl, *_data;
isc_result_t result;
{
isccc_sexpr_t *kv, *v;
+ REQUIRE(strp == NULL || *strp == NULL);
+
kv = isccc_alist_assq(alist, key);
if (kv != NULL) {
v = ISCCC_SEXPR_CDR(kv);
{
const char *_frm;
const char *_to;
- char *_ser, *_tim, *tmp;
+ char *_ser = NULL, *_tim = NULL, *tmp;
isc_result_t result;
char *key;
size_t len;
isccc_cc_lookupstring(_ctrl, "_ser", &_ser) != ISC_R_SUCCESS ||
isccc_cc_lookupstring(_ctrl, "_tim", &_tim) != ISC_R_SUCCESS)
return (ISC_R_FAILURE);
+
+ INSIST(_ser != NULL);
+ INSIST(_tim != NULL);
+
/*
* _frm and _to are optional.
*/
+ tmp = NULL;
if (isccc_cc_lookupstring(_ctrl, "_frm", &tmp) != ISC_R_SUCCESS)
_frm = "";
else
_frm = tmp;
+ tmp = NULL;
if (isccc_cc_lookupstring(_ctrl, "_to", &tmp) != ISC_R_SUCCESS)
_to = "";
else
(void) lwres_conf_parse(lwrctx, lwres_resolv_conf);
if (hostname == NULL && (flags & AI_PASSIVE) == 0) {
ai = ai_clone(*aip, AF_INET);
- if (ai == NULL) {
- lwres_freeaddrinfo(*aip);
+ if (ai == NULL)
SETERROR(EAI_MEMORY);
- }
*aip = ai;
ai->ai_socktype = socktype;
addr = LWRES_LIST_HEAD(by->addrs);
while (addr != NULL) {
ai = ai_clone(*aip, AF_INET);
- if (ai == NULL) {
- lwres_freeaddrinfo(*aip);
+ if (ai == NULL)
SETERROR(EAI_MEMORY);
- }
*aip = ai;
ai->ai_socktype = socktype;
SIN(ai->ai_addr)->sin_port = port;
if (hostname == NULL && (flags & AI_PASSIVE) == 0) {
ai = ai_clone(*aip, AF_INET6);
- if (ai == NULL) {
- lwres_freeaddrinfo(*aip);
+ if (ai == NULL)
SETERROR(EAI_MEMORY);
- }
*aip = ai;
ai->ai_socktype = socktype;
addr = LWRES_LIST_HEAD(by->addrs);
while (addr != NULL) {
ai = ai_clone(*aip, AF_INET6);
- if (ai == NULL) {
- lwres_freeaddrinfo(*aip);
+ if (ai == NULL)
SETERROR(EAI_MEMORY);
- }
*aip = ai;
ai->ai_socktype = socktype;
SIN6(ai->ai_addr)->sin6_port = port;
int names = 1;
int addresses = 1;
+ if (he == NULL)
+ return;
+
free(he->h_name);
cpp = he->h_addr_list;
void
lwres_freerrset(struct rrsetinfo *rrset) {
unsigned int i;
- for (i = 0; i < rrset->rri_nrdatas; i++) {
- if (rrset->rri_rdatas[i].rdi_data == NULL)
- break;
- free(rrset->rri_rdatas[i].rdi_data);
+ if (rrset->rri_rdatas != NULL) {
+ for (i = 0; i < rrset->rri_nrdatas; i++) {
+ if (rrset->rri_rdatas[i].rdi_data == NULL)
+ break;
+ free(rrset->rri_rdatas[i].rdi_data);
+ }
+ free(rrset->rri_rdatas);
}
- free(rrset->rri_rdatas);
- for (i = 0; i < rrset->rri_nsigs; i++) {
- if (rrset->rri_sigs[i].rdi_data == NULL)
- break;
- free(rrset->rri_sigs[i].rdi_data);
+ if (rrset->rri_sigs != NULL) {
+ for (i = 0; i < rrset->rri_nsigs; i++) {
+ if (rrset->rri_sigs[i].rdi_data == NULL)
+ break;
+ free(rrset->rri_sigs[i].rdi_data);
+ }
+ free(rrset->rri_sigs);
}
- free(rrset->rri_sigs);
free(rrset->rri_name);
free(rrset);
}