about summary refs log tree commit diff
path: root/nis/nss_nisplus/nisplus-pwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_nisplus/nisplus-pwd.c')
-rw-r--r--nis/nss_nisplus/nisplus-pwd.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/nis/nss_nisplus/nisplus-pwd.c b/nis/nss_nisplus/nisplus-pwd.c
index 18114ad7e5..45c364ac39 100644
--- a/nis/nss_nisplus/nisplus-pwd.c
+++ b/nis/nss_nisplus/nisplus-pwd.c
@@ -179,8 +179,11 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw,
 	return status;
     }
 
-  if (name == NULL || strlen (name) > 8)
-    return NSS_STATUS_NOTFOUND;
+  if (name == NULL)
+    {
+      *errnop = EINVAL;
+      return NSS_STATUS_UNAVAIL;
+    }
   else
     {
       nis_result *result;
@@ -203,16 +206,17 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw,
 
       nis_freeresult (result);
 
-      if (parse_res == -1)
+      if (parse_res < 1)
 	{
-	  *errnop = ERANGE;
-	  return NSS_STATUS_TRYAGAIN;
+	  if (parse_res == -1)
+	    {
+	      *errnop = ERANGE;
+	      return NSS_STATUS_TRYAGAIN;
+	    }
+	  else
+	    return NSS_STATUS_NOTFOUND;
 	}
-
-      if (parse_res)
-	return NSS_STATUS_SUCCESS;
-
-      return NSS_STATUS_NOTFOUND;
+      return NSS_STATUS_SUCCESS;
     }
 }
 
@@ -249,15 +253,16 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw,
 
     nis_freeresult (result);
 
-    if (parse_res == -1)
+    if (parse_res < 1)
       {
-	*errnop = ERANGE;
-	return NSS_STATUS_TRYAGAIN;
+	if (parse_res == -1)
+	  {
+	    *errnop = ERANGE;
+	    return NSS_STATUS_TRYAGAIN;
+	  }
+	else
+	  return NSS_STATUS_NOTFOUND;
       }
-
-    if (parse_res)
-      return NSS_STATUS_SUCCESS;
-
-    return NSS_STATUS_NOTFOUND;
+    return NSS_STATUS_SUCCESS;
   }
 }