Merge remote-tracking branch 'origin/master'
[unleashed/lotheac.git] / usr / src / uts / common / rpc / rpcsec_defs.h
blob24b43b7eded78e603483b0469ea907a28e647179
1 /*
2 * CDDL HEADER START
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.
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.
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]
20 * CDDL HEADER END
23 * Copyright (c) 1996,1997-1998 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _RPCSEC_DEFS_H
28 #define _RPCSEC_DEFS_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
33 * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved.
35 * $Id: auth_gssapi.h,v 1.11 1994/10/27 12:39:14 jik Exp $
38 #ifndef _KERNEL
39 #include <libintl.h>
40 #include <locale.h>
41 #endif
42 #include <gssapi/gssapi.h>
43 #include <rpc/types.h>
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
49 #ifdef _KERNEL
51 #if defined(DEBUG) && !defined(RPCGSS_DEBUG)
52 #define RPCGSS_DEBUG
53 #endif
55 #ifdef RPCGSS_DEBUG
56 extern uint_t rpcgss_log;
58 #define RPCGSS_LOG1(A, B, C, D) \
59 ((void)((rpcgss_log) && (rpcgss_log & (A)) && (printf((B), \
60 (C), (D)), TRUE)))
61 #define RPCGSS_LOG(A, B, C) \
62 ((void)((rpcgss_log) && (rpcgss_log & (A)) && (printf((B), (C)), TRUE)))
63 #define RPCGSS_LOG0(A, B) \
64 ((void)((rpcgss_log) && (rpcgss_log & (A)) && (printf(B), TRUE)))
65 #else
66 #define RPCGSS_LOG1(A, B, C, D)
67 #define RPCGSS_LOG(A, B, C)
68 #define RPCGSS_LOG0(A, B)
69 #endif
71 #else /* _KERNEL */
73 extern bool_t locale_set;
74 #if !defined(TEXT_DOMAIN)
75 #define TEXT_DOMAIN "SUNW_OST_OSCMD"
76 #endif
78 #endif /* _KERNEL */
81 typedef struct _rpc_gss_creds {
82 uint_t version;
83 uint_t gss_proc;
84 uint_t seq_num;
85 rpc_gss_service_t service;
86 gss_buffer_desc ctx_handle;
87 } rpc_gss_creds;
89 typedef gss_buffer_desc rpc_gss_init_arg;
91 typedef struct _rpc_gss_init_res {
92 gss_buffer_desc ctx_handle;
93 OM_uint32 gss_major, gss_minor;
94 OM_uint32 seq_window;
95 gss_buffer_desc token;
96 } rpc_gss_init_res;
100 * Convenience macros.
103 #define GSS_COPY_BUFFER(dest, src) { \
104 (dest).length = (src).length; \
105 (dest).value = (src).value; }
107 #define GSS_DUP_BUFFER(dest, src) { \
108 (dest).length = (src).length; \
109 (dest).value = (void *) mem_alloc((dest).length); \
110 bcopy((src).value, (dest).value, (dest).length); }
112 #define GSS_BUFFERS_EQUAL(b1, b2) (((b1).length == (b2).length) && \
113 (bcmp((b1).value, (b2).value, (b1.length)) == 0))
115 #define GSS_OIDS_EQUAL(o1, o2) \
116 ((((gss_OID)(o1))->length == ((gss_OID)(o2))->length) && \
117 (bcmp(((gss_OID)(o1))->elements, ((gss_OID)(o2))->elements, \
118 ((gss_OID)(o1))->length) == 0))
120 #define MAX_GSS_NAME 128
123 * Private interfaces for user and kernel space.
125 bool_t __xdr_gss_buf();
126 bool_t __xdr_rpc_gss_creds();
127 bool_t __xdr_rpc_gss_init_arg();
128 bool_t __xdr_rpc_gss_init_res();
130 bool_t __rpc_gss_wrap_data();
131 bool_t __rpc_gss_unwrap_data();
133 #ifdef _KERNEL
135 * kernel-level RPCSEC_GSS definitions.
138 void __rpc_gss_dup_oid(gss_OID, gss_OID *);
139 bool_t __rpc_gss_oids_equal(gss_OID oid1, gss_OID oid2);
140 void rpc_gss_display_status(OM_uint32 major, OM_uint32 minor,
141 rpc_gss_OID mechanism, uid_t uid,
142 char *function_name);
143 #else
145 * user-level RPCSEC_GSS definitions.
148 #define MAX_MECH_OID_PAIRS 32
150 typedef struct _rpc_gss_name {
151 char *name;
152 rpc_gss_OID type;
153 } rpc_gss_name;
155 extern rpc_gss_error_t *__rpc_gss_err();
156 #define rpc_gss_err (*(__rpc_gss_err()))
159 * Private interfaces in user space.
161 bool_t __rpc_gss_qop_to_num();
162 char *__rpc_gss_num_to_qop();
163 bool_t __rpc_gss_mech_to_oid();
164 char *__rpc_gss_oid_to_mech();
165 bool_t __rpc_gss_svc_to_num();
166 char *__rpc_gss_num_to_svc();
168 void __rpc_gss_xdrdynamic_create();
169 caddr_t __rpc_gss_xdrdynamic_getdata();
171 bool_t __rpcsec_init();
172 rpc_gss_OID __get_gss_oid();
173 void __rpc_gss_bind_error();
174 int __find_max_data_length(rpc_gss_service_t service, gss_ctx_id_t context,
175 OM_uint32 qop, int max_tp_unit_len);
177 #endif /* _KERNEL */
179 #ifdef __cplusplus
181 #endif
183 #endif /* _RPCSEC_DEFS_H */