11.16Stron/*	$NetBSD: authunix_prot.c,v 1.16 2013/03/11 20:19:28 tron Exp $	*/
21.2Scgd
31.1Scgd/*
41.16Stron * Copyright (c) 2010, Oracle America, Inc.
51.16Stron *
61.16Stron * Redistribution and use in source and binary forms, with or without
71.16Stron * modification, are permitted provided that the following conditions are
81.16Stron * met:
91.16Stron *
101.16Stron *     * Redistributions of source code must retain the above copyright
111.16Stron *       notice, this list of conditions and the following disclaimer.
121.16Stron *     * Redistributions in binary form must reproduce the above
131.16Stron *       copyright notice, this list of conditions and the following
141.16Stron *       disclaimer in the documentation and/or other materials
151.16Stron *       provided with the distribution.
161.16Stron *     * Neither the name of the "Oracle America, Inc." nor the names of its
171.16Stron *       contributors may be used to endorse or promote products derived
181.16Stron *       from this software without specific prior written permission.
191.16Stron *
201.16Stron *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
211.16Stron *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
221.16Stron *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
231.16Stron *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
241.16Stron *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
251.16Stron *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261.16Stron *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
271.16Stron *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
281.16Stron *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
291.16Stron *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
301.16Stron *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
311.16Stron *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
321.1Scgd */
331.1Scgd
341.3Schristos#include <sys/cdefs.h>
351.1Scgd#if defined(LIBC_SCCS) && !defined(lint)
361.3Schristos#if 0
371.3Schristosstatic char *sccsid = "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";
381.3Schristosstatic char *sccsid = "@(#)authunix_prot.c	2.1 88/07/29 4.0 RPCSRC";
391.3Schristos#else
401.16Stron__RCSID("$NetBSD: authunix_prot.c,v 1.16 2013/03/11 20:19:28 tron Exp $");
411.3Schristos#endif
421.1Scgd#endif
431.1Scgd
441.1Scgd/*
451.1Scgd * authunix_prot.c
461.1Scgd * XDR for UNIX style authentication parameters for RPC
471.1Scgd *
481.1Scgd * Copyright (C) 1984, Sun Microsystems, Inc.
491.1Scgd */
501.1Scgd
511.4Sjtc#include "namespace.h"
521.7Slukem
531.10Slukem#include <assert.h>
541.10Slukem
551.1Scgd#include <rpc/types.h>
561.1Scgd#include <rpc/xdr.h>
571.1Scgd#include <rpc/auth.h>
581.1Scgd#include <rpc/auth_unix.h>
591.4Sjtc
601.4Sjtc#ifdef __weak_alias
611.12Smycroft__weak_alias(xdr_authunix_parms,_xdr_authunix_parms)
621.4Sjtc#endif
631.1Scgd
641.1Scgd/*
651.1Scgd * XDR for unix authentication parameters.
661.1Scgd */
671.1Scgdbool_t
681.15Smattxdr_authunix_parms(XDR *xdrs, 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