about summary refs log tree commit diff
path: root/nis
diff options
context:
space:
mode:
Diffstat (limited to 'nis')
-rw-r--r--nis/nss_compat/compat-grp.c27
-rw-r--r--nis/nss_compat/compat-initgroups.c17
-rw-r--r--nis/nss_compat/compat-pwd.c32
-rw-r--r--nis/nss_compat/compat-spwd.c28
-rw-r--r--nis/nss_nis/nis-alias.c4
-rw-r--r--nis/nss_nis/nis-ethers.c16
-rw-r--r--nis/nss_nis/nis-grp.c24
-rw-r--r--nis/nss_nis/nis-hosts.c1
-rw-r--r--nis/nss_nis/nis-initgroups.c5
-rw-r--r--nis/nss_nis/nis-network.c23
-rw-r--r--nis/nss_nis/nis-proto.c25
-rw-r--r--nis/nss_nis/nis-publickey.c26
-rw-r--r--nis/nss_nis/nis-pwd.c24
-rw-r--r--nis/nss_nis/nis-rpc.c21
-rw-r--r--nis/nss_nis/nis-service.c17
-rw-r--r--nis/nss_nis/nis-spwd.c15
-rw-r--r--nis/rpcsvc/yp.h566
-rw-r--r--nis/yp_xdr.c386
-rw-r--r--nis/ypclnt.c4
-rw-r--r--nis/ypupdate_xdr.c46
20 files changed, 567 insertions, 740 deletions
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c
index ca5abc4d2c..3ef2039e84 100644
--- a/nis/nss_compat/compat-grp.c
+++ b/nis/nss_compat/compat-grp.c
@@ -246,6 +246,7 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
   if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
     {
       ent->nis = 0;
+      *errnop = ENOENT;
       return NSS_STATUS_NOTFOUND;
     }
 
@@ -285,6 +286,7 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
 	      != YPERR_SUCCESS)
 	    {
 	      ent->nis = 0;
+	      *errnop = ENOENT;
 	      return NSS_STATUS_NOTFOUND;
 	    }
 
@@ -440,7 +442,10 @@ getgrnam_plusgroup (const char *name, struct group *result, char *buffer,
 
       if (yp_match (domain, "group.byname", name, strlen (name),
 		    &outval, &outvallen) != YPERR_SUCCESS)
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
 
       if (buflen < ((size_t) outvallen + 1))
 	{
@@ -485,7 +490,10 @@ getgrent_next_file (struct group *result, ent_t *ent,
 	  buffer[buflen - 1] = '\xff';
 	  p = fgets (buffer, buflen, ent->stream);
 	  if (p == NULL && feof (ent->stream))
-	    return NSS_STATUS_NOTFOUND;
+	    {
+	      *errnop = ENOENT;
+	      return NSS_STATUS_NOTFOUND;
+	    }
 	  if (p == NULL || buffer[buflen - 1] != '\xff')
 	    {
 	      fsetpos (ent->stream, &pos);
@@ -625,7 +633,10 @@ internal_getgrnam_r (const char *name, struct group *result, ent_t *ent,
 	  buffer[buflen - 1] = '\xff';
 	  p = fgets (buffer, buflen, ent->stream);
 	  if (p == NULL && feof (ent->stream))
-	    return NSS_STATUS_NOTFOUND;
+	    {
+	      *errnop = ENOENT;
+	      return NSS_STATUS_NOTFOUND;
+	    }
 	  if (p == NULL || buffer[buflen - 1] != '\xff')
 	    {
 	      fsetpos (ent->stream, &pos);
@@ -667,7 +678,10 @@ internal_getgrnam_r (const char *name, struct group *result, ent_t *ent,
       if (result->gr_name[0] == '-' && result->gr_name[1] != '\0')
 	{
 	  if (strcmp (&result->gr_name[1], name) == 0)
-	    return NSS_STATUS_NOTFOUND;
+	    {
+	      *errnop = ENOENT;
+	      return NSS_STATUS_NOTFOUND;
+	    }
 	  else
 	    continue;
 	}
@@ -828,7 +842,10 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent,
 	  buffer[buflen - 1] = '\xff';
 	  p = fgets (buffer, buflen, ent->stream);
 	  if (p == NULL && feof (ent->stream))
-	    return NSS_STATUS_NOTFOUND;
+	    {
+	      *errnop = ENOENT;
+	      return NSS_STATUS_NOTFOUND;
+	    }
 	  if (p == NULL || buffer[buflen - 1] != '\xff')
 	    {
 	      fsetpos (ent->stream, &pos);
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index 9def98ba52..97ddaeebab 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -228,6 +228,7 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
 			&outval, &outvallen) != YPERR_SUCCESS)
 	    {
 	      ent->nis = 0;
+	      *errnop = ENOENT;
 	      return NSS_STATUS_UNAVAIL;
 	    }
 
@@ -252,6 +253,7 @@ getgrent_next_nis (struct group *result, ent_t *ent, char *buffer,
 	      != YPERR_SUCCESS)
 	    {
 	      ent->nis = 0;
+	      *errnop = ENOENT;
 	      return NSS_STATUS_NOTFOUND;
 	    }
 
@@ -403,11 +405,17 @@ getgrnam_plusgroup (const char *name, struct group *result, char *buffer,
       int outvallen;
 
       if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
 
       if (yp_match (domain, "group.byname", name, strlen (name),
 		    &outval, &outvallen) != YPERR_SUCCESS)
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
 
       if (buflen < ((size_t) outvallen + 1))
 	{
@@ -452,7 +460,10 @@ getgrent_next_file (struct group *result, ent_t *ent,
 	  buffer[buflen - 1] = '\xff';
 	  p = fgets (buffer, buflen, ent->stream);
 	  if (p == NULL && feof (ent->stream))
-	    return NSS_STATUS_NOTFOUND;
+	    {
+	      *errnop = ENOENT;
+	      return NSS_STATUS_NOTFOUND;
+	    }
 	  if (p == NULL || buffer[buflen - 1] != '\xff')
 	    {
 	      fsetpos (ent->stream, &pos);
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index eec2634f3a..4cbf739d05 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -681,6 +681,7 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
 	    {
 	      ent->nis = 0;
 	      give_pwd_free (&ent->pwd);
+	      *errnop = ENOENT;
 	      return NSS_STATUS_NOTFOUND;
 	    }
 
@@ -790,7 +791,10 @@ getpwnam_plususer (const char *name, struct passwd *result, char *buffer,
 
       if (yp_match (domain, "passwd.byname", name, strlen (name),
 		    &outval, &outvallen) != YPERR_SUCCESS)
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
 
       if (buflen < ((size_t) outvallen + 1))
 	{
@@ -840,7 +844,10 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
 	  buffer[buflen - 1] = '\xff';
 	  p = fgets (buffer, buflen, ent->stream);
 	  if (p == NULL && feof (ent->stream))
-	    return NSS_STATUS_NOTFOUND;
+	    {
+	      *errnop = ENOENT;
+	      return NSS_STATUS_NOTFOUND;
+	    }
 	  if (p == NULL || buffer[buflen - 1] != '\xff')
 	    {
 	      fsetpos (ent->stream, &pos);
@@ -915,7 +922,11 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
 	  if (status == NSS_STATUS_RETURN)
 	    continue;
 	  else
-	    return status;
+	    {
+	      if (status == NSS_STATUS_NOTFOUND)
+		*errnop = ENOENT;
+	      return status;
+	    }
 	}
 
       /* -user */
@@ -1051,7 +1062,10 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent,
 	  buffer[buflen - 1] = '\xff';
 	  p = fgets (buffer, buflen, ent->stream);
 	  if (p == NULL && feof (ent->stream))
-	    return NSS_STATUS_NOTFOUND;
+	    {
+	      *errnop = ENOENT;
+	      return NSS_STATUS_NOTFOUND;
+	    }
 	  if (p == NULL || buffer[buflen - 1] != '\xff')
 	    {
 	      fsetpos (ent->stream, &pos);
@@ -1146,7 +1160,10 @@ internal_getpwnam_r (const char *name, struct passwd *result, ent_t *ent,
 	  && result->pw_name[1] != '@')
 	{
 	  if (strcmp (&result->pw_name[1], name) == 0)
-	    return NSS_STATUS_NOTFOUND;
+	    {
+	      *errnop = ENOENT;
+	      return NSS_STATUS_NOTFOUND;
+	    }
 	  else
 	    continue;
 	}
@@ -1196,7 +1213,10 @@ _nss_compat_getpwnam_r (const char *name, struct passwd *pwd,
   enum nss_status status;
 
   if (name[0] == '-' || name[0] == '+')
-    return NSS_STATUS_NOTFOUND;
+    {
+      *errnop = ENOENT;
+      return NSS_STATUS_NOTFOUND;
+    }
 
   __libc_lock_lock (lock);
 
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index 1d4216393a..cf117fa964 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -631,6 +631,7 @@ getspent_next_nis (struct spwd *result, ent_t *ent,
 	    {
 	      ent->nis = 0;
 	      give_spwd_free (&ent->pwd);
+	      *errnop = ENOENT;
 	      return NSS_STATUS_NOTFOUND;
 	    }
 
@@ -736,12 +737,16 @@ getspnam_plususer (const char *name, struct spwd *result, char *buffer,
       int outvallen;
 
       if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
-	return NSS_STATUS_NOTFOUND;
-
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
       if (yp_match (domain, "shadow.byname", name, strlen (name),
 		    &outval, &outvallen)  != YPERR_SUCCESS)
-	return NSS_STATUS_NOTFOUND;
-
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
       if (buflen < ((size_t) outvallen + 1))
 	{
 	  free (outval);
@@ -791,7 +796,10 @@ getspent_next_file (struct spwd *result, ent_t *ent,
 	  buffer[buflen - 1] = '\xff';
 	  p = fgets (buffer, buflen, ent->stream);
 	  if (p == NULL && feof (ent->stream))
-	    return NSS_STATUS_NOTFOUND;
+	    {
+	      *errnop = ENOENT;
+	      return NSS_STATUS_NOTFOUND;
+	    }
 	  if (p == NULL || buffer[buflen - 1] != '\xff')
 	    {
 	      fsetpos (ent->stream, &pos);
@@ -999,7 +1007,10 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
 	  buffer[buflen - 1] = '\xff';
 	  p = fgets (buffer, buflen, ent->stream);
 	  if (p == NULL && feof (ent->stream))
-	    return NSS_STATUS_NOTFOUND;
+	    {
+	      *errnop = ENOENT;
+	      return NSS_STATUS_NOTFOUND;
+	    }
 	  if (p == NULL || buffer[buflen - 1] != '\xff')
 	    {
 	      fsetpos (ent->stream, &pos);
@@ -1050,7 +1061,10 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
 	    {
 	      if (user != NULL && user[0] != '-')
 		if (strcmp (user, name) == 0)
-		  return NSS_STATUS_NOTFOUND;
+		  {
+		    *errnop = ENOENT;
+		    return NSS_STATUS_NOTFOUND;
+		  }
 	    }
 	  __internal_endnetgrent (&netgrdata);
 	  continue;
diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c
index 50f08d2e0c..d1dc992c83 100644
--- a/nis/nss_nis/nis-alias.c
+++ b/nis/nss_nis/nis-alias.c
@@ -167,7 +167,9 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
 				      &result, &len));
       if (retval != NSS_STATUS_SUCCESS)
 	{
-	  if (retval == NSS_STATUS_TRYAGAIN)
+	  if (retval == NSS_STATUS_NOTFOUND)
+	    *errnop = ENOENT;
+	  else if (retval == NSS_STATUS_TRYAGAIN)
             *errnop = errno;
           return retval;
         }
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c
index a5723747fc..c95f766469 100644
--- a/nis/nss_nis/nis-ethers.c
+++ b/nis/nss_nis/nis-ethers.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -158,7 +158,10 @@ internal_nis_getetherent_r (struct ether *eth, char *buffer, size_t buflen,
       char *p;
 
       if (next == NULL)
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
       p = strncpy (buffer, next->val, buflen);
 
       while (isspace (*p))
@@ -212,7 +215,9 @@ _nss_nis_gethostton_r (const char *name, struct ether *eth,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_NOTFOUND)
+	*errnop = ENOENT;
+      else if (retval == NSS_STATUS_TRYAGAIN)
         *errnop = errno;
       return retval;
     }
@@ -297,7 +302,10 @@ _nss_nis_getntohost_r (struct ether_addr *addr, struct ether *eth,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  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 40d45825e4..6dca66e4df 100644
--- a/nis/nss_nis/nis-grp.c
+++ b/nis/nss_nis/nis-grp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -104,7 +104,9 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
 
       if (retval != NSS_STATUS_SUCCESS)
         {
-          if (retval == NSS_STATUS_TRYAGAIN)
+	  if (retval == NSS_STATUS_NOTFOUND)
+	    *errnop = ENOENT;
+          else if (retval == NSS_STATUS_TRYAGAIN)
             *errnop = errno;
           return retval;
         }
@@ -178,7 +180,9 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_NOTFOUND)
+	*errnop = EAGAIN;
+      else if (retval == NSS_STATUS_TRYAGAIN)
         *errnop = errno;
       return retval;
     }
@@ -202,7 +206,10 @@ _nss_nis_getgrnam_r (const char *name, struct group *grp,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = EAGAIN;
+	  return NSS_STATUS_NOTFOUND;
+	}
     }
   return NSS_STATUS_SUCCESS;
 }
@@ -227,7 +234,9 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_NOTFOUND)
+	*errnop = ENOENT;
+      else if (retval == NSS_STATUS_TRYAGAIN)
         *errnop = errno;
       return retval;
     }
@@ -251,7 +260,10 @@ _nss_nis_getgrgid_r (gid_t gid, struct group *grp,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  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 4abc613bbb..d791b98b3e 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -176,6 +176,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
 	      *h_errnop = TRY_AGAIN;
 	      break;
 	    case NSS_STATUS_NOTFOUND:
+	      *errnop = ENOENT;
 	      *h_errnop = HOST_NOT_FOUND;
 	      break;
 	    default:
diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
index 5960c80502..b69fea4e85 100644
--- a/nis/nss_nis/nis-initgroups.c
+++ b/nis/nss_nis/nis-initgroups.c
@@ -112,7 +112,10 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
   do
     {
       if (intern->next == NULL)
-        return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
       p = strncpy (buffer, intern->next->val, buflen);
       while (isspace (*p))
         ++p;
diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c
index 802c03229e..7a1b65e584 100644
--- a/nis/nss_nis/nis-network.c
+++ b/nis/nss_nis/nis-network.c
@@ -104,7 +104,9 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
 
       if (retval != NSS_STATUS_SUCCESS)
         {
-          if (retval == NSS_STATUS_TRYAGAIN)
+	  if (retval == NSS_STATUS_NOTFOUND)
+	    *errnop = ENOENT;
+          else if (retval == NSS_STATUS_TRYAGAIN)
 	    {
 	      *herrnop = NETDB_INTERNAL;
 	      *errnop = errno;
@@ -203,7 +205,9 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_NOTFOUND)
+	*errnop = ENOENT;
+      else if (retval == NSS_STATUS_TRYAGAIN)
 	{
 	  *errnop = errno;
 	  *herrnop = NETDB_INTERNAL;
@@ -233,7 +237,10 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-        return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
     }
   else
     return NSS_STATUS_SUCCESS;
@@ -281,7 +288,10 @@ _nss_nis_getnetbyaddr_r (unsigned long addr, int type, struct netent *net,
 		    continue;
 		  }
 		else
-		  return NSS_STATUS_NOTFOUND;
+		  {
+		    *errnop = ENOENT;
+		    return NSS_STATUS_NOTFOUND;
+		  }
 	      }
 	    else
 	      {
@@ -313,7 +323,10 @@ _nss_nis_getnetbyaddr_r (unsigned long addr, int type, struct netent *net,
 	    if (parse_res == -1)
 	      return NSS_STATUS_TRYAGAIN;
 	    else
-	      return NSS_STATUS_NOTFOUND;
+	      {
+		*errnop = ENOENT;
+		return NSS_STATUS_NOTFOUND;
+	      }
 	  }
 	else
 	  return NSS_STATUS_SUCCESS;
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index 3af0f4e896..e65bfa7c8d 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -150,7 +150,10 @@ internal_nis_getprotoent_r (struct protoent *proto,
       char *p;
 
       if (next == NULL)
-        return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
       p = strncpy (buffer, next->val, buflen);
 
       while (isspace (*p))
@@ -204,7 +207,9 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_NOTFOUND)
+	*errnop = ENOENT;
+      else if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -228,7 +233,10 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
     }
   return NSS_STATUS_SUCCESS;
 }
@@ -253,7 +261,9 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_NOTFOUND)
+	*errnop = ENOENT;
+      else if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -277,7 +287,10 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  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 1ab041f435..73afd442a9 100644
--- a/nis/nss_nis/nis-publickey.c
+++ b/nis/nss_nis/nis-publickey.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -30,7 +30,9 @@ extern int xdecrypt (char *, char *);
 
 #include "nss-nis.h"
 
-/* If we haven't found the entry, we give a SUCCESS and an empty key back. */
+/* If we haven't found the entry, we give a SUCCESS and an empty key back.
+   Solaris docu says: sizeof (pkey) == HEXKEYBYTES + 1.
+*/
 enum nss_status
 _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop)
 {
@@ -56,7 +58,9 @@ _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop)
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_NOTFOUND)
+	*errnop = ENOENT;
+      else if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -66,7 +70,8 @@ _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop)
       char *p = strchr (result, ':');
       if (p != NULL)
 	*p = 0;
-      strcpy (pkey, result);
+      strncpy (pkey, result, HEXKEYBYTES + 1);
+      pkey[HEXKEYBYTES] = '\0';
     }
   return NSS_STATUS_SUCCESS;
 }
@@ -76,7 +81,7 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
 		       int *errnop)
 {
   enum nss_status retval;
-  char buf[1024];
+  char buf[2 * (HEXKEYBYTES + 1)];
   char *domain, *result;
   int len;
 
@@ -98,7 +103,9 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_NOTFOUND)
+	*errnop = ENOENT;
+      else if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -109,15 +116,16 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
       if (p == NULL)
 	return NSS_STATUS_SUCCESS;
 
-      p++;
-      strcpy (buf, p);
+      ++p;
+      strncpy (buf, p, 2 * (HEXKEYBYTES + 1));
+      buf[2 * (HEXKEYBYTES + 1)] = '\0';
       if (!xdecrypt (buf, passwd))
 	return NSS_STATUS_SUCCESS;
 
       if (memcmp (buf, &(buf[HEXKEYBYTES]), KEYCHECKSUMSIZE) != 0)
 	return NSS_STATUS_SUCCESS;
 
-      buf[HEXKEYBYTES] = 0;
+      buf[HEXKEYBYTES] = '\0';
       strcpy (skey, buf);
     }
   return NSS_STATUS_SUCCESS;
diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c
index b70091508c..614637a173 100644
--- a/nis/nss_nis/nis-pwd.c
+++ b/nis/nss_nis/nis-pwd.c
@@ -106,7 +106,9 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
 
       if (retval != NSS_STATUS_SUCCESS)
         {
-          if (retval == NSS_STATUS_TRYAGAIN)
+	  if (retval == NSS_STATUS_NOTFOUND)
+	    *errnop = ENOENT;
+          else if (retval == NSS_STATUS_TRYAGAIN)
             *errnop = errno;
           return retval;
         }
@@ -231,7 +233,9 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_NOTFOUND)
+	*errnop = ENOENT;
+      else if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -302,7 +306,10 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
       if (parse_res == -1)
         return NSS_STATUS_TRYAGAIN;
       else
-        return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
     }
   else
     return NSS_STATUS_SUCCESS;
@@ -329,7 +336,9 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_NOTFOUND)
+	*errnop = ENOENT;
+      else if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -400,8 +409,11 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
     {
       if (parse_res == -1)
         return NSS_STATUS_TRYAGAIN;
-      else
-        return NSS_STATUS_NOTFOUND;
+     else
+       {
+	 *errnop = ENOENT;
+	 return NSS_STATUS_NOTFOUND;
+       }
     }
   else
     return NSS_STATUS_SUCCESS;
diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c
index 879e90af6d..a56ad037fe 100644
--- a/nis/nss_nis/nis-rpc.c
+++ b/nis/nss_nis/nis-rpc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -167,7 +167,10 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
   do
     {
       if (data->next == NULL)
-        return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
       p = strncpy (buffer, data->next->val, buflen);
       while (isspace (*p))
         ++p;
@@ -242,7 +245,10 @@ _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc,
   internal_nis_endrpcent (&data);
 
   if (!found && status == NSS_STATUS_SUCCESS)
-    return NSS_STATUS_NOTFOUND;
+    {
+      *errnop = ENOENT;
+      return NSS_STATUS_NOTFOUND;
+    }
   else
     return status;
 }
@@ -267,7 +273,9 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_NOTFOUND)
+	*errnop = ENOENT;
+      else if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -292,7 +300,10 @@ _nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
     }
   else
     return NSS_STATUS_SUCCESS;
diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c
index dfae9f7be2..fac62a9679 100644
--- a/nis/nss_nis/nis-service.c
+++ b/nis/nss_nis/nis-service.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -166,7 +166,10 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
   do
     {
       if (data->next == NULL)
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
       p = strncpy (buffer, data->next->val, buflen);
            while (isspace (*p))
         ++p;
@@ -236,7 +239,10 @@ _nss_nis_getservbyname_r (const char *name, char *protocol,
   internal_nis_endservent (&data);
 
   if (!found && status == NSS_STATUS_SUCCESS)
-    return NSS_STATUS_NOTFOUND;
+    {
+      *errnop = ENOENT;
+      return NSS_STATUS_NOTFOUND;
+    }
   else
     return status;
 }
@@ -270,7 +276,10 @@ _nss_nis_getservbyport_r (int port, char *protocol, struct servent *serv,
   internal_nis_endservent (&data);
 
   if (!found && status == NSS_STATUS_SUCCESS)
-    return NSS_STATUS_NOTFOUND;
+    {
+      *errnop = ENOENT;
+      return NSS_STATUS_NOTFOUND;
+    }
   else
     return status;
 }
diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c
index 452f91dc0b..37ea2f9dbf 100644
--- a/nis/nss_nis/nis-spwd.c
+++ b/nis/nss_nis/nis-spwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -104,7 +104,9 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen,
 
       if (retval != NSS_STATUS_SUCCESS)
         {
-          if (retval == NSS_STATUS_TRYAGAIN)
+          if (retval == NSS_STATUS_NOTFOUND)
+	    *errnop = ENOENT;
+	  else if (retval == NSS_STATUS_TRYAGAIN)
 	    *errnop = errno;
           return retval;
         }
@@ -178,7 +180,9 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
 
   if (retval != NSS_STATUS_SUCCESS)
     {
-      if (retval == NSS_STATUS_TRYAGAIN)
+      if (retval == NSS_STATUS_NOTFOUND)
+	*errnop = ENOENT;
+      else if (retval == NSS_STATUS_TRYAGAIN)
 	*errnop = errno;
       return retval;
     }
@@ -202,7 +206,10 @@ _nss_nis_getspnam_r (const char *name, struct spwd *sp,
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
       else
-	return NSS_STATUS_NOTFOUND;
+	{
+	  *errnop = ENOENT;
+	  return NSS_STATUS_NOTFOUND;
+	}
     }
   return NSS_STATUS_SUCCESS;
 }
diff --git a/nis/rpcsvc/yp.h b/nis/rpcsvc/yp.h
index 40914c5813..556e57476f 100644
--- a/nis/rpcsvc/yp.h
+++ b/nis/rpcsvc/yp.h
@@ -30,6 +30,7 @@
 #ifndef __RPCSVC_YP_H__
 #define __RPCSVC_YP_H__
 
+#include <features.h>
 #include <rpc/rpc.h>
 
 #define YPMAXRECORD 1024
@@ -51,14 +52,6 @@ enum ypstat {
 	YP_VERS = -8,
 };
 typedef enum ypstat ypstat;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypstat(XDR *, ypstat*);
-#elif __STDC__
-extern  bool_t xdr_ypstat(XDR *, ypstat*);
-#else /* Old Style C */
-bool_t xdr_ypstat();
-#endif /* Old Style C */
-
 
 enum ypxfrstat {
 	YPXFR_SUCC = 1,
@@ -79,543 +72,266 @@ enum ypxfrstat {
 	YPXFR_REFUSED = -14,
 };
 typedef enum ypxfrstat ypxfrstat;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypxfrstat(XDR *, ypxfrstat*);
-#elif __STDC__
-extern  bool_t xdr_ypxfrstat(XDR *, ypxfrstat*);
-#else /* Old Style C */
-bool_t xdr_ypxfrstat();
-#endif /* Old Style C */
-
 
 typedef char *domainname;
-#ifdef __cplusplus
-extern "C" bool_t xdr_domainname(XDR *, domainname*);
-#elif __STDC__
-extern  bool_t xdr_domainname(XDR *, domainname*);
-#else /* Old Style C */
-bool_t xdr_domainname();
-#endif /* Old Style C */
-
-
 typedef char *mapname;
-#ifdef __cplusplus
-extern "C" bool_t xdr_mapname(XDR *, mapname*);
-#elif __STDC__
-extern  bool_t xdr_mapname(XDR *, mapname*);
-#else /* Old Style C */
-bool_t xdr_mapname();
-#endif /* Old Style C */
-
-
 typedef char *peername;
-#ifdef __cplusplus
-extern "C" bool_t xdr_peername(XDR *, peername*);
-#elif __STDC__
-extern  bool_t xdr_peername(XDR *, peername*);
-#else /* Old Style C */
-bool_t xdr_peername();
-#endif /* Old Style C */
-
 
 typedef struct {
-	u_int keydat_len;
-	char *keydat_val;
+  u_int keydat_len;
+  char *keydat_val;
 } keydat;
-#ifdef __cplusplus
-extern "C" bool_t xdr_keydat(XDR *, keydat*);
-#elif __STDC__
-extern  bool_t xdr_keydat(XDR *, keydat*);
-#else /* Old Style C */
-bool_t xdr_keydat();
-#endif /* Old Style C */
-
 
 typedef struct {
-	u_int valdat_len;
-	char *valdat_val;
+  u_int valdat_len;
+  char *valdat_val;
 } valdat;
-#ifdef __cplusplus
-extern "C" bool_t xdr_valdat(XDR *, valdat*);
-#elif __STDC__
-extern  bool_t xdr_valdat(XDR *, valdat*);
-#else /* Old Style C */
-bool_t xdr_valdat();
-#endif /* Old Style C */
-
 
 struct ypmap_parms {
-	domainname domain;
-	mapname map;
-	u_int ordernum;
-	peername peer;
+  domainname domain;
+  mapname map;
+  u_int ordernum;
+  peername peer;
 };
 typedef struct ypmap_parms ypmap_parms;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypmap_parms(XDR *, ypmap_parms*);
-#elif __STDC__
-extern  bool_t xdr_ypmap_parms(XDR *, ypmap_parms*);
-#else /* Old Style C */
-bool_t xdr_ypmap_parms();
-#endif /* Old Style C */
-
 
 struct ypreq_key {
-	domainname domain;
-	mapname map;
-	keydat key;
+  domainname domain;
+  mapname map;
+  keydat key;
 };
 typedef struct ypreq_key ypreq_key;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypreq_key(XDR *, ypreq_key*);
-#elif __STDC__
-extern  bool_t xdr_ypreq_key(XDR *, ypreq_key*);
-#else /* Old Style C */
-bool_t xdr_ypreq_key();
-#endif /* Old Style C */
-
 
 struct ypreq_nokey {
-	domainname domain;
-	mapname map;
+  domainname domain;
+  mapname map;
 };
 typedef struct ypreq_nokey ypreq_nokey;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypreq_nokey(XDR *, ypreq_nokey*);
-#elif __STDC__
-extern  bool_t xdr_ypreq_nokey(XDR *, ypreq_nokey*);
-#else /* Old Style C */
-bool_t xdr_ypreq_nokey();
-#endif /* Old Style C */
-
 
 struct ypreq_xfr {
-	ypmap_parms map_parms;
-	u_int transid;
-	u_int prog;
-	u_int port;
+  ypmap_parms map_parms;
+  u_int transid;
+  u_int prog;
+  u_int port;
 };
 typedef struct ypreq_xfr ypreq_xfr;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypreq_xfr(XDR *, ypreq_xfr*);
-#elif __STDC__
-extern  bool_t xdr_ypreq_xfr(XDR *, ypreq_xfr*);
-#else /* Old Style C */
-bool_t xdr_ypreq_xfr();
-#endif /* Old Style C */
-
 
 struct ypresp_val {
-	ypstat stat;
-	valdat val;
+  ypstat stat;
+  valdat val;
 };
 typedef struct ypresp_val ypresp_val;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypresp_val(XDR *, ypresp_val*);
-#elif __STDC__
-extern  bool_t xdr_ypresp_val(XDR *, ypresp_val*);
-#else /* Old Style C */
-bool_t xdr_ypresp_val();
-#endif /* Old Style C */
-
 
 struct ypresp_key_val {
-	ypstat stat;
+  ypstat stat;
 #ifdef STUPID_SUN_BUG
-	/* This is the form as distributed by Sun.  But even the Sun NIS
-	   servers expect the values in the other order.  So their
-	   implementation somehow must change the order internally.  We
-	   don't want to follow this bad example since the user should be
-	   able to use rpcgen on this file.  */
-	keydat key;
-	valdat val;
+  /* This is the form as distributed by Sun.  But even the Sun NIS
+     servers expect the values in the other order.  So their
+     implementation somehow must change the order internally.  We
+     don't want to follow this bad example since the user should be
+     able to use rpcgen on this file.  */
+  keydat key;
+  valdat val;
 #else
-	valdat val;
-	keydat key;
+  valdat val;
+  keydat key;
 #endif
 };
 typedef struct ypresp_key_val ypresp_key_val;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypresp_key_val(XDR *, ypresp_key_val*);
-#elif __STDC__
-extern  bool_t xdr_ypresp_key_val(XDR *, ypresp_key_val*);
-#else /* Old Style C */
-bool_t xdr_ypresp_key_val();
-#endif /* Old Style C */
-
 
 struct ypresp_master {
-	ypstat stat;
-	peername peer;
+  ypstat stat;
+  peername peer;
 };
 typedef struct ypresp_master ypresp_master;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypresp_master(XDR *, ypresp_master*);
-#elif __STDC__
-extern  bool_t xdr_ypresp_master(XDR *, ypresp_master*);
-#else /* Old Style C */
-bool_t xdr_ypresp_master();
-#endif /* Old Style C */
-
 
 struct ypresp_order {
-	ypstat stat;
-	u_int ordernum;
+  ypstat stat;
+  u_int ordernum;
 };
 typedef struct ypresp_order ypresp_order;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypresp_order(XDR *, ypresp_order*);
-#elif __STDC__
-extern  bool_t xdr_ypresp_order(XDR *, ypresp_order*);
-#else /* Old Style C */
-bool_t xdr_ypresp_order();
-#endif /* Old Style C */
-
 
 struct ypresp_all {
-	bool_t more;
-	union {
-		ypresp_key_val val;
-	} ypresp_all_u;
+  bool_t more;
+  union {
+    ypresp_key_val val;
+  } ypresp_all_u;
 };
 typedef struct ypresp_all ypresp_all;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypresp_all(XDR *, ypresp_all*);
-#elif __STDC__
-extern  bool_t xdr_ypresp_all(XDR *, ypresp_all*);
-#else /* Old Style C */
-bool_t xdr_ypresp_all();
-#endif /* Old Style C */
-
 
 struct ypresp_xfr {
-	u_int transid;
-	ypxfrstat xfrstat;
+  u_int transid;
+  ypxfrstat xfrstat;
 };
 typedef struct ypresp_xfr ypresp_xfr;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypresp_xfr(XDR *, ypresp_xfr*);
-#elif __STDC__
-extern  bool_t xdr_ypresp_xfr(XDR *, ypresp_xfr*);
-#else /* Old Style C */
-bool_t xdr_ypresp_xfr();
-#endif /* Old Style C */
-
 
 struct ypmaplist {
-	mapname map;
-	struct ypmaplist *next;
+  mapname map;
+  struct ypmaplist *next;
 };
 typedef struct ypmaplist ypmaplist;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypmaplist(XDR *, ypmaplist*);
-#elif __STDC__
-extern  bool_t xdr_ypmaplist(XDR *, ypmaplist*);
-#else /* Old Style C */
-bool_t xdr_ypmaplist();
-#endif /* Old Style C */
-
 
 struct ypresp_maplist {
-	ypstat stat;
-	ypmaplist *maps;
+  ypstat stat;
+  ypmaplist *maps;
 };
 typedef struct ypresp_maplist ypresp_maplist;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypresp_maplist(XDR *, ypresp_maplist*);
-#elif __STDC__
-extern  bool_t xdr_ypresp_maplist(XDR *, ypresp_maplist*);
-#else /* Old Style C */
-bool_t xdr_ypresp_maplist();
-#endif /* Old Style C */
-
 
 enum yppush_status {
-	YPPUSH_SUCC = 1,
-	YPPUSH_AGE = 2,
-	YPPUSH_NOMAP = -1,
-	YPPUSH_NODOM = -2,
-	YPPUSH_RSRC = -3,
-	YPPUSH_RPC = -4,
-	YPPUSH_MADDR = -5,
-	YPPUSH_YPERR = -6,
-	YPPUSH_BADARGS = -7,
-	YPPUSH_DBM = -8,
-	YPPUSH_FILE = -9,
-	YPPUSH_SKEW = -10,
-	YPPUSH_CLEAR = -11,
-	YPPUSH_FORCE = -12,
-	YPPUSH_XFRERR = -13,
-	YPPUSH_REFUSED = -14,
+  YPPUSH_SUCC = 1,
+  YPPUSH_AGE = 2,
+  YPPUSH_NOMAP = -1,
+  YPPUSH_NODOM = -2,
+  YPPUSH_RSRC = -3,
+  YPPUSH_RPC = -4,
+  YPPUSH_MADDR = -5,
+  YPPUSH_YPERR = -6,
+  YPPUSH_BADARGS = -7,
+  YPPUSH_DBM = -8,
+  YPPUSH_FILE = -9,
+  YPPUSH_SKEW = -10,
+  YPPUSH_CLEAR = -11,
+  YPPUSH_FORCE = -12,
+  YPPUSH_XFRERR = -13,
+  YPPUSH_REFUSED = -14,
 };
 typedef enum yppush_status yppush_status;
-#ifdef __cplusplus
-extern "C" bool_t xdr_yppush_status(XDR *, yppush_status*);
-#elif __STDC__
-extern  bool_t xdr_yppush_status(XDR *, yppush_status*);
-#else /* Old Style C */
-bool_t xdr_yppush_status();
-#endif /* Old Style C */
-
 
 struct yppushresp_xfr {
-	u_int transid;
-	yppush_status status;
+  u_int transid;
+  yppush_status status;
 };
 typedef struct yppushresp_xfr yppushresp_xfr;
-#ifdef __cplusplus
-extern "C" bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr*);
-#elif __STDC__
-extern  bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr*);
-#else /* Old Style C */
-bool_t xdr_yppushresp_xfr();
-#endif /* Old Style C */
-
 
 enum ypbind_resptype {
-	YPBIND_SUCC_VAL = 1,
-	YPBIND_FAIL_VAL = 2,
+  YPBIND_SUCC_VAL = 1,
+  YPBIND_FAIL_VAL = 2,
 };
 typedef enum ypbind_resptype ypbind_resptype;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypbind_resptype(XDR *, ypbind_resptype*);
-#elif __STDC__
-extern  bool_t xdr_ypbind_resptype(XDR *, ypbind_resptype*);
-#else /* Old Style C */
-bool_t xdr_ypbind_resptype();
-#endif /* Old Style C */
-
 
 struct ypbind_binding {
-	char ypbind_binding_addr[4];
-	char ypbind_binding_port[2];
+  char ypbind_binding_addr[4];
+  char ypbind_binding_port[2];
 };
 typedef struct ypbind_binding ypbind_binding;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypbind_binding(XDR *, ypbind_binding*);
-#elif __STDC__
-extern  bool_t xdr_ypbind_binding(XDR *, ypbind_binding*);
-#else /* Old Style C */
-bool_t xdr_ypbind_binding();
-#endif /* Old Style C */
-
 
 struct ypbind_resp {
-	ypbind_resptype ypbind_status;
-	union {
-		u_int ypbind_error;
-		ypbind_binding ypbind_bindinfo;
-	} ypbind_resp_u;
+  ypbind_resptype ypbind_status;
+  union {
+    u_int ypbind_error;
+    ypbind_binding ypbind_bindinfo;
+  } ypbind_resp_u;
 };
 typedef struct ypbind_resp ypbind_resp;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypbind_resp(XDR *, ypbind_resp*);
-#elif __STDC__
-extern  bool_t xdr_ypbind_resp(XDR *, ypbind_resp*);
-#else /* Old Style C */
-bool_t xdr_ypbind_resp();
-#endif /* Old Style C */
 
 #define YPBIND_ERR_ERR 1
 #define YPBIND_ERR_NOSERV 2
 #define YPBIND_ERR_RESC 3
 
 struct ypbind_setdom {
-	domainname ypsetdom_domain;
-	ypbind_binding ypsetdom_binding;
-	u_int ypsetdom_vers;
+  domainname ypsetdom_domain;
+  ypbind_binding ypsetdom_binding;
+  u_int ypsetdom_vers;
 };
 typedef struct ypbind_setdom ypbind_setdom;
-#ifdef __cplusplus
-extern "C" bool_t xdr_ypbind_setdom(XDR *, ypbind_setdom*);
-#elif __STDC__
-extern  bool_t xdr_ypbind_setdom(XDR *, ypbind_setdom*);
-#else /* Old Style C */
-bool_t xdr_ypbind_setdom();
-#endif /* Old Style C */
 
+__BEGIN_DECLS
 
 #define YPPROG ((u_long)100004)
 #define YPVERS ((u_long)2)
 
-#ifdef __cplusplus
 #define YPPROC_NULL ((u_long)0)
-extern "C" void * ypproc_null_2(void *, CLIENT *);
-extern "C" void * ypproc_null_2_svc(void *, struct svc_req *);
+extern  void *ypproc_null_2 __P ((void *, CLIENT *));
+extern  void *ypproc_null_2_svc __P ((void *, struct svc_req *));
 #define YPPROC_DOMAIN ((u_long)1)
-extern "C" bool_t * ypproc_domain_2(domainname *, CLIENT *);
-extern "C" bool_t * ypproc_domain_2_svc(domainname *, struct svc_req *);
+extern  bool_t *ypproc_domain_2 __P ((domainname *, CLIENT *));
+extern  bool_t *ypproc_domain_2_svc __P ((domainname *, struct svc_req *));
 #define YPPROC_DOMAIN_NONACK ((u_long)2)
-extern "C" bool_t * ypproc_domain_nonack_2(domainname *, CLIENT *);
-extern "C" bool_t * ypproc_domain_nonack_2_svc(domainname *, struct svc_req *);
+extern  bool_t *ypproc_domain_nonack_2 __P ((domainname *, CLIENT *));
+extern  bool_t *ypproc_domain_nonack_2_svc __P ((domainname *, struct svc_req *));
 #define YPPROC_MATCH ((u_long)3)
-extern "C" ypresp_val * ypproc_match_2(ypreq_key *, CLIENT *);
-extern "C" ypresp_val * ypproc_match_2_svc(ypreq_key *, struct svc_req *);
+extern  ypresp_val *ypproc_match_2 __P ((ypreq_key *, CLIENT *));
+extern  ypresp_val *ypproc_match_2_svc __P ((ypreq_key *, struct svc_req *));
 #define YPPROC_FIRST ((u_long)4)
-extern "C" ypresp_key_val * ypproc_first_2(ypreq_key *, CLIENT *);
-extern "C" ypresp_key_val * ypproc_first_2_svc(ypreq_key *, struct svc_req *);
+extern  ypresp_key_val *ypproc_first_2 __P ((ypreq_key *, CLIENT *));
+extern  ypresp_key_val *ypproc_first_2_svc __P ((ypreq_key *, struct svc_req *));
 #define YPPROC_NEXT ((u_long)5)
-extern "C" ypresp_key_val * ypproc_next_2(ypreq_key *, CLIENT *);
-extern "C" ypresp_key_val * ypproc_next_2_svc(ypreq_key *, struct svc_req *);
+extern  ypresp_key_val *ypproc_next_2 __P ((ypreq_key *, CLIENT *));
+extern  ypresp_key_val *ypproc_next_2_svc __P ((ypreq_key *, struct svc_req *));
 #define YPPROC_XFR ((u_long)6)
-extern "C" ypresp_xfr * ypproc_xfr_2(ypreq_xfr *, CLIENT *);
-extern "C" ypresp_xfr * ypproc_xfr_2_svc(ypreq_xfr *, struct svc_req *);
+extern  ypresp_xfr *ypproc_xfr_2 __P ((ypreq_xfr *, CLIENT *));
+extern  ypresp_xfr *ypproc_xfr_2_svc __P ((ypreq_xfr *, struct svc_req *));
 #define YPPROC_CLEAR ((u_long)7)
-extern "C" void * ypproc_clear_2(void *, CLIENT *);
-extern "C" void * ypproc_clear_2_svc(void *, struct svc_req *);
+extern  void *ypproc_clear_2 __P ((void *, CLIENT *));
+extern  void *ypproc_clear_2_svc __P ((void *, struct svc_req *));
 #define YPPROC_ALL ((u_long)8)
-extern "C" ypresp_all * ypproc_all_2(ypreq_nokey *, CLIENT *);
-extern "C" ypresp_all * ypproc_all_2_svc(ypreq_nokey *, struct svc_req *);
+extern  ypresp_all *ypproc_all_2 __P ((ypreq_nokey *, CLIENT *));
+extern  ypresp_all *ypproc_all_2_svc __P ((ypreq_nokey *, struct svc_req *));
 #define YPPROC_MASTER ((u_long)9)
-extern "C" ypresp_master * ypproc_master_2(ypreq_nokey *, CLIENT *);
-extern "C" ypresp_master * ypproc_master_2_svc(ypreq_nokey *, struct svc_req *);
+extern  ypresp_master *ypproc_master_2 __P ((ypreq_nokey *, CLIENT *));
+extern  ypresp_master *ypproc_master_2_svc __P ((ypreq_nokey *, struct svc_req *));
 #define YPPROC_ORDER ((u_long)10)
-extern "C" ypresp_order * ypproc_order_2(ypreq_nokey *, CLIENT *);
-extern "C" ypresp_order * ypproc_order_2_svc(ypreq_nokey *, struct svc_req *);
+extern  ypresp_order *ypproc_order_2 __P ((ypreq_nokey *, CLIENT *));
+extern  ypresp_order *ypproc_order_2_svc __P ((ypreq_nokey *, struct svc_req *));
 #define YPPROC_MAPLIST ((u_long)11)
-extern "C" ypresp_maplist * ypproc_maplist_2(domainname *, CLIENT *);
-extern "C" ypresp_maplist * ypproc_maplist_2_svc(domainname *, struct svc_req *);
+extern  ypresp_maplist *ypproc_maplist_2 __P ((domainname *, CLIENT *));
+extern  ypresp_maplist *ypproc_maplist_2_svc __P ((domainname *, struct svc_req *));
+extern int ypprog_2_freeresult __P ((SVCXPRT *, xdrproc_t, caddr_t));
 
-#elif __STDC__
-#define YPPROC_NULL ((u_long)0)
-extern  void * ypproc_null_2(void *, CLIENT *);
-extern  void * ypproc_null_2_svc(void *, struct svc_req *);
-#define YPPROC_DOMAIN ((u_long)1)
-extern  bool_t * ypproc_domain_2(domainname *, CLIENT *);
-extern  bool_t * ypproc_domain_2_svc(domainname *, struct svc_req *);
-#define YPPROC_DOMAIN_NONACK ((u_long)2)
-extern  bool_t * ypproc_domain_nonack_2(domainname *, CLIENT *);
-extern  bool_t * ypproc_domain_nonack_2_svc(domainname *, struct svc_req *);
-#define YPPROC_MATCH ((u_long)3)
-extern  ypresp_val * ypproc_match_2(ypreq_key *, CLIENT *);
-extern  ypresp_val * ypproc_match_2_svc(ypreq_key *, struct svc_req *);
-#define YPPROC_FIRST ((u_long)4)
-extern  ypresp_key_val * ypproc_first_2(ypreq_key *, CLIENT *);
-extern  ypresp_key_val * ypproc_first_2_svc(ypreq_key *, struct svc_req *);
-#define YPPROC_NEXT ((u_long)5)
-extern  ypresp_key_val * ypproc_next_2(ypreq_key *, CLIENT *);
-extern  ypresp_key_val * ypproc_next_2_svc(ypreq_key *, struct svc_req *);
-#define YPPROC_XFR ((u_long)6)
-extern  ypresp_xfr * ypproc_xfr_2(ypreq_xfr *, CLIENT *);
-extern  ypresp_xfr * ypproc_xfr_2_svc(ypreq_xfr *, struct svc_req *);
-#define YPPROC_CLEAR ((u_long)7)
-extern  void * ypproc_clear_2(void *, CLIENT *);
-extern  void * ypproc_clear_2_svc(void *, struct svc_req *);
-#define YPPROC_ALL ((u_long)8)
-extern  ypresp_all * ypproc_all_2(ypreq_nokey *, CLIENT *);
-extern  ypresp_all * ypproc_all_2_svc(ypreq_nokey *, struct svc_req *);
-#define YPPROC_MASTER ((u_long)9)
-extern  ypresp_master * ypproc_master_2(ypreq_nokey *, CLIENT *);
-extern  ypresp_master * ypproc_master_2_svc(ypreq_nokey *, struct svc_req *);
-#define YPPROC_ORDER ((u_long)10)
-extern  ypresp_order * ypproc_order_2(ypreq_nokey *, CLIENT *);
-extern  ypresp_order * ypproc_order_2_svc(ypreq_nokey *, struct svc_req *);
-#define YPPROC_MAPLIST ((u_long)11)
-extern  ypresp_maplist * ypproc_maplist_2(domainname *, CLIENT *);
-extern  ypresp_maplist * ypproc_maplist_2_svc(domainname *, struct svc_req *);
-
-#else /* Old Style C */
-#define YPPROC_NULL ((u_long)0)
-extern  void * ypproc_null_2();
-extern  void * ypproc_null_2_svc();
-#define YPPROC_DOMAIN ((u_long)1)
-extern  bool_t * ypproc_domain_2();
-extern  bool_t * ypproc_domain_2_svc();
-#define YPPROC_DOMAIN_NONACK ((u_long)2)
-extern  bool_t * ypproc_domain_nonack_2();
-extern  bool_t * ypproc_domain_nonack_2_svc();
-#define YPPROC_MATCH ((u_long)3)
-extern  ypresp_val * ypproc_match_2();
-extern  ypresp_val * ypproc_match_2_svc();
-#define YPPROC_FIRST ((u_long)4)
-extern  ypresp_key_val * ypproc_first_2();
-extern  ypresp_key_val * ypproc_first_2_svc();
-#define YPPROC_NEXT ((u_long)5)
-extern  ypresp_key_val * ypproc_next_2();
-extern  ypresp_key_val * ypproc_next_2_svc();
-#define YPPROC_XFR ((u_long)6)
-extern  ypresp_xfr * ypproc_xfr_2();
-extern  ypresp_xfr * ypproc_xfr_2_svc();
-#define YPPROC_CLEAR ((u_long)7)
-extern  void * ypproc_clear_2();
-extern  void * ypproc_clear_2_svc();
-#define YPPROC_ALL ((u_long)8)
-extern  ypresp_all * ypproc_all_2();
-extern  ypresp_all * ypproc_all_2_svc();
-#define YPPROC_MASTER ((u_long)9)
-extern  ypresp_master * ypproc_master_2();
-extern  ypresp_master * ypproc_master_2_svc();
-#define YPPROC_ORDER ((u_long)10)
-extern  ypresp_order * ypproc_order_2();
-extern  ypresp_order * ypproc_order_2_svc();
-#define YPPROC_MAPLIST ((u_long)11)
-extern  ypresp_maplist * ypproc_maplist_2();
-extern  ypresp_maplist * ypproc_maplist_2_svc();
-#endif /* Old Style C */
 
 #define YPPUSH_XFRRESPPROG ((u_long)0x40000000)
 #define YPPUSH_XFRRESPVERS ((u_long)1)
 
-#ifdef __cplusplus
-#define YPPUSHPROC_NULL ((u_long)0)
-extern "C" void * yppushproc_null_1(void *, CLIENT *);
-extern "C" void * yppushproc_null_1_svc(void *, struct svc_req *);
-#define YPPUSHPROC_XFRRESP ((u_long)1)
-extern "C" void * yppushproc_xfrresp_1(yppushresp_xfr *, CLIENT *);
-extern "C" void * yppushproc_xfrresp_1_svc(yppushresp_xfr *, struct svc_req *);
-
-#elif __STDC__
 #define YPPUSHPROC_NULL ((u_long)0)
-extern  void * yppushproc_null_1(void *, CLIENT *);
-extern  void * yppushproc_null_1_svc(void *, struct svc_req *);
+extern  void *yppushproc_null_1 __P ((void *, CLIENT *));
+extern  void *yppushproc_null_1_svc __P ((void *, struct svc_req *));
 #define YPPUSHPROC_XFRRESP ((u_long)1)
-extern  void * yppushproc_xfrresp_1(yppushresp_xfr *, CLIENT *);
-extern  void * yppushproc_xfrresp_1_svc(yppushresp_xfr *, struct svc_req *);
+extern  void *yppushproc_xfrresp_1 __P ((yppushresp_xfr *, CLIENT *));
+extern  void *yppushproc_xfrresp_1_svc __P ((yppushresp_xfr *, struct svc_req *));
+extern int yppush_xfrrespprog_1_freeresult __P ((SVCXPRT *, xdrproc_t, caddr_t));
 
-#else /* Old Style C */
-#define YPPUSHPROC_NULL ((u_long)0)
-extern  void * yppushproc_null_1();
-extern  void * yppushproc_null_1_svc();
-#define YPPUSHPROC_XFRRESP ((u_long)1)
-extern  void * yppushproc_xfrresp_1();
-extern  void * yppushproc_xfrresp_1_svc();
-#endif /* Old Style C */
 
 #define YPBINDPROG ((u_long)100007)
 #define YPBINDVERS ((u_long)2)
 
-#ifdef __cplusplus
-#define YPBINDPROC_NULL ((u_long)0)
-extern "C" void * ypbindproc_null_2(void *, CLIENT *);
-extern "C" void * ypbindproc_null_2_svc(void *, struct svc_req *);
-#define YPBINDPROC_DOMAIN ((u_long)1)
-extern "C" ypbind_resp * ypbindproc_domain_2(domainname *, CLIENT *);
-extern "C" ypbind_resp * ypbindproc_domain_2_svc(domainname *, struct svc_req *);
-#define YPBINDPROC_SETDOM ((u_long)2)
-extern "C" void * ypbindproc_setdom_2(ypbind_setdom *, CLIENT *);
-extern "C" void * ypbindproc_setdom_2_svc(ypbind_setdom *, struct svc_req *);
-
-#elif __STDC__
-#define YPBINDPROC_NULL ((u_long)0)
-extern  void * ypbindproc_null_2(void *, CLIENT *);
-extern  void * ypbindproc_null_2_svc(void *, struct svc_req *);
-#define YPBINDPROC_DOMAIN ((u_long)1)
-extern  ypbind_resp * ypbindproc_domain_2(domainname *, CLIENT *);
-extern  ypbind_resp * ypbindproc_domain_2_svc(domainname *, struct svc_req *);
-#define YPBINDPROC_SETDOM ((u_long)2)
-extern  void * ypbindproc_setdom_2(ypbind_setdom *, CLIENT *);
-extern  void * ypbindproc_setdom_2_svc(ypbind_setdom *, struct svc_req *);
-
-#else /* Old Style C */
 #define YPBINDPROC_NULL ((u_long)0)
-extern  void * ypbindproc_null_2();
-extern  void * ypbindproc_null_2_svc();
+extern  void *ypbindproc_null_2 __P ((void *, CLIENT *));
+extern  void *ypbindproc_null_2_svc __P ((void *, struct svc_req *));
 #define YPBINDPROC_DOMAIN ((u_long)1)
-extern  ypbind_resp * ypbindproc_domain_2();
-extern  ypbind_resp * ypbindproc_domain_2_svc();
+extern  ypbind_resp *ypbindproc_domain_2 __P ((domainname *, CLIENT *));
+extern  ypbind_resp *ypbindproc_domain_2_svc __P ((domainname *, struct svc_req *));
 #define YPBINDPROC_SETDOM ((u_long)2)
-extern  void * ypbindproc_setdom_2();
-extern  void * ypbindproc_setdom_2_svc();
-#endif /* Old Style C */
+extern  void *ypbindproc_setdom_2 __P ((ypbind_setdom *, CLIENT *));
+extern  void *ypbindproc_setdom_2_svc __P ((ypbind_setdom *, struct svc_req *));
+extern int ypbindprog_2_freeresult __P ((SVCXPRT *, xdrproc_t, caddr_t));
+
+
+extern  bool_t xdr_ypstat __P ((XDR *, ypstat*));
+extern  bool_t xdr_ypxfrstat __P ((XDR *, ypxfrstat*));
+extern  bool_t xdr_domainname __P ((XDR *, domainname*));
+extern  bool_t xdr_mapname __P ((XDR *, mapname*));
+extern  bool_t xdr_peername __P ((XDR *, peername*));
+extern  bool_t xdr_keydat __P ((XDR *, keydat*));
+extern  bool_t xdr_valdat __P ((XDR *, valdat*));
+extern  bool_t xdr_ypmap_parms __P ((XDR *, ypmap_parms*));
+extern  bool_t xdr_ypreq_key __P ((XDR *, ypreq_key*));
+extern  bool_t xdr_ypreq_nokey __P ((XDR *, ypreq_nokey*));
+extern  bool_t xdr_ypreq_xfr __P ((XDR *, ypreq_xfr*));
+extern  bool_t xdr_ypresp_val __P ((XDR *, ypresp_val*));
+extern  bool_t xdr_ypresp_key_val __P ((XDR *, ypresp_key_val*));
+extern  bool_t xdr_ypresp_master __P ((XDR *, ypresp_master*));
+extern  bool_t xdr_ypresp_order __P ((XDR *, ypresp_order*));
+extern  bool_t xdr_ypresp_all __P ((XDR *, ypresp_all*));
+extern  bool_t xdr_ypresp_xfr __P ((XDR *, ypresp_xfr*));
+extern  bool_t xdr_ypmaplist __P ((XDR *, ypmaplist*));
+extern  bool_t xdr_ypresp_maplist __P ((XDR *, ypresp_maplist*));
+extern  bool_t xdr_yppush_status __P ((XDR *, yppush_status*));
+extern  bool_t xdr_yppushresp_xfr __P ((XDR *, yppushresp_xfr*));
+extern  bool_t xdr_ypbind_resptype __P ((XDR *, ypbind_resptype*));
+extern  bool_t xdr_ypbind_binding __P ((XDR *, ypbind_binding*));
+extern  bool_t xdr_ypbind_resp __P ((XDR *, ypbind_resp*));
+extern  bool_t xdr_ypbind_setdom __P ((XDR *, ypbind_setdom*));
+
+__END_DECLS
 
 #endif /* !__RPCSVC_YP_H__ */
diff --git a/nis/yp_xdr.c b/nis/yp_xdr.c
index e6477be778..f189169687 100644
--- a/nis/yp_xdr.c
+++ b/nis/yp_xdr.c
@@ -5,23 +5,23 @@
  * may copy or modify Sun RPC without charge, but are not authorized
  * to license or distribute it to anyone else except as part of a product or
  * program developed by the user.
- * 
+ *
  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- * 
+ *
  * Sun RPC is provided with no support and without any obligation on the
  * part of Sun Microsystems, Inc. to assist in its use, correction,
  * modification or enhancement.
- * 
+ *
  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  * OR ANY PART THEREOF.
- * 
+ *
  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  * or profits or other special, indirect and consequential damages, even if
  * Sun has been advised of the possibility of such damages.
- * 
+ *
  * Sun Microsystems, Inc.
  * 2550 Garcia Avenue
  * Mountain View, California  94043
@@ -32,311 +32,269 @@
 bool_t
 xdr_ypstat (XDR *xdrs, ypstat *objp)
 {
-  if (!xdr_enum(xdrs, (enum_t *)objp))
-    return (FALSE);
-  return (TRUE);
+  if (!xdr_enum (xdrs, (enum_t *) objp))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypxfrstat(XDR *xdrs, ypxfrstat *objp)
+xdr_ypxfrstat (XDR *xdrs, ypxfrstat *objp)
 {
-  if (!xdr_enum(xdrs, (enum_t *)objp)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_enum (xdrs, (enum_t *) objp))
+      return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_domainname(XDR *xdrs, domainname *objp)
+xdr_domainname (XDR *xdrs, domainname *objp)
 {
-  if (!xdr_string(xdrs, objp, YPMAXDOMAIN)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_string (xdrs, objp, ~0))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_mapname(XDR *xdrs, mapname *objp)
+xdr_mapname (XDR *xdrs, mapname *objp)
 {
-  if (!xdr_string(xdrs, objp, YPMAXMAP)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_string (xdrs, objp, ~0))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_peername(XDR *xdrs, peername *objp)
+xdr_peername (XDR *xdrs, peername *objp)
 {
-  if (!xdr_string(xdrs, objp, YPMAXPEER)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_string (xdrs, objp, ~0))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_keydat(XDR *xdrs, keydat *objp)
+xdr_keydat (XDR *xdrs, keydat *objp)
 {
-  if (!xdr_bytes(xdrs, (char **)&objp->keydat_val, (u_int *)&objp->keydat_len, YPMAXRECORD)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_bytes (xdrs, (char **) &objp->keydat_val,
+		  (u_int *) &objp->keydat_len, ~0))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_valdat(XDR *xdrs, valdat *objp)
+xdr_valdat (XDR *xdrs, valdat *objp)
 {
-  if (!xdr_bytes(xdrs, (char **)&objp->valdat_val, (u_int *)&objp->valdat_len, YPMAXRECORD)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_bytes (xdrs, (char **) &objp->valdat_val,
+		  (u_int *) &objp->valdat_len, ~0))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypmap_parms(XDR *xdrs, ypmap_parms *objp)
+xdr_ypmap_parms (XDR *xdrs, ypmap_parms *objp)
 {
-  if (!xdr_domainname(xdrs, &objp->domain)) {
-    return (FALSE);
-  }
-  if (!xdr_mapname(xdrs, &objp->map)) {
-    return (FALSE);
-  }
-  if (!xdr_u_int(xdrs, &objp->ordernum)) {
-    return (FALSE);
-  }
-  if (!xdr_peername(xdrs, &objp->peer)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_domainname (xdrs, &objp->domain))
+    return FALSE;
+  if (!xdr_mapname (xdrs, &objp->map))
+    return FALSE;
+  if (!xdr_u_int (xdrs, &objp->ordernum))
+    return FALSE;
+  if (!xdr_peername (xdrs, &objp->peer))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypreq_key(XDR *xdrs, ypreq_key *objp)
+xdr_ypreq_key (XDR *xdrs, ypreq_key *objp)
 {
-  if (!xdr_domainname(xdrs, &objp->domain)) {
-    return (FALSE);
-  }
-  if (!xdr_mapname(xdrs, &objp->map)) {
-    return (FALSE);
-  }
-  if (!xdr_keydat(xdrs, &objp->key)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_domainname (xdrs, &objp->domain))
+    return FALSE;
+  if (!xdr_mapname (xdrs, &objp->map))
+    return FALSE;
+  if (!xdr_keydat (xdrs, &objp->key))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypreq_nokey(XDR *xdrs, ypreq_nokey *objp)
+xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
 {
-  if (!xdr_domainname(xdrs, &objp->domain)) {
-    return (FALSE);
-  }
-  if (!xdr_mapname(xdrs, &objp->map)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_domainname (xdrs, &objp->domain))
+    return FALSE;
+  if (!xdr_mapname (xdrs, &objp->map))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypreq_xfr(XDR *xdrs, ypreq_xfr *objp)
+xdr_ypreq_xfr (XDR *xdrs, ypreq_xfr *objp)
 {
-  if (!xdr_ypmap_parms(xdrs, &objp->map_parms)) {
-    return (FALSE);
-  }
-  if (!xdr_u_int(xdrs, &objp->transid)) {
-    return (FALSE);
-  }
-  if (!xdr_u_int(xdrs, &objp->prog)) {
-    return (FALSE);
-  }
-  if (!xdr_u_int(xdrs, &objp->port)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_ypmap_parms (xdrs, &objp->map_parms))
+    return FALSE;
+  if (!xdr_u_int (xdrs, &objp->transid))
+    return FALSE;
+  if (!xdr_u_int (xdrs, &objp->prog))
+    return FALSE;
+  if (!xdr_u_int (xdrs, &objp->port))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypresp_val(XDR *xdrs, ypresp_val *objp)
+xdr_ypresp_val (XDR *xdrs, ypresp_val *objp)
 {
-  if (!xdr_ypstat(xdrs, &objp->stat)) {
-    return (FALSE);
-  }
-  if (!xdr_valdat(xdrs, &objp->val)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_ypstat (xdrs, &objp->stat))
+    return FALSE;
+  if (!xdr_valdat (xdrs, &objp->val))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypresp_key_val(XDR *xdrs, ypresp_key_val *objp)
+xdr_ypresp_key_val (XDR *xdrs, ypresp_key_val *objp)
 {
-  if (!xdr_ypstat(xdrs, &objp->stat)) {
-    return (FALSE);
-  }
-  if (!xdr_valdat(xdrs, &objp->val)) {
-    return (FALSE);
-  }
-  if (!xdr_keydat(xdrs, &objp->key)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_ypstat (xdrs, &objp->stat))
+    return FALSE;
+  if (!xdr_valdat (xdrs, &objp->val))
+    return FALSE;
+  if (!xdr_keydat (xdrs, &objp->key))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypresp_master(XDR *xdrs, ypresp_master *objp)
+xdr_ypresp_master (XDR *xdrs, ypresp_master *objp)
 {
-  if (!xdr_ypstat(xdrs, &objp->stat)) {
-    return (FALSE);
-  }
-  if (!xdr_peername(xdrs, &objp->peer)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_ypstat (xdrs, &objp->stat))
+    return FALSE;
+  if (!xdr_peername (xdrs, &objp->peer))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypresp_order(XDR *xdrs, ypresp_order *objp)
+xdr_ypresp_order (XDR *xdrs, ypresp_order *objp)
 {
-  if (!xdr_ypstat(xdrs, &objp->stat)) {
-    return (FALSE);
-  }
-  if (!xdr_u_int(xdrs, &objp->ordernum)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_ypstat (xdrs, &objp->stat))
+    return FALSE;
+  if (!xdr_u_int (xdrs, &objp->ordernum))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypresp_all(XDR *xdrs, ypresp_all *objp)
+xdr_ypresp_all (XDR *xdrs, ypresp_all *objp)
 {
-  if (!xdr_bool(xdrs, &objp->more)) {
-    return (FALSE);
-  }
-  switch (objp->more) {
-  case TRUE:
-    if (!xdr_ypresp_key_val(xdrs, &objp->ypresp_all_u.val)) {
-      return (FALSE);
+  if (!xdr_bool (xdrs, &objp->more))
+    return FALSE;
+  switch (objp->more)
+    {
+    case TRUE:
+      if (!xdr_ypresp_key_val (xdrs, &objp->ypresp_all_u.val))
+	return FALSE;
+      break;
+    case FALSE:
+      break;
+    default:
+      return FALSE;
     }
-    break;
-  case FALSE:
-    break;
-  default:
-    return (FALSE);
-  }
-  return (TRUE);
+  return TRUE;
 }
 
 bool_t
-xdr_ypresp_xfr(XDR *xdrs, ypresp_xfr *objp)
+xdr_ypresp_xfr (XDR *xdrs, ypresp_xfr *objp)
 {
-  if (!xdr_u_int(xdrs, &objp->transid)) {
-    return (FALSE);
-  }
-  if (!xdr_ypxfrstat(xdrs, &objp->xfrstat)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_u_int (xdrs, &objp->transid))
+    return FALSE;
+  if (!xdr_ypxfrstat (xdrs, &objp->xfrstat))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypmaplist(XDR *xdrs, ypmaplist *objp)
+xdr_ypmaplist (XDR *xdrs, ypmaplist *objp)
 {
-  if (!xdr_mapname(xdrs, &objp->map)) {
-    return (FALSE);
-  }
-  if (!xdr_pointer(xdrs, (char **)&objp->next, sizeof(ypmaplist), (xdrproc_t)xdr_ypmaplist)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_mapname (xdrs, &objp->map))
+    return FALSE;
+  if (!xdr_pointer (xdrs, (char **) &objp->next, sizeof (ypmaplist),
+		    (xdrproc_t) xdr_ypmaplist))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypresp_maplist(XDR *xdrs, ypresp_maplist *objp)
+xdr_ypresp_maplist (XDR *xdrs, ypresp_maplist *objp)
 {
-  if (!xdr_ypstat(xdrs, &objp->stat)) {
-    return (FALSE);
-  }
-  if (!xdr_pointer(xdrs, (char **)&objp->maps, sizeof(ypmaplist), (xdrproc_t)xdr_ypmaplist)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_ypstat (xdrs, &objp->stat))
+    return FALSE;
+  if (!xdr_pointer (xdrs, (char **) &objp->maps, sizeof (ypmaplist),
+		    (xdrproc_t) xdr_ypmaplist))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_yppush_status(XDR *xdrs, yppush_status *objp)
+xdr_yppush_status (XDR *xdrs, yppush_status *objp)
 {
-  if (!xdr_enum(xdrs, (enum_t *)objp)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_enum (xdrs, (enum_t *) objp))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_yppushresp_xfr(XDR *xdrs, yppushresp_xfr *objp)
+xdr_yppushresp_xfr (XDR *xdrs, yppushresp_xfr *objp)
 {
-  if (!xdr_u_int(xdrs, &objp->transid)) {
-    return (FALSE);
-  }
-  if (!xdr_yppush_status(xdrs, &objp->status)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_u_int (xdrs, &objp->transid))
+    return FALSE;
+  if (!xdr_yppush_status (xdrs, &objp->status))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypbind_resptype(XDR *xdrs, ypbind_resptype *objp)
+xdr_ypbind_resptype (XDR *xdrs, ypbind_resptype *objp)
 {
-  if (!xdr_enum(xdrs, (enum_t *)objp)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_enum (xdrs, (enum_t *) objp))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypbind_binding(XDR *xdrs, ypbind_binding *objp)
+xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp)
 {
-  if (!xdr_opaque(xdrs, objp->ypbind_binding_addr, 4)) {
-    return (FALSE);
-  }
-  if (!xdr_opaque(xdrs, objp->ypbind_binding_port, 2)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4))
+    return FALSE;
+  if (!xdr_opaque (xdrs, objp->ypbind_binding_port, 2))
+    return FALSE;
+  return TRUE;
 }
 
 bool_t
-xdr_ypbind_resp(XDR *xdrs, ypbind_resp *objp)
+xdr_ypbind_resp (XDR *xdrs, ypbind_resp *objp)
 {
-  if (!xdr_ypbind_resptype(xdrs, &objp->ypbind_status)) {
-    return (FALSE);
-  }
-  switch (objp->ypbind_status) {
-  case YPBIND_FAIL_VAL:
-    if (!xdr_u_int(xdrs, &objp->ypbind_resp_u.ypbind_error)) {
-      return (FALSE);
-		 }
-    break;
-  case YPBIND_SUCC_VAL:
-    if (!xdr_ypbind_binding(xdrs, &objp->ypbind_resp_u.ypbind_bindinfo)) {
-      return (FALSE);
+  if (!xdr_ypbind_resptype (xdrs, &objp->ypbind_status))
+    return FALSE;
+  switch (objp->ypbind_status)
+    {
+    case YPBIND_FAIL_VAL:
+      if (!xdr_u_int (xdrs, &objp->ypbind_resp_u.ypbind_error))
+	return FALSE;
+      break;
+    case YPBIND_SUCC_VAL:
+      if (!xdr_ypbind_binding (xdrs, &objp->ypbind_resp_u.ypbind_bindinfo))
+	return FALSE;
+      break;
+    default:
+      return FALSE;
     }
-    break;
-  default:
-    return (FALSE);
-  }
-  return (TRUE);
+  return TRUE;
 }
 
 bool_t
-xdr_ypbind_setdom(XDR *xdrs, ypbind_setdom *objp)
+xdr_ypbind_setdom (XDR *xdrs, ypbind_setdom *objp)
 {
-  if (!xdr_domainname(xdrs, &objp->ypsetdom_domain)) {
-    return (FALSE);
-  }
-  if (!xdr_ypbind_binding(xdrs, &objp->ypsetdom_binding)) {
-    return (FALSE);
-  }
-  if (!xdr_u_int(xdrs, &objp->ypsetdom_vers)) {
-    return (FALSE);
-  }
-  return (TRUE);
+  if (!xdr_domainname (xdrs, &objp->ypsetdom_domain))
+    return FALSE;
+  if (!xdr_ypbind_binding (xdrs, &objp->ypsetdom_binding))
+    return FALSE;
+  if (!xdr_u_int (xdrs, &objp->ypsetdom_vers))
+    return FALSE;
+  return TRUE;
 }
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 198c4775b5..94fce94f9d 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -90,7 +90,7 @@ __yp_bind (const char *domain, dom_binding **ypdb)
 
   do
     {
-      try++;
+      ++try;
       if (try > MAXTRIES)
         {
           if (is_new)
@@ -99,7 +99,7 @@ __yp_bind (const char *domain, dom_binding **ypdb)
         }
 
 #if USE_BINDINGDIR
-      if (ysd->dom_vers < 1 && try < 3)
+      if (ysd->dom_vers < 1 && try == 1) /* Try binding dir only first time */
 	{
 	  char path[sizeof (BINDINGDIR) - 1 + strlen (domain) + 10];
 	  struct iovec vec[2];
diff --git a/nis/ypupdate_xdr.c b/nis/ypupdate_xdr.c
index 53624337ab..e4027b07df 100644
--- a/nis/ypupdate_xdr.c
+++ b/nis/ypupdate_xdr.c
@@ -31,43 +31,35 @@
  * Copyright (c) 1986, 1990 by Sun Microsystems, Inc.
  */
 
-/* from @(#)ypupdate_prot.x     1.3 91/03/11 TIRPC 1.0 */
-
-/*
- * Compiled from ypupdate_prot.x using rpcgen
- * This is NOT source code!
- * DO NOT EDIT THIS FILE!
- */
-
-
 #include <rpcsvc/ypupd.h>
 
-bool_t 
-xdr_yp_buf (XDR * xdrs, yp_buf * objp)
+bool_t
+xdr_yp_buf (XDR *xdrs, yp_buf *objp)
 {
-  if (!xdr_bytes (xdrs, (char **) &objp->yp_buf_val, (u_int *) & objp->yp_buf_len, MAXYPDATALEN))
-    return (FALSE);
-  return (TRUE);
+  if (!xdr_bytes (xdrs, (char **) &objp->yp_buf_val,
+		  (u_int *) &objp->yp_buf_len, ~0))
+    return FALSE;
+  return TRUE;
 }
 
-bool_t 
-xdr_ypupdate_args (XDR * xdrs, ypupdate_args * objp)
+bool_t
+xdr_ypupdate_args (XDR *xdrs, ypupdate_args *objp)
 {
-  if (!xdr_string (xdrs, &objp->mapname, MAXMAPNAMELEN))
-    return (FALSE);
+  if (!xdr_string (xdrs, &objp->mapname, ~0))
+    return FALSE;
   if (!xdr_yp_buf (xdrs, &objp->key))
-    return (FALSE);
+    return FALSE;
   if (!xdr_yp_buf (xdrs, &objp->datum))
-    return (FALSE);
-  return (TRUE);
+    return FALSE;
+  return TRUE;
 }
 
-bool_t 
-xdr_ypdelete_args (XDR * xdrs, ypdelete_args * objp)
+bool_t
+xdr_ypdelete_args (XDR *xdrs, ypdelete_args *objp)
 {
-  if (!xdr_string (xdrs, &objp->mapname, MAXMAPNAMELEN))
-    return (FALSE);
+  if (!xdr_string (xdrs, &objp->mapname, ~0))
+    return FALSE;
   if (!xdr_yp_buf (xdrs, &objp->key))
-    return (FALSE);
-  return (TRUE);
+    return FALSE;
+  return TRUE;
 }