1*85858ec2Sguenther /* $OpenBSD: authunix_prot.c,v 1.8 2015/09/13 15:36:56 guenther Exp $ */
2cb7760d1Smillert
3df930be7Sderaadt /*
4cb7760d1Smillert * Copyright (c) 2010, Oracle America, Inc.
5df930be7Sderaadt *
6cb7760d1Smillert * Redistribution and use in source and binary forms, with or without
7cb7760d1Smillert * modification, are permitted provided that the following conditions are
8cb7760d1Smillert * met:
9df930be7Sderaadt *
10cb7760d1Smillert * * Redistributions of source code must retain the above copyright
11cb7760d1Smillert * notice, this list of conditions and the following disclaimer.
12cb7760d1Smillert * * Redistributions in binary form must reproduce the above
13cb7760d1Smillert * copyright notice, this list of conditions and the following
14cb7760d1Smillert * disclaimer in the documentation and/or other materials
15cb7760d1Smillert * provided with the distribution.
16cb7760d1Smillert * * Neither the name of the "Oracle America, Inc." nor the names of its
17cb7760d1Smillert * contributors may be used to endorse or promote products derived
18cb7760d1Smillert * from this software without specific prior written permission.
19df930be7Sderaadt *
20cb7760d1Smillert * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21cb7760d1Smillert * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22cb7760d1Smillert * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23cb7760d1Smillert * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24cb7760d1Smillert * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25cb7760d1Smillert * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26cb7760d1Smillert * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27cb7760d1Smillert * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28cb7760d1Smillert * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29cb7760d1Smillert * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30cb7760d1Smillert * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31cb7760d1Smillert * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32df930be7Sderaadt */
33df930be7Sderaadt
34df930be7Sderaadt /*
35df930be7Sderaadt * authunix_prot.c
36df930be7Sderaadt * XDR for UNIX style authentication parameters for RPC
37df930be7Sderaadt */
38df930be7Sderaadt
39df930be7Sderaadt #include <rpc/types.h>
40df930be7Sderaadt #include <rpc/xdr.h>
41df930be7Sderaadt #include <rpc/auth.h>
42df930be7Sderaadt #include <rpc/auth_unix.h>
43df930be7Sderaadt
44df930be7Sderaadt /*
45df930be7Sderaadt * XDR for unix authentication parameters.
46df930be7Sderaadt */
47df930be7Sderaadt bool_t
xdr_authunix_parms(XDR * xdrs,struct authunix_parms * p)48384ec30aSotto xdr_authunix_parms(XDR *xdrs, struct authunix_parms *p)
49df930be7Sderaadt {
50df930be7Sderaadt
51df930be7Sderaadt if (xdr_u_long(xdrs, &(p->aup_time))
52df930be7Sderaadt && xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME)
53df930be7Sderaadt && xdr_int(xdrs, &(p->aup_uid))
54df930be7Sderaadt && xdr_int(xdrs, &(p->aup_gid))
55df930be7Sderaadt && xdr_array(xdrs, (caddr_t *)&(p->aup_gids),
56df930be7Sderaadt &(p->aup_len), NGRPS, sizeof(int), xdr_int) ) {
57df930be7Sderaadt return (TRUE);
58df930be7Sderaadt }
59df930be7Sderaadt return (FALSE);
60df930be7Sderaadt }
61*85858ec2Sguenther DEF_WEAK(xdr_authunix_parms);
62df930be7Sderaadt
63