xref: /titanic_44/usr/src/uts/common/rpc/auth_sys.h (revision b045990893825c31e176b319ae8cc4ef32115d17)
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 /*
23  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
24  */
25 
26 /*
27  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
31 /* All Rights Reserved */
32 /*
33  * Portions of this source code were derived from Berkeley
34  * 4.3 BSD under license from the Regents of the University of
35  * California.
36  */
37 
38 /*
39  * auth_sys.h, Protocol for UNIX style authentication parameters for RPC
40  */
41 
42 #ifndef	_RPC_AUTH_SYS_H
43 #define	_RPC_AUTH_SYS_H
44 
45 /*
46  * The system is very weak.  The client uses no encryption for  it
47  * credentials and only sends null verifiers.  The server sends backs
48  * null verifiers or optionally a verifier that suggests a new short hand
49  * for the credentials.
50  */
51 
52 #include <sys/types.h>
53 #include <sys/param.h>
54 #include <rpc/types.h>
55 #include <rpc/xdr.h>
56 #include <rpc/auth.h>
57 
58 #ifdef	__cplusplus
59 extern "C" {
60 #endif
61 
62 /* The machine name is part of a credential; it may not exceed 255 bytes */
63 #define	 MAX_MACHINE_NAME 255
64 
65 /* gids compose part of a credential; there may not be more than 16 of them */
66 #define	 NGRPS 16
67 
68 /* gids compose part of a credential */
69 #define	 NGRPS_LOOPBACK NGROUPS_UMAX
70 
71 /*
72  * "sys" (Old UNIX) style credentials.
73  */
74 struct authsys_parms {
75 	uint_t	 aup_time;
76 	char	*aup_machname;
77 	uid_t	 aup_uid;
78 	gid_t	 aup_gid;
79 	uint_t	 aup_len;
80 	gid_t	*aup_gids;
81 };
82 /* For backward compatibility */
83 #define	 authunix_parms authsys_parms
84 
85 #ifdef __STDC__
86 extern bool_t xdr_authsys_parms(XDR *, struct authsys_parms *);
87 extern bool_t xdr_authloopback_parms(XDR *, struct authsys_parms *);
88 #else
89 extern bool_t xdr_authsys_parms();
90 extern bool_t xdr_authloopback_parms();
91 #endif
92 
93 
94 /* For backward compatibility */
95 #define	xdr_authunix_parms(xdrs, p) xdr_authsys_parms(xdrs, p)
96 
97 /*
98  * If a response verifier has flavor AUTH_SHORT, then the body of
99  * the response verifier encapsulates the following structure;
100  * again it is serialized in the obvious fashion.
101  */
102 struct short_hand_verf {
103 	struct opaque_auth new_cred;
104 };
105 
106 struct svc_req;
107 
108 extern bool_t xdr_gid_t(XDR *, gid_t *);
109 extern bool_t xdr_uid_t(XDR *, uid_t *);
110 
111 #ifdef _KERNEL
112 extern bool_t xdr_authkern(XDR *);
113 extern bool_t xdr_authloopback(XDR *);
114 extern enum auth_stat _svcauth_unix(struct svc_req *, struct rpc_msg *);
115 extern enum auth_stat _svcauth_short(struct svc_req *, struct rpc_msg *);
116 #endif
117 
118 #ifdef	__cplusplus
119 }
120 #endif
121 
122 #endif	/* !_RPC_AUTH_SYS_H */
123