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