#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.3 2001/01/17 19:05:42 majka Exp $";
+static char *rcsid = "$Id: svc_auth_unix.c,v 1.5 2003/06/23 17:24:59 majka Exp $";
#endif
/*
*/
#include <stdio.h>
+#include <string.h>
#include <sys/param.h>
#include <rpc/rpc.h>
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;
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);
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);
* 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;
}