diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs6dns/deps-lib/s6dns | 1 | ||||
-rw-r--r-- | src/libs6dns/s6dns_message_get_domain_nodecode.c | 2 | ||||
-rw-r--r-- | src/libs6dns/s6dns_message_parse_question.c | 21 | ||||
-rw-r--r-- | src/libs6dns/s6dns_message_parse_question_nodecode.c | 28 |
4 files changed, 20 insertions, 32 deletions
diff --git a/src/libs6dns/deps-lib/s6dns b/src/libs6dns/deps-lib/s6dns index 818e913..266b574 100644 --- a/src/libs6dns/deps-lib/s6dns +++ b/src/libs6dns/deps-lib/s6dns @@ -84,7 +84,6 @@ s6dns_message_parse_getrr.o s6dns_message_parse_init.o s6dns_message_parse_next.o s6dns_message_parse_question.o -s6dns_message_parse_question_nodecode.o s6dns_message_parse_skipqd.o s6dns_rci_free.o s6dns_rci_here.o diff --git a/src/libs6dns/s6dns_message_get_domain_nodecode.c b/src/libs6dns/s6dns_message_get_domain_nodecode.c index d3678db..9774527 100644 --- a/src/libs6dns/s6dns_message_get_domain_nodecode.c +++ b/src/libs6dns/s6dns_message_get_domain_nodecode.c @@ -4,7 +4,6 @@ #include <errno.h> #include <skalibs/posixishard.h> -#include <skalibs/bytestr.h> #include <s6-dns/s6dns-message.h> @@ -46,6 +45,5 @@ size_t s6dns_message_get_domain_nodecode (char *out, size_t outmax, char const * } else return (errno = EPROTONOSUPPORT, 0) ; /* unsupported extension */ } - case_lowerb(out, w) ; return w ; } diff --git a/src/libs6dns/s6dns_message_parse_question.c b/src/libs6dns/s6dns_message_parse_question.c index 484774c..f5b56ce 100644 --- a/src/libs6dns/s6dns_message_parse_question.c +++ b/src/libs6dns/s6dns_message_parse_question.c @@ -1,9 +1,28 @@ /* ISC license. */ +#include <stdint.h> +#include <errno.h> + +#include <skalibs/posixishard.h> +#include <skalibs/uint16.h> + +#include <s6-dns/s6dns-constants.h> #include <s6-dns/s6dns-domain.h> #include <s6-dns/s6dns-message.h> int s6dns_message_parse_question (s6dns_message_counts_t *counts, s6dns_domain_t *name, uint16_t *qtypep, char const *packet, unsigned int packetlen, unsigned int *pos) { - return s6dns_message_parse_question_nodecode(counts, name, qtypep, packet, packetlen, pos) && s6dns_domain_decode(name) ; + s6dns_domain_t d ; + uint16_t qtype ; + uint16_t qclass ; + if (!counts->qd) return (errno = EINVAL, 0) ; + if (!s6dns_message_get_domain(&d, packet, packetlen, pos)) return 0 ; + if (*pos + 4 > packetlen) return (errno = EPROTO, 0) ; + uint16_unpack_big(packet + *pos, &qtype) ; *pos += 2 ; + uint16_unpack_big(packet + *pos, &qclass) ; *pos += 2 ; + if (qclass != S6DNS_C_IN) return (errno = ENOTSUP, 0) ; + counts->qd-- ; + *name = d ; + *qtypep = qtype ; + return 1 ; } diff --git a/src/libs6dns/s6dns_message_parse_question_nodecode.c b/src/libs6dns/s6dns_message_parse_question_nodecode.c deleted file mode 100644 index 46ad4ff..0000000 --- a/src/libs6dns/s6dns_message_parse_question_nodecode.c +++ /dev/null @@ -1,28 +0,0 @@ -/* ISC license. */ - -#include <stdint.h> -#include <errno.h> - -#include <skalibs/posixishard.h> -#include <skalibs/uint16.h> - -#include <s6-dns/s6dns-constants.h> -#include <s6-dns/s6dns-domain.h> -#include <s6-dns/s6dns-message.h> - -int s6dns_message_parse_question_nodecode (s6dns_message_counts_t *counts, s6dns_domain_t *name, uint16_t *qtypep, char const *packet, unsigned int packetlen, unsigned int *pos) -{ - s6dns_domain_t d ; - uint16_t qtype ; - uint16_t qclass ; - if (!counts->qd) return (errno = EINVAL, 0) ; - if (!s6dns_message_get_domain_nodecode(d.s, 255, packet, packetlen, pos)) return 0 ; - if (*pos + 4 > packetlen) return (errno = EPROTO, 0) ; - uint16_unpack_big(packet + *pos, &qtype) ; *pos += 2 ; - uint16_unpack_big(packet + *pos, &qclass) ; *pos += 2 ; - if (qclass != S6DNS_C_IN) return (errno = ENOTSUP, 0) ; - counts->qd-- ; - *name = d ; - *qtypep = qtype ; - return 1 ; -} |