X-Git-Url: https://git.saurik.com/apple/libinfo.git/blobdiff_plain/3b7c7bd7aae68ec949fb3f4ef1d58b96033e40df..f64cfb2378dc3a60cd30c50180a366ec54b98781:/rpc.subproj/svc_auth_unix.c diff --git a/rpc.subproj/svc_auth_unix.c b/rpc.subproj/svc_auth_unix.c index 95f6ca8..3412d81 100644 --- a/rpc.subproj/svc_auth_unix.c +++ b/rpc.subproj/svc_auth_unix.c @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)svc_auth_unix.c 1.28 88/02/08 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)svc_auth_unix.c 2.3 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: svc_auth_unix.c,v 1.4 2002/02/19 20:36:25 epeyton Exp $"; +static char *rcsid = "$Id: svc_auth_unix.c,v 1.5 2003/06/23 17:24:59 majka Exp $"; #endif /* @@ -83,14 +83,17 @@ _svcauth_unix(rqst, msg) register enum auth_stat stat; XDR xdrs; register struct authunix_parms *aup; +#ifdef __LP64__ + int *buf; +#else register long *buf; +#endif struct area { struct authunix_parms area_aup; char area_machname[MAX_MACHINE_NAME+1]; int area_gids[NGROUPS]; } *area; - u_int auth_len; - int str_len, gid_len; + u_int auth_len, str_len, gid_len; register int i; area = (struct area *) rqst->rq_clntcred; @@ -99,7 +102,11 @@ _svcauth_unix(rqst, msg) aup->aup_gids = area->area_gids; auth_len = (u_int)msg->rm_call.cb_cred.oa_length; xdrmem_create(&xdrs, msg->rm_call.cb_cred.oa_base, auth_len,XDR_DECODE); - buf = XDR_INLINE(&xdrs, auth_len); +#ifdef __LP64__ + buf = (int *)XDR_INLINE(&xdrs, auth_len); +#else + buf = (long *)XDR_INLINE(&xdrs, auth_len); +#endif if (buf != NULL) { aup->aup_time = IXDR_GET_LONG(buf); str_len = IXDR_GET_U_LONG(buf); @@ -107,10 +114,14 @@ _svcauth_unix(rqst, msg) stat = AUTH_BADCRED; goto done; } - bcopy((caddr_t)buf, aup->aup_machname, (u_int)str_len); + bcopy((caddr_t)buf, aup->aup_machname, str_len); aup->aup_machname[str_len] = 0; str_len = RNDUP(str_len); +#ifdef __LP64__ + buf += str_len / sizeof (int); +#else buf += str_len / sizeof (long); +#endif aup->aup_uid = IXDR_GET_LONG(buf); aup->aup_gid = IXDR_GET_LONG(buf); gid_len = IXDR_GET_U_LONG(buf); @@ -127,8 +138,10 @@ _svcauth_unix(rqst, msg) * timestamp, hostname len (0), uid, gid, and gids len (0). */ if ((5 + gid_len) * BYTES_PER_XDR_UNIT + str_len > auth_len) { + /* LIBRARY CODE SHOULD NOT PRINT (void) printf("bad auth_len gid %d str %d auth %d\n", gid_len, str_len, auth_len); + */ stat = AUTH_BADCRED; goto done; }