nsswitch: Also set h_errnop for nss_wins functions
authorAndreas Schneider <asn@samba.org>
Tue, 20 Sep 2016 11:26:52 +0000 (13:26 +0200)
committerJim McDonough <jmcd@samba.org>
Tue, 20 Sep 2016 18:16:43 +0000 (20:16 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12269

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
Autobuild-User(master): Jim McDonough <jmcd@samba.org>
Autobuild-Date(master): Tue Sep 20 20:16:43 CEST 2016 on sn-devel-144

nsswitch/wins.c

index be84f2e..dccb6dd 100644 (file)
@@ -261,6 +261,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
        ip = lookup_byname_backend(name);
        if (ip == NULL) {
                *errnop = EINVAL;
+               *h_errnop = NETDB_INTERNAL;
                nss_status = NSS_STATUS_NOTFOUND;
                goto out;
        }
@@ -269,6 +270,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
        wbcFreeMemory(ip);
        if (rc == 0) {
                *errnop = errno;
+               *h_errnop = NETDB_INTERNAL;
                nss_status = NSS_STATUS_TRYAGAIN;
                goto out;
        }
@@ -279,6 +281,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
 
        if ((he->h_name = get_static(&buffer, &buflen, namelen)) == NULL) {
                *errnop = EAGAIN;
+               *h_errnop = NETDB_INTERNAL;
                nss_status = NSS_STATUS_TRYAGAIN;
                goto out;
        }
@@ -292,6 +295,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
 
        if (get_static(&buffer, &buflen, i) == NULL) {
                *errnop = EAGAIN;
+               *h_errnop = NETDB_INTERNAL;
                nss_status = NSS_STATUS_TRYAGAIN;
                goto out;
        }
@@ -299,6 +303,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
        if ((he->h_addr_list = (char **)get_static(
                     &buffer, &buflen, 2 * sizeof(char *))) == NULL) {
                *errnop = EAGAIN;
+               *h_errnop = NETDB_INTERNAL;
                nss_status = NSS_STATUS_TRYAGAIN;
                goto out;
        }
@@ -306,6 +311,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
        if ((he->h_addr_list[0] = get_static(&buffer, &buflen,
                                             INADDRSZ)) == NULL) {
                *errnop = EAGAIN;
+               *h_errnop = NETDB_INTERNAL;
                nss_status = NSS_STATUS_TRYAGAIN;
                goto out;
        }
@@ -326,6 +332,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
 
        if (get_static(&buffer, &buflen, i) == NULL) {
                *errnop = EAGAIN;
+               *h_errnop = NETDB_INTERNAL;
                nss_status = NSS_STATUS_TRYAGAIN;
                goto out;
        }
@@ -333,12 +340,14 @@ _nss_wins_gethostbyname_r(const char *hostname,
        if ((he->h_aliases = (char **)get_static(
                     &buffer, &buflen, sizeof(char *))) == NULL) {
                *errnop = EAGAIN;
+               *h_errnop = NETDB_INTERNAL;
                nss_status = NSS_STATUS_TRYAGAIN;
                goto out;
        }
 
        he->h_aliases[0] = NULL;
 
+       *h_errnop = NETDB_SUCCESS;
        nss_status = NSS_STATUS_SUCCESS;
 
   out: