dnsapi: dns_ns_name_pton() is unused so remove it.

This commit is contained in:
Francois Gouget 2009-01-07 12:41:44 +01:00 committed by Alexandre Julliard
parent cbe5d8e494
commit dfefbd1200
1 changed files with 0 additions and 129 deletions

View File

@ -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)