summary refs log tree commit diff
path: root/nis/nss_compat/compat-spwd.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-07-06 21:06:29 +0000
committerUlrich Drepper <drepper@redhat.com>2005-07-06 21:06:29 +0000
commit016c70ea61aa2a896c7862b70e1cf4e705ba21af (patch)
treefe6ed3992d1f3557de2a219c7ed57d78e790d157 /nis/nss_compat/compat-spwd.c
parentec73fd87dacd5815ee71c9b81d426608151418f8 (diff)
downloadglibc-016c70ea61aa2a896c7862b70e1cf4e705ba21af.tar.gz
glibc-016c70ea61aa2a896c7862b70e1cf4e705ba21af.tar.xz
glibc-016c70ea61aa2a896c7862b70e1cf4e705ba21af.zip
* nis/nss_compat/compat-grp.c (internal_getgrgid_r): Check if NSS
	module provides getgrgid_r.
	(getgrnam_plusgroup): Preserve original return value.
	* nis/nss_compat/compat-pwd.c (getpwnam_plususer): Preserve
	original return value.
	* nis/nss_compat/compat-spwd.c (getspnam_plususer): Likewise.
Diffstat (limited to 'nis/nss_compat/compat-spwd.c')
-rw-r--r--nis/nss_compat/compat-spwd.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index 4ca6368139..120e3bd38d 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999,2001-2004,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -401,13 +401,10 @@ static enum nss_status
 getspnam_plususer (const char *name, struct spwd *result, ent_t *ent,
 		   char *buffer, size_t buflen, int *errnop)
 {
-  struct spwd pwd;
-  char *p;
-  size_t plen;
-
   if (!nss_getspnam_r)
     return NSS_STATUS_UNAVAIL;
 
+  struct spwd pwd;
   memset (&pwd, '\0', sizeof (struct spwd));
   pwd.sp_warn = -1;
   pwd.sp_inact = -1;
@@ -416,18 +413,19 @@ getspnam_plususer (const char *name, struct spwd *result, ent_t *ent,
 
   copy_spwd_changes (&pwd, result, NULL, 0);
 
-  plen = spwd_need_buflen (&pwd);
+  size_t plen = spwd_need_buflen (&pwd);
   if (plen > buflen)
     {
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
-  p = buffer + (buflen - plen);
+  char *p = buffer + (buflen - plen);
   buflen -= plen;
 
-  if (nss_getspnam_r (name, result, buffer, buflen, errnop) !=
-      NSS_STATUS_SUCCESS)
-    return NSS_STATUS_NOTFOUND;
+  enum nss_status status = nss_getspnam_r (name, result, buffer, buflen,
+					   errnop);
+  if (status != NSS_STATUS_SUCCESS)
+    return status;
 
   if (in_blacklist (result->sp_namp, strlen (result->sp_namp), ent))
     return NSS_STATUS_NOTFOUND;