diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-01-23 23:22:10 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-01-23 23:22:10 +0000 |
commit | cc479c5abf86e0014cf6bc3492bbf53a47f503fc (patch) | |
tree | f6d242ea42993b010612c28cfcbc5228cee94549 | |
parent | a1d98e054e1d2a3481f897fb40f98972a57c74d9 (diff) |
sync with glibc
-rw-r--r-- | include/rpc/xdr.h | 34 | ||||
-rw-r--r-- | libc/inet/rpc/Makefile.in | 4 | ||||
-rw-r--r-- | libc/inet/rpc/auth_none.c | 13 | ||||
-rw-r--r-- | libc/inet/rpc/rpc_cmsg.c (renamed from libc/inet/rpc/rpc_callmsg.c) | 0 | ||||
-rw-r--r-- | libc/inet/rpc/svc_authux.c (renamed from libc/inet/rpc/svc_auth_unix.c) | 0 | ||||
-rw-r--r-- | libc/inet/rpc/xdr_mem.c | 30 | ||||
-rw-r--r-- | libc/inet/rpc/xdr_rec.c | 4 | ||||
-rw-r--r-- | libc/inet/rpc/xdr_stdio.c | 16 |
8 files changed, 48 insertions, 53 deletions
diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h index 4b2bb0e97..d2d097c86 100644 --- a/include/rpc/xdr.h +++ b/include/rpc/xdr.h @@ -39,13 +39,13 @@ #ifdef _LIBC /* Some adjustments to make the libc source from glibc * compile more easily with uClibc... */ -#ifndef __FORCE_GLIBC -#define __FORCE_GLIBC -#endif -#ifndef _GNU_SOUCE -#define _GNU_SOUCE -#endif -#define _(X) X +# ifndef __FORCE_GLIBC +# define __FORCE_GLIBC +# endif +# ifndef _GNU_SOUCE +# define _GNU_SOUCE +# endif +# define _(X) X #endif #include <features.h> #include <sys/types.h> @@ -137,7 +137,7 @@ struct XDR /* returns bytes off from beginning */ bool_t (*x_setpostn) (XDR *__xdrs, u_int __pos); /* lets you reposition the stream */ - int32_t *(*x_inline) (XDR *__xdrs, int __len); + int32_t *(*x_inline) (XDR *__xdrs, u_int __len); /* buf quick ptr to buffered data */ void (*x_destroy) (XDR *__xdrs); /* free privates of this xdr_stream */ @@ -150,7 +150,7 @@ struct XDR caddr_t x_public; /* users' data */ caddr_t x_private; /* pointer to private data */ caddr_t x_base; /* private used for position info */ - int x_handy; /* extra private word */ + u_int x_handy; /* extra private word */ }; /* @@ -273,20 +273,8 @@ struct xdr_discrim * and shouldn't be used any longer. Code which use this defines or longs * in the RPC code will not work on 64bit Solaris platforms ! */ -/* #define IXDR_GET_LONG(buf) \ */ -/* ((long)ntohl((u_long)*(*(u_int32_t**)&(buf))++)) */ -/* #define IXDR_PUT_LONG(buf, v) \ */ -/* (*(*(u_int32_t**)&(buf))++ = (long)htonl((u_long)(v))) */ - -/* WARNING: These macros are not safe against side effects for the 'buf' - * argument. But the old versions they're replacing took the address of - * 'buf' and were probably not safe in that situation either. */ -#define IXDR_GET_LONG(buf) \ - ((long) ntohl((u_long) (((u_int32_t *)(buf = (void *)(((char *) buf) + sizeof(u_int32_t))))[-1]) )) -#define IXDR_PUT_LONG(buf, v) \ - (((u_int32_t *)(buf = (void *)(((char *) buf) + sizeof(u_int32_t))))[-1]) = (long)htonl((u_long)(v)) - - +#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf)) +#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v))) #define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) #define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG(buf, (long)(v)) diff --git a/libc/inet/rpc/Makefile.in b/libc/inet/rpc/Makefile.in index 9bfa781d6..0b766f2b6 100644 --- a/libc/inet/rpc/Makefile.in +++ b/libc/inet/rpc/Makefile.in @@ -11,8 +11,8 @@ CSRC:= auth_none.c auth_unix.c authunix_prot.c bindresvport.c \ clnt_generic.c clnt_perror.c clnt_raw.c clnt_simple.c clnt_tcp.c \ clnt_udp.c rpc_dtablesize.c get_myaddress.c getrpcent.c getrpcport.c \ pmap_clnt.c pmap_getmaps.c pmap_getport.c pmap_prot.c \ - pmap_prot2.c pmap_rmt.c rpc_prot.c rpc_commondata.c rpc_callmsg.c \ - svc.c svc_auth.c svc_auth_unix.c svc_raw.c svc_run.c svc_simple.c \ + pmap_prot2.c pmap_rmt.c rpc_prot.c rpc_commondata.c rpc_cmsg.c \ + svc.c svc_auth.c svc_authux.c svc_raw.c svc_run.c svc_simple.c \ svc_tcp.c svc_udp.c xdr.c xdr_array.c xdr_float.c xdr_mem.c \ xdr_rec.c xdr_reference.c xdr_stdio.c \ rtime.c clnt_unix.c svc_unix.c create_xid.c xdr_intXX_t.c rcmd.c \ diff --git a/libc/inet/rpc/auth_none.c b/libc/inet/rpc/auth_none.c index e69dc2233..05851025f 100644 --- a/libc/inet/rpc/auth_none.c +++ b/libc/inet/rpc/auth_none.c @@ -42,7 +42,7 @@ libc_hidden_proto(xdrmem_create) libc_hidden_proto(xdr_opaque_auth) -#define MAX_MARSHEL_SIZE 20 +#define MAX_MARSHAL_SIZE 20 /* * Authenticator operations routines @@ -53,7 +53,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, @@ -61,9 +61,11 @@ static struct auth_ops ops = { authnone_destroy }; +/* Internal data and routines */ + struct authnone_private_s { AUTH no_client; - char marshalled_client[MAX_MARSHEL_SIZE]; + char marshalled_client[MAX_MARSHAL_SIZE]; u_int mcnt; }; #ifdef __UCLIBC_HAS_THREADS__ @@ -91,9 +93,9 @@ authnone_create (void) if (!ap->mcnt) { 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; - xdrmem_create (xdrs, ap->marshalled_client, (u_int) MAX_MARSHEL_SIZE, + xdrmem_create (xdrs, ap->marshalled_client, (u_int) MAX_MARSHAL_SIZE, XDR_ENCODE); (void) xdr_opaque_auth (xdrs, &ap->no_client.ah_cred); (void) xdr_opaque_auth (xdrs, &ap->no_client.ah_verf); @@ -104,7 +106,6 @@ authnone_create (void) } libc_hidden_def(authnone_create) -/*ARGSUSED */ static bool_t authnone_marshal (AUTH *client attribute_unused, XDR *xdrs) { diff --git a/libc/inet/rpc/rpc_callmsg.c b/libc/inet/rpc/rpc_cmsg.c index b47a67c71..b47a67c71 100644 --- a/libc/inet/rpc/rpc_callmsg.c +++ b/libc/inet/rpc/rpc_cmsg.c diff --git a/libc/inet/rpc/svc_auth_unix.c b/libc/inet/rpc/svc_authux.c index 3afcfc5d4..3afcfc5d4 100644 --- a/libc/inet/rpc/svc_auth_unix.c +++ b/libc/inet/rpc/svc_authux.c diff --git a/libc/inet/rpc/xdr_mem.c b/libc/inet/rpc/xdr_mem.c index 191672ec4..7613ffc2f 100644 --- a/libc/inet/rpc/xdr_mem.c +++ b/libc/inet/rpc/xdr_mem.c @@ -38,11 +38,9 @@ * */ -#define __FORCE_GLIBC #include <features.h> - - #include <string.h> +#include <limits.h> #include <rpc/rpc.h> libc_hidden_proto(memcpy) @@ -53,7 +51,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 int32_t *xdrmem_inline (XDR *, int); +static int32_t *xdrmem_inline (XDR *, u_int); static void xdrmem_destroy (XDR *); static bool_t xdrmem_getint32 (XDR *, int32_t *); static bool_t xdrmem_putint32 (XDR *, const int32_t *); @@ -107,8 +105,9 @@ xdrmem_destroy (XDR *xdrs attribute_unused) static bool_t xdrmem_getlong (XDR *xdrs, long *lp) { - if ((xdrs->x_handy -= 4) < 0) + if (xdrs->x_handy < 4) return FALSE; + xdrs->x_handy -= 4; *lp = (int32_t) ntohl ((*((int32_t *) (xdrs->x_private)))); xdrs->x_private += 4; return TRUE; @@ -122,8 +121,9 @@ xdrmem_getlong (XDR *xdrs, long *lp) static bool_t xdrmem_putlong (XDR *xdrs, const long *lp) { - if ((xdrs->x_handy -= 4) < 0) + if (xdrs->x_handy < 4) return FALSE; + xdrs->x_handy -= 4; *(int32_t *) xdrs->x_private = htonl (*lp); xdrs->x_private += 4; return TRUE; @@ -138,8 +138,9 @@ xdrmem_putlong (XDR *xdrs, const long *lp) static bool_t xdrmem_getbytes (XDR *xdrs, caddr_t addr, u_int len) { - if ((xdrs->x_handy -= len) < 0) + if (xdrs->x_handy < len) return FALSE; + xdrs->x_handy -= len; memcpy (addr, xdrs->x_private, len); xdrs->x_private += len; return TRUE; @@ -152,8 +153,9 @@ xdrmem_getbytes (XDR *xdrs, caddr_t addr, u_int len) static bool_t xdrmem_putbytes (XDR *xdrs, const char *addr, u_int len) { - if ((xdrs->x_handy -= len) < 0) + if (xdrs->x_handy < len) return FALSE; + xdrs->x_handy -= len; memcpy (xdrs->x_private, addr, len); xdrs->x_private += len; return TRUE; @@ -180,7 +182,9 @@ xdrmem_setpos (xdrs, pos) caddr_t newaddr = xdrs->x_base + pos; caddr_t lastaddr = xdrs->x_private + xdrs->x_handy; - if ((long) newaddr > (long) lastaddr) + if ((long) newaddr > (long) lastaddr + || (UINT_MAX < LONG_MAX + && (long) UINT_MAX < (long) lastaddr - (long) newaddr)) return FALSE; xdrs->x_private = newaddr; xdrs->x_handy = (long) lastaddr - (long) newaddr; @@ -191,7 +195,7 @@ xdrmem_setpos (xdrs, pos) * xdrs modified */ static int32_t * -xdrmem_inline (XDR *xdrs, int len) +xdrmem_inline (XDR *xdrs, u_int len) { int32_t *buf = 0; @@ -212,8 +216,9 @@ xdrmem_inline (XDR *xdrs, int len) static bool_t xdrmem_getint32 (XDR *xdrs, int32_t *ip) { - if ((xdrs->x_handy -= 4) < 0) + if (xdrs->x_handy < 4) return FALSE; + xdrs->x_handy -= 4; *ip = ntohl ((*((int32_t *) (xdrs->x_private)))); xdrs->x_private += 4; return TRUE; @@ -227,8 +232,9 @@ xdrmem_getint32 (XDR *xdrs, int32_t *ip) static bool_t xdrmem_putint32 (XDR *xdrs, const int32_t *ip) { - if ((xdrs->x_handy -= 4) < 0) + if (xdrs->x_handy < 4) return FALSE; + xdrs->x_handy -= 4; *(int32_t *) xdrs->x_private = htonl (*ip); xdrs->x_private += 4; return TRUE; diff --git a/libc/inet/rpc/xdr_rec.c b/libc/inet/rpc/xdr_rec.c index 4534a83e7..99e6fe9c3 100644 --- a/libc/inet/rpc/xdr_rec.c +++ b/libc/inet/rpc/xdr_rec.c @@ -71,7 +71,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 int32_t *xdrrec_inline (XDR *, int); +static int32_t *xdrrec_inline (XDR *, u_int); static void xdrrec_destroy (XDR *); static bool_t xdrrec_getint32 (XDR *, int32_t *); static bool_t xdrrec_putint32 (XDR *, const int32_t *); @@ -384,7 +384,7 @@ xdrrec_setpos (XDR *xdrs, u_int pos) } static int32_t * -xdrrec_inline (XDR *xdrs, int len) +xdrrec_inline (XDR *xdrs, u_int len) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; int32_t *buf = NULL; diff --git a/libc/inet/rpc/xdr_stdio.c b/libc/inet/rpc/xdr_stdio.c index 8bd08590d..32689e132 100644 --- a/libc/inet/rpc/xdr_stdio.c +++ b/libc/inet/rpc/xdr_stdio.c @@ -61,7 +61,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 int32_t *xdrstdio_inline (XDR *, int); +static int32_t *xdrstdio_inline (XDR *, u_int); static void xdrstdio_destroy (XDR *); static bool_t xdrstdio_getint32 (XDR *, int32_t *); static bool_t xdrstdio_putint32 (XDR *, const int32_t *); @@ -114,20 +114,20 @@ xdrstdio_destroy (XDR *xdrs) static bool_t xdrstdio_getlong (XDR *xdrs, long *lp) { - int32_t mycopy; + u_int32_t mycopy; - if (fread ((caddr_t) & mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) + if (fread ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) return FALSE; - *lp = (int32_t) ntohl (mycopy); + *lp = (long) ntohl (mycopy); return TRUE; } 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) + int32_t mycopy = htonl ((u_int32_t) *lp); + + if (fwrite ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) return FALSE; return TRUE; } @@ -163,7 +163,7 @@ xdrstdio_setpos (XDR *xdrs, u_int pos) } static int32_t * -xdrstdio_inline (XDR *xdrs attribute_unused, int len attribute_unused) +xdrstdio_inline (XDR *xdrs attribute_unused, u_int len attribute_unused) { /* * Must do some work to implement this: must insure |