/src/gss-ntlmssp/src/gss_spi.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* Copyright 2013 Simo Sorce <simo@samba.org>, see COPYING for license */ |
2 | | |
3 | | #include <gssapi/gssapi.h> |
4 | | #include <gssapi/gssapi_ext.h> |
5 | | |
6 | | #include "gss_ntlmssp.h" |
7 | | |
8 | | OM_uint32 gss_init_sec_context(OM_uint32 *minor_status, |
9 | | gss_cred_id_t claimant_cred_handle, |
10 | | gss_ctx_id_t *context_handle, |
11 | | gss_name_t target_name, |
12 | | gss_OID mech_type, |
13 | | OM_uint32 req_flags, |
14 | | OM_uint32 time_req, |
15 | | gss_channel_bindings_t input_chan_bindings, |
16 | | gss_buffer_t input_token, |
17 | | gss_OID *actual_mech_type, |
18 | | gss_buffer_t output_token, |
19 | | OM_uint32 *ret_flags, |
20 | | OM_uint32 *time_rec) |
21 | 0 | { |
22 | 0 | return gssntlm_init_sec_context(minor_status, |
23 | 0 | claimant_cred_handle, |
24 | 0 | context_handle, |
25 | 0 | target_name, |
26 | 0 | mech_type, |
27 | 0 | req_flags, |
28 | 0 | time_req, |
29 | 0 | input_chan_bindings, |
30 | 0 | input_token, |
31 | 0 | actual_mech_type, |
32 | 0 | output_token, |
33 | 0 | ret_flags, |
34 | 0 | time_rec); |
35 | 0 | } |
36 | | |
37 | | OM_uint32 gss_delete_sec_context(OM_uint32 *minor_status, |
38 | | gss_ctx_id_t *context_handle, |
39 | | gss_buffer_t output_token) |
40 | 1.16k | { |
41 | 1.16k | return gssntlm_delete_sec_context(minor_status, |
42 | 1.16k | context_handle, |
43 | 1.16k | output_token); |
44 | 1.16k | } |
45 | | |
46 | | OM_uint32 gss_acquire_cred_from(OM_uint32 *minor_status, |
47 | | gss_name_t desired_name, |
48 | | OM_uint32 time_req, |
49 | | gss_OID_set desired_mechs, |
50 | | gss_cred_usage_t cred_usage, |
51 | | gss_const_key_value_set_t cred_store, |
52 | | gss_cred_id_t *output_cred_handle, |
53 | | gss_OID_set *actual_mechs, |
54 | | OM_uint32 *time_rec) |
55 | 0 | { |
56 | 0 | return gssntlm_acquire_cred_from(minor_status, NULL, |
57 | 0 | desired_name, |
58 | 0 | time_req, |
59 | 0 | desired_mechs, |
60 | 0 | cred_usage, |
61 | 0 | cred_store, |
62 | 0 | output_cred_handle, |
63 | 0 | actual_mechs, |
64 | 0 | time_rec); |
65 | 0 | } |
66 | | |
67 | | OM_uint32 gss_acquire_cred(OM_uint32 *minor_status, |
68 | | gss_name_t desired_name, |
69 | | OM_uint32 time_req, |
70 | | gss_OID_set desired_mechs, |
71 | | gss_cred_usage_t cred_usage, |
72 | | gss_cred_id_t *output_cred_handle, |
73 | | gss_OID_set *actual_mechs, |
74 | | OM_uint32 *time_rec) |
75 | 0 | { |
76 | 0 | return gssntlm_acquire_cred(minor_status, |
77 | 0 | desired_name, |
78 | 0 | time_req, |
79 | 0 | desired_mechs, |
80 | 0 | cred_usage, |
81 | 0 | output_cred_handle, |
82 | 0 | actual_mechs, |
83 | 0 | time_rec); |
84 | 0 | } |
85 | | |
86 | | OM_uint32 gssspi_acquire_cred_with_password(OM_uint32 *minor_status, |
87 | | gss_name_t desired_name, |
88 | | gss_buffer_t password, |
89 | | OM_uint32 time_req, |
90 | | gss_OID_set desired_mechs, |
91 | | gss_cred_usage_t cred_usage, |
92 | | gss_cred_id_t *output_cred_handle, |
93 | | gss_OID_set *actual_mechs, |
94 | | OM_uint32 *time_rec) |
95 | 0 | { |
96 | 0 | return gssntlm_acquire_cred_with_password(minor_status, |
97 | 0 | desired_name, |
98 | 0 | password, |
99 | 0 | time_req, |
100 | 0 | desired_mechs, |
101 | 0 | cred_usage, |
102 | 0 | output_cred_handle, |
103 | 0 | actual_mechs, |
104 | 0 | time_rec); |
105 | 0 | } |
106 | | |
107 | | OM_uint32 gss_release_cred(OM_uint32 *minor_status, |
108 | | gss_cred_id_t *cred_handle) |
109 | 1.16k | { |
110 | 1.16k | return gssntlm_release_cred(minor_status, cred_handle); |
111 | 1.16k | } |
112 | | |
113 | | OM_uint32 gss_import_name(OM_uint32 *minor_status, |
114 | | gss_buffer_t input_name_buffer, |
115 | | gss_OID input_name_type, |
116 | | gss_name_t *output_name) |
117 | 0 | { |
118 | 0 | return gssntlm_import_name(minor_status, |
119 | 0 | input_name_buffer, |
120 | 0 | input_name_type, |
121 | 0 | output_name); |
122 | 0 | } |
123 | | |
124 | | OM_uint32 gssspi_import_name_by_mech(OM_uint32 *minor_status, |
125 | | gss_OID mech_type, |
126 | | gss_buffer_t input_name_buffer, |
127 | | gss_OID input_name_type, |
128 | | gss_name_t *output_name) |
129 | 0 | { |
130 | 0 | return gssntlm_import_name(minor_status, |
131 | 0 | input_name_buffer, |
132 | 0 | input_name_type, |
133 | 0 | output_name); |
134 | 0 | } |
135 | | |
136 | | OM_uint32 gss_duplicate_name(OM_uint32 *minor_status, |
137 | | const gss_name_t input_name, |
138 | | gss_name_t *dest_name) |
139 | 0 | { |
140 | 0 | return gssntlm_duplicate_name(minor_status, |
141 | 0 | input_name, dest_name); |
142 | 0 | } |
143 | | |
144 | | OM_uint32 gss_release_name(OM_uint32 *minor_status, |
145 | | gss_name_t *input_name) |
146 | 1.16k | { |
147 | 1.16k | return gssntlm_release_name(minor_status, |
148 | 1.16k | input_name); |
149 | 1.16k | } |
150 | | OM_uint32 gss_get_name_attribute(OM_uint32 *minor_status, |
151 | | gss_name_t name, |
152 | | gss_buffer_t attr, |
153 | | int *authenticated, |
154 | | int *complete, |
155 | | gss_buffer_t value, |
156 | | gss_buffer_t display_value, |
157 | | int *more) |
158 | 0 | { |
159 | 0 | return gssntlm_get_name_attribute(minor_status, name, attr, authenticated, |
160 | 0 | complete, value, display_value, more); |
161 | 0 | } |
162 | | |
163 | | OM_uint32 gss_context_time(OM_uint32 *minor_status, |
164 | | gss_ctx_id_t context_handle, |
165 | | OM_uint32 *time_rec) |
166 | 0 | { |
167 | 0 | return gssntlm_context_time(minor_status, context_handle, time_rec); |
168 | 0 | } |
169 | | |
170 | | OM_uint32 gss_accept_sec_context(OM_uint32 *minor_status, |
171 | | gss_ctx_id_t *context_handle, |
172 | | gss_cred_id_t acceptor_cred_handle, |
173 | | gss_buffer_t input_token_buffer, |
174 | | gss_channel_bindings_t input_chan_bindings, |
175 | | gss_name_t *src_name, |
176 | | gss_OID *mech_type, |
177 | | gss_buffer_t output_token, |
178 | | OM_uint32 *ret_flags, |
179 | | OM_uint32 *time_rec, |
180 | | gss_cred_id_t *delegated_cred_handle) |
181 | 0 | { |
182 | 0 | return gssntlm_accept_sec_context(minor_status, |
183 | 0 | context_handle, |
184 | 0 | acceptor_cred_handle, |
185 | 0 | input_token_buffer, |
186 | 0 | input_chan_bindings, |
187 | 0 | src_name, |
188 | 0 | mech_type, |
189 | 0 | output_token, |
190 | 0 | ret_flags, |
191 | 0 | time_rec, |
192 | 0 | delegated_cred_handle); |
193 | 0 | } |
194 | | |
195 | | OM_uint32 gss_get_mic(OM_uint32 *minor_status, |
196 | | gss_ctx_id_t context_handle, |
197 | | gss_qop_t qop_req, |
198 | | gss_buffer_t message_buffer, |
199 | | gss_buffer_t message_token) |
200 | 0 | { |
201 | 0 | return gssntlm_get_mic(minor_status, |
202 | 0 | context_handle, |
203 | 0 | qop_req, |
204 | 0 | message_buffer, |
205 | 0 | message_token); |
206 | 0 | } |
207 | | |
208 | | |
209 | | OM_uint32 gss_verify_mic(OM_uint32 *minor_status, |
210 | | gss_ctx_id_t context_handle, |
211 | | gss_buffer_t message_buffer, |
212 | | gss_buffer_t message_token, |
213 | | gss_qop_t *qop_state) |
214 | 0 | { |
215 | 0 | return gssntlm_verify_mic(minor_status, |
216 | 0 | context_handle, |
217 | 0 | message_buffer, |
218 | 0 | message_token, |
219 | 0 | qop_state); |
220 | 0 | } |
221 | | |
222 | | OM_uint32 gss_wrap(OM_uint32 *minor_status, |
223 | | gss_ctx_id_t context_handle, |
224 | | int conf_req_flag, |
225 | | gss_qop_t qop_req, |
226 | | gss_buffer_t input_message_buffer, |
227 | | int *conf_state, |
228 | | gss_buffer_t output_message_buffer) |
229 | 0 | { |
230 | 0 | return gssntlm_wrap(minor_status, |
231 | 0 | context_handle, |
232 | 0 | conf_req_flag, |
233 | 0 | qop_req, |
234 | 0 | input_message_buffer, |
235 | 0 | conf_state, |
236 | 0 | output_message_buffer); |
237 | 0 | } |
238 | | |
239 | | OM_uint32 gss_unwrap(OM_uint32 *minor_status, |
240 | | gss_ctx_id_t context_handle, |
241 | | gss_buffer_t input_message_buffer, |
242 | | gss_buffer_t output_message_buffer, |
243 | | int *conf_state, |
244 | | gss_qop_t *qop_state) |
245 | 0 | { |
246 | 0 | return gssntlm_unwrap(minor_status, |
247 | 0 | context_handle, |
248 | 0 | input_message_buffer, |
249 | 0 | output_message_buffer, |
250 | 0 | conf_state, |
251 | 0 | qop_state); |
252 | 0 | } |
253 | | |
254 | | OM_uint32 gss_wrap_size_limit(OM_uint32 *minor_status, |
255 | | gss_ctx_id_t context_handle, |
256 | | int conf_req_flag, |
257 | | gss_qop_t qop_req, |
258 | | OM_uint32 req_output_size, |
259 | | OM_uint32 *max_input_size) |
260 | 0 | { |
261 | 0 | return gssntlm_wrap_size_limit(minor_status, |
262 | 0 | context_handle, |
263 | 0 | conf_req_flag, |
264 | 0 | qop_req, |
265 | 0 | req_output_size, |
266 | 0 | max_input_size); |
267 | 0 | } |
268 | | |
269 | | OM_uint32 gss_inquire_context(OM_uint32 *minor_status, |
270 | | gss_ctx_id_t context_handle, |
271 | | gss_name_t *src_name, |
272 | | gss_name_t *targ_name, |
273 | | OM_uint32 *lifetime_rec, |
274 | | gss_OID *mech_type, |
275 | | OM_uint32 *ctx_flags, |
276 | | int *locally_initiated, |
277 | | int *open) |
278 | 0 | { |
279 | 0 | return gssntlm_inquire_context(minor_status, |
280 | 0 | context_handle, |
281 | 0 | src_name, |
282 | 0 | targ_name, |
283 | 0 | lifetime_rec, |
284 | 0 | mech_type, |
285 | 0 | ctx_flags, |
286 | 0 | locally_initiated, |
287 | 0 | open); |
288 | 0 | } |
289 | | |
290 | | OM_uint32 gss_display_name(OM_uint32 *minor_status, |
291 | | gss_name_t input_name, |
292 | | gss_buffer_t output_name_buffer, |
293 | | gss_OID *output_name_type) |
294 | 0 | { |
295 | 0 | return gssntlm_display_name(minor_status, |
296 | 0 | input_name, |
297 | 0 | output_name_buffer, |
298 | 0 | output_name_type); |
299 | 0 | } |
300 | | |
301 | | OM_uint32 gss_localname(OM_uint32 *minor_status, |
302 | | const gss_name_t name, |
303 | | gss_const_OID mech_type, |
304 | | gss_buffer_t localname) |
305 | 0 | { |
306 | 0 | return gssntlm_localname(minor_status, |
307 | 0 | name, |
308 | 0 | mech_type, |
309 | 0 | localname); |
310 | 0 | } |
311 | | |
312 | | OM_uint32 gss_set_sec_context_option(OM_uint32 *minor_status, |
313 | | gss_ctx_id_t *context_handle, |
314 | | const gss_OID desired_object, |
315 | | const gss_buffer_t value) |
316 | 0 | { |
317 | 0 | return gssntlm_set_sec_context_option(minor_status, |
318 | 0 | context_handle, |
319 | 0 | desired_object, |
320 | 0 | value); |
321 | 0 | } |
322 | | |
323 | | OM_uint32 gss_inquire_sec_context_by_oid(OM_uint32 *minor_status, |
324 | | const gss_ctx_id_t context_handle, |
325 | | const gss_OID desired_object, |
326 | | gss_buffer_set_t *data_set) |
327 | 0 | { |
328 | 0 | return gssntlm_inquire_sec_context_by_oid(minor_status, |
329 | 0 | context_handle, |
330 | 0 | desired_object, |
331 | 0 | data_set); |
332 | 0 | } |
333 | | |
334 | | OM_uint32 gss_inquire_cred(OM_uint32 *minor_status, |
335 | | gss_cred_id_t cred_handle, |
336 | | gss_name_t *name, |
337 | | OM_uint32 *lifetime, |
338 | | gss_cred_usage_t *cred_usage, |
339 | | gss_OID_set *mechanisms) |
340 | 0 | { |
341 | 0 | return gssntlm_inquire_cred(minor_status, |
342 | 0 | cred_handle, |
343 | 0 | name, |
344 | 0 | lifetime, |
345 | 0 | cred_usage, |
346 | 0 | mechanisms); |
347 | 0 | } |
348 | | |
349 | | OM_uint32 gss_inquire_cred_by_mech(OM_uint32 *minor_status, |
350 | | gss_cred_id_t cred_handle, |
351 | | gss_OID mech_type, |
352 | | gss_name_t *name, |
353 | | OM_uint32 *initiator_lifetime, |
354 | | OM_uint32 *acceptor_lifetime, |
355 | | gss_cred_usage_t *cred_usage) |
356 | 0 | { |
357 | 0 | return gssntlm_inquire_cred_by_mech(minor_status, |
358 | 0 | cred_handle, |
359 | 0 | mech_type, |
360 | 0 | name, |
361 | 0 | initiator_lifetime, |
362 | 0 | acceptor_lifetime, |
363 | 0 | cred_usage); |
364 | 0 | } |
365 | | |
366 | | OM_uint32 gss_export_sec_context(OM_uint32 *minor_status, |
367 | | gss_ctx_id_t *context_handle, |
368 | | gss_buffer_t interprocess_token) |
369 | 0 | { |
370 | 0 | return gssntlm_export_sec_context(minor_status, |
371 | 0 | context_handle, |
372 | 0 | interprocess_token); |
373 | 0 | } |
374 | | |
375 | | OM_uint32 gss_import_sec_context(OM_uint32 *minor_status, |
376 | | gss_buffer_t interprocess_token, |
377 | | gss_ctx_id_t *context_handle) |
378 | 0 | { |
379 | 0 | return gssntlm_import_sec_context(minor_status, |
380 | 0 | interprocess_token, |
381 | 0 | context_handle); |
382 | 0 | } |
383 | | |
384 | | OM_uint32 gss_export_cred(OM_uint32 *minor_status, |
385 | | gss_cred_id_t cred_handle, |
386 | | gss_buffer_t token) |
387 | 0 | { |
388 | 0 | return gssntlm_export_cred(minor_status, cred_handle, token); |
389 | 0 | } |
390 | | |
391 | | OM_uint32 gss_import_cred(OM_uint32 *minor_status, |
392 | | gss_buffer_t token, |
393 | | gss_cred_id_t *cred_handle) |
394 | 0 | { |
395 | 0 | return gssntlm_import_cred(minor_status, token, cred_handle); |
396 | 0 | } |
397 | | |
398 | | OM_uint32 gss_display_status(OM_uint32 *minor_status, |
399 | | OM_uint32 status_value, |
400 | | int status_type, |
401 | | gss_OID mech_type, |
402 | | OM_uint32 *message_context, |
403 | | gss_buffer_t status_string) |
404 | 0 | { |
405 | 0 | return gssntlm_display_status(minor_status, status_value, status_type, |
406 | 0 | mech_type, message_context, status_string); |
407 | 0 | } |
408 | | |
409 | | OM_uint32 gss_inquire_name(OM_uint32 *minor_status, |
410 | | gss_name_t name, |
411 | | int *name_is_MN, |
412 | | gss_OID *MN_mech, |
413 | | gss_buffer_set_t *attrs) |
414 | 0 | { |
415 | 0 | return gssntlm_inquire_name(minor_status, name, name_is_MN, MN_mech, |
416 | 0 | attrs); |
417 | 0 | } |
418 | | |
419 | | OM_uint32 gss_inquire_saslname_for_mech(OM_uint32 *minor_status, |
420 | | const gss_OID desired_mech, |
421 | | gss_buffer_t sasl_mech_name, |
422 | | gss_buffer_t mech_name, |
423 | | gss_buffer_t mech_description) |
424 | 0 | { |
425 | 0 | return gssntlm_inquire_saslname_for_mech(minor_status, desired_mech, |
426 | 0 | sasl_mech_name, mech_name, |
427 | 0 | mech_description); |
428 | 0 | } |
429 | | |
430 | | OM_uint32 gss_inquire_mech_for_saslname(OM_uint32 *minor_status, |
431 | | const gss_buffer_t sasl_mech_name, |
432 | | gss_OID *mech_type) |
433 | 0 | { |
434 | 0 | return gssntlm_inquire_mech_for_saslname(minor_status, sasl_mech_name, |
435 | 0 | mech_type); |
436 | 0 | } |
437 | | |
438 | | OM_uint32 gss_inquire_attrs_for_mech(OM_uint32 *minor_status, |
439 | | gss_const_OID mech_oid, |
440 | | gss_OID_set *mech_attrs, |
441 | | gss_OID_set *known_mech_attrs) |
442 | 0 | { |
443 | 0 | return gssntlm_inquire_attrs_for_mech(minor_status, mech_oid, mech_attrs, |
444 | 0 | known_mech_attrs); |
445 | 0 | } |
446 | | |
447 | | OM_uint32 gssspi_mech_invoke(OM_uint32 *minor_status, |
448 | | const gss_OID desired_mech, |
449 | | const gss_OID desired_object, |
450 | | gss_buffer_t value) |
451 | 0 | { |
452 | 0 | return gssntlm_mech_invoke(minor_status, desired_mech, desired_object, |
453 | 0 | value); |
454 | 0 | } |
455 | | |
456 | | OM_uint32 gssspi_set_cred_option(OM_uint32 *minor_status, |
457 | | gss_cred_id_t *cred_handle, |
458 | | const gss_OID desired_object, |
459 | | const gss_buffer_t value) |
460 | 0 | { |
461 | 0 | return gssntlm_set_cred_option(minor_status, cred_handle, desired_object, |
462 | 0 | value); |
463 | 0 | } |