Branch Coverage

src/ldns/resolver.c
Criterion Covered Total %
branch 107 326 32.8


line true false branch
146 0 0 if (!r || !keys) { return false; }
0 0 if (!r || !keys) { return false; }
150 0 0 if (!trust_anchors) { return false; }
152 0 0 for (i = 0; i < ldns_rr_list_rr_count(keys); i++) {
155 0 0 if (ldns_rr_list_contains_rr(trust_anchors, cur_rr)) {
156 0 0 if (trusted_keys) { ldns_rr_list_push_rr(trusted_keys, cur_rr); }
191 0 0 if (pos >= ldns_resolver_nameserver_count(r)) {
262 1 0 if (ns_count == 0 || !nameservers) {
0 1 if (ns_count == 0 || !nameservers) {
268 1 0 if (ns_count == 1) {
304 18 1 if (ns_count == 0) {
309 0 19 if(!nameservers)
316 18 1 if (ns_count == 0) {
321 0 19 if(!rtt)
338 0 0 if ((!rr) || (ldns_rr_get_type(rr) != LDNS_RR_TYPE_A &&
343 0 0 if (address) {
358 0 0 if (rrlist) {
359 0 0 for(i = 0; i < ldns_rr_list_rr_count(rrlist); i++) {
361 0 0 if (ldns_resolver_push_nameserver_rr(r, rr) != LDNS_STATUS_OK) {
407 0 0 if ((!rr) || (ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY &&
413 0 0 if (!(trust_anchors = ldns_resolver_dnssec_anchors(r))) { /* Initialize */
418 0 0 return (ldns_rr_list_push_rr(trust_anchors, ldns_rr_clone(rr))) ? LDNS_STATUS_OK : LDNS_STATUS_ERR;
514 1 0 if (pos >= ldns_resolver_nameserver_count(r)) {
537 0 1 if (c == 0) {
563 0 0 if (ldns_rdf_get_type(d) != LDNS_RDF_TYPE_DNAME) {
571 0 0 if (searchlist) {
613 0 18 if (!r) {
674 0 0 if (!(dst = LDNS_MALLOC(ldns_resolver))) return NULL;
677 0 0 if (dst->_searchlist_count == 0)
680 0 0 if (!(dst->_searchlist =
683 0 0 for (i = 0; i < dst->_searchlist_count; i++)
684 0 0 if (!(dst->_searchlist[i] =
690 0 0 if (dst->_nameserver_count == 0) {
694 0 0 if (!(dst->_nameservers =
697 0 0 for (i = 0; i < dst->_nameserver_count; i++)
698 0 0 if (!(dst->_nameservers[i] =
703 0 0 if (!(dst->_rtt =
709 0 0 if (dst->_domain && (!(dst->_domain = ldns_rdf_clone(src->_domain))))
0 0 if (dst->_domain && (!(dst->_domain = ldns_rdf_clone(src->_domain))))
712 0 0 if (dst->_tsig_keyname &&
0 0 if (dst->_tsig_keyname &&
716 0 0 if (dst->_tsig_keydata &&
0 0 if (dst->_tsig_keydata &&
720 0 0 if (dst->_tsig_algorithm &&
0 0 if (dst->_tsig_algorithm &&
747 0 0 for (i = 0; i < dst->_nameserver_count; i++)
751 0 0 for (i = 0; i < dst->_searchlist_count; i++)
782 1 0 if(!line_nr) line_nr = &lnr;
784 0 1 if(!fp) {
786 0 0 if(!myfp)
808 0 1 if (!r) {
809 0 0 if(!fp) fclose(myfp);
817 13 1 while (gtr > 0) {
819 3 10 if (word[0] == '#') {
821 3 0 if(oldline == *line_nr) {
826 162 0 } while(c != EOF && c != '\n');
159 3 } while(c != EOF && c != '\n');
827 3 0 if(c=='\n') (*line_nr)++;
838 6 1 if (gtr != 0) {
839 3 3 if(word[0] == '#') continue;
840 5 0 for(i = 0; i < LDNS_RESOLV_KEYWORDS; i++) {
841 3 2 if (strcasecmp(keyword[i], word) == 0) {
863 0 1 if (gtr == 0) {
864 0 0 if(!fp) fclose(myfp);
867 0 1 if(word[0] == '#') {
872 0 1 if (!tmp) {
874 0 0 if(!fp) fclose(myfp);
885 0 2 if (gtr == 0) {
886 0 0 if(!fp) fclose(myfp);
889 0 2 if(word[0] == '#') {
893 0 2 if(strchr(word, '%')) {
899 2 0 if (!tmp) {
904 0 2 if (!tmp) {
906 0 0 if(!fp) fclose(myfp);
917 0 0 if(!b) {
919 0 0 if(!fp) fclose(myfp);
924 0 0 if(ldns_buffer_status(b) != LDNS_STATUS_OK) {
927 0 0 if(!fp) fclose(myfp);
931 0 0 while (bgtr > 0) {
933 0 0 if(word[0] == '#') {
938 0 0 if (!tmp) {
941 0 0 if(!fp) fclose(myfp);
952 0 0 if (expect != LDNS_RESOLV_KEYWORD) {
970 0 0 if (gtr == 0) {
972 0 0 if(!fp) fclose(myfp);
975 0 0 if(word[0] == '#') {
990 0 1 if(!fp)
993 1 0 if (res) {
1009 1 0 if (!filename) {
1015 0 1 if (!fp) {
1021 1 0 if (s == LDNS_STATUS_OK) {
1022 1 0 if (res) {
1044 17 0 if (res) {
1045 0 17 if (res->_searchlist) {
1046 0 0 for (i = 0; i < ldns_resolver_searchlist_count(res); i++) {
1051 17 0 if (res->_nameservers) {
1052 18 17 for (i = 0; i < res->_nameserver_count; i++) {
1057 1 16 if (ldns_resolver_domain(res)) {
1060 0 17 if (res->_tsig_keyname) {
1063 0 17 if (res->_tsig_keydata) {
1066 0 17 if (res->_tsig_algorithm) {
1070 2 15 if (res->_cur_axfr_pkt) {
1074 17 0 if (res->_rtt) {
1077 0 17 if (res->_dnssec_anchors) {
1095 0 0 if (ldns_dname_absolute(name)) {
1098 0 0 } else if (ldns_resolver_dnsrch(r)) {
1100 0 0 for (i = 0; i <= ldns_resolver_searchlist_count(r); i++) {
1101 0 0 if (i == ldns_resolver_searchlist_count(r)) {
1112 0 0 if (pkt && *pkt) {
0 0 if (pkt && *pkt) {
1132 0 0 if (ldns_resolver_search_status(&pkt, (ldns_resolver *)r,
1147 0 6 if (!ldns_resolver_defnames(r) || !ldns_resolver_domain(r)) {
0 0 if (!ldns_resolver_defnames(r) || !ldns_resolver_domain(r)) {
1152 0 0 if (!newname) {
1165 0 6 if (ldns_resolver_query_status(&pkt, (ldns_resolver *)r,
1178 2 0 if (old_rtt && ldns_resolver_nameserver_count(r)) {
2 0 if (old_rtt && ldns_resolver_nameserver_count(r)) {
1194 2 0 if (cur_rtt) {
1209 1 23 if (stat != LDNS_STATUS_OK) {
1210 0 1 if(answer_pkt) {
1217 23 0 if (!ldns_resolver_usevc(r) && ldns_resolver_fallback(r)) {
23 0 if (!ldns_resolver_usevc(r) && ldns_resolver_fallback(r)) {
1218 2 21 if (ldns_pkt_tc(answer_pkt)) {
1220 2 0 if (ldns_pkt_edns_udp_size(query_pkt) == 0) {
1250 24 0 if (answer) {
1267 0 24 if (t == LDNS_RR_TYPE_IXFR) {
1278 0 0 if (!soa) {
1282 0 0 if (!owner_rdf) {
1290 0 0 if (ldns_str2rdf_dname(&mname_rdf, ".") != LDNS_STATUS_OK) {
1294 0 0 if (ldns_str2rdf_dname(&rname_rdf, ".") != LDNS_STATUS_OK) {
1299 0 0 if (!serial_rdf) {
1304 0 0 if (!refresh_rdf) {
1309 0 0 if (!retry_rdf) {
1314 0 0 if (!expire_rdf) {
1319 0 0 if (!minimum_rdf) {
1329 0 24 if (!*query_pkt) {
1335 1 23 if (ldns_resolver_dnssec(r)) {
1336 1 0 if (ldns_resolver_edns_udp_size(r) == 0) {
1340 1 0 if (ldns_resolver_dnssec_cd(r) || (flags & LDNS_CD)) {
0 1 if (ldns_resolver_dnssec_cd(r) || (flags & LDNS_CD)) {
1346 1 23 if (ldns_resolver_edns_udp_size(r) != 0) {
1356 0 24 if (ldns_resolver_debug(r)) {
1361 24 0 if (ldns_pkt_id(*query_pkt) == 0) {
1384 0 24 if (0 == t) {
1387 0 24 if (0 == c) {
1390 0 24 if (0 == ldns_resolver_nameserver_count(r)) {
1393 0 24 if (ldns_rdf_get_type(name) != LDNS_RDF_TYPE_DNAME) {
1399 0 24 if (status != LDNS_STATUS_OK) {
1409 0 24 if (ldns_resolver_tsig_keyname(r) && ldns_resolver_tsig_keydata(r)) {
0 0 if (ldns_resolver_tsig_keyname(r) && ldns_resolver_tsig_keydata(r)) {
1415 0 0 if (status != LDNS_STATUS_OK) {
1429 24 0 if (answer) {
1444 35 0 if (!resolver || resolver->_socket == 0) {
0 35 if (!resolver || resolver->_socket == 0) {
1448 33 2 if (resolver->_cur_axfr_pkt) {
1449 0 33 if (resolver->_axfr_i == ldns_pkt_ancount(resolver->_cur_axfr_pkt)) {
1458 1 32 if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_SOA) {
1460 0 1 if (resolver->_axfr_soa_count >= 2) {
1474 0 2 if(!packet_wire)
1482 0 2 if (status != LDNS_STATUS_OK) {
1499 1 1 } else if (ldns_pkt_get_rcode(resolver->_cur_axfr_pkt) != 0) {
1542 1 17 if (resolver->_socket != 0)
1592 27 26 for (i = 0; i < ldns_resolver_nameserver_count(r); i++) {