diff options
Diffstat (limited to 'resolv/nss_dns/dns-host.c')
-rw-r--r-- | resolv/nss_dns/dns-host.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index 1df7c23beb..fc00fe7796 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -143,7 +143,7 @@ _nss_dns_gethostbyname2_r (const char *name, int af, struct hostent *result, type = T_AAAA; break; default: - *h_errnop = NETDB_INTERNAL; + *h_errnop = NO_DATA; *errnop = EAFNOSUPPORT; return NSS_STATUS_UNAVAIL; } @@ -191,6 +191,14 @@ _nss_dns_gethostbyname_r (const char *name, struct hostent *result, enum nss_status +_nss_dns_getipnodebyname (const char *name, int af, struct hostent *result, + char *buffer, size_t buflen, int *errnop, + int *h_errnop) +{ +} + + +enum nss_status _nss_dns_gethostbyaddr_r (const char *addr, size_t len, int af, struct hostent *result, char *buffer, size_t buflen, int *errnop, int *h_errnop) @@ -419,11 +427,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1) { if (errno == EMSGSIZE) - { - *errnop = ERANGE; - *h_errnop = NETDB_INTERNAL; - return NSS_STATUS_TRYAGAIN; - } + goto too_small; n = -1; } @@ -470,7 +474,9 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, linebuflen -= n; /* Get canonical name. */ n = strlen (tbuf) + 1; /* For the \0. */ - if ((size_t) n > buflen || n >= MAXHOSTNAMELEN) + if (n > linebuflen) + goto too_small; + if (n >= MAXHOSTNAMELEN) { ++had_error; continue; @@ -492,7 +498,9 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, cp += n; /* Get canonical name. */ n = strlen (tbuf) + 1; /* For the \0. */ - if ((size_t) n > buflen || n >= MAXHOSTNAMELEN) + if (n > linebuflen) + goto too_small; + if (n >= MAXHOSTNAMELEN) { ++had_error; continue; @@ -536,11 +544,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1) { if (errno == EMSGSIZE) - { - *errnop = ERANGE; - *h_errnop = NETDB_INTERNAL; - return NSS_STATUS_TRYAGAIN; - } + goto too_small; n = -1; } @@ -613,11 +617,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, linebuflen -= sizeof (align) - ((u_long) bp % sizeof (align)); bp += sizeof (align) - ((u_long) bp % sizeof (align)); - if (n >= linebuflen) - { - ++had_error; - continue; - } + if (n > linebuflen) + goto too_small; if (hap >= &host_data->h_addr_ptrs[MAX_NR_ADDRS-1]) { cp += n; @@ -652,11 +653,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, { n = strlen (qname) + 1; /* For the \0. */ if (n > linebuflen) - { - *errnop = ERANGE; - *h_errnop = NETDB_INTERNAL; - return NSS_STATUS_TRYAGAIN; - } + goto too_small; if (n >= MAXHOSTNAMELEN) goto no_recovery; result->h_name = bp; |