Branch Coverage

src/ldns/host2str.c
Criterion Covered Total %
branch 77 584 13.1


line true false branch
136 0 48 return fmt && (fmt->flags & LDNS_FMT_RFC3597) &&
0 0 return fmt && (fmt->flags & LDNS_FMT_RFC3597) &&
150 0 0 if (!(fmt_st->flags & LDNS_FMT_RFC3597)) {
153 0 0 if (! fmt_st->bitmap) {
155 0 0 if (s != LDNS_STATUS_OK) {
170 0 0 if (!(fmt_st->flags & LDNS_FMT_RFC3597)) {
173 0 0 if (! fmt_st->bitmap) {
175 0 0 if (s != LDNS_STATUS_OK) {
186 8 0 if (lt && lt->name) {
8 0 if (lt && lt->name) {
198 16 0 if (lt && lt->name) {
16 0 if (lt && lt->name) {
212 0 0 if (lt && lt->name) {
0 0 if (lt && lt->name) {
226 0 0 if (lt && lt->name) {
0 0 if (lt && lt->name) {
242 0 8 if (!buf) {
247 8 0 if (ldns_pkt_opcode2buffer_str(buf, opcode) == LDNS_STATUS_OK) {
262 0 16 if (!buf) {
267 16 0 if (ldns_pkt_rcode2buffer_str(buf, rcode) == LDNS_STATUS_OK) {
282 0 0 if (!buf) {
287 0 0 if (ldns_algorithm2buffer_str(buf, algorithm)
303 0 0 if (!buf) {
308 0 0 if (ldns_cert_algorithm2buffer_str(buf, cert_algorithm)
332 0 40 if (ldns_rdf_size(dname) > LDNS_MAX_DOMAINLEN) {
338 0 40 if (1 == ldns_rdf_size(dname)) {
341 93 40 while ((len > 0) && src_pos < ldns_rdf_size(dname)) {
93 0 while ((len > 0) && src_pos < ldns_rdf_size(dname)) {
343 262 93 for(i = 0; i < len; i++) {
348 262 0 if(c == '.' || c == ';' ||
262 0 if(c == '.' || c == ';' ||
262 0 if(c == '.' || c == ';' ||
349 262 0 c == '(' || c == ')' ||
0 262 c == '(' || c == ')' ||
353 262 0 } else if (!(isascii(c) && isgraph(c))) {
0 262 } else if (!(isascii(c) && isgraph(c))) {
362 93 0 if (src_pos < ldns_rdf_size(dname)) {
403 0 0 if (ldns_serial_arithmitics_gmtime_r(ldns_rdf2native_int32(rdf), time(NULL), &tm)
404 0 0 && strftime(date_buf, 15, "%Y%m%d%H%M%S", &tm)) {
415 14 0 if (inet_ntop(AF_INET, ldns_rdf_data(rdf), str, INET_ADDRSTRLEN)) {
426 2 0 if (inet_ntop(AF_INET6, ldns_rdf_data(rdf), str, INET6_ADDRSTRLEN)) {
438 141 2 while (amount > 0) {
440 0 141 if (isprint((int)ch) || ch == '\t') {
0 0 if (isprint((int)ch) || ch == '\t') {
441 141 0 if (ch == '\"' || ch == '\\')
0 141 if (ch == '\"' || ch == '\\')
456 0 2 if(ldns_rdf_size(rdf) < 1) {
459 0 2 if((int)ldns_rdf_size(rdf) < (int)ldns_rdf_data(rdf)[0] + 1) {
474 0 0 if(!b64) return LDNS_STATUS_MEM_ERR;
475 0 0 if (ldns_b64_ntop(ldns_rdf_data(rdf), ldns_rdf_size(rdf), b64, size)) {
487 0 1 if(ldns_rdf_size(rdf) == 0)
493 0 1 if(!b32) return LDNS_STATUS_MEM_ERR;
496 1 0 if (size > 0) {
507 368 12 for (i = 0; i < ldns_rdf_size(rdf); i++) {
521 5 0 ldns_rr_descript(data) &&
545 0 0 if (lt) {
559 0 0 if (lt) {
578 0 0 if(exponent < 2) {
579 0 0 if(exponent == 1)
586 0 0 for(i=0; i
614 147 0 if (descriptor && descriptor->_name) {
147 0 if (descriptor && descriptor->_name) {
630 0 134 if (!buf) {
635 134 0 if (ldns_rr_type2buffer_str(buf, type) == LDNS_STATUS_OK) {
651 16 0 if (lt) {
666 0 3 if (!buf) {
671 3 0 if (ldns_rr_class2buffer_str(buf, klass) == LDNS_STATUS_OK) {
697 0 0 if(ldns_rdf_size(rdf) < 1) {
701 0 0 if (version == 0) {
702 0 0 if(ldns_rdf_size(rdf) < 16) {
713 0 0 if (latitude > equator) {
728 0 0 if (longitude > equator) {
747 0 0 if(altitude%100 != 0)
801 0 0 if(ldns_rdf_size(rdf) < 1) {
806 0 0 if (protocol && (protocol->p_name != NULL)) {
0 0 if (protocol && (protocol->p_name != NULL)) {
817 0 0 for (current_service = 0;
819 0 0 if (ldns_get_bit(&(ldns_rdf_data(rdf)[1]), current_service)) {
822 0 0 if (service && service->s_name) {
0 0 if (service && service->s_name) {
849 6 6 while((size_t)(pos + 2) < ldns_rdf_size(rdf)) {
853 0 6 if (ldns_rdf_size(rdf) < pos + bitmap_length) {
856 320 6 for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) {
857 290 30 if (! ldns_get_bit(&data[pos], bit_pos)) {
863 30 0 ldns_rr_descript(type) &&
892 0 0 if(ldns_rdf_size(rdf) < 1) {
897 0 0 if (salt_length == 0 || ((size_t)salt_length)+1 > ldns_rdf_size(rdf)) {
0 0 if (salt_length == 0 || ((size_t)salt_length)+1 > ldns_rdf_size(rdf)) {
900 0 0 for (salt_pos = 0; salt_pos < salt_length; salt_pos++) {
913 0 0 if (ldns_rdf_size(rdf) != 4) {
928 0 0 if (ldns_rdf_size(rdf) < 6) {
955 0 0 while (pos < (unsigned int) ldns_rdf_size(rdf)) {
956 0 0 if(pos + 3 >= (unsigned)ldns_rdf_size(rdf))
962 0 0 if (address_family == LDNS_APL_IP4) {
964 0 0 if (negation) {
969 0 0 for (i = 0; i < 4; i++) {
970 0 0 if (i > 0) {
973 0 0 if (i < (unsigned short) adf_length) {
974 0 0 if(pos+i+4 >= ldns_rdf_size(rdf))
983 0 0 } else if (address_family == LDNS_APL_IP6) {
985 0 0 if (negation) {
990 0 0 for (i = 0; i < 16; i++) {
991 0 0 if (i % 2 == 0 && i > 0) {
0 0 if (i % 2 == 0 && i > 0) {
994 0 0 if (i < (unsigned short) adf_length) {
995 0 0 if(pos+i+4 >= ldns_rdf_size(rdf))
1010 0 0 for (i = 1; i < (unsigned short) (4 + adf_length); i++) {
1011 0 0 if(pos+i >= ldns_rdf_size(rdf))
1026 0 0 if (ldns_rdf_size(rdf) < 2) {
1032 0 0 if (ldns_rdf_size(rdf) > 2) {
1034 0 0 if(!b64)
1069 0 0 if (ldns_rdf_size(rdf) < 3) {
1083 0 0 if(!gateway_data)
1085 0 0 if (ldns_rdf_size(rdf) < offset + LDNS_IP4ADDRLEN) {
1092 0 0 if(!gateway) {
1099 0 0 if(!gateway_data)
1101 0 0 if (ldns_rdf_size(rdf) < offset + LDNS_IP6ADDRLEN) {
1109 0 0 if(!gateway) {
1117 0 0 if(status != LDNS_STATUS_OK)
1125 0 0 if (ldns_rdf_size(rdf) <= offset) {
1130 0 0 if(!public_key_data) {
1137 0 0 if(!public_key) {
1144 0 0 if (gateway)
1160 0 0 if (ldns_rdf_size(rdf) != 8) {
1174 0 0 if (ldns_rdf_size(rdf) != 6) {
1187 0 0 if (ldns_rdf_size(rdf) != 8) {
1204 0 0 if (ldns_rdf_size(rdf) < 2) {
1208 0 0 if (nchars >= ldns_rdf_size(rdf) || /* should be rdf_size - 1 */
0 0 if (nchars >= ldns_rdf_size(rdf) || /* should be rdf_size - 1 */
1213 0 0 while (nchars > 0) {
1215 0 0 if (! isalnum(ch)) {
1244 0 0 if (rdf_size < 6) {
1247 0 0 if ((hit_size = data[0]) == 0 ||
0 0 if ((hit_size = data[0]) == 0 ||
1248 0 0 (pk_size = ldns_read_uint16(data + 2)) == 0 ||
1256 0 0 for (data += 4; hit_size > 0; hit_size--, data++) {
1262 0 0 if (ldns_buffer_reserve(output,
1285 96 1 if (rdf) {
1414 0 0 if(ldns_rdf_size(rdf) == 0)
1420 0 0 if (b32) {
1421 0 0 if (ldns_b32_ntop_extended_hex(ldns_rdf_data(rdf) + 1,
1425 0 0 if (ldns_str2rdf_dname(&out, b32) == LDNS_STATUS_OK) {
1442 0 0 for (i = 0; i < ldns_rr_rd_count(rr); i++) {
1445 0 0 if (total_rdfsize == 0) {
1450 0 0 for (i = 0; i < ldns_rr_rd_count(rr); i++) {
1451 0 0 for (j = 0; j < ldns_rdf_size(ldns_rr_rdf(rr, i)); j++) {
1468 0 13 if (fmt_st == NULL) {
1472 0 13 if (!rr) {
1473 0 0 if (LDNS_COMMENT_NULLS & fmt_st->flags) {
1478 13 0 if (ldns_rr_owner(rr)) {
1481 0 13 if (status != LDNS_STATUS_OK) {
1486 13 0 if (!ldns_rr_is_question(rr)) {
1492 0 13 if (status != LDNS_STATUS_OK) {
1497 0 13 if (ldns_output_format_covers_type(fmt, ldns_rr_get_type(rr))) {
1501 0 13 if (status != LDNS_STATUS_OK) {
1505 13 0 if (ldns_rr_rd_count(rr) > 0) {
1507 0 0 } else if (!ldns_rr_is_question(rr)) {
1511 40 13 for (i = 0; i < ldns_rr_rd_count(rr); i++) {
1514 0 0 (ldns_rr_get_type(rr) == LDNS_RR_TYPE_RRSIG) &&
1515 0 0 ((/* inception */ i == 4 &&
1517 0 0 LDNS_RDF_TYPE_TIME) ||
1518 0 0 (/* expiration */ i == 5 &&
1520 0 0 LDNS_RDF_TYPE_TIME) ||
1521 0 0 (/* signature */ i == 8 &&
1528 0 0 (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) &&
1529 0 0 /* serial */ i == 2 &&
1540 0 40 if(status != LDNS_STATUS_OK)
1542 27 13 if (i < ldns_rr_rd_count(rr) - 1) {
1549 13 0 if (ldns_rr_rd_count(rr) > 0) {
1554 0 0 if (! (fmt_st->flags & LDNS_COMMENT_KEY)) {
1559 0 0 if (fmt_st->flags & LDNS_COMMENT_KEY_ID) {
1563 0 0 if ((fmt_st->flags & LDNS_COMMENT_KEY_TYPE) &&
0 0 if ((fmt_st->flags & LDNS_COMMENT_KEY_TYPE) &&
1566 0 0 if (flags & LDNS_KEY_SEP_KEY) {
1571 0 0 if (fmt_st->flags & LDNS_COMMENT_KEY_SIZE){
1574 0 0 } else if (fmt_st->flags
1579 0 0 if (fmt_st->flags & LDNS_COMMENT_KEY_SIZE) {
1586 0 0 if ((fmt_st->flags & LDNS_COMMENT_KEY)
1587 0 0 && (fmt_st->flags& LDNS_COMMENT_RRSIGS)
1588 0 0 && ldns_rr_rdf(rr, 6) != NULL) {
1602 0 0 if(babble) {
1610 0 0 if (! (fmt_st->flags & LDNS_COMMENT_FLAGS) &&
0 0 if (! (fmt_st->flags & LDNS_COMMENT_FLAGS) &&
1615 0 0 if ((fmt_st->flags & LDNS_COMMENT_FLAGS)) {
1616 0 0 if (ldns_nsec3_optout(rr)) {
1622 0 0 if (fmt_st->flags & LDNS_COMMENT_NSEC3_CHAIN &&
0 0 if (fmt_st->flags & LDNS_COMMENT_NSEC3_CHAIN &&
1627 0 0 if (fmt_st->flags & LDNS_COMMENT_NSEC3_CHAIN &&
0 0 if (fmt_st->flags & LDNS_COMMENT_NSEC3_CHAIN &&
1632 0 0 if (key) {
1636 0 0 if (node->data) {
1650 0 0 if (key) {
1654 0 0 if (node->data) {
1691 0 0 for(i = 0; i < ldns_rr_list_rr_count(list); i++) {
1714 0 0 if (opcode) {
1720 0 0 if (rcode) {
1728 0 0 if (ldns_pkt_qr(pkt)) {
1731 0 0 if (ldns_pkt_aa(pkt)) {
1734 0 0 if (ldns_pkt_tc(pkt)) {
1737 0 0 if (ldns_pkt_rd(pkt)) {
1740 0 0 if (ldns_pkt_cd(pkt)) {
1743 0 0 if (ldns_pkt_ra(pkt)) {
1746 0 0 if (ldns_pkt_ad(pkt)) {
1767 0 0 if (!pkt) {
1772 0 0 if (ldns_buffer_status_ok(output)) {
1774 0 0 if (status != LDNS_STATUS_OK) {
1783 0 0 for (i = 0; i < ldns_pkt_qdcount(pkt); i++) {
1787 0 0 if (status != LDNS_STATUS_OK) {
1794 0 0 for (i = 0; i < ldns_pkt_ancount(pkt); i++) {
1798 0 0 if (status != LDNS_STATUS_OK) {
1807 0 0 for (i = 0; i < ldns_pkt_nscount(pkt); i++) {
1811 0 0 if (status != LDNS_STATUS_OK) {
1818 0 0 for (i = 0; i < ldns_pkt_arcount(pkt); i++) {
1822 0 0 if (status != LDNS_STATUS_OK) {
1831 0 0 if (ldns_pkt_edns(pkt)) {
1835 0 0 if (ldns_pkt_edns_do(pkt)) {
1840 0 0 if (ldns_pkt_edns_extended_rcode(pkt)) {
1847 0 0 if (ldns_pkt_edns_data(pkt)) {
1854 0 0 if (ldns_pkt_tsig(pkt)) {
1860 0 0 if (ldns_pkt_answerfrom(pkt)) {
1943 0 0 if (!k) {
1948 0 0 if (!bignum) {
1952 0 0 if (ldns_buffer_status_ok(output)) {
2011 0 0 if (i > LDNS_MAX_KEYLEN) {
2015 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2023 0 0 if (i > LDNS_MAX_KEYLEN) {
2027 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2035 0 0 if (rsa->d) {
2037 0 0 if (i > LDNS_MAX_KEYLEN) {
2041 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2052 0 0 if (rsa->p) {
2054 0 0 if (i > LDNS_MAX_KEYLEN) {
2058 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2069 0 0 if (rsa->q) {
2071 0 0 if (i > LDNS_MAX_KEYLEN) {
2075 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2086 0 0 if (rsa->dmp1) {
2088 0 0 if (i > LDNS_MAX_KEYLEN) {
2092 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2103 0 0 if (rsa->dmq1) {
2105 0 0 if (i > LDNS_MAX_KEYLEN) {
2109 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2120 0 0 if (rsa->iqmp) {
2122 0 0 if (i > LDNS_MAX_KEYLEN) {
2126 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2144 0 0 if (ldns_key_algorithm(k) == LDNS_SIGN_DSA) {
2146 0 0 } else if (ldns_key_algorithm(k) == LDNS_SIGN_DSA_NSEC3) {
2154 0 0 if (dsa->p) {
2156 0 0 if (i > LDNS_MAX_KEYLEN) {
2160 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2171 0 0 if (dsa->q) {
2173 0 0 if (i > LDNS_MAX_KEYLEN) {
2177 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2188 0 0 if (dsa->g) {
2190 0 0 if (i > LDNS_MAX_KEYLEN) {
2194 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2205 0 0 if (dsa->priv_key) {
2207 0 0 if (i > LDNS_MAX_KEYLEN) {
2211 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2222 0 0 if (dsa->pub_key) {
2224 0 0 if (i > LDNS_MAX_KEYLEN) {
2228 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2263 0 0 if(k->_key.key) {
2268 0 0 if (i > LDNS_MAX_KEYLEN) {
2272 0 0 if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) {
2332 0 0 if (*(ldns_buffer_at(buffer, ldns_buffer_position(buffer))) != 0) {
2333 0 0 if (!ldns_buffer_reserve(buffer, 1)) {
2337 0 0 if (!ldns_buffer_set_capacity(buffer, ldns_buffer_position(buffer))) {
2343 0 0 if(!str) {
2356 0 230 if (! ldns_buffer_reserve(buffer, 1)) {
2372 0 57 if (!tmp_buffer) {
2375 56 1 if (ldns_rdf2buffer_str(tmp_buffer, rdf) == LDNS_STATUS_OK) {
2389 0 13 if (!tmp_buffer) {
2392 13 0 if (ldns_rr2buffer_str_fmt(tmp_buffer, fmt, rr)
2413 0 0 if (!tmp_buffer) {
2416 0 0 if (ldns_pkt2buffer_str_fmt(tmp_buffer, fmt, pkt)
2438 0 0 if (!tmp_buffer) {
2441 0 0 if (ldns_key2buffer_str(tmp_buffer, k) == LDNS_STATUS_OK) {
2455 0 0 if (!tmp_buffer) {
2458 0 0 if (list) {
2464 0 0 if (fmt == NULL) {
2467 0 0 if (fmt->flags & LDNS_COMMENT_NULLS) {
2488 0 0 if (str) {
2501 0 0 if (str) {
2520 0 0 if (str) {
2539 0 0 for (i = 0; i < ldns_rr_list_rr_count(lst); i++) {
2558 0 0 if (!r) {
2583 0 0 fprintf(output, "tsig: %s %s\n",
0 0 fprintf(output, "tsig: %s %s\n",
2594 0 0 for (i = 0; i < ldns_resolver_searchlist_count(r); i++) {
2602 0 0 for (i = 0; i < ldns_resolver_nameserver_count(r); i++) {
2627 0 0 if(ldns_zone_soa(z))