X-Git-Url: https://git.saurik.com/apple/libinfo.git/blobdiff_plain/1d9e5cb8ce34c6120503c023c843076e0804d8c8..f64cfb2378dc3a60cd30c50180a366ec54b98781:/rpc.subproj/svc_auth_unix.c?ds=sidebyside diff --git a/rpc.subproj/svc_auth_unix.c b/rpc.subproj/svc_auth_unix.c index cd19041..3412d81 100644 --- a/rpc.subproj/svc_auth_unix.c +++ b/rpc.subproj/svc_auth_unix.c @@ -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); +#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; }