From b3ccd7786f77efef5e10f7b331ee22f940940171 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Thu, 5 Jul 2001 16:15:42 +0000 Subject: * configure.in: Add AC_TYPE_GETGROUPS to determine argument to getgroups. * auth_unix.c (authunix_create_default): Use GETGROUPS_T array in call to getgroups. Copy into array of int for call to authunix_create. Note: If auth_unix protection ever used with this code, we will need to cleanup assumptions in int being 32 bits in OTW transfer of gids. * clnt_tcp.c, svc_tcp.c: Change writetcp and readtcp to take char * as first argument to be compatible with xdrrec_create. * xdr.c (xdr_opaque): Cast argument in call to XDR_GETBYTES. * svc.h: Add prototype for gssrpc_svcudp_enablecache. * svc_auth_gssapi.c (_gssrpc_svcauth_gssapi): Change _svcauth_gssapi to _gssrpc_svcauth_gssapi for consistancy. * svc_auth.c: Move prototypes for _gssrpc_svcauth_{unix, null, short, gssapi} to: * svc_auth.h: here. * svc_auth_unix.c: Update _gssrpc_svcauth_short and _gssrpc_svcauth_unix to match prototype. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13563 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/rpc/ChangeLog | 28 ++++++++++++++++++++++++++++ src/lib/rpc/auth_unix.c | 8 ++++++-- src/lib/rpc/clnt_tcp.c | 14 ++++++++------ src/lib/rpc/configure.in | 1 + src/lib/rpc/svc.h | 2 ++ src/lib/rpc/svc_auth.c | 13 ------------- src/lib/rpc/svc_auth.h | 13 +++++++++++++ src/lib/rpc/svc_auth_gssapi.c | 2 +- src/lib/rpc/svc_auth_unix.c | 6 ++++-- src/lib/rpc/svc_tcp.c | 12 +++++++----- src/lib/rpc/xdr.c | 2 +- 11 files changed, 71 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/lib/rpc/ChangeLog b/src/lib/rpc/ChangeLog index 6410072..76556bb 100644 --- a/src/lib/rpc/ChangeLog +++ b/src/lib/rpc/ChangeLog @@ -1,3 +1,31 @@ +2001-07-05 Ezra Peisach + + * configure.in: Add AC_TYPE_GETGROUPS to determine argument to + getgroups. + + * auth_unix.c (authunix_create_default): Use GETGROUPS_T array in + call to getgroups. Copy into array of int for call to + authunix_create. Note: If auth_unix protection ever used with this + code, we will need to cleanup assumptions in int being 32 bits in + OTW transfer of gids. + + * clnt_tcp.c, svc_tcp.c: Change writetcp and readtcp to take char + * as first argument to be compatible with xdrrec_create. + + * xdr.c (xdr_opaque): Cast argument in call to XDR_GETBYTES. + + * svc.h: Add prototype for gssrpc_svcudp_enablecache. + + * svc_auth_gssapi.c (_gssrpc_svcauth_gssapi): Change + _svcauth_gssapi to _gssrpc_svcauth_gssapi for consistancy. + + * svc_auth.c: Move prototypes for _gssrpc_svcauth_{unix, null, + short, gssapi} to: + * svc_auth.h: here. + + * svc_auth_unix.c: Update _gssrpc_svcauth_short and + _gssrpc_svcauth_unix to match prototype. + 2001-06-28 Ezra Peisach * auth.h: Provide full prototype for xdr_des_block. diff --git a/src/lib/rpc/auth_unix.c b/src/lib/rpc/auth_unix.c index 696bb1f..9411fdc 100644 --- a/src/lib/rpc/auth_unix.c +++ b/src/lib/rpc/auth_unix.c @@ -176,7 +176,8 @@ authunix_create_default() char machname[MAX_MACHINE_NAME + 1]; register int uid; register int gid; - int gids[NGRPS]; + GETGROUPS_T gids[NGRPS]; + int igids[NGRPS], i; if (gethostname(machname, MAX_MACHINE_NAME) == -1) abort(); @@ -185,7 +186,10 @@ authunix_create_default() gid = getegid(); if ((len = getgroups(NGRPS, gids)) < 0) abort(); - return (authunix_create(machname, uid, gid, len, gids)); + for(i = 0; i < NGRPS; i++) { + igids[i] = gids[i]; + } + return (authunix_create(machname, uid, gid, len, igids)); } /* diff --git a/src/lib/rpc/clnt_tcp.c b/src/lib/rpc/clnt_tcp.c index c89950b..1201e7e 100644 --- a/src/lib/rpc/clnt_tcp.c +++ b/src/lib/rpc/clnt_tcp.c @@ -91,8 +91,8 @@ struct ct_data { XDR ct_xdrs; }; -static int readtcp(struct ct_data *, caddr_t, int); -static int writetcp(struct ct_data *, caddr_t, int); +static int readtcp(char *, caddr_t, int); +static int writetcp(char *, caddr_t, int); /* @@ -416,11 +416,12 @@ clnttcp_destroy(h) * around for the rpc level. */ static int -readtcp(ct, buf, len) - register struct ct_data *ct; +readtcp(ctptr, buf, len) + char *ctptr; caddr_t buf; register int len; { + register struct ct_data *ct = (struct ct_data *)ctptr; #ifdef FD_SETSIZE fd_set mask; fd_set readfds; @@ -472,11 +473,12 @@ readtcp(ct, buf, len) } static int -writetcp(ct, buf, len) - struct ct_data *ct; +writetcp(ctptr, buf, len) + char *ctptr; caddr_t buf; int len; { + struct ct_data *ct = (struct ct_data *)ctptr; register int i, cnt; for (cnt = len; cnt > 0; cnt -= i, buf += i) { diff --git a/src/lib/rpc/configure.in b/src/lib/rpc/configure.in index a4e2cfd..06b8cad 100644 --- a/src/lib/rpc/configure.in +++ b/src/lib/rpc/configure.in @@ -6,6 +6,7 @@ AC_PROG_ARCHIVE_ADD AC_PROG_RANLIB AC_PROG_INSTALL AC_CHECK_HEADERS(sys/uio.h) +AC_TYPE_GETGROUPS dnl Arrange for types.hin to include stdlib.h AC_CHECK_HEADER(stdlib.h, [ STDLIB_INCLUDE="#include "], diff --git a/src/lib/rpc/svc.h b/src/lib/rpc/svc.h index 189edf3..efbbefc 100644 --- a/src/lib/rpc/svc.h +++ b/src/lib/rpc/svc.h @@ -334,8 +334,10 @@ extern SVCXPRT *svcraw_create(void); */ #define svcudp_create gssrpc_svcudp_create #define svcudp_bufcreate gssrpc_svcudp_bufcreate +#define svcudp_enablecache gssrpc_svcudp_enablecache extern SVCXPRT *svcudp_create(int); extern SVCXPRT *svcudp_bufcreate(int, unsigned int, unsigned int); +extern int svcudp_enablecache(SVCXPRT *, rpc_u_int32); /* * Tcp based rpc. diff --git a/src/lib/rpc/svc_auth.c b/src/lib/rpc/svc_auth.c index 2b65d5b..2e28b5c 100644 --- a/src/lib/rpc/svc_auth.c +++ b/src/lib/rpc/svc_auth.c @@ -52,19 +52,6 @@ static char sccsid[] = "@(#)svc_auth.c 2.1 88/08/07 4.0 RPCSRC; from 1.19 87/08/ * */ -#define _svcauth_null _gssrpc_svcauth_null -#define _svcauth_unix _gssrpc_svcauth_unix -#define _svcauth_short _gssrpc_svcauth_short - -/* no authentication */ -enum auth_stat _svcauth_null(struct svc_req *, struct rpc_msg *, bool_t *); -/* unix style (uid, gids) */ -enum auth_stat _svcauth_unix(struct svc_req *, struct rpc_msg *, bool_t *); -/* short hand unix style */ -enum auth_stat _svcauth_short(struct svc_req *, struct rpc_msg *, bool_t *); -/* GSS-API style */ -enum auth_stat _svcauth_gssapi(struct svc_req *, struct rpc_msg *, bool_t *); - static struct svcauthsw_type { unsigned int flavor; enum auth_stat (*authenticator)(struct svc_req *, struct rpc_msg *, diff --git a/src/lib/rpc/svc_auth.h b/src/lib/rpc/svc_auth.h index 8147325..174c945 100644 --- a/src/lib/rpc/svc_auth.h +++ b/src/lib/rpc/svc_auth.h @@ -66,3 +66,16 @@ extern enum auth_stat _authenticate(struct svc_req *rqst, struct rpc_msg *msg, ((*((auth)->svc_ah_ops->svc_ah_unwrap))(auth, xdrs, xfunc, xwhere)) +#define _svcauth_null _gssrpc_svcauth_null +#define _svcauth_unix _gssrpc_svcauth_unix +#define _svcauth_short _gssrpc_svcauth_short +#define _svcauth_gssapi _gssrpc_svcauth_gssapi +/* no authentication */ +enum auth_stat _svcauth_null(struct svc_req *, struct rpc_msg *, bool_t *); +/* unix style (uid, gids) */ +enum auth_stat _svcauth_unix(struct svc_req *, struct rpc_msg *, bool_t *); +/* short hand unix style */ +enum auth_stat _svcauth_short(struct svc_req *, struct rpc_msg *, bool_t *); +/* GSS-API style */ +enum auth_stat _svcauth_gssapi(struct svc_req *, struct rpc_msg *, bool_t *); + diff --git a/src/lib/rpc/svc_auth_gssapi.c b/src/lib/rpc/svc_auth_gssapi.c index a1d46c3..f325738 100644 --- a/src/lib/rpc/svc_auth_gssapi.c +++ b/src/lib/rpc/svc_auth_gssapi.c @@ -117,7 +117,7 @@ static client_list *clients = NULL; extern int errno; -enum auth_stat _svcauth_gssapi(rqst, msg, no_dispatch) +enum auth_stat _gssrpc_svcauth_gssapi(rqst, msg, no_dispatch) register struct svc_req *rqst; register struct rpc_msg *msg; bool_t *no_dispatch; diff --git a/src/lib/rpc/svc_auth_unix.c b/src/lib/rpc/svc_auth_unix.c index 48632b2..a947de4 100644 --- a/src/lib/rpc/svc_auth_unix.c +++ b/src/lib/rpc/svc_auth_unix.c @@ -50,9 +50,10 @@ static char sccsid[] = "@(#)svc_auth_unix.c 1.28 88/02/08 Copyr 1984 Sun Micro"; * Unix longhand authenticator */ enum auth_stat -_gssrpc_svcauth_unix(rqst, msg) +_gssrpc_svcauth_unix(rqst, msg, dispatch) register struct svc_req *rqst; register struct rpc_msg *msg; + bool_t *dispatch; { register enum auth_stat stat; XDR xdrs; @@ -129,9 +130,10 @@ done: */ /*ARGSUSED*/ enum auth_stat -_gssrpc_svcauth_short(rqst, msg) +_gssrpc_svcauth_short(rqst, msg, dispatch) struct svc_req *rqst; struct rpc_msg *msg; + bool_t *dispatch; { rqst->rq_xprt->xp_auth = &svc_auth_any; return (AUTH_REJECTEDCRED); diff --git a/src/lib/rpc/svc_tcp.c b/src/lib/rpc/svc_tcp.c index e9f5312..3ea99aa 100644 --- a/src/lib/rpc/svc_tcp.c +++ b/src/lib/rpc/svc_tcp.c @@ -89,7 +89,7 @@ static struct xp_ops svctcp_rendezvous_op = { svctcp_destroy }; -static int readtcp(SVCXPRT *, caddr_t, int), writetcp(SVCXPRT *, caddr_t, int); +static int readtcp(char *, caddr_t, int), writetcp(char *, caddr_t, int); static SVCXPRT *makefd_xprt(int, unsigned int, unsigned int); struct tcp_rendezvous { /* kept in xprt->xp_p1 */ @@ -307,11 +307,12 @@ static struct timeval wait_per_try = { 35, 0 }; * (And a read of zero bytes is a half closed stream => error.) */ static int -readtcp(xprt, buf, len) - register SVCXPRT *xprt; +readtcp(xprtptr, buf, len) + char *xprtptr; caddr_t buf; register int len; { + register SVCXPRT *xprt = (SVCXPRT *) xprtptr; register int sock = xprt->xp_sock; #ifdef FD_SETSIZE fd_set mask; @@ -350,11 +351,12 @@ fatal_err: * Any error is fatal and the connection is closed. */ static int -writetcp(xprt, buf, len) - register SVCXPRT *xprt; +writetcp(xprtptr, buf, len) + char *xprtptr; caddr_t buf; int len; { + register SVCXPRT *xprt = (SVCXPRT *) xprtptr; register int i, cnt; for (cnt = len; cnt > 0; cnt -= i, buf += i) { diff --git a/src/lib/rpc/xdr.c b/src/lib/rpc/xdr.c index ccce136..85c86e5 100644 --- a/src/lib/rpc/xdr.c +++ b/src/lib/rpc/xdr.c @@ -408,7 +408,7 @@ xdr_opaque(xdrs, cp, cnt) } if (rndup == 0) return (TRUE); - return (XDR_GETBYTES(xdrs, crud, rndup)); + return (XDR_GETBYTES(xdrs, (caddr_t) (void *)crud, rndup)); } if (xdrs->x_op == XDR_ENCODE) { -- cgit v1.1