/src/samba/third_party/heimdal/lib/krb5/deprecated.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 1997 - 2009 Kungliga Tekniska Högskolan |
3 | | * (Royal Institute of Technology, Stockholm, Sweden). |
4 | | * All rights reserved. |
5 | | * |
6 | | * Redistribution and use in source and binary forms, with or without |
7 | | * modification, are permitted provided that the following conditions |
8 | | * are met: |
9 | | * |
10 | | * 1. Redistributions of source code must retain the above copyright |
11 | | * notice, this list of conditions and the following disclaimer. |
12 | | * |
13 | | * 2. Redistributions in binary form must reproduce the above copyright |
14 | | * notice, this list of conditions and the following disclaimer in the |
15 | | * documentation and/or other materials provided with the distribution. |
16 | | * |
17 | | * 3. Neither the name of the Institute nor the names of its contributors |
18 | | * may be used to endorse or promote products derived from this software |
19 | | * without specific prior written permission. |
20 | | * |
21 | | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND |
22 | | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
23 | | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
24 | | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE |
25 | | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
26 | | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
27 | | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
28 | | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
29 | | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
30 | | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
31 | | * SUCH DAMAGE. |
32 | | */ |
33 | | |
34 | | #ifdef __GNUC__ |
35 | | /* For some GCCs there's no way to shut them up about deprecated functions */ |
36 | | #define KRB5_DEPRECATED_FUNCTION(x) |
37 | | #endif |
38 | | |
39 | | #include "krb5_locl.h" |
40 | | |
41 | | |
42 | | #undef __attribute__ |
43 | | #define __attribute__(x) |
44 | | |
45 | | #ifndef HEIMDAL_SMALLER |
46 | | |
47 | | /** |
48 | | * Same as krb5_data_free(). MIT compat. |
49 | | * |
50 | | * Deprecated: use krb5_data_free(). |
51 | | * |
52 | | * @param context Kerberos 5 context. |
53 | | * @param data krb5_data to free. |
54 | | * |
55 | | * @ingroup krb5_deprecated |
56 | | */ |
57 | | |
58 | | KRB5_LIB_FUNCTION void KRB5_LIB_CALL |
59 | | krb5_free_data_contents(krb5_context context, krb5_data *data) |
60 | | KRB5_DEPRECATED_FUNCTION("Use krb5_data_free instead") |
61 | 0 | { |
62 | 0 | krb5_data_free(data); |
63 | 0 | } |
64 | | |
65 | | /** |
66 | | * Deprecated: keytypes doesn't exists, they are really enctypes. |
67 | | * |
68 | | * @ingroup krb5_deprecated |
69 | | */ |
70 | | |
71 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
72 | | krb5_keytype_to_enctypes_default (krb5_context context, |
73 | | krb5_keytype keytype, |
74 | | unsigned *len, |
75 | | krb5_enctype **val) |
76 | | KRB5_DEPRECATED_FUNCTION("Use X instead") |
77 | 0 | { |
78 | 0 | unsigned int i, n; |
79 | 0 | krb5_enctype *ret; |
80 | |
|
81 | 0 | if (keytype != (krb5_keytype)KEYTYPE_DES || context->etypes_des == NULL) |
82 | 0 | return krb5_keytype_to_enctypes (context, keytype, len, val); |
83 | | |
84 | 0 | for (n = 0; context->etypes_des[n]; ++n) |
85 | 0 | ; |
86 | 0 | ret = malloc (n * sizeof(*ret)); |
87 | 0 | if (ret == NULL && n != 0) |
88 | 0 | return krb5_enomem(context); |
89 | 0 | for (i = 0; i < n; ++i) |
90 | 0 | ret[i] = context->etypes_des[i]; |
91 | 0 | *len = n; |
92 | 0 | *val = ret; |
93 | 0 | return 0; |
94 | 0 | } |
95 | | |
96 | | |
97 | | static struct { |
98 | | const char *name; |
99 | | krb5_keytype type; |
100 | | } keys[] = { |
101 | | { "null", KRB5_ENCTYPE_NULL }, |
102 | | { "des", KRB5_ENCTYPE_DES_CBC_CRC }, |
103 | | { "des3", KRB5_ENCTYPE_OLD_DES3_CBC_SHA1 }, |
104 | | { "aes-128", KRB5_ENCTYPE_AES128_CTS_HMAC_SHA1_96 }, |
105 | | { "aes-256", KRB5_ENCTYPE_AES256_CTS_HMAC_SHA1_96 }, |
106 | | { "arcfour", KRB5_ENCTYPE_ARCFOUR_HMAC_MD5 }, |
107 | | { "arcfour-56", KRB5_ENCTYPE_ARCFOUR_HMAC_MD5_56 } |
108 | | }; |
109 | | |
110 | | static int num_keys = sizeof(keys) / sizeof(keys[0]); |
111 | | |
112 | | /** |
113 | | * Deprecated: keytypes doesn't exists, they are really enctypes in |
114 | | * most cases, use krb5_enctype_to_string(). |
115 | | * |
116 | | * @ingroup krb5_deprecated |
117 | | */ |
118 | | |
119 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
120 | | krb5_keytype_to_string(krb5_context context, |
121 | | krb5_keytype keytype, |
122 | | char **string) |
123 | | KRB5_DEPRECATED_FUNCTION("Use krb5_enctype_to_string instead") |
124 | 0 | { |
125 | 0 | const char *name = NULL; |
126 | 0 | int i; |
127 | |
|
128 | 0 | for(i = 0; i < num_keys; i++) { |
129 | 0 | if(keys[i].type == keytype) { |
130 | 0 | name = keys[i].name; |
131 | 0 | break; |
132 | 0 | } |
133 | 0 | } |
134 | |
|
135 | 0 | if(i >= num_keys) { |
136 | 0 | krb5_set_error_message(context, KRB5_PROG_KEYTYPE_NOSUPP, |
137 | 0 | "key type %d not supported", keytype); |
138 | 0 | return KRB5_PROG_KEYTYPE_NOSUPP; |
139 | 0 | } |
140 | 0 | *string = strdup(name); |
141 | 0 | if (*string == NULL) |
142 | 0 | return krb5_enomem(context); |
143 | 0 | return 0; |
144 | 0 | } |
145 | | |
146 | | /** |
147 | | * Deprecated: keytypes doesn't exists, they are really enctypes in |
148 | | * most cases, use krb5_string_to_enctype(). |
149 | | * |
150 | | * @ingroup krb5_deprecated |
151 | | */ |
152 | | |
153 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
154 | | krb5_string_to_keytype(krb5_context context, |
155 | | const char *string, |
156 | | krb5_keytype *keytype) |
157 | | KRB5_DEPRECATED_FUNCTION("Use krb5_string_to_enctype instead") |
158 | 0 | { |
159 | 0 | char *end; |
160 | 0 | int i; |
161 | |
|
162 | 0 | for(i = 0; i < num_keys; i++) |
163 | 0 | if(strcasecmp(keys[i].name, string) == 0){ |
164 | 0 | *keytype = keys[i].type; |
165 | 0 | return 0; |
166 | 0 | } |
167 | | |
168 | | /* check if the enctype is a number */ |
169 | 0 | *keytype = strtol(string, &end, 0); |
170 | 0 | if(*end == '\0' && *keytype != 0) { |
171 | 0 | if (krb5_enctype_valid(context, *keytype) == 0) |
172 | 0 | return 0; |
173 | 0 | } |
174 | | |
175 | 0 | krb5_set_error_message(context, KRB5_PROG_KEYTYPE_NOSUPP, |
176 | 0 | "key type %s not supported", string); |
177 | 0 | return KRB5_PROG_KEYTYPE_NOSUPP; |
178 | 0 | } |
179 | | |
180 | | /** |
181 | | * Deprecated: use krb5_get_init_creds() and friends. |
182 | | * |
183 | | * @ingroup krb5_deprecated |
184 | | */ |
185 | | |
186 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_CALLCONV |
187 | | krb5_password_key_proc (krb5_context context, |
188 | | krb5_enctype type, |
189 | | krb5_salt salt, |
190 | | krb5_const_pointer keyseed, |
191 | | krb5_keyblock **key) |
192 | | KRB5_DEPRECATED_FUNCTION("Use X instead") |
193 | 0 | { |
194 | 0 | krb5_error_code ret; |
195 | 0 | const char *password = (const char *)keyseed; |
196 | 0 | char buf[BUFSIZ]; |
197 | |
|
198 | 0 | *key = malloc (sizeof (**key)); |
199 | 0 | if (*key == NULL) |
200 | 0 | return krb5_enomem(context); |
201 | 0 | if (password == NULL) { |
202 | 0 | if(UI_UTIL_read_pw_string (buf, sizeof(buf), "Password: ", 0)) { |
203 | 0 | free (*key); |
204 | 0 | krb5_clear_error_message(context); |
205 | 0 | return KRB5_LIBOS_PWDINTR; |
206 | 0 | } |
207 | 0 | password = buf; |
208 | 0 | } |
209 | 0 | ret = krb5_string_to_key_salt (context, type, password, salt, *key); |
210 | 0 | memset_s(buf, sizeof(buf), 0, sizeof(buf)); |
211 | 0 | return ret; |
212 | 0 | } |
213 | | |
214 | | /** |
215 | | * Deprecated: use krb5_get_init_creds() and friends. |
216 | | * |
217 | | * @ingroup krb5_deprecated |
218 | | */ |
219 | | |
220 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
221 | | krb5_get_in_tkt_with_password (krb5_context context, |
222 | | krb5_flags options, |
223 | | krb5_addresses *addrs, |
224 | | const krb5_enctype *etypes, |
225 | | const krb5_preauthtype *pre_auth_types, |
226 | | const char *password, |
227 | | krb5_ccache ccache, |
228 | | krb5_creds *creds, |
229 | | krb5_kdc_rep *ret_as_reply) |
230 | | KRB5_DEPRECATED_FUNCTION("Use X instead") |
231 | 0 | { |
232 | 0 | return krb5_get_in_tkt (context, |
233 | 0 | options, |
234 | 0 | addrs, |
235 | 0 | etypes, |
236 | 0 | pre_auth_types, |
237 | 0 | krb5_password_key_proc, |
238 | 0 | password, |
239 | 0 | NULL, |
240 | 0 | NULL, |
241 | 0 | creds, |
242 | 0 | ccache, |
243 | 0 | ret_as_reply); |
244 | 0 | } |
245 | | |
246 | | static krb5_error_code KRB5_CALLCONV |
247 | | krb5_skey_key_proc (krb5_context context, |
248 | | krb5_enctype type, |
249 | | krb5_salt salt, |
250 | | krb5_const_pointer keyseed, |
251 | | krb5_keyblock **key) |
252 | 0 | { |
253 | 0 | return krb5_copy_keyblock (context, keyseed, key); |
254 | 0 | } |
255 | | |
256 | | /** |
257 | | * Deprecated: use krb5_get_init_creds() and friends. |
258 | | * |
259 | | * @ingroup krb5_deprecated |
260 | | */ |
261 | | |
262 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
263 | | krb5_get_in_tkt_with_skey (krb5_context context, |
264 | | krb5_flags options, |
265 | | krb5_addresses *addrs, |
266 | | const krb5_enctype *etypes, |
267 | | const krb5_preauthtype *pre_auth_types, |
268 | | const krb5_keyblock *key, |
269 | | krb5_ccache ccache, |
270 | | krb5_creds *creds, |
271 | | krb5_kdc_rep *ret_as_reply) |
272 | | KRB5_DEPRECATED_FUNCTION("Use X instead") |
273 | 0 | { |
274 | 0 | if(key == NULL) |
275 | 0 | return krb5_get_in_tkt_with_keytab (context, |
276 | 0 | options, |
277 | 0 | addrs, |
278 | 0 | etypes, |
279 | 0 | pre_auth_types, |
280 | 0 | NULL, |
281 | 0 | ccache, |
282 | 0 | creds, |
283 | 0 | ret_as_reply); |
284 | 0 | else |
285 | 0 | return krb5_get_in_tkt (context, |
286 | 0 | options, |
287 | 0 | addrs, |
288 | 0 | etypes, |
289 | 0 | pre_auth_types, |
290 | 0 | krb5_skey_key_proc, |
291 | 0 | key, |
292 | 0 | NULL, |
293 | 0 | NULL, |
294 | 0 | creds, |
295 | 0 | ccache, |
296 | 0 | ret_as_reply); |
297 | 0 | } |
298 | | |
299 | | /** |
300 | | * Deprecated: use krb5_get_init_creds() and friends. |
301 | | * |
302 | | * @ingroup krb5_deprecated |
303 | | */ |
304 | | |
305 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_CALLCONV |
306 | | krb5_keytab_key_proc (krb5_context context, |
307 | | krb5_enctype enctype, |
308 | | krb5_salt salt, |
309 | | krb5_const_pointer keyseed, |
310 | | krb5_keyblock **key) |
311 | | KRB5_DEPRECATED_FUNCTION("Use X instead") |
312 | 0 | { |
313 | 0 | krb5_keytab_key_proc_args *args = rk_UNCONST(keyseed); |
314 | 0 | krb5_keytab keytab = args->keytab; |
315 | 0 | krb5_principal principal = args->principal; |
316 | 0 | krb5_error_code ret; |
317 | 0 | krb5_keytab real_keytab; |
318 | 0 | krb5_keytab_entry entry; |
319 | |
|
320 | 0 | if(keytab == NULL) |
321 | 0 | krb5_kt_default(context, &real_keytab); |
322 | 0 | else |
323 | 0 | real_keytab = keytab; |
324 | |
|
325 | 0 | ret = krb5_kt_get_entry (context, real_keytab, principal, |
326 | 0 | 0, enctype, &entry); |
327 | 0 | if (ret == 0) { |
328 | 0 | ret = krb5_copy_keyblock (context, &entry.keyblock, key); |
329 | 0 | krb5_kt_free_entry(context, &entry); |
330 | 0 | } |
331 | |
|
332 | 0 | if (keytab == NULL) |
333 | 0 | krb5_kt_close (context, real_keytab); |
334 | 0 | return ret; |
335 | 0 | } |
336 | | |
337 | | /** |
338 | | * Deprecated: use krb5_get_init_creds() and friends. |
339 | | * |
340 | | * @ingroup krb5_deprecated |
341 | | */ |
342 | | |
343 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
344 | | krb5_get_in_tkt_with_keytab (krb5_context context, |
345 | | krb5_flags options, |
346 | | krb5_addresses *addrs, |
347 | | const krb5_enctype *etypes, |
348 | | const krb5_preauthtype *pre_auth_types, |
349 | | krb5_keytab keytab, |
350 | | krb5_ccache ccache, |
351 | | krb5_creds *creds, |
352 | | krb5_kdc_rep *ret_as_reply) |
353 | | KRB5_DEPRECATED_FUNCTION("Use X instead") |
354 | 0 | { |
355 | 0 | krb5_keytab_key_proc_args a; |
356 | |
|
357 | 0 | a.principal = creds->client; |
358 | 0 | a.keytab = keytab; |
359 | |
|
360 | 0 | return krb5_get_in_tkt (context, |
361 | 0 | options, |
362 | 0 | addrs, |
363 | 0 | etypes, |
364 | 0 | pre_auth_types, |
365 | 0 | krb5_keytab_key_proc, |
366 | 0 | &a, |
367 | 0 | NULL, |
368 | 0 | NULL, |
369 | 0 | creds, |
370 | 0 | ccache, |
371 | 0 | ret_as_reply); |
372 | 0 | } |
373 | | |
374 | | /** |
375 | | * Generate a new ccache of type `ops' in `id'. |
376 | | * |
377 | | * Deprecated: use krb5_cc_new_unique() instead. |
378 | | * |
379 | | * @return Return an error code or 0, see krb5_get_error_message(). |
380 | | * |
381 | | * @ingroup krb5_ccache |
382 | | */ |
383 | | |
384 | | |
385 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
386 | | krb5_cc_gen_new(krb5_context context, |
387 | | const krb5_cc_ops *ops, |
388 | | krb5_ccache *id) |
389 | | KRB5_DEPRECATED_FUNCTION("Use krb5_cc_new_unique instead") |
390 | 0 | { |
391 | 0 | return krb5_cc_new_unique(context, ops->prefix, NULL, id); |
392 | 0 | } |
393 | | |
394 | | /** |
395 | | * Deprecated: use krb5_principal_get_realm() |
396 | | * |
397 | | * @ingroup krb5_deprecated |
398 | | */ |
399 | | |
400 | | KRB5_LIB_FUNCTION krb5_realm * KRB5_LIB_CALL |
401 | | krb5_princ_realm(krb5_context context, |
402 | | krb5_principal principal) |
403 | | KRB5_DEPRECATED_FUNCTION("Use krb5_principal_get_realm instead") |
404 | 0 | { |
405 | 0 | return &principal->realm; |
406 | 0 | } |
407 | | |
408 | | |
409 | | /** |
410 | | * Deprecated: use krb5_principal_set_realm() |
411 | | * |
412 | | * @ingroup krb5_deprecated |
413 | | */ |
414 | | |
415 | | KRB5_LIB_FUNCTION void KRB5_LIB_CALL |
416 | | krb5_princ_set_realm(krb5_context context, |
417 | | krb5_principal principal, |
418 | | krb5_realm *realm) |
419 | | KRB5_DEPRECATED_FUNCTION("Use krb5_principal_set_realm instead") |
420 | 0 | { |
421 | 0 | principal->realm = *realm; |
422 | 0 | } |
423 | | |
424 | | /** |
425 | | * Deprecated: use krb5_free_cred_contents() |
426 | | * |
427 | | * @ingroup krb5_deprecated |
428 | | */ |
429 | | |
430 | | /* keep this for compatibility with older code */ |
431 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
432 | | krb5_free_creds_contents (krb5_context context, krb5_creds *c) |
433 | | KRB5_DEPRECATED_FUNCTION("Use krb5_free_cred_contents instead") |
434 | 0 | { |
435 | 0 | return krb5_free_cred_contents (context, c); |
436 | 0 | } |
437 | | |
438 | | /** |
439 | | * Free the error message returned by krb5_get_error_string(). |
440 | | * |
441 | | * Deprecated: use krb5_free_error_message() |
442 | | * |
443 | | * @param context Kerberos context |
444 | | * @param str error message to free |
445 | | * |
446 | | * @ingroup krb5_deprecated |
447 | | */ |
448 | | |
449 | | KRB5_LIB_FUNCTION void KRB5_LIB_CALL |
450 | | krb5_free_error_string(krb5_context context, char *str) |
451 | | KRB5_DEPRECATED_FUNCTION("Use krb5_free_error_message instead") |
452 | 0 | { |
453 | 0 | krb5_free_error_message(context, str); |
454 | 0 | } |
455 | | |
456 | | /** |
457 | | * Set the error message returned by krb5_get_error_string(). |
458 | | * |
459 | | * Deprecated: use krb5_set_error_message() |
460 | | * |
461 | | * @param context Kerberos context |
462 | | * @param fmt error message to free |
463 | | * |
464 | | * @return Return an error code or 0. |
465 | | * |
466 | | * @ingroup krb5_deprecated |
467 | | */ |
468 | | |
469 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
470 | | krb5_set_error_string(krb5_context context, const char *fmt, ...) |
471 | | __attribute__ ((__format__ (__printf__, 2, 3))) |
472 | | KRB5_DEPRECATED_FUNCTION("Use krb5_set_error_message instead") |
473 | 0 | { |
474 | 0 | va_list ap; |
475 | |
|
476 | 0 | va_start(ap, fmt); |
477 | 0 | krb5_vset_error_message (context, 0, fmt, ap); |
478 | 0 | va_end(ap); |
479 | 0 | return 0; |
480 | 0 | } |
481 | | |
482 | | /** |
483 | | * Set the error message returned by krb5_get_error_string(). |
484 | | * |
485 | | * Deprecated: use krb5_vset_error_message() |
486 | | * |
487 | | * @param context Kerberos context |
488 | | * @param fmt error message to free |
489 | | * @param args variable argument list vector |
490 | | * |
491 | | * @return Return an error code or 0. |
492 | | * |
493 | | * @ingroup krb5_deprecated |
494 | | */ |
495 | | |
496 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
497 | | krb5_vset_error_string(krb5_context context, const char *fmt, va_list args) |
498 | | __attribute__ ((__format__ (__printf__, 2, 0))) |
499 | | KRB5_DEPRECATED_FUNCTION("Use krb5_vset_error_message instead") |
500 | 0 | { |
501 | 0 | krb5_vset_error_message(context, 0, fmt, args); |
502 | 0 | return 0; |
503 | 0 | } |
504 | | |
505 | | /** |
506 | | * Clear the error message returned by krb5_get_error_string(). |
507 | | * |
508 | | * Deprecated: use krb5_clear_error_message() |
509 | | * |
510 | | * @param context Kerberos context |
511 | | * |
512 | | * @ingroup krb5_deprecated |
513 | | */ |
514 | | |
515 | | KRB5_LIB_FUNCTION void KRB5_LIB_CALL |
516 | | krb5_clear_error_string(krb5_context context) |
517 | | KRB5_DEPRECATED_FUNCTION("Use krb5_clear_error_message instead") |
518 | 0 | { |
519 | 0 | krb5_clear_error_message(context); |
520 | 0 | } |
521 | | |
522 | | /** |
523 | | * Deprecated: use krb5_get_credentials_with_flags(). |
524 | | * |
525 | | * @ingroup krb5_deprecated |
526 | | */ |
527 | | |
528 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
529 | | krb5_get_cred_from_kdc_opt(krb5_context context, |
530 | | krb5_ccache ccache, |
531 | | krb5_creds *in_creds, |
532 | | krb5_creds **out_creds, |
533 | | krb5_creds ***ret_tgts, |
534 | | krb5_flags flags) |
535 | | KRB5_DEPRECATED_FUNCTION("Use krb5_get_credentials_with_flags instead") |
536 | 0 | { |
537 | 0 | krb5_kdc_flags f; |
538 | 0 | f.i = flags; |
539 | 0 | return _krb5_get_cred_kdc_any(context, f, ccache, NULL, |
540 | 0 | in_creds, NULL, NULL, |
541 | 0 | out_creds, ret_tgts); |
542 | 0 | } |
543 | | |
544 | | /** |
545 | | * Deprecated: use krb5_get_credentials_with_flags(). |
546 | | * |
547 | | * @ingroup krb5_deprecated |
548 | | */ |
549 | | |
550 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
551 | | krb5_get_cred_from_kdc(krb5_context context, |
552 | | krb5_ccache ccache, |
553 | | krb5_creds *in_creds, |
554 | | krb5_creds **out_creds, |
555 | | krb5_creds ***ret_tgts) |
556 | | KRB5_DEPRECATED_FUNCTION("Use krb5_get_credentials_with_flags instead") |
557 | 0 | { |
558 | 0 | return krb5_get_cred_from_kdc_opt(context, ccache, |
559 | 0 | in_creds, out_creds, ret_tgts, 0); |
560 | 0 | } |
561 | | |
562 | | /** |
563 | | * Deprecated: use krb5_xfree(). |
564 | | * |
565 | | * @ingroup krb5_deprecated |
566 | | */ |
567 | | |
568 | | KRB5_LIB_FUNCTION void KRB5_LIB_CALL |
569 | | krb5_free_unparsed_name(krb5_context context, char *str) |
570 | | KRB5_DEPRECATED_FUNCTION("Use krb5_xfree instead") |
571 | 0 | { |
572 | 0 | krb5_xfree(str); |
573 | 0 | } |
574 | | |
575 | | /** |
576 | | * Deprecated: use krb5_generate_subkey_extended() |
577 | | * |
578 | | * @ingroup krb5_deprecated |
579 | | */ |
580 | | |
581 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
582 | | krb5_generate_subkey(krb5_context context, |
583 | | const krb5_keyblock *key, |
584 | | krb5_keyblock **subkey) |
585 | | KRB5_DEPRECATED_FUNCTION("Use krb5_generate_subkey_extended instead") |
586 | 0 | { |
587 | 0 | return krb5_generate_subkey_extended(context, key, ETYPE_NULL, subkey); |
588 | 0 | } |
589 | | |
590 | | /** |
591 | | * Deprecated: use krb5_auth_con_getremoteseqnumber() |
592 | | * |
593 | | * @ingroup krb5_deprecated |
594 | | */ |
595 | | |
596 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
597 | | krb5_auth_getremoteseqnumber(krb5_context context, |
598 | | krb5_auth_context auth_context, |
599 | | int32_t *seqnumber) |
600 | | KRB5_DEPRECATED_FUNCTION("Use krb5_auth_con_getremoteseqnumber instead") |
601 | 0 | { |
602 | 0 | *seqnumber = auth_context->remote_seqnumber; |
603 | 0 | return 0; |
604 | 0 | } |
605 | | |
606 | | /** |
607 | | * Return the error message in context. On error or no error string, |
608 | | * the function returns NULL. |
609 | | * |
610 | | * @param context Kerberos 5 context |
611 | | * |
612 | | * @return an error string, needs to be freed with |
613 | | * krb5_free_error_message(). The functions return NULL on error. |
614 | | * |
615 | | * @ingroup krb5_error |
616 | | */ |
617 | | |
618 | | KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL |
619 | | krb5_get_error_string(krb5_context context) |
620 | | KRB5_DEPRECATED_FUNCTION("Use krb5_get_error_message instead") |
621 | 0 | { |
622 | 0 | return heim_get_error_string(context->hcontext); |
623 | 0 | } |
624 | | |
625 | | KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL |
626 | | krb5_have_error_string(krb5_context context) |
627 | | KRB5_DEPRECATED_FUNCTION("Use krb5_get_error_message instead") |
628 | 0 | { |
629 | 0 | return heim_have_error_string(context->hcontext); |
630 | 0 | } |
631 | | |
632 | | struct send_to_kdc { |
633 | | krb5_send_to_kdc_func func; |
634 | | void *data; |
635 | | }; |
636 | | |
637 | | /* |
638 | | * Send the data `send' to one host from `handle` and get back the reply |
639 | | * in `receive'. |
640 | | */ |
641 | | |
642 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
643 | | krb5_sendto (krb5_context context, |
644 | | const krb5_data *send_data, |
645 | | krb5_krbhst_handle handle, |
646 | | krb5_data *receive) |
647 | 0 | { |
648 | 0 | krb5_error_code ret; |
649 | 0 | krb5_sendto_ctx ctx; |
650 | |
|
651 | 0 | ret = krb5_sendto_ctx_alloc(context, &ctx); |
652 | 0 | if (ret) |
653 | 0 | return ret; |
654 | 0 | _krb5_sendto_ctx_set_krb5hst(context, ctx, handle); |
655 | |
|
656 | 0 | ret = krb5_sendto_context(context, ctx, send_data, (char *)_krb5_krbhst_get_realm(handle), receive); |
657 | 0 | krb5_sendto_ctx_free(context, ctx); |
658 | 0 | return ret; |
659 | 0 | } |
660 | | |
661 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
662 | | krb5_sendto_kdc(krb5_context context, |
663 | | const krb5_data *send_data, |
664 | | const krb5_realm *realm, |
665 | | krb5_data *receive) |
666 | 0 | { |
667 | 0 | return krb5_sendto_kdc_flags(context, send_data, realm, receive, 0); |
668 | 0 | } |
669 | | |
670 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
671 | | krb5_sendto_kdc_flags(krb5_context context, |
672 | | const krb5_data *send_data, |
673 | | const krb5_realm *realm, |
674 | | krb5_data *receive, |
675 | | int flags) |
676 | 0 | { |
677 | 0 | krb5_error_code ret; |
678 | 0 | krb5_sendto_ctx ctx; |
679 | |
|
680 | 0 | ret = krb5_sendto_ctx_alloc(context, &ctx); |
681 | 0 | if (ret) |
682 | 0 | return ret; |
683 | 0 | krb5_sendto_ctx_add_flags(ctx, flags); |
684 | 0 | krb5_sendto_ctx_set_func(ctx, _krb5_kdc_retry, NULL); |
685 | |
|
686 | 0 | ret = krb5_sendto_context(context, ctx, send_data, *realm, receive); |
687 | 0 | krb5_sendto_ctx_free(context, ctx); |
688 | 0 | return ret; |
689 | 0 | } |
690 | | |
691 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
692 | | krb5_set_send_to_kdc_func(krb5_context context, |
693 | | krb5_send_to_kdc_func func, |
694 | | void *data) |
695 | 0 | { |
696 | 0 | free(context->send_to_kdc); |
697 | 0 | if (func == NULL) { |
698 | 0 | context->send_to_kdc = NULL; |
699 | 0 | return 0; |
700 | 0 | } |
701 | | |
702 | 0 | context->send_to_kdc = malloc(sizeof(*context->send_to_kdc)); |
703 | 0 | if (context->send_to_kdc == NULL) { |
704 | 0 | krb5_set_error_message(context, ENOMEM, |
705 | 0 | N_("malloc: out of memory", "")); |
706 | 0 | return ENOMEM; |
707 | 0 | } |
708 | | |
709 | 0 | context->send_to_kdc->func = func; |
710 | 0 | context->send_to_kdc->data = data; |
711 | 0 | return 0; |
712 | 0 | } |
713 | | |
714 | | KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL |
715 | | _krb5_copy_send_to_kdc_func(krb5_context context, krb5_context to) |
716 | 0 | { |
717 | 0 | if (context->send_to_kdc) |
718 | 0 | return krb5_set_send_to_kdc_func(to, |
719 | 0 | context->send_to_kdc->func, |
720 | 0 | context->send_to_kdc->data); |
721 | 0 | else |
722 | 0 | return krb5_set_send_to_kdc_func(to, NULL, NULL); |
723 | 0 | } |
724 | | |
725 | | #endif /* HEIMDAL_SMALLER */ |