From: Miek Gieben Date: Thu, 20 Jan 2005 15:24:03 +0000 (+0000) Subject: str/txt conversion added X-Git-Tag: release-0.50~544 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=216994f43f52ae2d95c1a6c71f176fbeb911855d;p=thirdparty%2Fldns.git str/txt conversion added --- diff --git a/ldns/error.h b/ldns/error.h index 2baa8996..1dfaf266 100644 --- a/ldns/error.h +++ b/ldns/error.h @@ -27,7 +27,8 @@ enum ldns_enum_status LDNS_STATUS_ERR, LDNS_STATUS_INT_EXP, LDNS_STATUS_INVALID_IP4, - LDNS_STATUS_INVALID_IP6 + LDNS_STATUS_INVALID_IP6, + LDNS_STATUS_INVALID_STR }; typedef enum ldns_enum_status ldns_status; diff --git a/libdns.vim b/libdns.vim index 94c6825f..a418c78c 100644 --- a/libdns.vim +++ b/libdns.vim @@ -61,6 +61,7 @@ syn keyword ldnsMacro LDNS_STATUS_INT_EXP syn keyword ldnsMacro LDNS_STATUS_ERR syn keyword ldnsMacro LDNS_STATUS_INVALID_IP4 syn keyword ldnsMacro LDNS_STATUS_INVALID_IP6 +syn keyword ldnsMacro LDNS_STATUS_INVALID_STR " ldns/resolver.h syn keyword ldnsType ldns_resolver diff --git a/str2host.c b/str2host.c index a3fc6414..ac6a708b 100644 --- a/str2host.c +++ b/str2host.c @@ -185,14 +185,18 @@ ldns_str2rdf_aaaa(ldns_rdf **rd, const uint8_t* str) } /** - * convert .... into wireformat + * convert a string into wireformat (think txt record) * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted + * \param[in] str the string to be converted (NULL terminated) * \return ldns_status */ ldns_status ldns_str2rdf_str(ldns_rdf **rd, const uint8_t* str) { + if (strlen(str) > 255) { + return LDNS_STATUS_INVALID_STR; + } + ldns_rdf_new(strlen(str), LDNS_RDF_TYPE_STR, str); return LDNS_STATUS_OK; }