about summary refs log tree commit diff
path: root/nis/nss_nis
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_nis')
-rw-r--r--nis/nss_nis/nis-alias.c16
-rw-r--r--nis/nss_nis/nis-ethers.c34
-rw-r--r--nis/nss_nis/nis-grp.c32
-rw-r--r--nis/nss_nis/nis-hosts.c2
-rw-r--r--nis/nss_nis/nis-network.c4
-rw-r--r--nis/nss_nis/nis-proto.c32
-rw-r--r--nis/nss_nis/nis-publickey.c4
-rw-r--r--nis/nss_nis/nis-pwd.c2
-rw-r--r--nis/nss_nis/nis-rpc.c2
-rw-r--r--nis/nss_nis/nis-service.c5
-rw-r--r--nis/nss_nis/nis-spwd.c17
11 files changed, 79 insertions, 71 deletions
diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c
index 0d0294082d..6ef23012b8 100644
--- a/nis/nss_nis/nis-alias.c
+++ b/nis/nss_nis/nis-alias.c
@@ -231,7 +231,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
 
   if (name == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
@@ -262,11 +262,13 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
 
   alias->alias_local = 0;
   parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, buflen, errnop);
-  if (parse_res == -1)
-    return NSS_STATUS_TRYAGAIN;
+  if (parse_res < 1)
+    {
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+      else
+	return NSS_STATUS_NOTFOUND;
+    }
 
-  if (parse_res)
-    return NSS_STATUS_SUCCESS;
-  else
-    return NSS_STATUS_NOTFOUND;
+  return NSS_STATUS_SUCCESS;
 }
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c
index cbc37591ee..a5723747fc 100644
--- a/nis/nss_nis/nis-ethers.c
+++ b/nis/nss_nis/nis-ethers.c
@@ -200,7 +200,7 @@ _nss_nis_gethostton_r (const char *name, struct ether *eth,
 
   if (name == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
@@ -231,13 +231,14 @@ _nss_nis_gethostton_r (const char *name, struct ether *eth,
   free (result);
 
   parse_res = _nss_files_parse_etherent (p, eth, data, buflen, errnop);
-  if (parse_res == -1)
-    return NSS_STATUS_TRYAGAIN;
-
-  if (!parse_res)
-    return NSS_STATUS_NOTFOUND;
-  else
-    return NSS_STATUS_SUCCESS;
+  if (parse_res < 1)
+    {
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+      else
+	return NSS_STATUS_NOTFOUND;
+    }
+  return NSS_STATUS_SUCCESS;
 }
 
 enum nss_status
@@ -252,7 +253,7 @@ _nss_nis_getntohost_r (struct ether_addr *addr, struct ether *eth,
 
   if (addr == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
@@ -291,11 +292,12 @@ _nss_nis_getntohost_r (struct ether_addr *addr, struct ether *eth,
   free (result);
 
   parse_res = _nss_files_parse_etherent (p, eth, data, buflen, errnop);
-  if (parse_res == -1)
-    return NSS_STATUS_TRYAGAIN;
-
-  if (!parse_res)
-    return NSS_STATUS_NOTFOUND;
-  else
-    return NSS_STATUS_SUCCESS;
+  if (parse_res < 1)
+    {
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+      else
+	return NSS_STATUS_NOTFOUND;
+    }
+  return NSS_STATUS_SUCCESS;
 }
diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c
index 98cc4fd878..40d45825e4 100644
--- a/nis/nss_nis/nis-grp.c
+++ b/nis/nss_nis/nis-grp.c
@@ -166,7 +166,7 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
 
   if (name == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
@@ -197,13 +197,14 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
   free (result);
 
   parse_res = _nss_files_parse_grent (p, grp, data, buflen, errnop);
-  if (parse_res == -1)
-    return NSS_STATUS_TRYAGAIN;
-
-  if (parse_res)
-    return NSS_STATUS_SUCCESS;
-  else
-    return NSS_STATUS_NOTFOUND;
+  if (parse_res < 1)
+    {
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+      else
+	return NSS_STATUS_NOTFOUND;
+    }
+  return NSS_STATUS_SUCCESS;
 }
 
 enum nss_status
@@ -245,11 +246,12 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
   free (result);
 
   parse_res = _nss_files_parse_grent (p, grp, data, buflen, errnop);
-  if (parse_res == -1)
-    return NSS_STATUS_TRYAGAIN;
-
-  if (parse_res)
-    return NSS_STATUS_SUCCESS;
-  else
-    return NSS_STATUS_NOTFOUND;
+  if (parse_res < 1)
+    {
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+      else
+	return NSS_STATUS_NOTFOUND;
+    }
+  return NSS_STATUS_SUCCESS;
 }
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
index e627d24399..c9d355171a 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -246,7 +246,7 @@ _nss_nis_gethostbyname2_r (const char *name, int af, struct hostent *host,
 
   if (name == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c
index 4fcf729b34..93cff5ce93 100644
--- a/nis/nss_nis/nis-network.c
+++ b/nis/nss_nis/nis-network.c
@@ -115,7 +115,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
       if ((size_t) (len + 1) > buflen)
         {
           free (result);
-          __set_errno (ERANGE);
+	  *errnop = ERANGE;
 	  *herrnop = NETDB_INTERNAL;
           return NSS_STATUS_TRYAGAIN;
         }
@@ -171,7 +171,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
 
   if (name == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       *herrnop = NETDB_INTERNAL;
       return NSS_STATUS_UNAVAIL;
     }
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index a6f57fde98..3af0f4e896 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -192,7 +192,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
 
   if (name == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
@@ -223,13 +223,14 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
   free (result);
 
   parse_res = _nss_files_parse_protoent (p, proto, data, buflen, errnop);
-  if (parse_res == -1)
-    return NSS_STATUS_TRYAGAIN;
-
-  if (parse_res)
-    return NSS_STATUS_SUCCESS;
-  else
-    return NSS_STATUS_NOTFOUND;
+  if (parse_res < 1)
+    {
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+      else
+	return NSS_STATUS_NOTFOUND;
+    }
+  return NSS_STATUS_SUCCESS;
 }
 
 enum nss_status
@@ -271,11 +272,12 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
   free (result);
 
   parse_res = _nss_files_parse_protoent (p, proto, data, buflen, errnop);
-  if (parse_res == -1)
-    return NSS_STATUS_TRYAGAIN;
-
-  if (parse_res)
-    return NSS_STATUS_SUCCESS;
-  else
-    return NSS_STATUS_NOTFOUND;
+  if (parse_res < 1)
+    {
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+      else
+	return NSS_STATUS_NOTFOUND;
+    }
+  return NSS_STATUS_SUCCESS;
 }
diff --git a/nis/nss_nis/nis-publickey.c b/nis/nss_nis/nis-publickey.c
index 1c485d9d23..1ab041f435 100644
--- a/nis/nss_nis/nis-publickey.c
+++ b/nis/nss_nis/nis-publickey.c
@@ -42,7 +42,7 @@ _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop)
 
   if (netname == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
@@ -84,7 +84,7 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
 
   if (netname == NULL || passwd == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c
index 8924886e1e..296526d7e6 100644
--- a/nis/nss_nis/nis-pwd.c
+++ b/nis/nss_nis/nis-pwd.c
@@ -166,7 +166,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
 
   if (name == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c
index 3be99496e4..879e90af6d 100644
--- a/nis/nss_nis/nis-rpc.c
+++ b/nis/nss_nis/nis-rpc.c
@@ -207,7 +207,7 @@ _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc,
 
   if (name == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c
index 0aa35cc34b..dfae9f7be2 100644
--- a/nis/nss_nis/nis-service.c
+++ b/nis/nss_nis/nis-service.c
@@ -34,7 +34,6 @@ extern int _nss_files_parse_servent (char *line, struct servent *result,
 				     char *data, size_t datalen, int *errnop);
 
 
-
 __libc_lock_define_initialized (static, lock)
 
 struct response_t
@@ -208,7 +207,7 @@ _nss_nis_getservbyname_r (const char *name, char *protocol,
 
   if (name == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
@@ -252,7 +251,7 @@ _nss_nis_getservbyport_r (int port, char *protocol, struct servent *serv,
 
   if (protocol == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c
index 5be010d433..452f91dc0b 100644
--- a/nis/nss_nis/nis-spwd.c
+++ b/nis/nss_nis/nis-spwd.c
@@ -166,7 +166,7 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
 
   if (name == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
@@ -197,11 +197,12 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
   free (result);
 
   parse_res = _nss_files_parse_spent (p, sp, data, buflen, errnop);
-  if (parse_res == -1)
-    return NSS_STATUS_TRYAGAIN;
-
-  if (parse_res)
-    return NSS_STATUS_SUCCESS;
-  else
-    return NSS_STATUS_NOTFOUND;
+  if (parse_res < 1)
+    {
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+      else
+	return NSS_STATUS_NOTFOUND;
+    }
+  return NSS_STATUS_SUCCESS;
 }