diff options
| author | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
|---|---|---|
| committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
| commit | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch) | |
| tree | 2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /sunrpc | |
| parent | 7d58530341304d403a6626d7f7a1913165fe2f32 (diff) | |
| download | glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip | |
2.5-18.1
Diffstat (limited to 'sunrpc')
46 files changed, 580 insertions, 417 deletions
diff --git a/sunrpc/Makefile b/sunrpc/Makefile index 284e355cc3..30f74dc135 100644 --- a/sunrpc/Makefile +++ b/sunrpc/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1994-2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1994-2004, 2005, 2006 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 @@ -85,6 +85,7 @@ all: # Make this the default target; it will be defined in Rules. include ../Makeconfig +tests = tst-xdrmem tst-xdrmem2 xtests := tst-getmyaddr ifeq ($(have-thread-library),yes) @@ -107,28 +108,25 @@ librpcsvc-inhibit-o = .os # Build no shared rpcsvc library. omit-deps = $(librpcsvc-routines) endif -CFLAGS-xbootparam_prot.c = -Wno-unused -CFLAGS-xnlm_prot.c = -Wno-unused -CFLAGS-xrstat.c = -Wno-unused -CFLAGS-xyppasswd.c = -Wno-unused -CFLAGS-xklm_prot.c = -Wno-unused -CFLAGS-xrex.c = -Wno-unused -CFLAGS-xsm_inter.c = -Wno-unused -CFLAGS-xmount.c = -Wno-unused -CFLAGS-xrusers.c = -Wno-unused -CFLAGS-xspray.c = -Wno-unused -CFLAGS-xnfs_prot.c = -Wno-unused -CFLAGS-xrquota.c = -Wno-unused -CFLAGS-xkey_prot.c = -Wno-unused +CFLAGS-xbootparam_prot.c = -Wno-unused $(PIC-ccflag) +CFLAGS-xnlm_prot.c = -Wno-unused $(PIC-ccflag) +CFLAGS-xrstat.c = -Wno-unused $(PIC-ccflag) +CFLAGS-xyppasswd.c = -Wno-unused $(PIC-ccflag) +CFLAGS-xklm_prot.c = -Wno-unused $(PIC-ccflag) +CFLAGS-xrex.c = -Wno-unused $(PIC-ccflag) +CFLAGS-xsm_inter.c = -Wno-unused $(PIC-ccflag) +CFLAGS-xmount.c = -Wno-unused $(PIC-ccflag) +CFLAGS-xrusers.c = -Wno-unused $(PIC-ccflag) +CFLAGS-xspray.c = -Wno-unused $(PIC-ccflag) +CFLAGS-xnfs_prot.c = -Wno-unused $(PIC-ccflag) +CFLAGS-xrquota.c = -Wno-unused $(PIC-ccflag) +CFLAGS-xkey_prot.c = -Wno-unused $(PIC-ccflag) CFLAGS-auth_unix.c = -fexceptions CFLAGS-key_call.c = -fexceptions CFLAGS-pmap_rmt.c = -fexceptions CFLAGS-clnt_perr.c = -fexceptions CFLAGS-openchild.c = -fexceptions -ifeq (yes,$(have_doors)) -CPPFLAGS-key_call.c += -DHAVE_DOORS=1 -endif CPPFLAGS += -D_RPC_THREAD_SAFE_ include ../Rules diff --git a/sunrpc/auth_des.c b/sunrpc/auth_des.c index fc5956dcd7..a76f0278ce 100644 --- a/sunrpc/auth_des.c +++ b/sunrpc/auth_des.c @@ -66,7 +66,7 @@ static void authdes_destroy (AUTH *); static bool_t synchronize (struct sockaddr *, struct rpc_timeval *) internal_function; -static struct auth_ops authdes_ops = { +static const struct auth_ops authdes_ops = { authdes_nextverf, authdes_marshal, authdes_validate, @@ -107,14 +107,14 @@ authdes_create (const char *servername, u_int window, /* syncaddr - optional addr of host to sync with */ /* ckey - optional conversation key to use */ { - u_char pkey_data[1024]; + char pkey_data[1024]; netobj pkey; if (!getpublickey (servername, pkey_data)) return NULL; - pkey.n_bytes = (char *) pkey_data; - pkey.n_len = strlen ((char *) pkey_data) + 1; + pkey.n_bytes = pkey_data; + pkey.n_len = strlen (pkey_data) + 1; return INTUSE(authdes_pk_create) (servername, &pkey, window, syncaddr, ckey); } @@ -174,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; + goto failed; } } else @@ -185,7 +185,7 @@ authdes_pk_create (const char *servername, netobj *pkey, u_int window, */ auth->ah_cred.oa_flavor = AUTH_DES; auth->ah_verf.oa_flavor = AUTH_DES; - auth->ah_ops = &authdes_ops; + auth->ah_ops = (struct auth_ops *) &authdes_ops; auth->ah_private = (caddr_t) ad; if (!authdes_refresh (auth)) @@ -237,7 +237,7 @@ authdes_marshal (AUTH *auth, XDR *xdrs) des_block cryptbuf[2]; des_block ivec; int status; - unsigned int len; + int len; register int32_t *ixdr; struct timeval tval; diff --git a/sunrpc/auth_none.c b/sunrpc/auth_none.c index 9c4d3fde66..f459520a2c 100644 --- a/sunrpc/auth_none.c +++ b/sunrpc/auth_none.c @@ -49,7 +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 const struct auth_ops ops = { authnone_verf, authnone_marshal, authnone_validate, @@ -80,7 +80,7 @@ authnone_create_once (void) ap = &authnone_private; ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth; - ap->no_client.ah_ops = &ops; + ap->no_client.ah_ops = (struct auth_ops *) &ops; xdrs = &xdr_stream; INTUSE(xdrmem_create) (xdrs, ap->marshalled_client, (u_int) MAX_MARSHAL_SIZE, XDR_ENCODE); @@ -88,7 +88,7 @@ authnone_create_once (void) (void) INTUSE(xdr_opaque_auth) (xdrs, &ap->no_client.ah_verf); ap->mcnt = XDR_GETPOS (xdrs); XDR_DESTROY (xdrs); -} +} AUTH * authnone_create (void) diff --git a/sunrpc/auth_unix.c b/sunrpc/auth_unix.c index 1cf18cb6b3..1740e58cdc 100644 --- a/sunrpc/auth_unix.c +++ b/sunrpc/auth_unix.c @@ -65,7 +65,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 const struct auth_ops auth_unix_ops = { authunix_nextverf, authunix_marshal, authunix_validate, @@ -111,18 +111,12 @@ authunix_create (char *machname, uid_t uid, gid_t gid, int len, if (auth == NULL || au == NULL) { no_memory: -#ifdef USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", - _("authunix_create: out of memory\n")); - else -#endif - (void) fputs (_("authunix_create: out of memory\n"), stderr); + (void) __fxprintf (NULL, "%s", _("authunix_create: out of memory\n")); mem_free (auth, sizeof (*auth)); mem_free (au, sizeof (*au)); return NULL; } - auth->ah_ops = &auth_unix_ops; + auth->ah_ops = (struct auth_ops *) &auth_unix_ops; auth->ah_private = (caddr_t) au; auth->ah_verf = au->au_shcred = _null_auth; au->au_shfaults = 0; diff --git a/sunrpc/bindrsvprt.c b/sunrpc/bindrsvprt.c index 374518716e..023ae1723b 100644 --- a/sunrpc/bindrsvprt.c +++ b/sunrpc/bindrsvprt.c @@ -43,14 +43,15 @@ int bindresvport (int sd, struct sockaddr_in *sin) { - int res; static short port; struct sockaddr_in myaddr; int i; #define STARTPORT 600 +#define LOWPORT 512 #define ENDPORT (IPPORT_RESERVED - 1) #define NPORTS (ENDPORT - STARTPORT + 1) + static short startport = STARTPORT; if (sin == (struct sockaddr_in *) 0) { @@ -68,17 +69,30 @@ bindresvport (int sd, struct sockaddr_in *sin) { port = (__getpid () % NPORTS) + STARTPORT; } - res = -1; - __set_errno (EADDRINUSE); - for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; ++i) + /* Initialize to make gcc happy. */ + int res = -1; + + int nports = ENDPORT - startport + 1; + int endport = ENDPORT; + again: + for (i = 0; i < nports; ++i) { sin->sin_port = htons (port++); - if (port > ENDPORT) - { - port = STARTPORT; - } + if (port > endport) + port = startport; res = __bind (sd, sin, sizeof (struct sockaddr_in)); + if (res >= 0 || errno != EADDRINUSE) + break; + } + + if (i == nports && startport != LOWPORT) + { + startport = LOWPORT; + endport = STARTPORT - 1; + nports = STARTPORT - LOWPORT; + port = LOWPORT + port % (STARTPORT - LOWPORT); + goto again; } return res; diff --git a/sunrpc/clnt_perr.c b/sunrpc/clnt_perr.c index 4fa5e62c0f..6446b32740 100644 --- a/sunrpc/clnt_perr.c +++ b/sunrpc/clnt_perr.c @@ -155,12 +155,7 @@ libc_hidden_def (clnt_sperror) void clnt_perror (CLIENT * rpch, const char *msg) { -#ifdef USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", clnt_sperror (rpch, msg)); - else -#endif - (void) fputs (clnt_sperror (rpch, msg), stderr); + (void) __fxprintf (NULL, "%s", clnt_sperror (rpch, msg)); } libc_hidden_def (clnt_perror) @@ -289,12 +284,7 @@ libc_hidden_def (clnt_sperrno) void clnt_perrno (enum clnt_stat num) { -#ifdef USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", clnt_sperrno (num)); - else -#endif - (void) fputs (clnt_sperrno (num), stderr); + (void) __fxprintf (NULL, "%s", clnt_sperrno (num)); } @@ -337,12 +327,7 @@ libc_hidden_def (clnt_spcreateerror) void clnt_pcreateerror (const char *msg) { -#ifdef USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", clnt_spcreateerror (msg)); - else -#endif - (void) fputs (clnt_spcreateerror (msg), stderr); + (void) __fxprintf (NULL, "%s", clnt_spcreateerror (msg)); } struct auth_errtab diff --git a/sunrpc/clnt_raw.c b/sunrpc/clnt_raw.c index e8613422a5..019f1bbae0 100644 --- a/sunrpc/clnt_raw.c +++ b/sunrpc/clnt_raw.c @@ -74,7 +74,7 @@ static bool_t clntraw_freeres (CLIENT *, xdrproc_t, caddr_t); static bool_t clntraw_control (CLIENT *, int, char *); static void clntraw_destroy (CLIENT *); -static struct clnt_ops client_ops = +static const struct clnt_ops client_ops = { clntraw_call, clntraw_abort, @@ -127,7 +127,7 @@ clntraw_create (u_long prog, u_long vers) /* * create client handle */ - client->cl_ops = &client_ops; + client->cl_ops = (struct clnt_ops *) &client_ops; client->cl_auth = INTUSE(authnone_create) (); return client; } diff --git a/sunrpc/clnt_tcp.c b/sunrpc/clnt_tcp.c index 5d02cd99cb..5bec3bcf3a 100644 --- a/sunrpc/clnt_tcp.c +++ b/sunrpc/clnt_tcp.c @@ -91,7 +91,7 @@ static bool_t clnttcp_freeres (CLIENT *, xdrproc_t, caddr_t); static bool_t clnttcp_control (CLIENT *, int, char *); static void clnttcp_destroy (CLIENT *); -static struct clnt_ops tcp_ops = +static const struct clnt_ops tcp_ops = { clnttcp_call, clnttcp_abort, @@ -128,13 +128,7 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, if (h == NULL || ct == NULL) { struct rpc_createerr *ce = &get_rpc_createerr (); -#ifdef USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", - _("clnttcp_create: out of memory\n")); - else -#endif - (void) fputs (_("clnttcp_create: out of memory\n"), stderr); + (void) __fxprintf (NULL, "%s", _("clnttcp_create: out of memory\n")); ce->cf_stat = RPC_SYSTEMERROR; ce->cf_error.re_errno = ENOMEM; goto fooy; @@ -219,7 +213,7 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, */ INTUSE(xdrrec_create) (&(ct->ct_xdrs), sendsz, recvsz, (caddr_t) ct, readtcp, writetcp); - h->cl_ops = &tcp_ops; + h->cl_ops = (struct clnt_ops *) &tcp_ops; h->cl_private = (caddr_t) ct; h->cl_auth = INTUSE(authnone_create) (); return h; diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c index f3787dd1a5..8c24677c83 100644 --- a/sunrpc/clnt_udp.c +++ b/sunrpc/clnt_udp.c @@ -74,7 +74,7 @@ static bool_t clntudp_freeres (CLIENT *, xdrproc_t, caddr_t); static bool_t clntudp_control (CLIENT *, int, char *); static void clntudp_destroy (CLIENT *); -static struct clnt_ops udp_ops = +static const struct clnt_ops udp_ops = { clntudp_call, clntudp_abort, @@ -136,13 +136,7 @@ clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version, if (cl == NULL || cu == NULL) { struct rpc_createerr *ce = &get_rpc_createerr (); -#ifdef USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", - _("clntudp_create: out of memory\n")); - else -#endif - (void) fputs (_("clntudp_create: out of memory\n"), stderr); + (void) __fxprintf (NULL, "%s", _("clntudp_create: out of memory\n")); ce- |
