diff options
| author | Ulrich Drepper <drepper@redhat.com> | 1999-04-15 13:54:57 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 1999-04-15 13:54:57 +0000 |
| commit | f8afba91cf8bf8f8324c3c88b8c368e7c2bd5894 (patch) | |
| tree | dbdd5f960cf217c76d495ba44173feafae9d184f /sunrpc | |
| parent | a5486962345290853d7d42ef4a799f16bd6764e2 (diff) | |
| download | 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.c | 98 | ||||
| -rw-r--r-- | sunrpc/auth_none.c | 29 | ||||
| -rw-r--r-- | sunrpc/auth_unix.c | 53 | ||||
| -rw-r--r-- | sunrpc/authdes_prot.c | 8 | ||||
| -rw-r--r-- | sunrpc/authuxprot.c | 11 | ||||
| -rw-r--r-- | sunrpc/bindrsvprt.c | 13 | ||||
| -rw-r--r-- | sunrpc/clnt_gen.c | 5 | ||||
| -rw-r--r-- | sunrpc/rpc/auth_des.h | 16 | ||||
| -rw-r--r-- | sunrpc/rpc/xdr.h | 5 | ||||
| -rw-r--r-- | sunrpc/rpc_cmsg.c | 36 | ||||
| -rw-r--r-- | sunrpc/rtime.c | 4 | ||||
| -rw-r--r-- | sunrpc/svc_authux.c | 12 | ||||
| -rw-r--r-- | sunrpc/svcauth_des.c | 183 | ||||
| -rw-r--r-- | sunrpc/xdr_mem.c | 52 | ||||
| -rw-r--r-- | sunrpc/xdr_rec.c | 34 | ||||
| -rw-r--r-- | sunrpc/xdr_sizeof.c | 14 | ||||
| -rw-r--r-- | sunrpc/xdr_stdio.c | 35 |
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) |
