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.
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.
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]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved.
31 * rpcsec_gss.h, RPCSEC_GSS security service interface.
43 #include <gssapi/gssapi.h>
46 * Interface definitions.
48 #define MAX_NAME_LEN 64
49 #define MAX_GSS_MECH 128
50 #define MAX_GSS_NAME 128
53 rpc_gss_svc_default
= 0,
55 rpc_gss_svc_integrity
= 2,
56 rpc_gss_svc_privacy
= 3
60 * GSS-API based security mechanism type specified as
61 * object identifiers (OIDs).
62 * This type is derived from gss_OID_desc/gss_OID.
64 #define rpc_gss_OID_s gss_OID_desc_struct
65 typedef struct rpc_gss_OID_s rpc_gss_OID_desc
, *rpc_gss_OID
;
69 * This is already suitable for both LP64 and ILP32.
71 typedef struct rpc_gss_principal
{
74 } *rpc_gss_principal_t
;
79 gss_cred_id_t my_cred
;
80 gss_channel_bindings_t input_channel_bindings
;
81 } rpc_gss_options_req_t
;
86 uint_t rpcsec_version
;
89 gss_ctx_id_t gss_context
;
91 rpc_gss_OID actual_mechanism
;
93 char actual_mechanism
[MAX_GSS_MECH
];
95 } rpc_gss_options_ret_t
;
103 rpc_gss_OID mechanism
;
109 rpc_gss_principal_t client_principal
;
110 char *svc_principal
; /* service@server, e.g. nfs@caribe */
111 rpc_gss_service_t service
;
125 * for callback routine
130 bool_t (*callback
)();
131 } rpc_gss_callback_t
;
134 * lock used for the callback routine
138 rpc_gss_rawcred_t
*raw_cred
;
143 * This is for user RPC applications.
144 * Structure used to fetch the error code when one of
145 * the rpc_gss_* routines fails.
152 #define RPC_GSS_ER_SUCCESS 0 /* no error */
153 #define RPC_GSS_ER_SYSTEMERROR 1 /* system error */
157 struct gss_clnt_data32
{
158 gss_OID_desc32 mechanism
;
159 rpc_gss_service_t service
;
160 char uname
[MAX_NAME_LEN
]; /* server's service name */
161 char inst
[MAX_NAME_LEN
]; /* server's instance name */
162 char realm
[MAX_NAME_LEN
]; /* server's realm */
168 * This is for Kernel RPC applications.
169 * RPCSEC_GSS flavor specific data in sec_data opaque field.
171 typedef struct gss_clnt_data
{
172 rpc_gss_OID_desc mechanism
;
173 rpc_gss_service_t service
;
174 char uname
[MAX_NAME_LEN
]; /* server's service name */
175 char inst
[MAX_NAME_LEN
]; /* server's instance name */
176 char realm
[MAX_NAME_LEN
]; /* server's realm */
183 * KERNEL rpc_gss_* interfaces.
186 int rpc_gss_secget(CLIENT
*, char *, rpc_gss_OID
,
187 rpc_gss_service_t
, uint_t
, rpc_gss_options_req_t
*,
188 rpc_gss_options_ret_t
*, void *, cred_t
*, AUTH
**);
190 void rpc_gss_secfree(AUTH
*);
192 int rpc_gss_seccreate(CLIENT
*, char *, rpc_gss_OID
,
193 rpc_gss_service_t
, uint_t
, rpc_gss_options_req_t
*,
194 rpc_gss_options_ret_t
*, cred_t
*, AUTH
**);
196 int rpc_gss_revauth(uid_t
, rpc_gss_OID
);
197 void rpc_gss_secpurge(void *);
198 enum auth_stat
__svcrpcsec_gss(struct svc_req
*,
199 struct rpc_msg
*, bool_t
*);
200 bool_t
rpc_gss_set_defaults(AUTH
*, rpc_gss_service_t
, uint_t
);
201 rpc_gss_service_t
rpc_gss_get_service_type(AUTH
*);
206 * USER rpc_gss_* public interfaces
210 CLIENT
*clnt
, /* associated client handle */
211 char *principal
, /* server service principal */
212 char *mechanism
, /* security mechanism */
213 rpc_gss_service_t service_type
, /* security service */
214 char *qop
, /* requested QOP */
215 rpc_gss_options_req_t
*options_req
, /* requested options */
216 rpc_gss_options_ret_t
*options_ret
/* returned options */
220 rpc_gss_get_principal_name(
221 rpc_gss_principal_t
*principal
,
228 char **rpc_gss_get_mechanisms();
230 char **rpc_gss_get_mech_info(
232 rpc_gss_service_t
*service
236 rpc_gss_is_installed(
254 rpc_gss_set_svc_name(
263 rpc_gss_set_defaults(
265 rpc_gss_service_t service
,
271 rpc_gss_error_t
*error
275 * User level private interfaces
277 enum auth_stat
__svcrpcsec_gss();
278 bool_t
__rpc_gss_wrap();
279 bool_t
__rpc_gss_unwrap();
284 * USER and KERNEL rpc_gss_* interfaces.
287 rpc_gss_set_callback(
288 rpc_gss_callback_t
*cb
294 rpc_gss_rawcred_t
**rcred
,
295 rpc_gss_ucred_t
**ucred
,
300 rpc_gss_max_data_length(
306 rpc_gss_svc_max_data_length(
312 rpc_gss_get_versions(
317 #define RPCSEC_GSS_REFRESH_ATTEMPTS 20
322 * The reason to put these definition in this header file
323 * is for 2.6 snoop to handle the RPCSEC_GSS protocol
326 #define RPCSEC_GSS_DATA 0
327 #define RPCSEC_GSS_INIT 1
328 #define RPCSEC_GSS_CONTINUE_INIT 2
329 #define RPCSEC_GSS_DESTROY 3
331 #define RPCSEC_GSS_VERSION 1
337 #endif /* !_RPCSEC_GSS_H */