From: Jelte Jansen Date: Wed, 17 Aug 2005 14:20:42 +0000 (+0000) Subject: fixed bug in dname reading (dnames ending in \. were botched) X-Git-Tag: release-1.0.0~274 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3da66a3c27de565f3acff886ca0513dfd8db8b24;p=thirdparty%2Fldns.git fixed bug in dname reading (dnames ending in \. were botched) --- diff --git a/dname.c b/dname.c index b20b3763..8b310dc6 100644 --- a/dname.c +++ b/dname.c @@ -215,7 +215,8 @@ ldns_dname_str_absolute(const char *dname_str) { return (dname_str && strlen(dname_str) > 1 && - dname_str[strlen(dname_str) - 1] == '.' + dname_str[strlen(dname_str) - 1] == '.' && + dname_str[strlen(dname_str) - 2] != '\\' ); } diff --git a/dnssec.c b/dnssec.c index cb218374..57dc2098 100644 --- a/dnssec.c +++ b/dnssec.c @@ -1461,6 +1461,9 @@ ldns_zone_sign(ldns_zone *zone, ldns_key_list *key_list) cur_rrsigs = ldns_sign_public(cur_rrset, key_list); ldns_zone_push_rr_list(signed_zone, cur_rrset); ldns_zone_push_rr_list(signed_zone, cur_rrsigs); + } else { + /* push it unsigned? */ + ldns_zone_push_rr_list(signed_zone, cur_rrset); } cur_rrset = ldns_rr_list_pop_rrset(signed_zone_rrs); } diff --git a/str2host.c b/str2host.c index 87bd269f..fae29302 100644 --- a/str2host.c +++ b/str2host.c @@ -203,7 +203,8 @@ ldns_str2rdf_dname(ldns_rdf **d, const char *str) break; case '\\': /* octet value or literal char */ - if (isdigit((int) s[1]) && + if (strlen((char *)s) > 3 && + isdigit((int) s[1]) && isdigit((int) s[2]) && isdigit((int) s[3])) { /* cast this so it fits */ @@ -225,7 +226,7 @@ ldns_str2rdf_dname(ldns_rdf **d, const char *str) } /* add root label if last char was not '.' */ - if (str[strlen(str)-1] != '.') { + if (!ldns_dname_str_absolute(str)) { len += label_len + 1; *pq = label_len; *q = 0; @@ -234,7 +235,7 @@ ldns_str2rdf_dname(ldns_rdf **d, const char *str) /* s - buf_str works because no magic is done in the above for-loop */ *d = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, len, buf); - + return LDNS_STATUS_OK; }