summary refs log tree commit diff
path: root/nis
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-05-19 16:04:10 +0000
committerJakub Jelinek <jakub@redhat.com>2006-05-19 16:04:10 +0000
commit4cad81b6e72ed99c7816f28ad6828196b2ac7b65 (patch)
tree418c1c32beba4d79ae71206b90fbb6a8847eca2a /nis
parent3ec0d26c76d6905501034692d05bddbabae64e76 (diff)
downloadglibc-4cad81b6e72ed99c7816f28ad6828196b2ac7b65.tar.gz
glibc-4cad81b6e72ed99c7816f28ad6828196b2ac7b65.tar.xz
glibc-4cad81b6e72ed99c7816f28ad6828196b2ac7b65.zip
Updated to fedora-glibc-20060519T1550 cvs/fedora-glibc-2_4_90-8
Diffstat (limited to 'nis')
-rw-r--r--nis/nis_call.c83
-rw-r--r--nis/nis_callback.c42
-rw-r--r--nis/nis_error.c84
-rw-r--r--nis/nis_error.h48
-rw-r--r--nis/nis_xdr.c4
-rw-r--r--nis/nis_xdr.h36
-rw-r--r--nis/nss_compat/compat-grp.c8
-rw-r--r--nis/nss_compat/compat-initgroups.c6
-rw-r--r--nis/nss_compat/compat-pwd.c8
-rw-r--r--nis/nss_compat/compat-spwd.c8
-rw-r--r--nis/yp_xdr.c8
-rw-r--r--nis/ypupdate_xdr.c2
12 files changed, 199 insertions, 138 deletions
diff --git a/nis/nis_call.c b/nis/nis_call.c
index 32d29ae99f..753ef77997 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -368,6 +368,12 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, nis_error *status)
 	   domain ! (Now I understand why a root server must be a
 	   replica of the parent domain) */
 	fd_res = __nis_finddirectory (dir, ndomain);
+	if (fd_res == NULL)
+	  {
+	    nis_free_directory (dir);
+	    *status = NIS_NOMEMORY;
+	    return NULL;
+	  }
 	*status = fd_res->status;
 	if (fd_res->status != NIS_SUCCESS)
 	  {
@@ -375,27 +381,25 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, nis_error *status)
 	    __free_fdresult (fd_res);
 	    return dir;
 	  }
+	nis_free_directory (dir);
 	obj = calloc (1, sizeof (directory_obj));
+	if (obj == NULL)
+	  {
+	    __free_fdresult (fd_res);
+	    *status = NIS_NOMEMORY;
+	    return NULL;
+	  }
 	xdrmem_create (&xdrs, fd_res->dir_data.dir_data_val,
 		       fd_res->dir_data.dir_data_len, XDR_DECODE);
 	_xdr_directory_obj (&xdrs, obj);
 	xdr_destroy (&xdrs);
 	__free_fdresult (fd_res);
-	if (obj != NULL)
-	  {
-	    /* We have found a NIS+ server serving ndomain, now
-	       let us search for "name" */
-	    nis_free_directory (dir);
-	    return rec_dirsearch (name, obj, status);
-	  }
-	else
-	  {
-	    /* Ups, very bad. Are we already the root server ? */
-	    nis_free_directory (dir);
-	    return NULL;
-	  }
+
+	/* We have found a NIS+ server serving ndomain, now
+	   let us search for "name" */
+	return rec_dirsearch (name, obj, status);
       }
-    break;
+      break;
     case LOWER_NAME:
       {
 	directory_obj *obj;
@@ -433,6 +437,12 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, nis_error *status)
 	strcpy (cp, domain);
 
 	fd_res = __nis_finddirectory (dir, leaf);
+	if (fd_res == NULL)
+	  {
+	    nis_free_directory (dir);
+	    *status = NIS_NOMEMORY;
+	    return NULL;
+	  }
 	*status = fd_res->status;
 	if (fd_res->status != NIS_SUCCESS)
 	  {
@@ -440,21 +450,24 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, nis_error *status)
 	    __free_fdresult (fd_res);
 	    return dir;
 	  }
-	obj = calloc(1, sizeof(directory_obj));
-	xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
-		      fd_res->dir_data.dir_data_len, XDR_DECODE);
-	_xdr_directory_obj(&xdrs, obj);
-	xdr_destroy(&xdrs);
-	__free_fdresult (fd_res);
-	if (obj != NULL)
+	nis_free_directory (dir);
+	obj = calloc (1, sizeof(directory_obj));
+	if (obj == NULL)
 	  {
-	    /* We have found a NIS+ server serving ndomain, now
-	       let us search for "name" */
-	    nis_free_directory (dir);
-	    return rec_dirsearch (name, obj, status);
+	    __free_fdresult (fd_res);
+	    *status = NIS_NOMEMORY;
+	    return NULL;
 	  }
+	xdrmem_create (&xdrs, fd_res->dir_data.dir_data_val,
+		       fd_res->dir_data.dir_data_len, XDR_DECODE);
+	_xdr_directory_obj (&xdrs, obj);
+	xdr_destroy (&xdrs);
+	__free_fdresult (fd_res);
+	/* We have found a NIS+ server serving ndomain, now
+	   let us search for "name" */
+	return rec_dirsearch (name, obj, status);
       }
-    break;
+      break;
     case BAD_NAME:
       nis_free_directory (dir);
       *status = NIS_BADNAME;
@@ -484,6 +497,8 @@ first_shoot (const_nis_name name, directory_obj *dir)
     return dir;
 
   fd_res = __nis_finddirectory (dir, domain);
+  if (fd_res == NULL)
+    return NULL;
   if (fd_res->status == NIS_SUCCESS
       && (obj = calloc (1, sizeof (directory_obj))) != NULL)
     {
@@ -513,28 +528,30 @@ __nisfind_server (const_nis_name name, directory_obj **dir)
     dir = __nis_cache_search (name, flags, &cinfo);
 #endif
 
+  nis_error result = NIS_SUCCESS;
   if (*dir == NULL)
     {
       nis_error status;
       directory_obj *obj;
 
       *dir = readColdStartFile ();
-      if (*dir == NULL) /* No /var/nis/NIS_COLD_START->no NIS+ installed */
+      if (*dir == NULL)
+	/* No /var/nis/NIS_COLD_START->no NIS+ installed.  */
 	return NIS_UNAVAIL;
 
       /* Try at first, if servers in "dir" know our object */
       obj = first_shoot (name, *dir);
       if (obj == NULL)
 	{
-	  *dir = rec_dirsearch (name, *dir, &status);
-	  if (*dir == NULL)
-	    return status;
+	  obj = rec_dirsearch (name, *dir, &status);
+	  if (obj == NULL)
+	    result = status;
 	}
-      else
-	*dir = obj;
+
+      *dir = obj;
     }
 
-  return NIS_SUCCESS;
+  return result;
 }
 
 nis_error
diff --git a/nis/nis_callback.c b/nis/nis_callback.c
index 7d1b9f8e53..6582315c70 100644
--- a/nis/nis_callback.c
+++ b/nis/nis_callback.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
@@ -275,15 +275,14 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
   int sock = RPC_ANYSOCK;
   struct sockaddr_in sin;
   socklen_t len = sizeof (struct sockaddr_in);
-  char addr[NIS_MAXNAMELEN + 1];
   unsigned short port;
+  int nomsg = 0;
 
-  cb = (struct nis_cb *) calloc (1, sizeof (struct nis_cb));
+  cb = (struct nis_cb *) calloc (1,
+				 sizeof (struct nis_cb) + sizeof (nis_server));
   if (__builtin_expect (cb == NULL, 0))
     goto failed;
-  cb->serv = (nis_server *) calloc (1, sizeof (nis_server));
-  if (__builtin_expect (cb->serv == NULL, 0))
-    goto failed;
+  cb->serv = (nis_server *) (cb + 1);
   cb->serv->name = strdup (nis_local_principal ());
   if (__builtin_expect (cb->serv->name == NULL, 0))
     goto failed;
@@ -326,15 +325,20 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
   cb->serv->ep.ep_val[0].proto = strdup ((flags & USE_DGRAM) ? "udp" : "tcp");
   if (__builtin_expect (cb->serv->ep.ep_val[0].proto == NULL, 0))
     goto failed;
-  cb->xprt = (flags & USE_DGRAM) ? svcudp_bufcreate (sock, 100, 8192) :
-				   svctcp_create (sock, 100, 8192);
+  cb->xprt = ((flags & USE_DGRAM)
+	      ? svcudp_bufcreate (sock, 100, 8192)
+	      : svctcp_create (sock, 100, 8192));
+  if (cb->xprt == NULL)
+    {
+      nomsg = 1;
+      goto failed;
+    }
   cb->sock = cb->xprt->xp_sock;
   if (!svc_register (cb->xprt, CB_PROG, CB_VERS, cb_prog_1, 0))
     {
       xprt_unregister (cb->xprt);
       svc_destroy (cb->xprt);
       xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
-      free (cb->serv);
       free (cb);
       syslog (LOG_ERR, "NIS+: failed to register callback dispatcher");
       return NULL;
@@ -345,30 +349,31 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
       xprt_unregister (cb->xprt);
       svc_destroy (cb->xprt);
       xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
-      free (cb->serv);
       free (cb);
       syslog (LOG_ERR, "NIS+: failed to read local socket info");
       return NULL;
     }
   port = ntohs (sin.sin_port);
   get_myaddress (&sin);
-  snprintf (addr, sizeof (addr), "%s.%d.%d", inet_ntoa (sin.sin_addr),
-	    (port & 0xFF00) >> 8, port & 0x00FF);
-  cb->serv->ep.ep_val[0].uaddr = strdup (addr);
+
+  if (asprintf (&cb->serv->ep.ep_val[0].uaddr, "%s.%d.%d",
+		inet_ntoa (sin.sin_addr), (port & 0xFF00) >> 8, port & 0x00FF)
+      < 0)
+    goto failed;
 
   return cb;
 
  failed:
   if (cb)
     {
+      if (cb->xprt)
+	svc_destroy (cb->xprt);
       if (cb->serv)
-	{
-	  xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
-	  free (cb->serv);
-	}
+	xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
       free (cb);
     }
-  syslog (LOG_ERR, "NIS+: out of memory allocating callback");
+  if (!nomsg)
+    syslog (LOG_ERR, "NIS+: out of memory allocating callback");
   return NULL;
 }
 
@@ -379,7 +384,6 @@ __nis_destroy_callback (struct nis_cb *cb)
   svc_destroy (cb->xprt);
   close (cb->sock);
   xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
-  free (cb->serv);
   free (cb);
 
   return NIS_SUCCESS;
diff --git a/nis/nis_error.c b/nis/nis_error.c
index 7db885ef93..d92ad03604 100644
--- a/nis/nis_error.c
+++ b/nis/nis_error.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 1999, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1997,1998,1999,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -24,65 +24,41 @@
 #include <rpcsvc/nis.h>
 
 
-static const char *nis_errlist[] =
+#define MF(line) MF1 (line)
+#define MF1(line) str##line
+static const union msgstr_t
 {
-  N_("Success"),
-  N_("Probable success"),
-  N_("Not found"),
-  N_("Probably not found"),
-  N_("Cache expired"),
-  N_("NIS+ servers unreachable"),
-  N_("Unknown object"),
-  N_("Server busy, try again"),
-  N_("Generic system error"),
-  N_("First/next chain broken"),
-  N_("Permission denied"),
-  N_("Not owner"),
-  N_("Name not served by this server"),
-  N_("Server out of memory"),
-  N_("Object with same name exists"),
-  N_("Not master server for this domain"),
-  N_("Invalid object for operation"),
-  N_("Malformed name, or illegal name"),
-  N_("Unable to create callback"),
-  N_("Results sent to callback proc"),
-  N_("Not found, no such name"),
-  N_("Name/entry isn't unique"),
-  N_("Modification failed"),
-  N_("Database for table does not exist"),
-  N_("Entry/table type mismatch"),
-  N_("Link points to illegal name"),
-  N_("Partial success"),
-  N_("Too many attributes"),
-  N_("Error in RPC subsystem"),
-  N_("Missing or malformed attribute"),
-  N_("Named object is not searchable"),
-  N_("Error while talking to callback proc"),
-  N_("Non NIS+ namespace encountered"),
-  N_("Illegal object type for operation"),
-  N_("Passed object is not the same object on server"),
-  N_("Modify operation failed"),
-  N_("Query illegal for named table"),
-  N_("Attempt to remove a non-empty table"),
-  N_("Error in accessing NIS+ cold start file.  Is NIS+ installed?"),
-  N_("Full resync required for directory"),
-  N_("NIS+ operation failed"),
-  N_("NIS+ service is unavailable or not installed"),
-  N_("Yes, 42 is the meaning of life"),
-  N_("Unable to authenticate NIS+ server"),
-  N_("Unable to authenticate NIS+ client"),
-  N_("No file space on server"),
-  N_("Unable to create process on server"),
-  N_("Master server busy, full dump rescheduled.")
-};
+  struct
+  {
+#define S(s) char MF(__LINE__)[sizeof (s)];
+#include "nis_error.h"
+#undef S
+  };
+  char str[0];
+} msgstr =
+  {
+    {
+#define S(s) s,
+#include "nis_error.h"
+#undef S
+    }
+  };
+
+static const unsigned short int msgidx[] =
+  {
+#define S(s) offsetof (union msgstr_t, MF (__LINE__)),
+#include "nis_error.h"
+#undef S
+  };
+
 
 const char *
 nis_sperrno (const nis_error status)
 {
-  if (status >= (sizeof (nis_errlist) / sizeof (nis_errlist[0])))
+  if (status >= sizeof (msgidx) / sizeof (msgidx[0]))
     return "???";
   else
-    return gettext (nis_errlist[status]);
+    return gettext (msgstr.str + msgidx[status]);
 }
 libnsl_hidden_def (nis_sperrno)
 
@@ -105,7 +81,7 @@ nis_sperror_r (const nis_error status, const char *label,
   if (snprintf (buffer, buflen, "%s: %s", label, nis_sperrno (status))
       >= buflen)
     {
-      errno = ERANGE;
+      __set_errno (ERANGE);
       return NULL;
     }
 
diff --git a/nis/nis_error.h b/nis/nis_error.h
new file mode 100644
index 0000000000..add1316d9f
--- /dev/null
+++ b/nis/nis_error.h
@@ -0,0 +1,48 @@
+S(N_("Success"))
+S(N_("Probable success"))
+S(N_("Not found"))
+S(N_("Probably not found"))
+S(N_("Cache expired"))
+S(N_("NIS+ servers unreachable"))
+S(N_("Unknown object"))
+S(N_("Server busy, try again"))
+S(N_("Generic system error"))
+S(N_("First/next chain broken"))
+S(N_("Permission denied"))
+S(N_("Not owner"))
+S(N_("Name not served by this server"))
+S(N_("Server out of memory"))
+S(N_("Object with same name exists"))
+S(N_("Not master server for this domain"))
+S(N_("Invalid object for operation"))
+S(N_("Malformed name, or illegal name"))
+S(N_("Unable to create callback"))
+S(N_("Results sent to callback proc"))
+S(N_("Not found, no such name"))
+S(N_("Name/entry isn't unique"))
+S(N_("Modification failed"))
+S(N_("Database for table does not exist"))
+S(N_("Entry/table type mismatch"))
+S(N_("Link points to illegal name"))
+S(N_("Partial success"))
+S(N_("Too many attributes"))
+S(N_("Error in RPC subsystem"))
+S(N_("Missing or malformed attribute"))
+S(N_("Named object is not searchable"))
+S(N_("Error while talking to callback proc"))
+S(N_("Non NIS+ namespace encountered"))
+S(N_("Illegal object type for operation"))
+S(N_("Passed object is not the same object on server"))
+S(N_("Modify operation failed"))
+S(N_("Query illegal for named table"))
+S(N_("Attempt to remove a non-empty table"))
+S(N_("Error in accessing NIS+ cold start file.  Is NIS+ installed?"))
+S(N_("Full resync required for directory"))
+S(N_("NIS+ operation failed"))
+S(N_("NIS+ service is unavailable or not installed"))
+S(N_("Yes, 42 is the meaning of life"))
+S(N_("Unable to authenticate NIS+ server"))
+S(N_("Unable to authenticate NIS+ client"))
+S(N_("No file space on server"))
+S(N_("Unable to create process on server"))
+S(N_("Master server busy, full dump rescheduled."))
diff --git a/nis/nis_xdr.c b/nis/nis_xdr.c
index 1ef08c7890..3d4f7268c0 100644
--- a/nis/nis_xdr.c
+++ b/nis/nis_xdr.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -433,6 +433,7 @@ xdr_obj_p (XDR *xdrs, obj_p *objp)
   return xdr_pointer (xdrs, (char **)objp, sizeof (nis_object),
 		      (xdrproc_t)_xdr_nis_object);
 }
+libnsl_hidden_def (xdr_obj_p)
 
 bool_t
 xdr_cback_data (XDR *xdrs, cback_data *objp)
@@ -441,3 +442,4 @@ xdr_cback_data (XDR *xdrs, cback_data *objp)
 		    &objp->entries.entries_len, ~0,
 		    sizeof (obj_p), (xdrproc_t) xdr_obj_p);
 }
+libnsl_hidden_def (xdr_cback_data)
diff --git a/nis/nis_xdr.h b/nis/nis_xdr.h
index 2f1a179e0a..791a964d2f 100644
--- a/nis/nis_xdr.h
+++ b/nis/nis_xdr.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -22,24 +22,20 @@
 
 #include <features.h>
 
-__BEGIN_DECLS
-
-extern  bool_t _xdr_nis_attr (XDR *, nis_attr*);
-extern  bool_t _xdr_nis_name (XDR *, nis_name*);
-extern  bool_t _xdr_nis_server (XDR *, nis_server*);
-extern  bool_t _xdr_directory_obj (XDR *, directory_obj*);
-extern  bool_t _xdr_nis_object (XDR *, nis_object*);
-extern  bool_t _xdr_nis_error (XDR *, nis_error*);
-extern  bool_t _xdr_nis_result (XDR *, nis_result*);
-extern  bool_t _xdr_ns_request (XDR *, ns_request*);
-extern  bool_t _xdr_ib_request (XDR *, ib_request*);
-extern  bool_t _xdr_ping_args (XDR *, ping_args*);
-extern  bool_t _xdr_cp_result (XDR *, cp_result*);
-extern  bool_t _xdr_nis_tag (XDR *, nis_tag*);
-extern  bool_t _xdr_nis_taglist (XDR *, nis_taglist*);
-extern  bool_t _xdr_fd_args (XDR *, fd_args*);
-extern  bool_t _xdr_fd_result (XDR *, fd_result*);
-
-__END_DECLS
+extern  bool_t _xdr_nis_attr (XDR *, nis_attr*) attribute_hidden;
+extern  bool_t _xdr_nis_name (XDR *, nis_name*) attribute_hidden;
+extern  bool_t _xdr_nis_server (XDR *, nis_server*) attribute_hidden;
+extern  bool_t _xdr_directory_obj (XDR *, directory_obj*) attribute_hidden;
+extern  bool_t _xdr_nis_object (XDR *, nis_object*) attribute_hidden;
+extern  bool_t _xdr_nis_error (XDR *, nis_error*) attribute_hidden;
+extern  bool_t _xdr_nis_result (XDR *, nis_result*) attribute_hidden;
+extern  bool_t _xdr_ns_request (XDR *, ns_request*) attribute_hidden;
+extern  bool_t _xdr_ib_request (XDR *, ib_request*) attribute_hidden;
+extern  bool_t _xdr_ping_args (XDR *, ping_args*) attribute_hidden;
+extern  bool_t _xdr_cp_result (XDR *, cp_result*) attribute_hidden;
+extern  bool_t _xdr_nis_tag (XDR *, nis_tag*) attribute_hidden;
+extern  bool_t _xdr_nis_taglist (XDR *, nis_taglist*) attribute_hidden;
+extern  bool_t _xdr_fd_args (XDR *, fd_args*) attribute_hidden;
+extern  bool_t _xdr_fd_result (XDR *, fd_result*) attribute_hidden;
 
 #endif
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c
index d51eb6d0f2..093876fd74 100644
--- a/nis/nss_compat/compat-grp.c
+++ b/nis/nss_compat/compat-grp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001-2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999,2001-2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -138,7 +138,11 @@ internal_setgrent (ent_t *ent, int stayopen)
     rewind (ent->stream);
 
   if (status == NSS_STATUS_SUCCESS && nss_setgrent)
-    return nss_setgrent (stayopen);
+    {
+      status = nss_setgrent (stayopen);
+      if (status == NSS_STATUS_UNAVAIL)
+        status = NSS_STATUS_SUCCESS;
+    }
 
   return status;
 }
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index 9574ea7c0b..70403a0785 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -36,7 +36,6 @@ 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);
@@ -45,7 +44,6 @@ 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)
@@ -92,11 +90,9 @@ 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 43ccb27071..1031714529 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001-2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999,2001-2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -258,7 +258,11 @@ internal_setpwent (ent_t *ent, int stayopen)
   give_pwd_free (&ent->pwd);
 
   if (status == NSS_STATUS_SUCCESS && nss_setpwent)
-    return nss_setpwent (stayopen);
+    {
+      status = nss_setpwent (stayopen);
+      if (status == NSS_STATUS_UNAVAIL)
+        status = NSS_STATUS_SUCCESS;
+    }
 
   return status;
 }
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index 120e3bd38d..5c820a5f65 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001-2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999,2001-2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -212,7 +212,11 @@ internal_setspent (ent_t *ent, int stayopen)
   give_spwd_free (&ent->pwd);
 
   if (status == NSS_STATUS_SUCCESS && nss_setspent)
-    return nss_setspent (stayopen);
+    {
+      status = nss_setspent (stayopen);
+      if (status == NSS_STATUS_UNAVAIL)
+        status = NSS_STATUS_SUCCESS;
+    }
 
   return status;
 }
diff --git a/nis/yp_xdr.c b/nis/yp_xdr.c
index 0ee80126e8..b87ee06151 100644
--- a/nis/yp_xdr.c
+++ b/nis/yp_xdr.c
@@ -103,6 +103,7 @@ xdr_ypreq_key (XDR *xdrs, ypreq_key *objp)
     return FALSE;
   return xdr_keydat (xdrs, &objp->key);
 }
+libnsl_hidden_def (xdr_ypreq_key)
 
 bool_t
 xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
@@ -111,6 +112,7 @@ xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
     return FALSE;
   return xdr_mapname (xdrs, &objp->map);
 }
+libnsl_hidden_def (xdr_ypreq_nokey)
 
 bool_t
 xdr_ypreq_xfr (XDR *xdrs, ypreq_xfr *objp)
@@ -131,6 +133,7 @@ xdr_ypresp_val (XDR *xdrs, ypresp_val *objp)
     return FALSE;
   return xdr_valdat (xdrs, &objp->val);
 }
+libnsl_hidden_def (xdr_ypresp_val)
 
 bool_t
 xdr_ypresp_key_val (XDR *xdrs, ypresp_key_val *objp)
@@ -150,6 +153,7 @@ xdr_ypresp_master (XDR *xdrs, ypresp_master *objp)
     return FALSE;
   return xdr_peername (xdrs, &objp->peer);
 }
+libnsl_hidden_def (xdr_ypresp_master)
 
 bool_t
 xdr_ypresp_order (XDR *xdrs, ypresp_order *objp)
@@ -158,6 +162,7 @@ xdr_ypresp_order (XDR *xdrs, ypresp_order *objp)
     return FALSE;
   return xdr_u_int (xdrs, &objp->ordernum);
 }
+libnsl_hidden_def (xdr_ypresp_order)
 
 bool_t
 xdr_ypresp_all (XDR *xdrs, ypresp_all *objp)
@@ -193,6 +198,7 @@ xdr_ypmaplist (XDR *xdrs, ypmaplist *objp)
   return xdr_pointer (xdrs, (char **) &objp->next, sizeof (ypmaplist),
 		      (xdrproc_t) xdr_ypmaplist);
 }
+libnsl_hidden_def (xdr_ypmaplist)
 
 bool_t
 xdr_ypresp_maplist (XDR *xdrs, ypresp_maplist *objp)
@@ -202,6 +208,7 @@ xdr_ypresp_maplist (XDR *xdrs, ypresp_maplist *objp)
   return xdr_pointer (xdrs, (char **) &objp->maps, sizeof (ypmaplist),
 		      (xdrproc_t) xdr_ypmaplist);
 }
+libnsl_hidden_def (xdr_ypresp_maplist)
 
 bool_t
 xdr_yppush_status (XDR *xdrs, yppush_status *objp)
@@ -248,6 +255,7 @@ xdr_ypbind_resp (XDR *xdrs, ypbind_resp *objp)
     }
   return FALSE;
 }
+libnsl_hidden_def (xdr_ypbind_resp)
 
 bool_t
 xdr_ypbind_setdom (XDR *xdrs, ypbind_setdom *objp)
diff --git a/nis/ypupdate_xdr.c b/nis/ypupdate_xdr.c
index 4789e47c3e..0f5469fa23 100644
--- a/nis/ypupdate_xdr.c
+++ b/nis/ypupdate_xdr.c
@@ -50,6 +50,7 @@ xdr_ypupdate_args (XDR *xdrs, ypupdate_args *objp)
     return FALSE;
   return xdr_yp_buf (xdrs, &objp->datum);
 }
+libnsl_hidden_def (xdr_ypupdate_args)
 
 bool_t
 xdr_ypdelete_args (XDR *xdrs, ypdelete_args *objp)
@@ -58,3 +59,4 @@ xdr_ypdelete_args (XDR *xdrs, ypdelete_args *objp)
     return FALSE;
   return xdr_yp_buf (xdrs, &objp->key);
 }
+libnsl_hidden_def (xdr_ypdelete_args)