about summary refs log tree commit diff
path: root/sunrpc
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-04-15 13:54:57 +0000
committerUlrich Drepper <drepper@redhat.com>1999-04-15 13:54:57 +0000
commitf8afba91cf8bf8f8324c3c88b8c368e7c2bd5894 (patch)
treedbdd5f960cf217c76d495ba44173feafae9d184f /sunrpc
parenta5486962345290853d7d42ef4a799f16bd6764e2 (diff)
downloadglibc-f8afba91cf8bf8f8324c3c88b8c368e7c2bd5894.tar.gz
glibc-f8afba91cf8bf8f8324c3c88b8c368e7c2bd5894.tar.xz
glibc-f8afba91cf8bf8f8324c3c88b8c368e7c2bd5894.zip
Update.
	* Versions.def: Add GLIBC_2.1.1 to libpthread.

	* iconvdata/Makefile (modules): Add KOI8-U.
	(distribute): Add koi8-u.c.
	(gen-8bit-gap-modules): Add koi8-u.
	* iconvdata/gconv-modules: Add KOI8-U entries.
	* iconvdata/koi8-u.c: New file.

1999-04-13  Thorsten Kukuk  <kukuk@suse.de>

	* sunrpc/auth_des.c: 64bit fixes, security fixes.
	* sunrpc/auth_none.c: Pretty print.
	* sunrpc/auth_unix.c: Likewise.
	* sunrpc/authdes_prot.c: Likewise.
	* sunrpc/authuxprot.c: Likewise.
	* sunrpc/bindrsvprt.c: Likewise.
	* sunrpc/clnt_gen.c: Likewise.
	* sunrpc/rpc/xdr.h: Likewise.
	* sunrpc/rpc/auth_des.h: Add rpc_timeval struct.
	* sunrpc/rpc_cmsg.c: Don't use *long pointers.
	* sunrpc/rtime.c: Use new rpc_timeval.
	* sunrpc/svc_authux.c: Don't use *long pointers.
	* sunrpc/svcauth_des.c: Likewise + security fixes.
	* sunrpc/xdr_mem.c: Don't use *long pointers.
	* sunrpc/xdr_rec.c: Likewise.
	* sunrpc/xdr_sizeof.c: Likewise.
	* sunrpc/xdr_stdio.c: Likewise.

1999-04-15  Ulrich Drepper  <drepper@cygnus.com>
Diffstat (limited to 'sunrpc')
-rw-r--r--sunrpc/auth_des.c98
-rw-r--r--sunrpc/auth_none.c29
-rw-r--r--sunrpc/auth_unix.c53
-rw-r--r--sunrpc/authdes_prot.c8
-rw-r--r--sunrpc/authuxprot.c11
-rw-r--r--sunrpc/bindrsvprt.c13
-rw-r--r--sunrpc/clnt_gen.c5
-rw-r--r--sunrpc/rpc/auth_des.h16
-rw-r--r--sunrpc/rpc/xdr.h5
-rw-r--r--sunrpc/rpc_cmsg.c36
-rw-r--r--sunrpc/rtime.c4
-rw-r--r--sunrpc/svc_authux.c12
-rw-r--r--sunrpc/svcauth_des.c183
-rw-r--r--sunrpc/xdr_mem.c52
-rw-r--r--sunrpc/xdr_rec.c34
-rw-r--r--sunrpc/xdr_sizeof.c14
-rw-r--r--sunrpc/xdr_stdio.c35
17 files changed, 249 insertions, 359 deletions
diff --git a/sunrpc/auth_des.c b/sunrpc/auth_des.c
index d8659a9b6c..5100f9e31d 100644
--- a/sunrpc/auth_des.c
+++ b/sunrpc/auth_des.c
@@ -1,6 +1,3 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)auth_des.c	2.2 88/07/29 4.0 RPCSRC; from 1.9 88/02/08 SMI";
-#endif
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -55,7 +52,6 @@ static char sccsid[] = "@(#)auth_des.c	2.2 88/07/29 4.0 RPCSRC; from 1.9 88/02/0
 
 #define debug(msg)		/* printf("%s\n", msg) */
 
-extern int rtime (struct sockaddr_in *, struct timeval *, struct timeval *);
 extern bool_t xdr_authdes_cred (XDR *, struct authdes_cred *);
 extern bool_t xdr_authdes_verf (XDR *, struct authdes_verf *);
 
@@ -67,7 +63,7 @@ static bool_t authdes_marshal (AUTH *, XDR *);
 static bool_t authdes_validate (AUTH *, struct opaque_auth *);
 static bool_t authdes_refresh (AUTH *);
 static void authdes_destroy (AUTH *);
-static bool_t synchronize (struct sockaddr *, struct timeval *)
+static bool_t synchronize (struct sockaddr *, struct rpc_timeval *)
      internal_function;
 
 static struct auth_ops authdes_ops = {
@@ -90,11 +86,11 @@ struct ad_private {
   uint32_t ad_window;		/* client specified window */
   bool_t ad_dosync;		/* synchronize? */
   struct sockaddr ad_syncaddr;	/* remote host to synch with */
-  struct timeval ad_timediff;	/* server's time - client's time */
-  u_long ad_nickname;		/* server's nickname for client */
+  struct rpc_timeval ad_timediff;	/* server's time - client's time */
+  uint32_t ad_nickname;		/* server's nickname for client */
   struct authdes_cred ad_cred;	/* storage for credential */
   struct authdes_verf ad_verf;	/* storage for verifier */
-  struct timeval ad_timestamp;	/* timestamp sent */
+  struct rpc_timeval ad_timestamp;	/* timestamp sent */
   des_block ad_xkey;		/* encrypted conversation key */
   u_char ad_pkey[1024];	        /* Servers actual public key */
 };
@@ -115,7 +111,7 @@ authdes_create (const char *servername, u_int window,
   netobj pkey;
 
   if (!getpublickey (servername, pkey_data))
-    return (NULL);
+    return NULL;
 
   pkey.n_bytes = (char *) pkey_data;
   pkey.n_len = strlen ((char *) pkey_data) + 1;
@@ -135,6 +131,13 @@ authdes_pk_create (const char *servername, netobj *pkey, u_int window,
    */
   auth = ALLOC (AUTH);
   ad = ALLOC (struct ad_private);
+
+  if (auth == NULL || ad == NULL)
+    {
+      debug ("authdes_create: out of memory");
+      goto failed;
+    }
+
   memset (ad, 0, sizeof (struct ad_private));
   memcpy (ad->ad_pkey, pkey->n_bytes, pkey->n_len);
   if (!getnetname (namebuf))
@@ -145,8 +148,7 @@ authdes_pk_create (const char *servername, netobj *pkey, u_int window,
   ad->ad_servernamelen = strlen (servername);
   ad->ad_servername = mem_alloc (ad->ad_servernamelen + 1);
 
-  if (auth == NULL || ad == NULL || ad->ad_fullname == NULL ||
-      ad->ad_servername == NULL)
+  if (ad->ad_fullname == NULL || ad->ad_servername == NULL)
     {
       debug ("authdes_create: out of memory");
       goto failed;
@@ -155,8 +157,8 @@ authdes_pk_create (const char *servername, netobj *pkey, u_int window,
   /*
    * Set up private data
    */
-  bcopy (namebuf, ad->ad_fullname, ad->ad_fullnamelen + 1);
-  bcopy (servername, ad->ad_servername, ad->ad_servernamelen + 1);
+  memcpy (ad->ad_fullname, namebuf, ad->ad_fullnamelen + 1);
+  memcpy (ad->ad_servername, servername, ad->ad_servernamelen + 1);
   ad->ad_timediff.tv_sec = ad->ad_timediff.tv_usec = 0;
   if (syncaddr != NULL)
     {
@@ -172,7 +174,7 @@ authdes_pk_create (const char *servername, netobj *pkey, u_int window,
       if (key_gendes (&auth->ah_key) < 0)
 	{
 	  debug ("authdes_create: unable to gen conversation key");
-	  return (NULL);
+	  return NULL;
 	}
     }
   else
@@ -189,7 +191,7 @@ authdes_pk_create (const char *servername, netobj *pkey, u_int window,
   if (!authdes_refresh (auth))
     goto failed;
 
-  return (auth);
+  return auth;
 
 failed:
   if (auth != NULL)
@@ -202,7 +204,7 @@ failed:
 	FREE (ad->ad_servername, ad->ad_servernamelen + 1);
       FREE (ad, sizeof (struct ad_private));
     }
-  return (NULL);
+  return NULL;
 }
 
 /*
@@ -215,7 +217,7 @@ failed:
  */
 /*ARGSUSED */
 static void
-authdes_nextverf (AUTH * auth)
+authdes_nextverf (AUTH *auth)
 {
   /* what the heck am I supposed to do??? */
 }
@@ -226,7 +228,7 @@ authdes_nextverf (AUTH * auth)
  * 2. Marshal
  */
 static bool_t
-authdes_marshal (AUTH * auth, XDR * xdrs)
+authdes_marshal (AUTH *auth, XDR *xdrs)
 {
   struct ad_private *ad = AUTH_PRIVATE (auth);
   struct authdes_cred *cred = &ad->ad_cred;
@@ -235,15 +237,16 @@ authdes_marshal (AUTH * auth, XDR * xdrs)
   des_block ivec;
   int status;
   unsigned int len;
-  register long *ixdr;
+  register int32_t *ixdr;
+  struct timeval tval;
 
   /*
    * Figure out the "time", accounting for any time difference
    * with the server if necessary.
    */
-  __gettimeofday (&ad->ad_timestamp, (struct timezone *) NULL);
-  ad->ad_timestamp.tv_sec += ad->ad_timediff.tv_sec;
-  ad->ad_timestamp.tv_usec += ad->ad_timediff.tv_usec;
+  __gettimeofday (&tval, (struct timezone *) NULL);
+  ad->ad_timestamp.tv_sec = tval.tv_sec + ad->ad_timediff.tv_sec;
+  ad->ad_timestamp.tv_usec = tval.tv_usec + ad->ad_timediff.tv_usec;
   if (ad->ad_timestamp.tv_usec >= MILLION)
     {
       ad->ad_timestamp.tv_usec -= MILLION;
@@ -255,9 +258,9 @@ authdes_marshal (AUTH * auth, XDR * xdrs)
    * encrypt them.
    * XXX We have a real Year 2038 problem here.
    */
-  ixdr = (long *) cryptbuf;
-  IXDR_PUT_LONG (ixdr, ad->ad_timestamp.tv_sec);
-  IXDR_PUT_LONG (ixdr, ad->ad_timestamp.tv_usec);
+  ixdr = (int32_t *) cryptbuf;
+  IXDR_PUT_INT32 (ixdr, ad->ad_timestamp.tv_sec);
+  IXDR_PUT_INT32 (ixdr, ad->ad_timestamp.tv_usec);
   if (ad->ad_cred.adc_namekind == ADN_FULLNAME)
     {
       IXDR_PUT_U_INT32 (ixdr, ad->ad_window);
@@ -267,14 +270,13 @@ authdes_marshal (AUTH * auth, XDR * xdrs)
 	      2 * sizeof (des_block), DES_ENCRYPT | DES_HW, (char *) &ivec);
     }
   else
-    {
-      status = ecb_crypt ((char *) &auth->ah_key, (char *) cryptbuf,
-			  sizeof (des_block), DES_ENCRYPT | DES_HW);
-    }
+    status = ecb_crypt ((char *) &auth->ah_key, (char *) cryptbuf,
+			sizeof (des_block), DES_ENCRYPT | DES_HW);
+
   if (DES_FAILED (status))
     {
       debug ("authdes_marshal: DES encryption failure");
-      return (FALSE);
+      return FALSE;
     }
   ad->ad_verf.adv_xtimestamp = cryptbuf[0];
   if (ad->ad_cred.adc_namekind == ADN_FULLNAME)
@@ -293,13 +295,9 @@ authdes_marshal (AUTH * auth, XDR * xdrs)
    * authentication data.
    */
   if (ad->ad_cred.adc_namekind == ADN_FULLNAME)
-    {
-      len = ((1 + 1 + 2 + 1) * BYTES_PER_XDR_UNIT + ad->ad_fullnamelen);
-    }
+    len = ((1 + 1 + 2 + 1) * BYTES_PER_XDR_UNIT + ad->ad_fullnamelen);
   else
-    {
-      len = (1 + 1) * BYTES_PER_XDR_UNIT;
-    }
+    len = (1 + 1) * BYTES_PER_XDR_UNIT;
 
   if ((ixdr = xdr_inline (xdrs, 2 * BYTES_PER_XDR_UNIT)) != NULL)
     {
@@ -325,6 +323,7 @@ authdes_marshal (AUTH * auth, XDR * xdrs)
       ATTEMPT (xdr_putint32 (xdrs, &len));
     }
   ATTEMPT (xdr_authdes_verf (xdrs, verf));
+
   return TRUE;
 }
 
@@ -338,15 +337,15 @@ authdes_validate (AUTH *auth, struct opaque_auth *rverf)
   struct ad_private *ad = AUTH_PRIVATE (auth);
   struct authdes_verf verf;
   int status;
-  register u_long *ixdr;
+  register uint32_t *ixdr;
 
   if (rverf->oa_length != (2 + 1) * BYTES_PER_XDR_UNIT)
-    return (FALSE);
+    return FALSE;
 
-  ixdr = (u_long *) rverf->oa_base;
-  verf.adv_xtimestamp.key.high = (u_long) * ixdr++;
-  verf.adv_xtimestamp.key.low = (u_long) * ixdr++;
-  verf.adv_int_u = (u_long) * ixdr++;	/* nickname not XDR'd ! */
+  ixdr = (uint32_t *) rverf->oa_base;
+  verf.adv_xtimestamp.key.high = *ixdr++;
+  verf.adv_xtimestamp.key.low = *ixdr++;
+  verf.adv_int_u = *ixdr++;	/* nickname not XDR'd ! */
 
   /*
    * Decrypt the timestamp
@@ -363,15 +362,15 @@ authdes_validate (AUTH *auth, struct opaque_auth *rverf)
   /*
    * xdr the decrypted timestamp
    */
-  ixdr = (u_long *) verf.adv_xtimestamp.c;
-  verf.adv_timestamp.tv_sec = IXDR_GET_LONG (ixdr) + 1;
-  verf.adv_timestamp.tv_usec = IXDR_GET_LONG (ixdr);
+  ixdr = (uint32_t *) verf.adv_xtimestamp.c;
+  verf.adv_timestamp.tv_sec = IXDR_GET_U_INT32 (ixdr) + 1;
+  verf.adv_timestamp.tv_usec = IXDR_GET_U_INT32 (ixdr);
 
   /*
    * validate
    */
   if (memcmp ((char *) &ad->ad_timestamp, (char *) &verf.adv_timestamp,
-	      sizeof (struct timeval)) != 0)
+	      sizeof (struct rpc_timeval)) != 0)
     {
       debug ("authdes_validate: verifier mismatch\n");
       return FALSE;
@@ -395,8 +394,7 @@ authdes_refresh (AUTH *auth)
   struct ad_private *ad = AUTH_PRIVATE (auth);
   struct authdes_cred *cred = &ad->ad_cred;
 
-  if (ad->ad_dosync &&
-      !synchronize (&ad->ad_syncaddr, &ad->ad_timediff))
+  if (ad->ad_dosync && !synchronize (&ad->ad_syncaddr, &ad->ad_timediff))
     {
       /*
        * Hope the clocks are synced!
@@ -438,10 +436,10 @@ authdes_destroy (AUTH *auth)
  */
 static bool_t
 internal_function
-synchronize (struct sockaddr *syncaddr, struct timeval *timep)
+synchronize (struct sockaddr *syncaddr, struct rpc_timeval *timep)
 {
   struct timeval mytime;
-  struct timeval timeout;
+  struct rpc_timeval timeout;
 
   timeout.tv_sec = RTIME_TIMEOUT;
   timeout.tv_usec = 0;
diff --git a/sunrpc/auth_none.c b/sunrpc/auth_none.c
index 0ab306407c..b2f9273530 100644
--- a/sunrpc/auth_none.c
+++ b/sunrpc/auth_none.c
@@ -1,4 +1,3 @@
-/* @(#)auth_none.c	2.1 88/07/29 4.0 RPCSRC */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -27,16 +26,13 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
+/*
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ */
 /*
  * auth_none.c
  * Creates a client authentication handle for passing "null"
  * credentials and verifiers to remote systems.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
  */
 
 #include <rpc/types.h>
@@ -53,8 +49,7 @@ static bool_t authnone_marshal (AUTH *, XDR *);
 static bool_t authnone_validate (AUTH *, struct opaque_auth *);
 static bool_t authnone_refresh (AUTH *);
 
-static struct auth_ops ops =
-{
+static struct auth_ops ops = {
   authnone_verf,
   authnone_marshal,
   authnone_validate,
@@ -63,12 +58,11 @@ static struct auth_ops ops =
 };
 
 static struct authnone_private
-  {
-    AUTH no_client;
-    char marshalled_client[MAX_MARSHEL_SIZE];
-    u_int mcnt;
-  }
- *authnone_private;
+{
+  AUTH no_client;
+  char marshalled_client[MAX_MARSHEL_SIZE];
+  u_int mcnt;
+} *authnone_private;
 
 AUTH *
 authnone_create (void)
@@ -106,9 +100,8 @@ authnone_marshal (AUTH *client, XDR *xdrs)
   struct authnone_private *ap = authnone_private;
 
   if (ap == 0)
-    return (0);
-  return ((*xdrs->x_ops->x_putbytes) (xdrs,
-				      ap->marshalled_client, ap->mcnt));
+    return 0;
+  return (*xdrs->x_ops->x_putbytes) (xdrs, ap->marshalled_client, ap->mcnt);
 }
 
 static void
diff --git a/sunrpc/auth_unix.c b/sunrpc/auth_unix.c
index 9314119a70..82ef91a0de 100644
--- a/sunrpc/auth_unix.c
+++ b/sunrpc/auth_unix.c
@@ -1,4 +1,3 @@
-/* @(#)auth_unix.c	2.2 88/08/01 4.0 RPCSRC */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -27,20 +26,16 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
 /*
- * auth_unix.c, Implements UNIX style authentication parameters.
- *
  * Copyright (C) 1984, Sun Microsystems, Inc.
+ */
+/*
+ * auth_unix.c, Implements UNIX style authentication parameters.
  *
  * The system is very weak.  The client uses no encryption for it's
  * credentials and only sends null verifiers.  The server sends backs
  * null verifiers or optionally a verifier that suggests a new short hand
  * for the credentials.
- *
  */
 
 #include <limits.h>
@@ -63,8 +58,7 @@ static bool_t authunix_validate (AUTH *, struct opaque_auth *);
 static bool_t authunix_refresh (AUTH *);
 static void authunix_destroy (AUTH *);
 
-static struct auth_ops auth_unix_ops =
-{
+static struct auth_ops auth_unix_ops = {
   authunix_nextverf,
   authunix_marshal,
   authunix_validate,
@@ -75,14 +69,13 @@ static struct auth_ops auth_unix_ops =
 /*
  * This struct is pointed to by the ah_private field of an auth_handle.
  */
-struct audata
-  {
-    struct opaque_auth au_origcred;	/* original credentials */
-    struct opaque_auth au_shcred;	/* short hand cred */
-    u_long au_shfaults;		/* short hand cache faults */
-    char au_marshed[MAX_AUTH_BYTES];
-    u_int au_mpos;		/* xdr pos at end of marshed */
-  };
+struct audata {
+  struct opaque_auth au_origcred;	/* original credentials */
+  struct opaque_auth au_shcred;	/* short hand cred */
+  u_long au_shfaults;		/* short hand cache faults */
+  char au_marshed[MAX_AUTH_BYTES];
+  u_int au_mpos;		/* xdr pos at end of marshed */
+};
 #define	AUTH_PRIVATE(auth)	((struct audata *)auth->ah_private)
 
 static bool_t marshal_new_auth (AUTH *) internal_function;
@@ -93,12 +86,8 @@ static bool_t marshal_new_auth (AUTH *) internal_function;
  * Returns an auth handle with the given stuff in it.
  */
 AUTH *
-authunix_create (machname, uid, gid, len, aup_gids)
-     char *machname;
-     uid_t uid;
-     gid_t gid;
-     int len;
-     gid_t *aup_gids;
+authunix_create (char *machname, uid_t uid, gid_t gid, int len,
+		 gid_t *aup_gids)
 {
   struct authunix_parms aup;
   char mymem[MAX_AUTH_BYTES];
@@ -146,12 +135,13 @@ authunix_create (machname, uid, gid, len, aup_gids)
     abort ();
   au->au_origcred.oa_length = len = XDR_GETPOS (&xdrs);
   au->au_origcred.oa_flavor = AUTH_UNIX;
-  if ((au->au_origcred.oa_base = mem_alloc ((u_int) len)) == NULL)
+  au->au_origcred.oa_base = mem_alloc ((u_int) len);
+  if (au->au_origcred.oa_base == NULL)
     {
-      (void) fprintf (stderr, _("authunix_create: out of memory\n"));
+      (void) fputs (_("authunix_create: out of memory\n"), stderr);
       return NULL;
     }
-  bcopy (mymem, au->au_origcred.oa_base, (u_int) len);
+  memcpy(au->au_origcred.oa_base, mymem, (u_int) len);
 
   /*
    * set auth handle to reflect new cred.
@@ -317,13 +307,10 @@ marshal_new_auth (AUTH *auth)
   xdrmem_create (xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE);
   if ((!xdr_opaque_auth (xdrs, &(auth->ah_cred))) ||
       (!xdr_opaque_auth (xdrs, &(auth->ah_verf))))
-    {
-      perror (_("auth_none.c - Fatal marshalling problem"));
-    }
+    perror (_("auth_none.c - Fatal marshalling problem"));
   else
-    {
-      au->au_mpos = XDR_GETPOS (xdrs);
-    }
+    au->au_mpos = XDR_GETPOS (xdrs);
+
   XDR_DESTROY (xdrs);
 
   return TRUE;
diff --git a/sunrpc/authdes_prot.c b/sunrpc/authdes_prot.c
index 3c6eacced6..6c79fc2c88 100644
--- a/sunrpc/authdes_prot.c
+++ b/sunrpc/authdes_prot.c
@@ -1,6 +1,3 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)authdes_prot.c	2.1 88/07/29 4.0 RPCSRC; from 1.6 88/02/08 SMI";
-#endif
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -32,7 +29,6 @@ static char sccsid[] = "@(#)authdes_prot.c	2.1 88/07/29 4.0 RPCSRC; from 1.6 88/
 /*
  * Copyright (c) 1988 by Sun Microsystems, Inc.
  */
-
 /*
  * authdes_prot.c, XDR routines for DES authentication
  */
@@ -45,7 +41,7 @@ static char sccsid[] = "@(#)authdes_prot.c	2.1 88/07/29 4.0 RPCSRC; from 1.6 88/
 #define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE)
 
 bool_t
-xdr_authdes_cred (XDR * xdrs, struct authdes_cred *cred)
+xdr_authdes_cred (XDR *xdrs, struct authdes_cred *cred)
 {
   /*
    * Unrolled xdr
@@ -68,7 +64,7 @@ xdr_authdes_cred (XDR * xdrs, struct authdes_cred *cred)
 
 
 bool_t
-xdr_authdes_verf (register XDR * xdrs, register struct authdes_verf * verf)
+xdr_authdes_verf (register XDR *xdrs, register struct authdes_verf *verf)
 {
   /*
    * Unrolled xdr
diff --git a/sunrpc/authuxprot.c b/sunrpc/authuxprot.c
index 9f0242fcb0..b033c568ac 100644
--- a/sunrpc/authuxprot.c
+++ b/sunrpc/authuxprot.c
@@ -1,4 +1,3 @@
-/* @(#)authunix_prot.c	2.1 88/07/29 4.0 RPCSRC */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -27,18 +26,14 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
+/*
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ */
 /*
  * authunix_prot.c
  * XDR for UNIX style authentication parameters for RPC
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
  */
 
-
 #include <rpc/types.h>
 #include <rpc/xdr.h>
 #include <rpc/auth.h>
diff --git a/sunrpc/bindrsvprt.c b/sunrpc/bindrsvprt.c
index f646ffda70..0acfd69e09 100644
--- a/sunrpc/bindrsvprt.c
+++ b/sunrpc/bindrsvprt.c
@@ -26,17 +26,14 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)bindresvport.c	2.2 88/07/29 4.0 RPCSRC 1.8 88/02/08 SMI";
-#endif
 /*
  * Copyright (c) 1987 by Sun Microsystems, Inc.
  */
 
+#include <errno.h>
 #include <unistd.h>
 #include <string.h>
 #include <sys/types.h>
-#include <sys/errno.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 
@@ -49,9 +46,6 @@ bindresvport (int sd, struct sockaddr_in *sin)
   int res;
   static short port;
   struct sockaddr_in myaddr;
-#ifndef errno
-  extern int errno;
-#endif
   int i;
 
 #define STARTPORT 600
@@ -69,13 +63,15 @@ bindresvport (int sd, struct sockaddr_in *sin)
       __set_errno (EPFNOSUPPORT);
       return -1;
     }
+
   if (port == 0)
     {
       port = (__getpid () % NPORTS) + STARTPORT;
     }
   res = -1;
   __set_errno (EADDRINUSE);
-  for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; i++)
+
+  for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; ++i)
     {
       sin->sin_port = htons (port++);
       if (port > ENDPORT)
@@ -84,5 +80,6 @@ bindresvport (int sd, struct sockaddr_in *sin)
 	}
       res = bind (sd, sin, sizeof (struct sockaddr_in));
     }
+
   return res;
 }
diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c
index f62618bdac..1a2cc9141e 100644
--- a/sunrpc/clnt_gen.c
+++ b/sunrpc/clnt_gen.c
@@ -1,4 +1,3 @@
-/* @(#)clnt_generic.c	2.2 88/08/01 4.0 RPCSRC */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -27,12 +26,10 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)clnt_generic.c 1.4 87/08/11 (C) 1987 SMI";
-#endif
 /*
  * Copyright (C) 1987, Sun Microsystems, Inc.
  */
+
 #include <alloca.h>
 #include <errno.h>
 #include <string.h>
diff --git a/sunrpc/rpc/auth_des.h b/sunrpc/rpc/auth_des.h
index 7bb3c59b8e..b94bafb67b 100644
--- a/sunrpc/rpc/auth_des.h
+++ b/sunrpc/rpc/auth_des.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -48,12 +48,19 @@ struct authdes_cred
     uint32_t adc_nickname;
   };
 
+/* A timeval replacement for !32bit platforms */
+struct rpc_timeval
+  {
+    uint32_t tv_sec;            /* Seconds.  */
+    uint32_t tv_usec;           /* Microseconds.  */
+  };
+
 /* A des authentication verifier */
 struct authdes_verf
   {
     union
       {
-	struct timeval adv_ctime;	/* clear time */
+	struct rpc_timeval adv_ctime;	/* clear time */
 	des_block adv_xtime;		/* crypt time */
       }
     adv_time_u;
@@ -96,8 +103,9 @@ extern int getpublickey __P ((__const char *__name, char *__key));
 extern int getsecretkey __P ((__const char *__name, char *__key,
 			      __const char *__passwd));
 
-extern int rtime __P ((struct sockaddr_in *__addrp,  struct timeval *__timep,
-		       struct timeval *__timeout));
+extern int rtime __P ((struct sockaddr_in *__addrp,
+		       struct rpc_timeval *__timep,
+		       struct rpc_timeval *__timeout));
 
 __END_DECLS
 
diff --git a/sunrpc/rpc/xdr.h b/sunrpc/rpc/xdr.h
index 44bad8a337..91dbcc3da3 100644
--- a/sunrpc/rpc/xdr.h
+++ b/sunrpc/rpc/xdr.h
@@ -1,4 +1,3 @@
-/* @(#)xdr.h	2.2 88/07/29 4.0 RPCSRC */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -27,7 +26,6 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  */
-/*      @(#)xdr.h 1.19 87/04/22 SMI      */
 
 /*
  * xdr.h, External Data Representation Serialization Routines.
@@ -130,7 +128,7 @@ struct XDR
 	/* returns bytes off from beginning */
 	bool_t (*x_setpostn) __PMT ((XDR *__xdrs, u_int pos));
 	/* lets you reposition the stream */
-	long *(*x_inline) __PMT ((XDR *__xdrs, int len));
+	int32_t *(*x_inline) __PMT ((XDR *__xdrs, int len));
 	/* buf quick ptr to buffered data */
 	void (*x_destroy) __PMT ((XDR *__xdrs));
 	/* free privates of this xdr_stream */
@@ -162,6 +160,7 @@ typedef bool_t (*xdrproc_t) __PMT ((XDR *, void *,...));
  * Operations defined on a XDR handle
  *
  * XDR          *xdrs;
+ * int32_t      *int32p;
  * long         *longp;
  * caddr_t       addr;
  * u_int         len;
diff --git a/sunrpc/rpc_cmsg.c b/sunrpc/rpc_cmsg.c
index 4cd2a8f35a..3930de3e93 100644
--- a/sunrpc/rpc_cmsg.c
+++ b/sunrpc/rpc_cmsg.c
@@ -48,7 +48,7 @@ static char sccsid[] = "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro";
 bool_t
 xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
 {
-  long *buf;
+  int32_t *buf;
   struct opaque_auth *oa;
 
   if (xdrs->x_op == XDR_ENCODE)
@@ -70,28 +70,24 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
 	  IXDR_PUT_LONG (buf, cmsg->rm_xid);
 	  IXDR_PUT_ENUM (buf, cmsg->rm_direction);
 	  if (cmsg->rm_direction != CALL)
-	    {
-	      return FALSE;
-	    }
+	    return FALSE;
 	  IXDR_PUT_LONG (buf, cmsg->rm_call.cb_rpcvers);
 	  if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION)
-	    {
-	      return FALSE;
-	    }
+	    return FALSE;
 	  IXDR_PUT_LONG (buf, cmsg->rm_call.cb_prog);
 	  IXDR_PUT_LONG (buf, cmsg->rm_call.cb_vers);
 	  IXDR_PUT_LONG (buf, cmsg->rm_call.cb_proc);
 	  oa = &cmsg->rm_call.cb_cred;
 	  IXDR_PUT_ENUM (buf, oa->oa_flavor);
-	  IXDR_PUT_LONG (buf, oa->oa_length);
+	  IXDR_PUT_INT32 (buf, oa->oa_length);
 	  if (oa->oa_length)
 	    {
 	      bcopy (oa->oa_base, (caddr_t) buf, oa->oa_length);
-	      buf = (long *) ((char *) buf + RNDUP (oa->oa_length));
+	      buf = (int32_t *) ((char *) buf + RNDUP (oa->oa_length));
 	    }
 	  oa = &cmsg->rm_call.cb_verf;
 	  IXDR_PUT_ENUM (buf, oa->oa_flavor);
-	  IXDR_PUT_LONG (buf, oa->oa_length);
+	  IXDR_PUT_INT32 (buf, oa->oa_length);
 	  if (oa->oa_length)
 	    {
 	      bcopy (oa->oa_base, (caddr_t) buf, oa->oa_length);
@@ -123,13 +119,11 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
 	  cmsg->rm_call.cb_proc = IXDR_GET_LONG (buf);
 	  oa = &cmsg->rm_call.cb_cred;
 	  oa->oa_flavor = IXDR_GET_ENUM (buf, enum_t);
-	  oa->oa_length = IXDR_GET_LONG (buf);
+	  oa->oa_length = IXDR_GET_INT32 (buf);
 	  if (oa->oa_length)
 	    {
 	      if (oa->oa_length > MAX_AUTH_BYTES)
-		{
-		  return FALSE;
-		}
+		return FALSE;
 	      if (oa->oa_base == NULL)
 		{
 		  oa->oa_base = (caddr_t)
@@ -140,9 +134,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
 		{
 		  if (xdr_opaque (xdrs, oa->oa_base,
 				  oa->oa_length) == FALSE)
-		    {
-		      return FALSE;
-		    }
+		    return FALSE;
 		}
 	      else
 		{
@@ -167,14 +159,12 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
 	  else
 	    {
 	      oa->oa_flavor = IXDR_GET_ENUM (buf, enum_t);
-	      oa->oa_length = IXDR_GET_LONG (buf);
+	      oa->oa_length = IXDR_GET_INT32 (buf);
 	    }
 	  if (oa->oa_length)
 	    {
 	      if (oa->oa_length > MAX_AUTH_BYTES)
-		{
-		  return FALSE;
-		}
+		return FALSE;
 	      if (oa->oa_base == NULL)
 		{
 		  oa->oa_base = (caddr_t)
@@ -185,9 +175,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
 		{
 		  if (xdr_opaque (xdrs, oa->oa_base,
 				  oa->oa_length) == FALSE)
-		    {
-		      return FALSE;
-		    }
+		    return FALSE;
 		}
 	      else
 		{
diff --git a/sunrpc/rtime.c b/sunrpc/rtime.c
index 09a8948624..ba3e768b08 100644
--- a/sunrpc/rtime.c
+++ b/sunrpc/rtime.c
@@ -70,8 +70,8 @@ do_close (int s)
 }
 
 int
-rtime (struct sockaddr_in *addrp, struct timeval *timep,
-       struct timeval *timeout)
+rtime (struct sockaddr_in *addrp, struct rpc_timeval *timep,
+       struct rpc_timeval *timeout)
 {
   int s;
   struct pollfd fd;
diff --git a/sunrpc/svc_authux.c b/sunrpc/svc_authux.c
index 627b7e3faf..08065b4184 100644
--- a/sunrpc/svc_authux.c
+++ b/sunrpc/svc_authux.c
@@ -1,4 +1,3 @@
-/* @(#)svc_auth_unix.c	2.3 88/08/01 4.0 RPCSRC; from 1.28 88/02/08 SMI */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -27,9 +26,6 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_auth_unix.c 1.28 88/02/08 Copyr 1984 Sun Micro";
-#endif
 
 /*
  * svc_auth_unix.c
@@ -56,7 +52,7 @@ _svcauth_unix (struct svc_req *rqst, struct rpc_msg *msg)
   enum auth_stat stat;
   XDR xdrs;
   struct authunix_parms *aup;
-  long *buf;
+  int32_t *buf;
   struct area
     {
       struct authunix_parms area_aup;
@@ -78,7 +74,7 @@ _svcauth_unix (struct svc_req *rqst, struct rpc_msg *msg)
   if (buf != NULL)
     {
       aup->aup_time = IXDR_GET_LONG (buf);
-      str_len = IXDR_GET_U_LONG (buf);
+      str_len = IXDR_GET_U_INT32 (buf);
       if (str_len > MAX_MACHINE_NAME)
 	{
 	  stat = AUTH_BADCRED;
@@ -87,10 +83,10 @@ _svcauth_unix (struct svc_req *rqst, struct rpc_msg *msg)
       bcopy ((caddr_t) buf, aup->aup_machname, (u_int) str_len);
       aup->aup_machname[str_len] = 0;
       str_len = RNDUP (str_len);
-      buf = (u_long *) ((char *) buf + str_len);
+      buf = (int32_t *) ((char *) buf + str_len);
       aup->aup_uid = IXDR_GET_LONG (buf);
       aup->aup_gid = IXDR_GET_LONG (buf);
-      gid_len = IXDR_GET_U_LONG (buf);
+      gid_len = IXDR_GET_U_INT32 (buf);
       if (gid_len > NGRPS)
 	{
 	  stat = AUTH_BADCRED;
diff --git a/sunrpc/svcauth_des.c b/sunrpc/svcauth_des.c
index f73c2d1461..56b683a3ab 100644
--- a/sunrpc/svcauth_des.c
+++ b/sunrpc/svcauth_des.c
@@ -1,11 +1,3 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)svcauth_des.c	2.3 89/07/11 4.0 RPCSRC; from 1.15 88/02/08 SMI";
-#endif
-
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- */
-
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -34,7 +26,9 @@ static char sccsid[] = "@(#)svcauth_des.c	2.3 89/07/11 4.0 RPCSRC; from 1.15 88/
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  */
-
+/*
+ * Copyright (c) 1988 by Sun Microsystems, Inc.
+ */
 /*
  * svcauth_des.c, server-side des authentication
  *
@@ -62,7 +56,7 @@ static char sccsid[] = "@(#)svcauth_des.c	2.3 89/07/11 4.0 RPCSRC; from 1.15 88/
 
 #define debug(msg)		/*printf("svcauth_des: %s\n", msg) */
 
-#define USEC_PER_SEC ((u_long) 1000000L)
+#define USEC_PER_SEC ((uint32_t) 1000000L)
 #define BEFORE(t1, t2) timercmp(t1, t2, <)
 
 /*
@@ -74,16 +68,16 @@ struct cache_entry
     des_block key;		/* conversation key */
     char *rname;		/* client's name */
     u_int window;		/* credential lifetime window */
-    struct timeval laststamp;	/* detect replays of creds */
+    struct rpc_timeval laststamp;	/* detect replays of creds */
     char *localcred;		/* generic local credential */
   };
 static struct cache_entry *authdes_cache /* [AUTHDES_CACHESZ] */ ;
-static short *authdes_lru /* [AUTHDES_CACHESZ] */ ;
+static int *authdes_lru /* [AUTHDES_CACHESZ] */ ;
 
 static void cache_init (void) internal_function; /* initialize the cache */
-static short cache_spot (des_block *, char *, struct timeval *)
+static short cache_spot (des_block *, char *, struct rpc_timeval *)
      internal_function;		/* find an entry in the cache */
-static void cache_ref (short sid) internal_function;
+static void cache_ref (uint32_t sid) internal_function;
 				/* note that sid was ref'd */
 
 static void invalidate (char *cred) internal_function;
@@ -106,18 +100,18 @@ svcauthdes_stats;
 enum auth_stat
 _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
 {
-  register long *ixdr;
+  register uint32_t *ixdr;
   des_block cryptbuf[2];
   register struct authdes_cred *cred;
   struct authdes_verf verf;
   int status;
   register struct cache_entry *entry;
-  short sid = 0;
+  uint32_t sid = 0;
   des_block *sessionkey;
   des_block ivec;
   u_int window;
-  struct timeval timestamp;
-  u_long namelen;
+  struct rpc_timeval timestamp;
+  uint32_t namelen;
   struct area
     {
       struct authdes_cred area_cred;
@@ -127,6 +121,8 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
 
   if (authdes_cache == NULL)
     cache_init ();
+  if (authdes_cache == NULL) /* No free memory */
+    return AUTH_FAILED;
 
   area = (struct area *) rqst->rq_clntcred;
   cred = (struct authdes_cred *) &area->area_cred;
@@ -134,27 +130,30 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
   /*
    * Get the credential
    */
-  ixdr = (long *) msg->rm_call.cb_cred.oa_base;
+  if (msg->rm_call.cb_cred.oa_length <= 0 ||
+      msg->rm_call.cb_cred.oa_length > MAX_AUTH_BYTES)
+    return AUTH_BADCRED;
+
+  ixdr = (uint32_t *) msg->rm_call.cb_cred.oa_base;
   cred->adc_namekind = IXDR_GET_ENUM (ixdr, enum authdes_namekind);
   switch (cred->adc_namekind)
     {
     case ADN_FULLNAME:
-      namelen = IXDR_GET_U_LONG (ixdr);
+      namelen = IXDR_GET_U_INT32 (ixdr);
       if (namelen > MAXNETNAMELEN)
 	{
 	  return AUTH_BADCRED;
 	}
       cred->adc_fullname.name = area->area_netname;
-      bcopy ((char *) ixdr, cred->adc_fullname.name,
-	     (u_int) namelen);
+      bcopy ((char *) ixdr, cred->adc_fullname.name, namelen);
       cred->adc_fullname.name[namelen] = 0;
       ixdr += (RNDUP (namelen) / BYTES_PER_XDR_UNIT);
-      cred->adc_fullname.key.key.high = (u_long) * ixdr++;
-      cred->adc_fullname.key.key.low = (u_long) * ixdr++;
-      cred->adc_fullname.window = (u_long) * ixdr++;
+      cred->adc_fullname.key.key.high = *ixdr++;
+      cred->adc_fullname.key.key.low = *ixdr++;
+      cred->adc_fullname.window = *ixdr++;
       break;
     case ADN_NICKNAME:
-      cred->adc_nickname = (u_long) * ixdr++;
+      cred->adc_nickname = *ixdr++;
       break;
     default:
       return AUTH_BADCRED;
@@ -163,11 +162,14 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
   /*
    * Get the verifier
    */
-  ixdr = (long *) msg->rm_call.cb_verf.oa_base;
-  verf.adv_xtimestamp.key.high = (u_long) * ixdr++;
-  verf.adv_xtimestamp.key.low = (u_long) * ixdr++;
-  verf.adv_int_u = (u_long) * ixdr++;
+  if (msg->rm_call.cb_verf.oa_length <= 0 ||
+      msg->rm_call.cb_verf.oa_length > MAX_AUTH_BYTES)
+    return AUTH_BADCRED;
 
+  ixdr = (uint32_t *) msg->rm_call.cb_verf.oa_base;
+  verf.adv_xtimestamp.key.high = *ixdr++;
+  verf.adv_xtimestamp.key.low = *ixdr++;
+  verf.adv_int_u = *ixdr++;
 
   /*
    * Get the conversation key
@@ -194,12 +196,18 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
     }
   else
     {				/* ADN_NICKNAME */
-      sid = (short) cred->adc_nickname;
-      if (sid >= AUTHDES_CACHESZ)
+      if (cred->adc_nickname >= AUTHDES_CACHESZ)
 	{
 	  debug ("bad nickname");
 	  return AUTH_BADCRED;	/* garbled credential */
 	}
+      else
+	sid = cred->adc_nickname;
+
+      /* XXX This could be wrong, but else we have a
+	 security problem */
+      if (authdes_cache[sid].rname == NULL)
+	return AUTH_BADCRED;
       sessionkey = &authdes_cache[sid].key;
     }
 
@@ -218,10 +226,9 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
 			  (char *) &ivec);
     }
   else
-    {
-      status = ecb_crypt ((char *) sessionkey, (char *) cryptbuf,
-			  sizeof (des_block), DES_DECRYPT | DES_HW);
-    }
+    status = ecb_crypt ((char *) sessionkey, (char *) cryptbuf,
+			sizeof (des_block), DES_DECRYPT | DES_HW);
+
   if (DES_FAILED (status))
     {
       debug ("decryption failure");
@@ -231,9 +238,9 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
   /*
    * XDR the decrypted timestamp
    */
-  ixdr = (long *) cryptbuf;
-  timestamp.tv_sec = IXDR_GET_LONG (ixdr);
-  timestamp.tv_usec = IXDR_GET_LONG (ixdr);
+  ixdr = (uint32_t *) cryptbuf;
+  timestamp.tv_sec = IXDR_GET_INT32 (ixdr);
+  timestamp.tv_usec = IXDR_GET_INT32 (ixdr);
 
   /*
    * Check for valid credentials and verifiers.
@@ -248,20 +255,23 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
 
     if (cred->adc_namekind == ADN_FULLNAME)
       {
-	window = IXDR_GET_U_LONG (ixdr);
-	winverf = IXDR_GET_U_LONG (ixdr);
+	short tmp_spot;
+
+	window = IXDR_GET_U_INT32 (ixdr);
+	winverf = IXDR_GET_U_INT32 (ixdr);
 	if (winverf != window - 1)
 	  {
 	    debug ("window verifier mismatch");
 	    return AUTH_BADCRED;	/* garbled credential */
 	  }
-	sid = cache_spot (sessionkey, cred->adc_fullname.name,
-			  &timestamp);
-	if (sid < 0)
+	tmp_spot = cache_spot (sessionkey, cred->adc_fullname.name,
+			       &timestamp);
+	if (tmp_spot < 0 || tmp_spot > AUTHDES_CACHESZ)
 	  {
 	    debug ("replayed credential");
 	    return AUTH_REJECTEDCRED;		/* replay */
 	  }
+	sid = tmp_spot;
 	nick = 0;
       }
     else
@@ -270,17 +280,16 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
 	nick = 1;
       }
 
-    if ((u_long) timestamp.tv_usec >= USEC_PER_SEC)
+    if (timestamp.tv_usec >= USEC_PER_SEC)
       {
 	debug ("invalid usecs");
 	/* cached out (bad key), or garbled verifier */
 	return nick ? AUTH_REJECTEDVERF : AUTH_BADVERF;
       }
-    if (nick && BEFORE (&timestamp,
-			&authdes_cache[sid].laststamp))
+    if (nick && BEFORE (&timestamp, &authdes_cache[sid].laststamp))
       {
 	debug ("timestamp before last seen");
-	return (AUTH_REJECTEDVERF);	/* replay */
+	return AUTH_REJECTEDVERF;	/* replay */
       }
     __gettimeofday (&current, (struct timezone *) NULL);
     current.tv_sec -= window;	/* allow for expiration */
@@ -295,14 +304,14 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
   /*
    * Set up the reply verifier
    */
-  verf.adv_nickname = (u_long) sid;
+  verf.adv_nickname = sid;
 
   /*
    * xdr the timestamp before encrypting
    */
-  ixdr = (long *) cryptbuf;
-  IXDR_PUT_LONG (ixdr, timestamp.tv_sec - 1);
-  IXDR_PUT_LONG (ixdr, timestamp.tv_usec);
+  ixdr = (int32_t *) cryptbuf;
+  IXDR_PUT_INT32 (ixdr, timestamp.tv_sec - 1);
+  IXDR_PUT_INT32 (ixdr, timestamp.tv_usec);
 
   /*
    * encrypt the timestamp
@@ -319,10 +328,10 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
   /*
    * Serialize the reply verifier, and update rqst
    */
-  ixdr = (long *) msg->rm_call.cb_verf.oa_base;
-  *ixdr++ = (long) verf.adv_xtimestamp.key.high;
-  *ixdr++ = (long) verf.adv_xtimestamp.key.low;
-  *ixdr++ = (long) verf.adv_int_u;
+  ixdr = (uint32_t *) msg->rm_call.cb_verf.oa_base;
+  *ixdr++ = verf.adv_xtimestamp.key.high;
+  *ixdr++ = verf.adv_xtimestamp.key.low;
+  *ixdr++ = verf.adv_int_u;
 
   rqst->rq_xprt->xp_verf.oa_flavor = AUTH_DES;
   rqst->rq_xprt->xp_verf.oa_base = msg->rm_call.cb_verf.oa_base;
@@ -341,20 +350,17 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
       size_t full_len;
 
       cred->adc_fullname.window = window;
-      cred->adc_nickname = (u_long) sid;	/* save nickname */
+      cred->adc_nickname = sid;	/* save nickname */
       if (entry->rname != NULL)
-	{
-	  mem_free (entry->rname, strlen (entry->rname) + 1);
-	}
+	mem_free (entry->rname, strlen (entry->rname) + 1);
       full_len = strlen (cred->adc_fullname.name) + 1;
       entry->rname = mem_alloc ((u_int) full_len);
       if (entry->rname != NULL)
-	{
-	  memcpy (entry->rname, cred->adc_fullname.name, full_len);
-	}
+	memcpy (entry->rname, cred->adc_fullname.name, full_len);
       else
 	{
 	  debug ("out of memory");
+	  return AUTH_FAILED; /* out of memory is bad */
 	}
       entry->key = *sessionkey;
       entry->window = window;
@@ -385,17 +391,17 @@ cache_init (void)
 
   authdes_cache = (struct cache_entry *)
     mem_alloc (sizeof (struct cache_entry) * AUTHDES_CACHESZ);
+  if (authdes_cache == NULL)
+    return;
   __bzero ((char *) authdes_cache,
 	   sizeof (struct cache_entry) * AUTHDES_CACHESZ);
 
-  authdes_lru = (short *) mem_alloc (sizeof (short) * AUTHDES_CACHESZ);
+  authdes_lru = (int *) mem_alloc (sizeof (int) * AUTHDES_CACHESZ);
   /*
    * Initialize the lru list
    */
-  for (i = 0; i < AUTHDES_CACHESZ; i++)
-    {
-      authdes_lru[i] = i;
-    }
+  for (i = 0; i < AUTHDES_CACHESZ; ++i)
+    authdes_lru[i] = i;
 }
 
 
@@ -405,7 +411,7 @@ cache_init (void)
 static short
 cache_victim (void)
 {
-  return (authdes_lru[AUTHDES_CACHESZ - 1]);
+  return authdes_lru[AUTHDES_CACHESZ - 1];
 }
 
 /*
@@ -413,15 +419,15 @@ cache_victim (void)
  */
 static void
 internal_function
-cache_ref (register short sid)
+cache_ref (register uint32_t sid)
 {
   register int i;
-  register short curr;
-  register short prev;
+  register int curr;
+  register int prev;
 
   prev = authdes_lru[0];
   authdes_lru[0] = sid;
-  for (i = 1; prev != sid; i++)
+  for (i = 1; prev != sid; ++i)
     {
       curr = authdes_lru[i];
       authdes_lru[i] = prev;
@@ -429,7 +435,6 @@ cache_ref (register short sid)
     }
 }
 
-
 /*
  * Find a spot in the cache for a credential containing
  * the items given.  Return -1 if a replay is detected, otherwise
@@ -437,14 +442,15 @@ cache_ref (register short sid)
  */
 static short
 internal_function
-cache_spot (register des_block * key, char *name, struct timeval *timestamp)
+cache_spot (register des_block *key, char *name,
+	    struct rpc_timeval *timestamp)
 {
   register struct cache_entry *cp;
   register int i;
-  register u_long hi;
+  register uint32_t hi;
 
   hi = key->key.high;
-  for (cp = authdes_cache, i = 0; i < AUTHDES_CACHESZ; i++, cp++)
+  for (cp = authdes_cache, i = 0; i < AUTHDES_CACHESZ; ++i, ++cp)
     {
       if (cp->key.key.high == hi &&
 	  cp->key.key.low == key->key.low &&
@@ -453,18 +459,17 @@ cache_spot (register des_block * key, char *name, struct timeval *timestamp)
 	{
 	  if (BEFORE (timestamp, &cp->laststamp))
 	    {
-	      svcauthdes_stats.ncachereplays++;
+	      ++svcauthdes_stats.ncachereplays;
 	      return -1;	/* replay */
 	    }
-	  svcauthdes_stats.ncachehits++;
+	  ++svcauthdes_stats.ncachehits;
 	  return i;		/* refresh */
 	}
     }
-  svcauthdes_stats.ncachemisses++;
+  ++svcauthdes_stats.ncachemisses;
   return cache_victim ();	/* new credential */
 }
 
-
 /*
  * Local credential handling stuff.
  * NOTE: bsd unix dependent.
@@ -527,10 +532,8 @@ authdes_getucred (const struct authdes_cred *adc, uid_t * uid, gid_t * gid,
       *uid = cred->uid = i_uid;
       *gid = cred->gid = i_gid;
       *grouplen = cred->grouplen = i_grouplen;
-      for (i = i_grouplen - 1; i >= 0; i--)
-	{
-	  cred->groups[i] = groups[i];	/* int to short */
-	}
+      for (i = i_grouplen - 1; i >= 0; --i)
+	cred->groups[i] = groups[i];	/* int to short */
       return 1;
     }
   else if (cred->grouplen == UNKNOWN)
@@ -547,10 +550,8 @@ authdes_getucred (const struct authdes_cred *adc, uid_t * uid, gid_t * gid,
   *uid = cred->uid;
   *gid = cred->gid;
   *grouplen = cred->grouplen;
-  for (i = cred->grouplen - 1; i >= 0; i--)
-    {
-      groups[i] = cred->groups[i];	/* short to int */
-    }
+  for (i = cred->grouplen - 1; i >= 0; --i)
+    groups[i] = cred->groups[i];	/* short to int */
   return 1;
 }
 
@@ -559,8 +560,6 @@ internal_function
 invalidate (char *cred)
 {
   if (cred == NULL)
-    {
-      return;
-    }
+    return;
   ((struct bsdcred *) cred)->grouplen = INVALID;
 }
diff --git a/sunrpc/xdr_mem.c b/sunrpc/xdr_mem.c
index 9379048bf7..9cc3890427 100644
--- a/sunrpc/xdr_mem.c
+++ b/sunrpc/xdr_mem.c
@@ -1,4 +1,3 @@
-/* @(#)xdr_mem.c	2.1 88/07/29 4.0 RPCSRC */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -27,9 +26,6 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-#endif
 
 /*
  * xdr_mem.h, XDR implementation using memory buffers.
@@ -42,7 +38,6 @@ static char sccsid[] = "@(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";
  *
  */
 
-
 #include <string.h>
 #include <rpc/rpc.h>
 
@@ -52,7 +47,7 @@ static bool_t xdrmem_getbytes (XDR *, caddr_t, u_int);
 static bool_t xdrmem_putbytes (XDR *, const char *, u_int);
 static u_int xdrmem_getpos (const XDR *);
 static bool_t xdrmem_setpos (XDR *, u_int);
-static long *xdrmem_inline (XDR *, int);
+static int32_t *xdrmem_inline (XDR *, int);
 static void xdrmem_destroy (XDR *);
 static bool_t xdrmem_getint32 (XDR *, int32_t *);
 static bool_t xdrmem_putint32 (XDR *, const int32_t *);
@@ -76,13 +71,8 @@ static const struct xdr_ops xdrmem_ops =
  * memory buffer.
  */
 void
-xdrmem_create (xdrs, addr, size, op)
-     XDR *xdrs;
-     const caddr_t addr;
-     u_int size;
-     enum xdr_op op;
+xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op)
 {
-
   xdrs->x_op = op;
   /* We have to add the const since the `struct xdr_ops' in `struct XDR'
      is not `const'.  */
@@ -107,11 +97,8 @@ xdrmem_destroy (XDR *xdrs)
  * point at the next element.  Neither object pointed to is const
  */
 static bool_t
-xdrmem_getlong (xdrs, lp)
-     XDR *xdrs;
-     long *lp;
+xdrmem_getlong (XDR *xdrs, long *lp)
 {
-
   if ((xdrs->x_handy -= 4) < 0)
     return FALSE;
   *lp = (int32_t) ntohl ((*((int32_t *) (xdrs->x_private))));
@@ -125,11 +112,8 @@ xdrmem_getlong (xdrs, lp)
  * long pointed at is const
  */
 static bool_t
-xdrmem_putlong (xdrs, lp)
-     XDR *xdrs;
-     const long *lp;
+xdrmem_putlong (XDR *xdrs, const long *lp)
 {
-
   if ((xdrs->x_handy -= 4) < 0)
     return FALSE;
   *(int32_t *) xdrs->x_private = htonl (*lp);
@@ -144,12 +128,8 @@ xdrmem_putlong (xdrs, lp)
  * a good idea.  None of the things pointed to are const.
  */
 static bool_t
-xdrmem_getbytes (xdrs, addr, len)
-     XDR *xdrs;
-     caddr_t addr;
-     u_int len;
+xdrmem_getbytes (XDR *xdrs, caddr_t addr, u_int len)
 {
-
   if ((xdrs->x_handy -= len) < 0)
     return FALSE;
   bcopy (xdrs->x_private, addr, len);
@@ -162,12 +142,8 @@ xdrmem_getbytes (xdrs, addr, len)
  * unaligned data.  The source address is const.
  */
 static bool_t
-xdrmem_putbytes (xdrs, addr, len)
-     XDR *xdrs;
-     const char *addr;
-     u_int len;
+xdrmem_putbytes (XDR *xdrs, const char *addr, u_int len)
 {
-
   if ((xdrs->x_handy -= len) < 0)
     return FALSE;
   bcopy (addr, xdrs->x_private, len);
@@ -180,10 +156,8 @@ xdrmem_putbytes (xdrs, addr, len)
  * of xdrs.  **FIXME** does this not assume u_int == u_long?
  */
 static u_int
-xdrmem_getpos (xdrs)
-     const XDR *xdrs;
+xdrmem_getpos (const XDR *xdrs)
 {
-
   return (u_long) xdrs->x_private - (u_long) xdrs->x_base;
 }
 
@@ -208,17 +182,15 @@ xdrmem_setpos (xdrs, pos)
 /*
  * xdrs modified
  */
-static long *
-xdrmem_inline (xdrs, len)
-     XDR *xdrs;
-     int len;
+static int32_t *
+xdrmem_inline (XDR *xdrs, int len)
 {
-  long *buf = 0;
+  int32_t *buf = 0;
 
   if (xdrs->x_handy >= len)
     {
       xdrs->x_handy -= len;
-      buf = (long *) xdrs->x_private;
+      buf = (int32_t *) xdrs->x_private;
       xdrs->x_private += len;
     }
   return buf;
@@ -232,7 +204,6 @@ xdrmem_inline (xdrs, len)
 static bool_t
 xdrmem_getint32 (XDR *xdrs, int32_t *ip)
 {
-
   if ((xdrs->x_handy -= 4) < 0)
     return FALSE;
   *ip = ntohl ((*((int32_t *) (xdrs->x_private))));
@@ -248,7 +219,6 @@ xdrmem_getint32 (XDR *xdrs, int32_t *ip)
 static bool_t
 xdrmem_putint32 (XDR *xdrs, const int32_t *ip)
 {
-
   if ((xdrs->x_handy -= 4) < 0)
     return FALSE;
   *(int32_t *) xdrs->x_private = htonl (*ip);
diff --git a/sunrpc/xdr_rec.c b/sunrpc/xdr_rec.c
index e0f22c5595..4809589d07 100644
--- a/sunrpc/xdr_rec.c
+++ b/sunrpc/xdr_rec.c
@@ -1,4 +1,3 @@
-/* @(#)xdr_rec.c	2.2 88/08/01 4.0 RPCSRC */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -27,9 +26,6 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
-#endif
 
 /*
  * xdr_rec.c, Implements TCP/IP based XDR streams with a "record marking"
@@ -64,7 +60,7 @@ static bool_t xdrrec_getbytes (XDR *, caddr_t, u_int);
 static bool_t xdrrec_putbytes (XDR *, const char *, u_int);
 static u_int xdrrec_getpos (const XDR *);
 static bool_t xdrrec_setpos (XDR *, u_int);
-static long *xdrrec_inline (XDR *, int);
+static int32_t *xdrrec_inline (XDR *, int);
 static void xdrrec_destroy (XDR *);
 static bool_t xdrrec_getint32 (XDR *, int32_t *);
 static bool_t xdrrec_putint32 (XDR *, const int32_t *);
@@ -204,9 +200,7 @@ xdrrec_create (XDR *xdrs, u_int sendsize,
  */
 
 static bool_t
-xdrrec_getlong (xdrs, lp)
-     XDR *xdrs;
-     long *lp;
+xdrrec_getlong (XDR *xdrs, long *lp)
 {
   RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
   int32_t *buflp = (int32_t *) rstrm->in_finger;
@@ -231,9 +225,7 @@ xdrrec_getlong (xdrs, lp)
 }
 
 static bool_t
-xdrrec_putlong (xdrs, lp)
-     XDR *xdrs;
-     const long *lp;
+xdrrec_putlong (XDR *xdrs, const long *lp)
 {
   RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
   int32_t *dest_lp = (int32_t *) rstrm->out_finger;
@@ -283,10 +275,7 @@ xdrrec_getbytes (XDR *xdrs, caddr_t addr, u_int len)
 }
 
 static bool_t
-xdrrec_putbytes (xdrs, addr, len)
-     XDR *xdrs;
-     const char *addr;
-     u_int len;
+xdrrec_putbytes (XDR *xdrs, const char *addr, u_int len)
 {
   RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
   u_int current;
@@ -336,9 +325,7 @@ xdrrec_getpos (const XDR *xdrs)
 }
 
 static bool_t
-xdrrec_setpos (xdrs, pos)
-     XDR *xdrs;
-     u_int pos;
+xdrrec_setpos (XDR *xdrs, u_int pos)
 {
   RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
   u_int currpos = xdrrec_getpos (xdrs);
@@ -377,11 +364,11 @@ xdrrec_setpos (xdrs, pos)
   return FALSE;
 }
 
-static long *
+static int32_t *
 xdrrec_inline (XDR *xdrs, int len)
 {
   RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
-  long *buf = NULL;
+  int32_t *buf = NULL;
 
   switch (xdrs->x_op)
     {
@@ -389,7 +376,7 @@ xdrrec_inline (XDR *xdrs, int len)
     case XDR_ENCODE:
       if ((rstrm->out_finger + len) <= rstrm->out_boundry)
 	{
-	  buf = (long *) rstrm->out_finger;
+	  buf = (int32_t *) rstrm->out_finger;
 	  rstrm->out_finger += len;
 	}
       break;
@@ -398,7 +385,7 @@ xdrrec_inline (XDR *xdrs, int len)
       if ((len <= rstrm->fbtbc) &&
 	  ((rstrm->in_finger + len) <= rstrm->in_boundry))
 	{
-	  buf = (long *) rstrm->in_finger;
+	  buf = (int32_t *) rstrm->in_finger;
 	  rstrm->fbtbc -= len;
 	  rstrm->in_finger += len;
 	}
@@ -411,8 +398,7 @@ xdrrec_inline (XDR *xdrs, int len)
 }
 
 static void
-xdrrec_destroy (xdrs)
-     XDR *xdrs;
+xdrrec_destroy (XDR *xdrs)
 {
   RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
 
diff --git a/sunrpc/xdr_sizeof.c b/sunrpc/xdr_sizeof.c
index e999e0ef51..faaea34fa3 100644
--- a/sunrpc/xdr_sizeof.c
+++ b/sunrpc/xdr_sizeof.c
@@ -70,22 +70,18 @@ x_setpostn (XDR *xdrs, u_int len)
   return FALSE;
 }
 
-static long *
+static int32_t *
 x_inline (XDR *xdrs, int len)
 {
   if (len == 0)
-    {
-      return NULL;
-    }
+    return NULL;
   if (xdrs->x_op != XDR_ENCODE)
-    {
-      return NULL;
-    }
+    return NULL;
   if (len < (int) xdrs->x_base)
     {
       /* x_private was already allocated */
       xdrs->x_handy += len;
-      return (long *) xdrs->x_private;
+      return (int32_t *) xdrs->x_private;
     }
   else
     {
@@ -99,7 +95,7 @@ x_inline (XDR *xdrs, int len)
 	}
       xdrs->x_base = (caddr_t) len;
       xdrs->x_handy += len;
-      return (long *) xdrs->x_private;
+      return (int32_t *) xdrs->x_private;
     }
 }
 
diff --git a/sunrpc/xdr_stdio.c b/sunrpc/xdr_stdio.c
index e58137c559..411cf17da1 100644
--- a/sunrpc/xdr_stdio.c
+++ b/sunrpc/xdr_stdio.c
@@ -1,4 +1,3 @@
-/* @(#)xdr_stdio.c	2.1 88/07/29 4.0 RPCSRC */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -27,9 +26,6 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";
-#endif
 
 /*
  * xdr_stdio.c, XDR implementation on standard i/o file.
@@ -59,7 +55,7 @@ static bool_t xdrstdio_getbytes (XDR *, caddr_t, u_int);
 static bool_t xdrstdio_putbytes (XDR *, const char *, u_int);
 static u_int xdrstdio_getpos (const XDR *);
 static bool_t xdrstdio_setpos (XDR *, u_int);
-static long *xdrstdio_inline (XDR *, int);
+static int32_t *xdrstdio_inline (XDR *, int);
 static void xdrstdio_destroy (XDR *);
 static bool_t xdrstdio_getint32 (XDR *, int32_t *);
 static bool_t xdrstdio_putint32 (XDR *, const int32_t *);
@@ -87,12 +83,8 @@ static const struct xdr_ops xdrstdio_ops =
  * Operation flag is set to op.
  */
 void
-xdrstdio_create (xdrs, file, op)
-     XDR *xdrs;
-     FILE *file;
-     enum xdr_op op;
+xdrstdio_create (XDR *xdrs, FILE *file, enum xdr_op op)
 {
-
   xdrs->x_op = op;
   /* We have to add the const since the `struct xdr_ops' in `struct XDR'
      is not `const'.  */
@@ -107,17 +99,14 @@ xdrstdio_create (xdrs, file, op)
  * Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create.
  */
 static void
-xdrstdio_destroy (xdrs)
-     XDR *xdrs;
+xdrstdio_destroy (XDR *xdrs)
 {
   (void) fflush ((FILE *) xdrs->x_private);
   /* xx should we close the file ?? */
 };
 
 static bool_t
-xdrstdio_getlong (xdrs, lp)
-     XDR *xdrs;
-     long *lp;
+xdrstdio_getlong (XDR *xdrs, long *lp)
 {
   int32_t mycopy;
 
@@ -130,7 +119,6 @@ xdrstdio_getlong (xdrs, lp)
 static bool_t
 xdrstdio_putlong (XDR *xdrs, const long *lp)
 {
-
   long mycopy = htonl (*lp);
   lp = &mycopy;
   if (fwrite ((caddr_t) lp, 4, 1, (FILE *) xdrs->x_private) != 1)
@@ -139,13 +127,10 @@ xdrstdio_putlong (XDR *xdrs, const long *lp)
 }
 
 static bool_t
-xdrstdio_getbytes (xdrs, addr, len)
-     XDR *xdrs;
-     const caddr_t addr;
-     u_int len;
+xdrstdio_getbytes (XDR *xdrs, const caddr_t addr, u_int len)
 {
-
-  if ((len != 0) && (fread (addr, (int) len, 1, (FILE *) xdrs->x_private) != 1))
+  if ((len != 0) && (fread (addr, (int) len, 1,
+			    (FILE *) xdrs->x_private) != 1))
     return FALSE;
   return TRUE;
 }
@@ -153,7 +138,8 @@ xdrstdio_getbytes (xdrs, addr, len)
 static bool_t
 xdrstdio_putbytes (XDR *xdrs, const char *addr, u_int len)
 {
-  if ((len != 0) && (fwrite (addr, (int) len, 1, (FILE *) xdrs->x_private) != 1))
+  if ((len != 0) && (fwrite (addr, (int) len, 1,
+			     (FILE *) xdrs->x_private) != 1))
     return FALSE;
   return TRUE;
 }
@@ -170,10 +156,9 @@ xdrstdio_setpos (XDR *xdrs, u_int pos)
   return fseek ((FILE *) xdrs->x_private, (long) pos, 0) < 0 ? FALSE : TRUE;
 }
 
-static long *
+static int32_t *
 xdrstdio_inline (XDR *xdrs, int len)
 {
-
   /*
    * Must do some work to implement this: must insure
    * enough data in the underlying stdio buffer,