author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 55638 | 430a51e86f28 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
2 |
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
#ifndef NATIVE_FUNC_H |
|
27 |
#define NATIVE_FUNC_H |
|
28 |
||
29 |
#include "gssapi.h" |
|
30 |
||
49682
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
31 |
#ifdef WIN32 |
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
32 |
#include <windows.h> |
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
33 |
#define GETLIB(libName) LoadLibrary(libName) |
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
34 |
#define GETFUNC(lib,name) GetProcAddress(lib,name) |
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
35 |
#define CLOSELIB(lib) CloseHandle(lib) |
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
36 |
#else |
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
37 |
#include <dlfcn.h> |
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
38 |
#define GETLIB(libName) dlopen(libName, RTLD_NOW) |
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
39 |
#define GETFUNC(lib,name) dlsym(lib,name) |
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
40 |
#define CLOSELIB(lib) dlclose(lib) |
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
41 |
#endif |
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
42 |
|
2 | 43 |
#ifndef TRUE |
44 |
#define TRUE 1 |
|
45 |
#endif |
|
46 |
||
47 |
#ifndef FALSE |
|
48 |
#define FALSE 0 |
|
49 |
#endif |
|
50 |
||
49682
2918e1146106
8200468: Port the native GSS-API bridge to Windows
weijun
parents:
47216
diff
changeset
|
51 |
int loadNative(const char *libName); |
2 | 52 |
|
53 |
/* function pointer definitions */ |
|
54 |
typedef OM_uint32 (*RELEASE_NAME_FN_PTR) |
|
55 |
(OM_uint32 *minor_status, |
|
56 |
gss_name_t *name); |
|
57 |
||
58 |
typedef OM_uint32 (*IMPORT_NAME_FN_PTR) |
|
59 |
(OM_uint32 *minor_status, |
|
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
60 |
gss_const_buffer_t input_name_buffer, |
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
61 |
gss_const_OID input_name_type, |
2 | 62 |
gss_name_t *output_name); |
63 |
||
64 |
typedef OM_uint32 (*COMPARE_NAME_FN_PTR) |
|
65 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
66 |
gss_const_name_t name1, |
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
67 |
gss_const_name_t name2, |
2 | 68 |
int *name_equal); |
69 |
||
70 |
typedef OM_uint32 (*CANONICALIZE_NAME_FN_PTR) |
|
71 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
72 |
gss_const_name_t input_name, |
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
73 |
gss_const_OID mech_type, |
2 | 74 |
gss_name_t *output_name); |
75 |
||
76 |
typedef OM_uint32 (*EXPORT_NAME_FN_PTR) |
|
77 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
78 |
gss_const_name_t input_name, |
2 | 79 |
gss_buffer_t exported_name); |
80 |
||
81 |
typedef OM_uint32 (*DISPLAY_NAME_FN_PTR) |
|
82 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
83 |
gss_const_name_t input_name, |
2 | 84 |
gss_buffer_t output_name_buffer, |
85 |
gss_OID *output_name_type); |
|
86 |
||
87 |
typedef OM_uint32 (*ACQUIRE_CRED_FN_PTR) |
|
88 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
89 |
gss_const_name_t desired_name, |
2 | 90 |
OM_uint32 time_req, |
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
91 |
gss_const_OID_set desired_mech, |
2 | 92 |
gss_cred_usage_t cred_usage, |
93 |
gss_cred_id_t *output_cred_handle, |
|
94 |
gss_OID_set *actual_mechs, |
|
95 |
OM_uint32 *time_rec); |
|
96 |
||
97 |
typedef OM_uint32 (*RELEASE_CRED_FN_PTR) |
|
98 |
(OM_uint32 *minor_status, |
|
99 |
gss_cred_id_t *cred_handle); |
|
100 |
||
101 |
typedef OM_uint32 (*INQUIRE_CRED_FN_PTR) |
|
102 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
103 |
gss_const_cred_id_t cred_handle, |
2 | 104 |
gss_name_t *name, |
105 |
OM_uint32 *lifetime, |
|
106 |
gss_cred_usage_t *cred_usage, |
|
107 |
gss_OID_set *mechanisms); |
|
108 |
||
109 |
typedef OM_uint32 (*IMPORT_SEC_CONTEXT_FN_PTR) |
|
110 |
(OM_uint32 *minor_status, |
|
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
111 |
gss_const_buffer_t interprocess_token, |
2 | 112 |
gss_ctx_id_t *context_handle); |
113 |
||
114 |
typedef OM_uint32 (*INIT_SEC_CONTEXT_FN_PTR) |
|
115 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
116 |
gss_const_cred_id_t initiator_cred_handle, |
2 | 117 |
gss_ctx_id_t *context_handle, |
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
118 |
gss_const_name_t target_name, |
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
119 |
gss_const_OID mech_type, |
2 | 120 |
OM_uint32 req_flags, |
121 |
OM_uint32 time_req, |
|
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
122 |
gss_const_channel_bindings_t input_chan_bindings, |
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
123 |
gss_const_buffer_t input_token, |
2 | 124 |
gss_OID *actual_mech_type, |
125 |
gss_buffer_t output_token, |
|
126 |
OM_uint32 *ret_flags, |
|
127 |
OM_uint32 *time_rec); |
|
128 |
||
129 |
typedef OM_uint32 (*ACCEPT_SEC_CONTEXT_FN_PTR) |
|
130 |
(OM_uint32 *minor_status, |
|
131 |
gss_ctx_id_t *context_handle, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
132 |
gss_const_cred_id_t acceptor_cred_handle, |
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
133 |
gss_const_buffer_t input_token, |
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
134 |
gss_const_channel_bindings_t input_chan_bindings, |
2 | 135 |
gss_name_t *src_name, |
136 |
gss_OID *mech_type, |
|
137 |
gss_buffer_t output_token, |
|
138 |
OM_uint32 *ret_flags, |
|
139 |
OM_uint32 *time_rec, |
|
140 |
gss_cred_id_t *delegated_cred_handle); |
|
141 |
||
142 |
typedef OM_uint32 (*INQUIRE_CONTEXT_FN_PTR) |
|
143 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
144 |
gss_const_ctx_id_t context_handle, |
2 | 145 |
gss_name_t *src_name, |
146 |
gss_name_t *targ_name, |
|
147 |
OM_uint32 *lifetime_rec, |
|
148 |
gss_OID *mech_type, |
|
149 |
OM_uint32 *ctx_flags, |
|
150 |
int *locally_initiated, |
|
151 |
int *open); |
|
152 |
||
153 |
typedef OM_uint32 (*DELETE_SEC_CONTEXT_FN_PTR) |
|
154 |
(OM_uint32 *minor_status, |
|
155 |
gss_ctx_id_t *context_handle, |
|
156 |
gss_buffer_t output_token); |
|
157 |
||
158 |
typedef OM_uint32 (*CONTEXT_TIME_FN_PTR) |
|
159 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
160 |
gss_const_ctx_id_t context_handle, |
2 | 161 |
OM_uint32 *time_rec); |
162 |
||
163 |
typedef OM_uint32 (*WRAP_SIZE_LIMIT_FN_PTR) |
|
164 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
165 |
gss_const_ctx_id_t context_handle, |
2 | 166 |
int conf_req_flag, |
167 |
gss_qop_t qop_req, |
|
168 |
OM_uint32 req_output_size, |
|
169 |
OM_uint32 *max_input_size); |
|
170 |
||
171 |
typedef OM_uint32 (*EXPORT_SEC_CONTEXT_FN_PTR) |
|
172 |
(OM_uint32 *minor_status, |
|
173 |
gss_ctx_id_t *context_handle, |
|
174 |
gss_buffer_t interprocess_token); |
|
175 |
||
176 |
typedef OM_uint32 (*GET_MIC_FN_PTR) |
|
177 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
178 |
gss_const_ctx_id_t context_handle, |
2 | 179 |
gss_qop_t qop_req, |
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
180 |
gss_const_buffer_t message_buffer, |
2 | 181 |
gss_buffer_t msg_token); |
182 |
||
183 |
typedef OM_uint32 (*VERIFY_MIC_FN_PTR) |
|
184 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
185 |
gss_const_ctx_id_t context_handle, |
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
186 |
gss_const_buffer_t message_buffer, |
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
187 |
gss_const_buffer_t token_buffer, |
2 | 188 |
gss_qop_t *qop_state); |
189 |
||
190 |
typedef OM_uint32 (*WRAP_FN_PTR) |
|
191 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
192 |
gss_const_ctx_id_t context_handle, |
2 | 193 |
int conf_req_flag, |
194 |
gss_qop_t qop_req, |
|
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
195 |
gss_const_buffer_t input_message_buffer, |
2 | 196 |
int *conf_state, |
197 |
gss_buffer_t output_message_buffer); |
|
198 |
||
199 |
typedef OM_uint32 (*UNWRAP_FN_PTR) |
|
200 |
(OM_uint32 *minor_status, |
|
55354
74f0622db875
6722928: Support SSPI as a native GSS-API provider
weijun
parents:
49682
diff
changeset
|
201 |
gss_const_ctx_id_t context_handle, |
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
202 |
gss_const_buffer_t input_message_buffer, |
2 | 203 |
gss_buffer_t output_message_buffer, |
204 |
int *conf_state, |
|
205 |
gss_qop_t *qop_state); |
|
206 |
||
207 |
typedef OM_uint32 (*INDICATE_MECHS_FN_PTR) |
|
208 |
(OM_uint32 *minor_status, |
|
209 |
gss_OID_set *mech_set); |
|
210 |
||
211 |
typedef OM_uint32 (*INQUIRE_NAMES_FOR_MECH_FN_PTR) |
|
212 |
(OM_uint32 *minor_status, |
|
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
213 |
gss_const_OID mechanism, |
2 | 214 |
gss_OID_set *name_types); |
215 |
||
216 |
typedef OM_uint32 (*ADD_OID_SET_MEMBER_FN_PTR) |
|
217 |
(OM_uint32 *minor_status, |
|
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
218 |
gss_const_OID member_oid, |
2 | 219 |
gss_OID_set *oid_set); |
220 |
||
221 |
typedef OM_uint32 (*DISPLAY_STATUS_FN_PTR) |
|
222 |
(OM_uint32 *minor_status, |
|
223 |
OM_uint32 status_value, |
|
224 |
int status_type, |
|
55638
430a51e86f28
8225687: Newly added sspi.cpp in JDK-6722928 still contains some small errors
weijun
parents:
55354
diff
changeset
|
225 |
gss_const_OID mech_type, |
2 | 226 |
OM_uint32 *message_context, |
227 |
gss_buffer_t status_string); |
|
228 |
||
229 |
typedef OM_uint32 (*CREATE_EMPTY_OID_SET_FN_PTR) |
|
230 |
(OM_uint32 *minor_status, |
|
231 |
gss_OID_set *oid_set); |
|
232 |
||
233 |
typedef OM_uint32 (*RELEASE_OID_SET_FN_PTR) |
|
234 |
(OM_uint32 *minor_status, |
|
235 |
gss_OID_set *set); |
|
236 |
||
237 |
typedef OM_uint32 (*RELEASE_BUFFER_FN_PTR) |
|
238 |
(OM_uint32 *minor_status, |
|
239 |
gss_buffer_t buffer); |
|
240 |
||
241 |
||
242 |
/* dynamically resolved functions from gss library */ |
|
243 |
||
244 |
typedef struct GSS_FUNCTION_TABLE { |
|
245 |
gss_OID_set mechs; |
|
246 |
RELEASE_NAME_FN_PTR releaseName; |
|
247 |
IMPORT_NAME_FN_PTR importName; |
|
248 |
COMPARE_NAME_FN_PTR compareName; |
|
249 |
CANONICALIZE_NAME_FN_PTR canonicalizeName; |
|
250 |
EXPORT_NAME_FN_PTR exportName; |
|
251 |
DISPLAY_NAME_FN_PTR displayName; |
|
252 |
ACQUIRE_CRED_FN_PTR acquireCred; |
|
253 |
RELEASE_CRED_FN_PTR releaseCred; |
|
254 |
INQUIRE_CRED_FN_PTR inquireCred; |
|
255 |
IMPORT_SEC_CONTEXT_FN_PTR importSecContext; |
|
256 |
INIT_SEC_CONTEXT_FN_PTR initSecContext; |
|
257 |
ACCEPT_SEC_CONTEXT_FN_PTR acceptSecContext; |
|
258 |
INQUIRE_CONTEXT_FN_PTR inquireContext; |
|
259 |
DELETE_SEC_CONTEXT_FN_PTR deleteSecContext; |
|
260 |
CONTEXT_TIME_FN_PTR contextTime; |
|
261 |
WRAP_SIZE_LIMIT_FN_PTR wrapSizeLimit; |
|
262 |
EXPORT_SEC_CONTEXT_FN_PTR exportSecContext; |
|
263 |
GET_MIC_FN_PTR getMic; |
|
264 |
VERIFY_MIC_FN_PTR verifyMic; |
|
265 |
WRAP_FN_PTR wrap; |
|
266 |
UNWRAP_FN_PTR unwrap; |
|
267 |
INDICATE_MECHS_FN_PTR indicateMechs; |
|
268 |
INQUIRE_NAMES_FOR_MECH_FN_PTR inquireNamesForMech; |
|
269 |
ADD_OID_SET_MEMBER_FN_PTR addOidSetMember; |
|
270 |
DISPLAY_STATUS_FN_PTR displayStatus; |
|
271 |
CREATE_EMPTY_OID_SET_FN_PTR createEmptyOidSet; |
|
272 |
RELEASE_OID_SET_FN_PTR releaseOidSet; |
|
273 |
RELEASE_BUFFER_FN_PTR releaseBuffer; |
|
274 |
||
275 |
} GSS_FUNCTION_TABLE; |
|
276 |
||
277 |
typedef GSS_FUNCTION_TABLE *GSS_FUNCTION_TABLE_PTR; |
|
278 |
||
279 |
/* global GSS function table */ |
|
280 |
GSS_FUNCTION_TABLE_PTR ftab; |
|
281 |
||
282 |
#endif |