From dfefbd12003c1938615411f7e966d22400674c49 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Wed, 7 Jan 2009 12:41:44 +0100 Subject: [PATCH] dnsapi: dns_ns_name_pton() is unused so remove it. --- dlls/dnsapi/ns_name.c | 129 ------------------------------------------ 1 file changed, 129 deletions(-) diff --git a/dlls/dnsapi/ns_name.c b/dlls/dnsapi/ns_name.c index 98225789fe1..c8e81871b12 100644 --- a/dlls/dnsapi/ns_name.c +++ b/dlls/dnsapi/ns_name.c @@ -140,135 +140,6 @@ dns_ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) { return (dn - dst); } -/* - * dns_ns_name_pton(src, dst, dstsiz) - * Convert a ascii string into an encoded domain name as per RFC1035. - * return: - * -1 if it fails - * 1 if string was fully qualified - * 0 is string was not fully qualified - * notes: - * Enforces label and domain length limits. - */ - -int -dns_ns_name_pton(const char *src, u_char *dst, size_t dstsiz) { - u_char *label, *bp, *eom; - int c, n, escaped; - char *cp; - - escaped = 0; - bp = dst; - eom = dst + dstsiz; - label = bp++; - - while ((c = *src++) != 0) { - if (escaped) { - if ((cp = strchr(digits, c)) != NULL) { - n = (cp - digits) * 100; - if ((c = *src++) == 0 || - (cp = strchr(digits, c)) == NULL) { - return (-1); - } - n += (cp - digits) * 10; - if ((c = *src++) == 0 || - (cp = strchr(digits, c)) == NULL) { - return (-1); - } - n += (cp - digits); - if (n > 255) { - return (-1); - } - c = n; - } else if (c == '[' && label == bp - 1 && *src == 'x') { - /* Theoretically we would have to handle \[o - as well but we do not since we do not need - it internally. */ - *label = 0x41; - label = bp++; - ++src; - while (isxdigit (*src)) { - n = *src > '9' ? *src - 'a' + 10 : *src - '0'; - ++src; - if (! isxdigit(*src)) { - return (-1); - } - n <<= 4; - n += *src > '9' ? *src - 'a' + 10 : *src - '0'; - if (bp + 1 >= eom) { - return (-1); - } - *bp++ = n; - ++src; - } - *label = (bp - label - 1) * 8; - if (*src++ != ']' || *src++ != '.') { - return (-1); - } - escaped = 0; - label = bp++; - if (bp >= eom) { - return (-1); - } - continue; - } - escaped = 0; - } else if (c == '\\') { - escaped = 1; - continue; - } else if (c == '.') { - c = (bp - label - 1); - if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */ - return (-1); - } - if (label >= eom) { - return (-1); - } - *label = c; - /* Fully qualified ? */ - if (*src == '\0') { - if (c != 0) { - if (bp >= eom) { - return (-1); - } - *bp++ = '\0'; - } - if ((bp - dst) > NS_MAXCDNAME) { - return (-1); - } - return (1); - } - if (c == 0 || *src == '.') { - return (-1); - } - label = bp++; - continue; - } - if (bp >= eom) { - return (-1); - } - *bp++ = (u_char)c; - } - c = (bp - label - 1); - if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */ - return (-1); - } - if (label >= eom) { - return (-1); - } - *label = c; - if (c != 0) { - if (bp >= eom) { - return (-1); - } - *bp++ = 0; - } - if ((bp - dst) > NS_MAXCDNAME) { /* src too big */ - return (-1); - } - return (0); -} - /* * dns_ns_name_unpack(msg, eom, src, dst, dstsiz)