authunix_prot.c revision 1.14
11.14Schristos/*	$NetBSD: authunix_prot.c,v 1.14 2012/03/13 21:13:44 christos Exp $	*/
21.2Scgd
31.1Scgd/*
41.1Scgd * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
51.1Scgd * unrestricted use provided that this legend is included on all tape
61.1Scgd * media and as a part of the software program in whole or part.  Users
71.1Scgd * may copy or modify Sun RPC without charge, but are not authorized
81.1Scgd * to license or distribute it to anyone else except as part of a product or
91.1Scgd * program developed by the user.
101.1Scgd *
111.1Scgd * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
121.1Scgd * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
131.1Scgd * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
141.1Scgd *
151.1Scgd * Sun RPC is provided with no support and without any obligation on the
161.1Scgd * part of Sun Microsystems, Inc. to assist in its use, correction,
171.1Scgd * modification or enhancement.
181.1Scgd *
191.1Scgd * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
201.1Scgd * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
211.1Scgd * OR ANY PART THEREOF.
221.1Scgd *
231.1Scgd * In no event will Sun Microsystems, Inc. be liable for any lost revenue
241.1Scgd * or profits or other special, indirect and consequential damages, even if
251.1Scgd * Sun has been advised of the possibility of such damages.
261.1Scgd *
271.1Scgd * Sun Microsystems, Inc.
281.1Scgd * 2550 Garcia Avenue
291.1Scgd * Mountain View, California  94043
301.1Scgd */
311.1Scgd
321.3Schristos#include <sys/cdefs.h>
331.1Scgd#if defined(LIBC_SCCS) && !defined(lint)
341.3Schristos#if 0
351.3Schristosstatic char *sccsid = "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";
361.3Schristosstatic char *sccsid = "@(#)authunix_prot.c	2.1 88/07/29 4.0 RPCSRC";
371.3Schristos#else
381.14Schristos__RCSID("$NetBSD: authunix_prot.c,v 1.14 2012/03/13 21:13:44 christos Exp $");
391.3Schristos#endif
401.1Scgd#endif
411.1Scgd
421.1Scgd/*
431.1Scgd * authunix_prot.c
441.1Scgd * XDR for UNIX style authentication parameters for RPC
451.1Scgd *
461.1Scgd * Copyright (C) 1984, Sun Microsystems, Inc.
471.1Scgd */
481.1Scgd
491.4Sjtc#include "namespace.h"
501.7Slukem
511.10Slukem#include <assert.h>
521.10Slukem
531.1Scgd#include <rpc/types.h>
541.1Scgd#include <rpc/xdr.h>
551.1Scgd#include <rpc/auth.h>
561.1Scgd#include <rpc/auth_unix.h>
571.4Sjtc
581.4Sjtc#ifdef __weak_alias
591.12Smycroft__weak_alias(xdr_authunix_parms,_xdr_authunix_parms)
601.4Sjtc#endif
611.1Scgd
621.1Scgd/*
631.1Scgd * XDR for unix authentication parameters.
641.1Scgd */
651.1Scgdbool_t
661.1Scgdxdr_authunix_parms(xdrs, p)
671.7Slukem	XDR *xdrs;
681.7Slukem	struct authunix_parms *p;
691.1Scgd{
701.10Slukem
711.10Slukem	_DIAGASSERT(xdrs != NULL);
721.10Slukem	_DIAGASSERT(p != NULL);
731.1Scgd
741.1Scgd	if (xdr_u_long(xdrs, &(p->aup_time))
751.1Scgd	    && xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME)
761.1Scgd	    && xdr_int(xdrs, &(p->aup_uid))
771.1Scgd	    && xdr_int(xdrs, &(p->aup_gid))
781.13Smrg	    && xdr_array(xdrs, (char **)(void *)&(p->aup_gids),
791.14Schristos		    &(p->aup_len), NGRPS, (unsigned int)sizeof(int),
801.14Schristos		    (xdrproc_t)xdr_int) ) {
811.1Scgd		return (TRUE);
821.1Scgd	}
831.1Scgd	return (FALSE);
841.1Scgd}
85