From: Jelte Jansen Date: Wed, 9 Jan 2008 15:26:29 +0000 (+0000) Subject: fix in makefile (copy manpages from srcdir not builddir) X-Git-Tag: release-1.3.0~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e254cac159ea3e6e21a2c2fe8fd361dce3150f7;p=thirdparty%2Fldns.git fix in makefile (copy manpages from srcdir not builddir) fixed parsing of \# data for known rr types with multiple rdata fields --- diff --git a/examples/Makefile.in b/examples/Makefile.in index 7b567f83..cf6c61c9 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -104,7 +104,7 @@ install: $(PROGRAMS) $(INSTALL) -d -m 755 $(DESTDIR)$(mandir)/man1 for i in $(PROGRAMS); do \ $(libtool) --tag=CC --mode=install ${INSTALL} -c $$i $(DESTDIR)$(bindir) ; \ - $(INSTALL) -c -m 644 $$i.1 $(DESTDIR)$(mandir)/man1/$$i.1 ; \ + $(INSTALL) -c -m 644 ($srcdir)/$$i.1 $(DESTDIR)$(mandir)/man1/$$i.1 ; \ done exit 0 diff --git a/rr.c b/rr.c index bb355aea..e158bd95 100644 --- a/rr.c +++ b/rr.c @@ -128,6 +128,8 @@ ldns_rr_new_frm_str(ldns_rr **newrr, const char *str, uint32_t default_ttl, ldns uint16_t hex_data_size; char *hex_data_str; uint16_t cur_hex_data_size; + uint8_t *hex_data; + size_t hex_pos; new = ldns_rr_new(); @@ -398,19 +400,27 @@ ldns_rr_new_frm_str(ldns_rr **newrr, const char *str, uint32_t default_ttl, ldns cur_hex_data_size = 0; while(cur_hex_data_size < 2 * hex_data_size) { c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); + rd_strlen = strlen(rd); strncpy(hex_data_str + cur_hex_data_size, rd, rd_strlen); cur_hex_data_size += rd_strlen; } hex_data_str[cur_hex_data_size] = '\0'; - r = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_HEX, hex_data_str); + /* correct the rdf type */ + /* if *we* know the type, interpret it as wireformat */ if (desc) { - ldns_rdf_set_type(r, ldns_rr_descriptor_field_type(desc, r_cnt)); + hex_data = LDNS_XMALLOC(uint8_t, hex_data_size + 2); + ldns_write_uint16(hex_data, hex_data_size); + ldns_hexstring_to_data(hex_data + 2, hex_data_str); + hex_pos = 0; + ldns_wire2rdf(new, hex_data, hex_data_size+2, &hex_pos); + LDNS_FREE(hex_data); } else { + r = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_HEX, hex_data_str); ldns_rdf_set_type(r, LDNS_RDF_TYPE_UNKNOWN); + ldns_rr_push_rdf(new, r); } LDNS_FREE(hex_data_str); - ldns_rr_push_rdf(new, r); } else { /* Normal RR */ switch(ldns_rr_descriptor_field_type(desc, r_cnt)) { diff --git a/str2host.c b/str2host.c index 714a288f..33c9acbd 100644 --- a/str2host.c +++ b/str2host.c @@ -701,6 +701,7 @@ ldns_str2rdf_unknown(ldns_rdf **rd, const char *str) { /* this should be caught in an earlier time (general str2host for rr's */ + printf("[XX] ERROR!\n"); rd = rd; str = str; return LDNS_STATUS_NOT_IMPL; diff --git a/util.c b/util.c index cafd4ddc..25f24aac 100644 --- a/util.c +++ b/util.c @@ -166,6 +166,28 @@ ldns_int_to_hexdigit(int i) } } +int +ldns_hexstring_to_data(uint8_t *data, const char *str) +{ + int i; + + if (!str || !data) { + return -1; + } + + if (strlen(str) % 2 != 0) { + return -2; + } + + for (i = 0; i < strlen(str) / 2; i++) { + data[i] = + 16 * ldns_hexdigit_to_int(str[i*2]) + + ldns_hexdigit_to_int(str[i*2 + 1]); + } + + return i; +} + const char * ldns_version(void) {