about summary refs log tree commit diff
path: root/nis/nss_compat
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /nis/nss_compat
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
downloadglibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz
glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.xz
glibc-a334319f6530564d22e775935d9c91663623a1b4.zip
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'nis/nss_compat')
-rw-r--r--nis/nss_compat/compat-grp.c48
-rw-r--r--nis/nss_compat/compat-initgroups.c6
-rw-r--r--nis/nss_compat/compat-pwd.c83
-rw-r--r--nis/nss_compat/compat-spwd.c73
4 files changed, 93 insertions, 117 deletions
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c
index 236c84a20f..08bf5d2f80 100644
--- a/nis/nss_compat/compat-grp.c
+++ b/nis/nss_compat/compat-grp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001-2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999,2001,2002,2003,2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -59,13 +59,12 @@ struct blacklist_t
 struct ent_t
 {
   bool_t files;
-  enum nss_status setent_status;
   FILE *stream;
   struct blacklist_t blacklist;
 };
 typedef struct ent_t ent_t;
 
-static ent_t ext_ent = { TRUE, NSS_STATUS_SUCCESS, NULL, { NULL, 0, 0 }};
+static ent_t ext_ent = {TRUE, NULL, {NULL, 0, 0}};
 
 /* Protect global state against multiple changers.  */
 __libc_lock_define_initialized (static, lock)
@@ -90,7 +89,7 @@ init_nss_interface (void)
 }
 
 static enum nss_status
-internal_setgrent (ent_t *ent, int stayopen, int needent)
+internal_setgrent (ent_t *ent, int stayopen)
 {
   enum nss_status status = NSS_STATUS_SUCCESS;
 
@@ -138,8 +137,8 @@ internal_setgrent (ent_t *ent, int stayopen, int needent)
   else
     rewind (ent->stream);
 
-  if (needent && status == NSS_STATUS_SUCCESS && nss_setgrent)
-    ent->setent_status = nss_setgrent (stayopen);
+  if (status == NSS_STATUS_SUCCESS && nss_setgrent)
+    return nss_setgrent (stayopen);
 
   return status;
 }
@@ -155,7 +154,7 @@ _nss_compat_setgrent (int stayopen)
   if (ni == NULL)
     init_nss_interface ();
 
-  result = internal_setgrent (&ext_ent, stayopen, 1);
+  result = internal_setgrent (&ext_ent, stayopen);
 
   __libc_lock_unlock (lock);
 
@@ -209,10 +208,6 @@ getgrent_next_nss (struct group *result, ent_t *ent, char *buffer,
   if (!nss_getgrent_r)
     return NSS_STATUS_UNAVAIL;
 
-  /* If the setgrent call failed, say so.  */
-  if (ent->setent_status != NSS_STATUS_SUCCESS)
-    return ent->setent_status;
-
   do
     {
       enum nss_status status;
@@ -234,10 +229,9 @@ getgrnam_plusgroup (const char *name, struct group *result, ent_t *ent,
   if (!nss_getgrnam_r)
     return NSS_STATUS_UNAVAIL;
 
-  enum nss_status status = nss_getgrnam_r (name, result, buffer, buflen,
-					   errnop);
-  if (status != NSS_STATUS_SUCCESS)
-    return status;
+  if (nss_getgrnam_r (name, result, buffer, buflen, errnop) !=
+      NSS_STATUS_SUCCESS)
+    return NSS_STATUS_NOTFOUND;
 
   if (in_blacklist (result->gr_name, strlen (result->gr_name), ent))
     return NSS_STATUS_NOTFOUND;
@@ -364,7 +358,7 @@ _nss_compat_getgrent_r (struct group *grp, char *buffer, size_t buflen,
     init_nss_interface ();
 
   if (ext_ent.stream == NULL)
-    result = internal_setgrent (&ext_ent, 1, 1);
+    result = internal_setgrent (&ext_ent, 1);
 
   if (result == NSS_STATUS_SUCCESS)
     {
@@ -486,7 +480,7 @@ enum nss_status
 _nss_compat_getgrnam_r (const char *name, struct group *grp,
 			char *buffer, size_t buflen, int *errnop)
 {
-  ent_t ent = { TRUE, NSS_STATUS_SUCCESS, NULL, { NULL, 0, 0 }};
+  ent_t ent = {TRUE, NULL, {NULL, 0, 0}};
   enum nss_status result;
 
   if (name[0] == '-' || name[0] == '+')
@@ -499,7 +493,7 @@ _nss_compat_getgrnam_r (const char *name, struct group *grp,
 
   __libc_lock_unlock (lock);
 
-  result = internal_setgrent (&ent, 0, 0);
+  result = internal_setgrent (&ent, 0);
 
   if (result == NSS_STATUS_SUCCESS)
     result = internal_getgrnam_r (name, grp, &ent, buffer, buflen, errnop);
@@ -557,7 +551,7 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
 	     !(parse_res = _nss_files_parse_grent (p, result, data, buflen,
 						   errnop)));
 
-      if (__builtin_expect (parse_res == -1, 0))
+      if (parse_res == -1)
 	/* The parser ran out of space.  */
 	goto erange_reset;
 
@@ -580,17 +574,13 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
       /* +group */
       if (result->gr_name[0] == '+' && result->gr_name[1] != '\0')
 	{
-	  /* Yes, no +1, see the memcpy call below.  */
-	  size_t len = strlen (result->gr_name);
-	  char buf[len];
 	  enum nss_status status;
 
 	  /* Store the group in the blacklist for the "+" at the end of
 	     /etc/group */
-	  memcpy (buf, &result->gr_name[1], len);
+	  blacklist_store_name (&result->gr_name[1], ent);
 	  status = getgrnam_plusgroup (&result->gr_name[1], result, ent,
 				       buffer, buflen, errnop);
-	  blacklist_store_name (buf, ent);
 	  if (status == NSS_STATUS_SUCCESS && result->gr_gid == gid)
 	    break;
 	  else
@@ -599,11 +589,9 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
       /* +:... */
       if (result->gr_name[0] == '+' && result->gr_name[1] == '\0')
 	{
-	  if (!nss_getgrgid_r)
-	    return NSS_STATUS_UNAVAIL;
+	  enum nss_status status;
 
-	  enum nss_status status = nss_getgrgid_r (gid, result, buffer, buflen,
-						   errnop);
+	  status = nss_getgrgid_r (gid, result, buffer, buflen, errnop);
 	  if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
 	    return NSS_STATUS_NOTFOUND;
 	  else
@@ -618,7 +606,7 @@ enum nss_status
 _nss_compat_getgrgid_r (gid_t gid, struct group *grp,
 			char *buffer, size_t buflen, int *errnop)
 {
-  ent_t ent = { TRUE, NSS_STATUS_SUCCESS, NULL, { NULL, 0, 0 }};
+  ent_t ent = {TRUE, NULL, {NULL, 0, 0}};
   enum nss_status result;
 
   __libc_lock_lock (lock);
@@ -628,7 +616,7 @@ _nss_compat_getgrgid_r (gid_t gid, struct group *grp,
 
   __libc_lock_unlock (lock);
 
-  result = internal_setgrent (&ent, 0, 0);
+  result = internal_setgrent (&ent, 0);
 
   if (result == NSS_STATUS_SUCCESS)
     result = internal_getgrgid_r (gid, grp, &ent, buffer, buflen, errnop);
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index 70403a0785..9574ea7c0b 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -36,6 +36,7 @@ static service_user *ni;
 static enum nss_status (*nss_initgroups_dyn) (const char *, gid_t,
 					      long int *, long int *,
 					      gid_t **, long int, int *);
+static enum nss_status (*nss_setgrent) (int stayopen);
 static enum nss_status (*nss_getgrnam_r) (const char *name,
 					  struct group * grp, char *buffer,
 					  size_t buflen, int *errnop);
@@ -44,6 +45,7 @@ static enum nss_status (*nss_getgrgid_r) (gid_t gid, struct group * grp,
 					  int *errnop);
 static enum nss_status (*nss_getgrent_r) (struct group * grp, char *buffer,
 					  size_t buflen, int *errnop);
+static enum nss_status (*nss_endgrent) (void);
 
 /* Protect global state against multiple changers.  */
 __libc_lock_define_initialized (static, lock)
@@ -90,9 +92,11 @@ init_nss_interface (void)
       && __nss_database_lookup ("group_compat", NULL, "nis", &ni) >= 0)
     {
       nss_initgroups_dyn = __nss_lookup_function (ni, "initgroups_dyn");
+      nss_setgrent = __nss_lookup_function (ni, "setgrent");
       nss_getgrnam_r = __nss_lookup_function (ni, "getgrnam_r");
       nss_getgrgid_r = __nss_lookup_function (ni, "getgrgid_r");
       nss_getgrent_r = __nss_lookup_function (ni, "getgrent_r");
+      nss_endgrent = __nss_lookup_function (ni, "endgrent");
     }
 
   __libc_lock_unlock (lock);
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index ac132046da..89a6a7013e 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001-2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999,2001,2002,2003,2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -62,10 +62,9 @@ struct blacklist_t
 
 struct ent_t
 {
-  bool netgroup;
-  bool first;
-  bool files;
-  enum nss_status setent_status;
+  bool_t netgroup;
+  bool_t first;
+  bool_t files;
   FILE *stream;
   struct blacklist_t blacklist;
   struct passwd pwd;
@@ -73,9 +72,8 @@ struct ent_t
 };
 typedef struct ent_t ent_t;
 
-static ent_t ext_ent = { false, false, true, NSS_STATUS_SUCCESS, NULL,
-			 { NULL, 0, 0 },
-			 { NULL, NULL, 0, 0, NULL, NULL, NULL }};
+static ent_t ext_ent = {0, 0, TRUE, NULL, {NULL, 0, 0},
+                        {NULL, NULL, 0, 0, NULL, NULL, NULL}};
 
 /* Protect global state against multiple changers.  */
 __libc_lock_define_initialized (static, lock)
@@ -204,13 +202,12 @@ copy_pwd_changes (struct passwd *dest, struct passwd *src,
 }
 
 static enum nss_status
-internal_setpwent (ent_t *ent, int stayopen, int needent)
+internal_setpwent (ent_t *ent, int stayopen)
 {
   enum nss_status status = NSS_STATUS_SUCCESS;
 
-  ent->first = ent->netgroup = false;
-  ent->files = true;
-  ent->setent_status = NSS_STATUS_SUCCESS;
+  ent->first = ent->netgroup = FALSE;
+  ent->files = TRUE;
 
   /* If something was left over free it.  */
   if (ent->netgroup)
@@ -260,8 +257,8 @@ internal_setpwent (ent_t *ent, int stayopen, int needent)
 
   give_pwd_free (&ent->pwd);
 
-  if (needent && status == NSS_STATUS_SUCCESS && nss_setpwent)
-    ent->setent_status = nss_setpwent (stayopen);
+  if (status == NSS_STATUS_SUCCESS && nss_setpwent)
+    return nss_setpwent (stayopen);
 
   return status;
 }
@@ -277,7 +274,7 @@ _nss_compat_setpwent (int stayopen)
   if (ni == NULL)
     init_nss_interface ();
 
-  result = internal_setpwent (&ext_ent, stayopen, 1);
+  result = internal_setpwent (&ext_ent, stayopen);
 
   __libc_lock_unlock (lock);
 
@@ -300,7 +297,7 @@ internal_endpwent (ent_t *ent)
   if (ent->netgroup)
     __internal_endnetgrent (&ent->netgrdata);
 
-  ent->first = ent->netgroup = false;
+  ent->first = ent->netgroup = FALSE;
 
   if (ent->blacklist.data != NULL)
     {
@@ -347,17 +344,17 @@ getpwent_next_nss_netgr (const char *name, struct passwd *result, ent_t *ent,
 
   if (yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
     {
-      ent->netgroup = false;
-      ent->first = false;
+      ent->netgroup = FALSE;
+      ent->first = FALSE;
       give_pwd_free (&ent->pwd);
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (ent->first == true)
+  if (ent->first == TRUE)
     {
       memset (&ent->netgrdata, 0, sizeof (struct __netgrent));
       __internal_setnetgrent (group, &ent->netgrdata);
-      ent->first = false;
+      ent->first = FALSE;
     }
 
   while (1)
@@ -426,10 +423,6 @@ getpwent_next_nss (struct passwd *result, ent_t *ent, char *buffer,
   if (!nss_getpwent_r)
     return NSS_STATUS_UNAVAIL;
 
-  /* If the setpwent call failed, say so.  */
-  if (ent->setent_status != NSS_STATUS_SUCCESS)
-    return ent->setent_status;
-
   p2len = pwd_need_buflen (&ent->pwd);
   if (p2len > buflen)
     {
@@ -440,7 +433,7 @@ getpwent_next_nss (struct passwd *result, ent_t *ent, char *buffer,
   buflen -= p2len;
 
   if (ent->first)
-    ent->first = false;
+    ent->first = FALSE;
 
   do
     {
@@ -460,27 +453,29 @@ static enum nss_status
 getpwnam_plususer (const char *name, struct passwd *result, ent_t *ent,
 		   char *buffer, size_t buflen, int *errnop)
 {
+  struct passwd pwd;
+  char *p;
+  size_t plen;
+
   if (!nss_getpwnam_r)
     return NSS_STATUS_UNAVAIL;
 
-  struct passwd pwd;
   memset (&pwd, '\0', sizeof (struct passwd));
 
   copy_pwd_changes (&pwd, result, NULL, 0);
 
-  size_t plen = pwd_need_buflen (&pwd);
+  plen = pwd_need_buflen (&pwd);
   if (plen > buflen)
     {
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
-  char *p = buffer + (buflen - plen);
+  p = buffer + (buflen - plen);
   buflen -= plen;
 
-  enum nss_status status = nss_getpwnam_r (name, result, buffer, buflen,
-					   errnop);
-  if (status != NSS_STATUS_SUCCESS)
-    return status;
+  if (nss_getpwnam_r (name, result, buffer, buflen, errnop) !=
+      NSS_STATUS_SUCCESS)
+    return NSS_STATUS_NOTFOUND;
 
   if (in_blacklist (result->pw_name, strlen (result->pw_name), ent))
     return NSS_STATUS_NOTFOUND;
@@ -573,8 +568,8 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
 	{
 	  enum nss_status status;
 
-	  ent->netgroup = true;
-	  ent->first = true;
+	  ent->netgroup = TRUE;
+	  ent->first = TRUE;
 	  copy_pwd_changes (&ent->pwd, result, NULL, 0);
 
 	  status = getpwent_next_nss_netgr (NULL, result, ent,
@@ -629,8 +624,8 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
       /* +:... */
       if (result->pw_name[0] == '+' && result->pw_name[1] == '\0')
 	{
-	  ent->files = false;
-	  ent->first = true;
+	  ent->files = FALSE;
+	  ent->first = TRUE;
 	  copy_pwd_changes (&ent->pwd, result, NULL, 0);
 
 	  return getpwent_next_nss (result, ent, buffer, buflen, errnop);
@@ -678,7 +673,7 @@ _nss_compat_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
     init_nss_interface ();
 
   if (ext_ent.stream == NULL)
-    result = internal_setpwent (&ext_ent, 1, 1);
+    result = internal_setpwent (&ext_ent, 1);
 
   if (result == NSS_STATUS_SUCCESS)
     result = internal_getpwent_r (pwd, &ext_ent, buffer, buflen, errnop);
@@ -830,8 +825,8 @@ _nss_compat_getpwnam_r (const char *name, struct passwd *pwd,
 			char *buffer, size_t buflen, int *errnop)
 {
   enum nss_status result;
-  ent_t ent = { false, false, true, NSS_STATUS_SUCCESS, NULL, { NULL, 0, 0 },
-		{ NULL, NULL, 0, 0, NULL, NULL, NULL }};
+  ent_t ent = {0, 0, TRUE, NULL, {NULL, 0, 0},
+               {NULL, NULL, 0, 0, NULL, NULL, NULL}};
 
   if (name[0] == '-' || name[0] == '+')
     return NSS_STATUS_NOTFOUND;
@@ -843,7 +838,7 @@ _nss_compat_getpwnam_r (const char *name, struct passwd *pwd,
 
   __libc_lock_unlock (lock);
 
-  result = internal_setpwent (&ent, 0, 0);
+  result = internal_setpwent (&ent, 0);
 
   if (result == NSS_STATUS_SUCCESS)
     result = internal_getpwnam_r (name, pwd, &ent, buffer, buflen, errnop);
@@ -1072,8 +1067,8 @@ _nss_compat_getpwuid_r (uid_t uid, struct passwd *pwd,
 			char *buffer, size_t buflen, int *errnop)
 {
   enum nss_status result;
-  ent_t ent = { false, false, true, NSS_STATUS_SUCCESS, NULL, { NULL, 0, 0 },
-		{ NULL, NULL, 0, 0, NULL, NULL, NULL }};
+  ent_t ent = {0, 0, TRUE, NULL, {NULL, 0, 0},
+               {NULL, NULL, 0, 0, NULL, NULL, NULL}};
 
   __libc_lock_lock (lock);
 
@@ -1082,7 +1077,7 @@ _nss_compat_getpwuid_r (uid_t uid, struct passwd *pwd,
 
   __libc_lock_unlock (lock);
 
-  result = internal_setpwent (&ent, 0, 0);
+  result = internal_setpwent (&ent, 0);
 
   if (result == NSS_STATUS_SUCCESS)
     result = internal_getpwuid_r (uid, pwd, &ent, buffer, buflen, errnop);
@@ -1139,7 +1134,7 @@ blacklist_store_name (const char *name, ent_t *ent)
   return;
 }
 
-/* Returns TRUE if ent->blacklist contains name, else FALSE.  */
+/* returns TRUE if ent->blacklist contains name, else FALSE */
 static bool_t
 in_blacklist (const char *name, int namelen, ent_t *ent)
 {
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index d1de3f75b0..4ca6368139 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001-2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999,2001,2002,2003,2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -59,10 +59,9 @@ struct blacklist_t
 
 struct ent_t
 {
-  bool netgroup;
-  bool files;
-  bool first;
-  enum nss_status setent_status;
+  bool_t netgroup;
+  bool_t files;
+  bool_t first;
   FILE *stream;
   struct blacklist_t blacklist;
   struct spwd pwd;
@@ -70,9 +69,8 @@ struct ent_t
 };
 typedef struct ent_t ent_t;
 
-static ent_t ext_ent = { false, true, false, NSS_STATUS_SUCCESS, NULL,
-			 { NULL, 0, 0},
-			 { NULL, NULL, 0, 0, 0, 0, 0, 0, 0}};
+static ent_t ext_ent = {0, TRUE, 0, NULL, {NULL, 0, 0},
+			{NULL, NULL, 0, 0, 0, 0, 0, 0, 0}};
 
 /* Protect global state against multiple changers.  */
 __libc_lock_define_initialized (static, lock)
@@ -163,7 +161,7 @@ internal_setspent (ent_t *ent, int stayopen)
   enum nss_status status = NSS_STATUS_SUCCESS;
 
   ent->first = ent->netgroup = 0;
-  ent->files = true;
+  ent->files = TRUE;
 
   /* If something was left over free it.  */
   if (ent->netgroup)
@@ -214,7 +212,7 @@ internal_setspent (ent_t *ent, int stayopen)
   give_spwd_free (&ent->pwd);
 
   if (status == NSS_STATUS_SUCCESS && nss_setspent)
-    ent->setent_status = nss_setspent (stayopen);
+    return nss_setspent (stayopen);
 
   return status;
 }
@@ -253,8 +251,8 @@ internal_endspent (ent_t *ent)
   if (ent->netgroup)
     __internal_endnetgrent (&ent->netgrdata);
 
-  ent->first = ent->netgroup = false;
-  ent->files = true;
+  ent->first = ent->netgroup = FALSE;
+  ent->files = TRUE;
 
   if (ent->blacklist.data != NULL)
     {
@@ -296,23 +294,19 @@ getspent_next_nss_netgr (const char *name, struct spwd *result, ent_t *ent,
   if (!nss_getspnam_r)
     return NSS_STATUS_UNAVAIL;
 
-  /* If the setpwent call failed, say so.  */
-  if (ent->setent_status != NSS_STATUS_SUCCESS)
-    return ent->setent_status;
-
   if (yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
     {
-      ent->netgroup = false;
-      ent->first = false;
+      ent->netgroup = FALSE;
+      ent->first = FALSE;
       give_spwd_free (&ent->pwd);
       return NSS_STATUS_UNAVAIL;
     }
 
-  if (ent->first == true)
+  if (ent->first == TRUE)
     {
       memset (&ent->netgrdata, 0, sizeof (struct __netgrent));
       __internal_setnetgrent (group, &ent->netgrdata);
-      ent->first = false;
+      ent->first = FALSE;
     }
 
   while (1)
@@ -327,7 +321,7 @@ getspent_next_nss_netgr (const char *name, struct spwd *result, ent_t *ent,
       if (status != 1)
 	{
 	  __internal_endnetgrent (&ent->netgrdata);
-	  ent->netgroup = false;
+	  ent->netgroup = FALSE;
 	  give_spwd_free (&ent->pwd);
 	  return NSS_STATUS_RETURN;
 	}
@@ -402,16 +396,18 @@ getspent_next_nss (struct spwd *result, ent_t *ent,
   return NSS_STATUS_SUCCESS;
 }
 
-
 /* This function handle the +user entrys in /etc/shadow */
 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;
@@ -420,19 +416,18 @@ getspnam_plususer (const char *name, struct spwd *result, ent_t *ent,
 
   copy_spwd_changes (&pwd, result, NULL, 0);
 
-  size_t plen = spwd_need_buflen (&pwd);
+  plen = spwd_need_buflen (&pwd);
   if (plen > buflen)
     {
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
-  char *p = buffer + (buflen - plen);
+  p = buffer + (buflen - plen);
   buflen -= plen;
 
-  enum nss_status status = nss_getspnam_r (name, result, buffer, buflen,
-					   errnop);
-  if (status != NSS_STATUS_SUCCESS)
-    return status;
+  if (nss_getspnam_r (name, result, buffer, buflen, errnop) !=
+      NSS_STATUS_SUCCESS)
+    return NSS_STATUS_NOTFOUND;
 
   if (in_blacklist (result->sp_namp, strlen (result->sp_namp), ent))
     return NSS_STATUS_NOTFOUND;
@@ -443,7 +438,6 @@ getspnam_plususer (const char *name, struct spwd *result, ent_t *ent,
   return NSS_STATUS_SUCCESS;
 }
 
-
 static enum nss_status
 getspent_next_file (struct spwd *result, ent_t *ent,
 		    char *buffer, size_t buflen, int *errnop)
@@ -524,8 +518,8 @@ getspent_next_file (struct spwd *result, ent_t *ent,
 	{
 	  int status;
 
-	  ent->netgroup = true;
-	  ent->first = true;
+	  ent->netgroup = TRUE;
+	  ent->first = TRUE;
 	  copy_spwd_changes (&ent->pwd, result, NULL, 0);
 
 	  status = getspent_next_nss_netgr (NULL, result, ent,
@@ -581,8 +575,8 @@ getspent_next_file (struct spwd *result, ent_t *ent,
       /* +:... */
       if (result->sp_namp[0] == '+' && result->sp_namp[1] == '\0')
 	{
-	  ent->files = false;
-	  ent->first = true;
+	  ent->files = FALSE;
+	  ent->first = TRUE;
 	  copy_spwd_changes (&ent->pwd, result, NULL, 0);
 
 	  return getspent_next_nss (result, ent, buffer, buflen, errnop);
@@ -617,7 +611,6 @@ internal_getspent_r (struct spwd *pw, ent_t *ent,
     return getspent_next_nss (pw, ent, buffer, buflen, errnop);
 }
 
-
 enum nss_status
 _nss_compat_getspent_r (struct spwd *pwd, char *buffer, size_t buflen,
 			int *errnop)
@@ -641,7 +634,6 @@ _nss_compat_getspent_r (struct spwd *pwd, char *buffer, size_t buflen,
   return result;
 }
 
-
 /* Searches in /etc/passwd and the NIS/NIS+ map for a special user */
 static enum nss_status
 internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
@@ -784,14 +776,13 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
   return NSS_STATUS_SUCCESS;
 }
 
-
 enum nss_status
 _nss_compat_getspnam_r (const char *name, struct spwd *pwd,
 			char *buffer, size_t buflen, int *errnop)
 {
   enum nss_status result;
-  ent_t ent = { false, true, false, NSS_STATUS_SUCCESS, NULL, { NULL, 0, 0},
-		{ NULL, NULL, 0, 0, 0, 0, 0, 0, 0}};
+  ent_t ent = {0, TRUE, 0, NULL, {NULL, 0, 0},
+	       {NULL, NULL, 0, 0, 0, 0, 0, 0, 0}};
 
   if (name[0] == '-' || name[0] == '+')
     return NSS_STATUS_NOTFOUND;
@@ -813,7 +804,6 @@ _nss_compat_getspnam_r (const char *name, struct spwd *pwd,
   return result;
 }
 
-
 /* Support routines for remembering -@netgroup and -user entries.
    The names are stored in a single string with `|' as separator. */
 static void
@@ -860,7 +850,6 @@ blacklist_store_name (const char *name, ent_t *ent)
   return;
 }
 
-
 /* Returns TRUE if ent->blacklist contains name, else FALSE.  */
 static bool_t
 in_blacklist (const char *name, int namelen, ent_t *ent)
@@ -869,7 +858,7 @@ in_blacklist (const char *name, int namelen, ent_t *ent)
   char *cp;
 
   if (ent->blacklist.data == NULL)
-    return false;
+    return FALSE;
 
   buf[0] = '|';
   cp = stpcpy (&buf[1], name);