authunix_prot.c revision 239963
1173143Srwatson/*	$NetBSD: authunix_prot.c,v 1.12 2000/01/22 22:19:17 mycroft Exp $	*/
2156283Srwatson
3156283Srwatson/*
4156283Srwatson * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5173143Srwatson * unrestricted use provided that this legend is included on all tape
6156283Srwatson * media and as a part of the software program in whole or part.  Users
7156283Srwatson * may copy or modify Sun RPC without charge, but are not authorized
8156283Srwatson * to license or distribute it to anyone else except as part of a product or
9156283Srwatson * program developed by the user.
10156283Srwatson *
11156283Srwatson * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
12156283Srwatson * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
13156283Srwatson * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14156283Srwatson *
15156283Srwatson * Sun RPC is provided with no support and without any obligation on the
16156283Srwatson * part of Sun Microsystems, Inc. to assist in its use, correction,
17156283Srwatson * modification or enhancement.
18187214Srwatson *
19156283Srwatson * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
20156283Srwatson * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
21156283Srwatson * OR ANY PART THEREOF.
22156283Srwatson *
23156283Srwatson * In no event will Sun Microsystems, Inc. be liable for any lost revenue
24156283Srwatson * or profits or other special, indirect and consequential damages, even if
25156283Srwatson * Sun has been advised of the possibility of such damages.
26156283Srwatson *
27156283Srwatson * Sun Microsystems, Inc.
28156283Srwatson * 2550 Garcia Avenue
29156283Srwatson * Mountain View, California  94043
30156283Srwatson */
31156283Srwatson
32156283Srwatson#if defined(LIBC_SCCS) && !defined(lint)
33156283Srwatsonstatic char *sccsid2 = "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";
34156283Srwatsonstatic char *sccsid = "@(#)authunix_prot.c	2.1 88/07/29 4.0 RPCSRC";
35156283Srwatson#endif
36156283Srwatson#include <sys/cdefs.h>
37156283Srwatson__FBSDID("$FreeBSD: head/lib/libc/rpc/authunix_prot.c 239963 2012-09-01 02:56:17Z pfg $");
38156283Srwatson
39156283Srwatson/*
40156283Srwatson * authunix_prot.c
41156283Srwatson * XDR for UNIX style authentication parameters for RPC
42156283Srwatson *
43156283Srwatson * Copyright (C) 1984, Sun Microsystems, Inc.
44156283Srwatson */
45156283Srwatson
46156283Srwatson#include "namespace.h"
47156283Srwatson#include <assert.h>
48156283Srwatson
49156283Srwatson#include <rpc/types.h>
50156283Srwatson#include <rpc/xdr.h>
51156283Srwatson#include <rpc/auth.h>
52156283Srwatson#include <rpc/auth_unix.h>
53156283Srwatson#include "un-namespace.h"
54156283Srwatson
55156283Srwatson/*
56156283Srwatson * XDR for unix authentication parameters.
57156283Srwatson */
58156283Srwatsonbool_t
59156283Srwatsonxdr_authunix_parms(xdrs, p)
60156283Srwatson	XDR *xdrs;
61156283Srwatson	struct authunix_parms *p;
62156283Srwatson{
63187214Srwatson	gid_t **paup_gids;
64187214Srwatson
65187214Srwatson	assert(xdrs != NULL);
66156283Srwatson	assert(p != NULL);
67156283Srwatson
68156283Srwatson	paup_gids = &p->aup_gids;
69187214Srwatson
70187214Srwatson	if (xdr_u_long(xdrs, &(p->aup_time))
71187214Srwatson	    && xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME)
72156283Srwatson	    && xdr_u_int(xdrs, &(p->aup_uid))
73173143Srwatson	    && xdr_u_int(xdrs, &(p->aup_gid))
74156283Srwatson	    && xdr_array(xdrs, (char **) paup_gids,
75156283Srwatson		    &(p->aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int) ) {
76156283Srwatson		return (TRUE);
77156283Srwatson	}
78173143Srwatson	return (FALSE);
79173143Srwatson}
80173143Srwatson