xref: /freebsd/lib/libc/rpc/authunix_prot.c (revision 102c7c92999b70a04b58b4506aba62701f195b1a)
18360efbdSAlfred Perlstein /*	$NetBSD: authunix_prot.c,v 1.12 2000/01/22 22:19:17 mycroft Exp $	*/
28360efbdSAlfred Perlstein 
399064799SGarrett Wollman /*
499064799SGarrett Wollman  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
599064799SGarrett Wollman  * unrestricted use provided that this legend is included on all tape
699064799SGarrett Wollman  * media and as a part of the software program in whole or part.  Users
799064799SGarrett Wollman  * may copy or modify Sun RPC without charge, but are not authorized
899064799SGarrett Wollman  * to license or distribute it to anyone else except as part of a product or
999064799SGarrett Wollman  * program developed by the user.
1099064799SGarrett Wollman  *
1199064799SGarrett Wollman  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
1299064799SGarrett Wollman  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
1399064799SGarrett Wollman  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
1499064799SGarrett Wollman  *
1599064799SGarrett Wollman  * Sun RPC is provided with no support and without any obligation on the
1699064799SGarrett Wollman  * part of Sun Microsystems, Inc. to assist in its use, correction,
1799064799SGarrett Wollman  * modification or enhancement.
1899064799SGarrett Wollman  *
1999064799SGarrett Wollman  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
2099064799SGarrett Wollman  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
2199064799SGarrett Wollman  * OR ANY PART THEREOF.
2299064799SGarrett Wollman  *
2399064799SGarrett Wollman  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
2499064799SGarrett Wollman  * or profits or other special, indirect and consequential damages, even if
2599064799SGarrett Wollman  * Sun has been advised of the possibility of such damages.
2699064799SGarrett Wollman  *
2799064799SGarrett Wollman  * Sun Microsystems, Inc.
2899064799SGarrett Wollman  * 2550 Garcia Avenue
2999064799SGarrett Wollman  * Mountain View, California  94043
3099064799SGarrett Wollman  */
3199064799SGarrett Wollman 
3299064799SGarrett Wollman #if defined(LIBC_SCCS) && !defined(lint)
33a986ef57SDavid E. O'Brien static char *sccsid2 = "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";
348360efbdSAlfred Perlstein static char *sccsid = "@(#)authunix_prot.c	2.1 88/07/29 4.0 RPCSRC";
3599064799SGarrett Wollman #endif
36d3d20c82SDavid E. O'Brien #include <sys/cdefs.h>
37d3d20c82SDavid E. O'Brien __FBSDID("$FreeBSD$");
3899064799SGarrett Wollman 
3999064799SGarrett Wollman /*
4099064799SGarrett Wollman  * authunix_prot.c
4199064799SGarrett Wollman  * XDR for UNIX style authentication parameters for RPC
4299064799SGarrett Wollman  *
4399064799SGarrett Wollman  * Copyright (C) 1984, Sun Microsystems, Inc.
4499064799SGarrett Wollman  */
4599064799SGarrett Wollman 
468360efbdSAlfred Perlstein #include "namespace.h"
478360efbdSAlfred Perlstein #include <assert.h>
4899064799SGarrett Wollman 
4999064799SGarrett Wollman #include <rpc/types.h>
5099064799SGarrett Wollman #include <rpc/xdr.h>
5199064799SGarrett Wollman #include <rpc/auth.h>
5299064799SGarrett Wollman #include <rpc/auth_unix.h>
538360efbdSAlfred Perlstein #include "un-namespace.h"
5499064799SGarrett Wollman 
5599064799SGarrett Wollman /*
5699064799SGarrett Wollman  * XDR for unix authentication parameters.
5799064799SGarrett Wollman  */
5899064799SGarrett Wollman bool_t
5999064799SGarrett Wollman xdr_authunix_parms(xdrs, p)
608360efbdSAlfred Perlstein 	XDR *xdrs;
618360efbdSAlfred Perlstein 	struct authunix_parms *p;
6299064799SGarrett Wollman {
63102c7c92SJohn Birrell 	int **paup_gids;
6499064799SGarrett Wollman 
658360efbdSAlfred Perlstein 	assert(xdrs != NULL);
668360efbdSAlfred Perlstein 	assert(p != NULL);
678360efbdSAlfred Perlstein 
68102c7c92SJohn Birrell 	paup_gids = &p->aup_gids;
69102c7c92SJohn Birrell 
7099064799SGarrett Wollman 	if (xdr_u_long(xdrs, &(p->aup_time))
7199064799SGarrett Wollman 	    && xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME)
7299064799SGarrett Wollman 	    && xdr_int(xdrs, &(p->aup_uid))
7399064799SGarrett Wollman 	    && xdr_int(xdrs, &(p->aup_gid))
74102c7c92SJohn Birrell 	    && xdr_array(xdrs, (char **) paup_gids,
758360efbdSAlfred Perlstein 		    &(p->aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int) ) {
7699064799SGarrett Wollman 		return (TRUE);
7799064799SGarrett Wollman 	}
7899064799SGarrett Wollman 	return (FALSE);
7999064799SGarrett Wollman }
80