X-Git-Url: https://git.saurik.com/apple/libinfo.git/blobdiff_plain/ccd4a120fd72e1cd2071458320f7a1914ef55421..9e8ccf68ea9492d257074b9d3023cf906c5dfeda:/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 04abeab..3412d81 100644 --- a/rpc.subproj/svc_auth_unix.c +++ b/rpc.subproj/svc_auth_unix.c @@ -3,22 +3,21 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights + * Reserved. This file contains Original Code and/or Modifications of + * Original Code as defined in and that are subject to the Apple Public + * Source License Version 1.1 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource and read it before using + * this file. * * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. + * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. * * @APPLE_LICENSE_HEADER_END@ */ @@ -84,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; @@ -100,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); @@ -108,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); @@ -128,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; }