diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-03-17 03:57:03 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-03-17 03:57:03 +0000 |
commit | 24ea71e942d6c4aaf6577f6fca7b4c4968a34565 (patch) | |
tree | e5ad3709e9907fe6948bb046865a0e2fd1c49962 | |
parent | 79df061031cc3f271ad5b1bd685942607d682b68 (diff) | |
download | glibc-24ea71e942d6c4aaf6577f6fca7b4c4968a34565.tar.gz glibc-24ea71e942d6c4aaf6577f6fca7b4c4968a34565.tar.xz glibc-24ea71e942d6c4aaf6577f6fca7b4c4968a34565.zip |
(_nss_nis_gethostbyname2_r): New functions. Compare result for
correct address type. (_nss_nis_gethostbyname_r): Use _nss_nis_gethostbyname2_r.
-rw-r--r-- | nis/nss_nis/nis-hosts.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c index bab7f4c5f4..42fc5aeac7 100644 --- a/nis/nss_nis/nis-hosts.c +++ b/nis/nss_nis/nis-hosts.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996. @@ -242,7 +242,7 @@ _nss_nis_gethostent_r (struct hostent *host, char *buffer, size_t buflen, } enum nss_status -_nss_nis_gethostbyname_r (const char *name, struct hostent *host, +_nss_nis_gethostbyname2_r (const char *name, int af, struct hostent *host, char *buffer, size_t buflen, int *h_errnop) { enum nss_status retval; @@ -297,9 +297,9 @@ _nss_nis_gethostbyname_r (const char *name, struct hostent *host, parse_res = parse_line (p, host, data, buflen); - if (!parse_res) + if (!parse_res || host->h_addrtype != af) { - if (errno == ERANGE) + if (!parse_res && errno == ERANGE) { *h_errnop = NETDB_INTERNAL; return NSS_STATUS_TRYAGAIN; @@ -316,6 +316,24 @@ _nss_nis_gethostbyname_r (const char *name, struct hostent *host, } enum nss_status +_nss_nis_gethostbyname_r (const char *name, struct hostent *host, + char *buffer, size_t buflen, int *h_errnop) +{ + if (_res.options & RES_USE_INET6) + { + enum nss_status status; + + status = _nss_nis_gethostbyname2_r (name, AF_INET6, host, buffer, buflen, + h_errnop); + if (status == NSS_STATUS_SUCCESS) + return status; + } + + return _nss_nis_gethostbyname2_r (name, AF_INET, host, buffer, buflen, + h_errnop); +} + +enum nss_status _nss_nis_gethostbyaddr_r (char *addr, int addrlen, int type, struct hostent *host, char *buffer, size_t buflen, int *h_errnop) |