xref: /titanic_44/usr/src/uts/common/rpc/auth_sys.h (revision 40e5e17b3361b3eea56a9723071c406894a20b78)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28 /*
29  * Portions of this source code were derived from Berkeley
30  * 4.3 BSD under license from the Regents of the University of
31  * California.
32  */
33 
34 /*
35  * auth_sys.h, Protocol for UNIX style authentication parameters for RPC
36  */
37 
38 #ifndef	_RPC_AUTH_SYS_H
39 #define	_RPC_AUTH_SYS_H
40 
41 #pragma ident	"%Z%%M%	%I%	%E% SMI"
42 
43 /*
44  * The system is very weak.  The client uses no encryption for  it
45  * credentials and only sends null verifiers.  The server sends backs
46  * null verifiers or optionally a verifier that suggests a new short hand
47  * for the credentials.
48  */
49 
50 #include <sys/types.h>
51 #include <rpc/types.h>
52 #include <rpc/xdr.h>
53 #include <rpc/auth.h>
54 
55 #ifdef	__cplusplus
56 extern "C" {
57 #endif
58 
59 /* The machine name is part of a credential; it may not exceed 255 bytes */
60 #define	 MAX_MACHINE_NAME 255
61 
62 /* gids compose part of a credential; there may not be more than 16 of them */
63 #define	 NGRPS 16
64 
65 /* gids compose part of a credential; there may not be more than 64 of them */
66 #define	 NGRPS_LOOPBACK 64
67 
68 /*
69  * "sys" (Old UNIX) style credentials.
70  */
71 struct authsys_parms {
72 	uint_t	 aup_time;
73 	char	*aup_machname;
74 	uid_t	 aup_uid;
75 	gid_t	 aup_gid;
76 	uint_t	 aup_len;
77 	gid_t	*aup_gids;
78 };
79 /* For backward compatibility */
80 #define	 authunix_parms authsys_parms
81 
82 #ifdef __STDC__
83 extern bool_t xdr_authsys_parms(XDR *, struct authsys_parms *);
84 extern bool_t xdr_authloopback_parms(XDR *, struct authsys_parms *);
85 #else
86 extern bool_t xdr_authsys_parms();
87 extern bool_t xdr_authloopback_parms();
88 #endif
89 
90 
91 /* For backward compatibility */
92 #define	xdr_authunix_parms(xdrs, p) xdr_authsys_parms(xdrs, p)
93 
94 /*
95  * If a response verifier has flavor AUTH_SHORT, then the body of
96  * the response verifier encapsulates the following structure;
97  * again it is serialized in the obvious fashion.
98  */
99 struct short_hand_verf {
100 	struct opaque_auth new_cred;
101 };
102 
103 struct svc_req;
104 
105 extern bool_t xdr_gid_t(XDR *, gid_t *ip);
106 extern bool_t xdr_uid_t(XDR *, gid_t *ip);
107 
108 #ifdef _KERNEL
109 extern bool_t xdr_authkern(XDR *);
110 extern bool_t xdr_authloopback(XDR *);
111 extern enum auth_stat _svcauth_unix(struct svc_req *, struct rpc_msg *);
112 extern enum auth_stat _svcauth_short(struct svc_req *, struct rpc_msg *);
113 #endif
114 
115 #ifdef	__cplusplus
116 }
117 #endif
118 
119 #endif	/* !_RPC_AUTH_SYS_H */
120