174462Salfred/* $NetBSD: authunix_prot.c,v 1.12 2000/01/22 22:19:17 mycroft Exp $ */ 274462Salfred 3261057Smav/*- 4261057Smav * Copyright (c) 2009, Sun Microsystems, Inc. 5261057Smav * All rights reserved. 68870Srgrimes * 7261057Smav * Redistribution and use in source and binary forms, with or without 8261057Smav * modification, are permitted provided that the following conditions are met: 9261057Smav * - Redistributions of source code must retain the above copyright notice, 10261057Smav * this list of conditions and the following disclaimer. 11261057Smav * - Redistributions in binary form must reproduce the above copyright notice, 12261057Smav * this list of conditions and the following disclaimer in the documentation 13261057Smav * and/or other materials provided with the distribution. 14261057Smav * - Neither the name of Sun Microsystems, Inc. nor the names of its 15261057Smav * contributors may be used to endorse or promote products derived 16261057Smav * from this software without specific prior written permission. 17261057Smav * 18261057Smav * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19261057Smav * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20261057Smav * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21261057Smav * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22261057Smav * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23261057Smav * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24261057Smav * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25261057Smav * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26261057Smav * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27261057Smav * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28261057Smav * POSSIBILITY OF SUCH DAMAGE. 291901Swollman */ 301901Swollman 311901Swollman#if defined(LIBC_SCCS) && !defined(lint) 32136581Sobrienstatic char *sccsid2 = "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro"; 3374462Salfredstatic char *sccsid = "@(#)authunix_prot.c 2.1 88/07/29 4.0 RPCSRC"; 341901Swollman#endif 3592990Sobrien#include <sys/cdefs.h> 3692990Sobrien__FBSDID("$FreeBSD$"); 371901Swollman 381901Swollman/* 391901Swollman * authunix_prot.c 401901Swollman * XDR for UNIX style authentication parameters for RPC 411901Swollman * 421901Swollman * Copyright (C) 1984, Sun Microsystems, Inc. 431901Swollman */ 441901Swollman 4574462Salfred#include "namespace.h" 4674462Salfred#include <assert.h> 471901Swollman 481901Swollman#include <rpc/types.h> 491901Swollman#include <rpc/xdr.h> 501901Swollman#include <rpc/auth.h> 511901Swollman#include <rpc/auth_unix.h> 5274462Salfred#include "un-namespace.h" 531901Swollman 541901Swollman/* 551901Swollman * XDR for unix authentication parameters. 561901Swollman */ 571901Swollmanbool_t 581901Swollmanxdr_authunix_parms(xdrs, p) 5974462Salfred XDR *xdrs; 6074462Salfred struct authunix_parms *p; 611901Swollman{ 62241309Spfg u_int **paup_gids; 631901Swollman 6474462Salfred assert(xdrs != NULL); 6574462Salfred assert(p != NULL); 6674462Salfred 67173763Sjb paup_gids = &p->aup_gids; 68173763Sjb 69241309Spfg if (xdr_u_long(xdrs, &(p->aup_time)) && 70241309Spfg xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME) && 71241309Spfg xdr_u_int(xdrs, &(p->aup_uid)) && 72241309Spfg xdr_u_int(xdrs, &(p->aup_gid)) && 73241309Spfg xdr_array(xdrs, (char **) paup_gids, 74241309Spfg &(p->aup_len), NGRPS, sizeof(u_int), (xdrproc_t)xdr_u_int) ) { 751901Swollman return (TRUE); 761901Swollman } 771901Swollman return (FALSE); 781901Swollman} 79