Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/krb5/krb5.h @ 69:33d812a61356
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 17:55:14 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 69:33d812a61356 |
---|---|
1 /* This file is generated, please don't edit it directly. */ | |
2 #ifndef KRB5_KRB5_H_INCLUDED | |
3 #define KRB5_KRB5_H_INCLUDED | |
4 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ | |
5 /* General definitions for Kerberos version 5. */ | |
6 /* | |
7 * Copyright 1989, 1990, 1995, 2001, 2003, 2007, 2011 by the Massachusetts | |
8 * Institute of Technology. All Rights Reserved. | |
9 * | |
10 * Export of this software from the United States of America may | |
11 * require a specific license from the United States Government. | |
12 * It is the responsibility of any person or organization contemplating | |
13 * export to obtain such a license before exporting. | |
14 * | |
15 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and | |
16 * distribute this software and its documentation for any purpose and | |
17 * without fee is hereby granted, provided that the above copyright | |
18 * notice appear in all copies and that both that copyright notice and | |
19 * this permission notice appear in supporting documentation, and that | |
20 * the name of M.I.T. not be used in advertising or publicity pertaining | |
21 * to distribution of the software without specific, written prior | |
22 * permission. Furthermore if you modify this software you must label | |
23 * your software as modified software and not distribute it in such a | |
24 * fashion that it might be confused with the original M.I.T. software. | |
25 * M.I.T. makes no representations about the suitability of | |
26 * this software for any purpose. It is provided "as is" without express | |
27 * or implied warranty. | |
28 */ | |
29 /* | |
30 * Copyright (C) 1998 by the FundsXpress, INC. | |
31 * | |
32 * All rights reserved. | |
33 * | |
34 * Export of this software from the United States of America may require | |
35 * a specific license from the United States Government. It is the | |
36 * responsibility of any person or organization contemplating export to | |
37 * obtain such a license before exporting. | |
38 * | |
39 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and | |
40 * distribute this software and its documentation for any purpose and | |
41 * without fee is hereby granted, provided that the above copyright | |
42 * notice appear in all copies and that both that copyright notice and | |
43 * this permission notice appear in supporting documentation, and that | |
44 * the name of FundsXpress. not be used in advertising or publicity pertaining | |
45 * to distribution of the software without specific, written prior | |
46 * permission. FundsXpress makes no representations about the suitability of | |
47 * this software for any purpose. It is provided "as is" without express | |
48 * or implied warranty. | |
49 * | |
50 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
51 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
52 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
53 */ | |
54 | |
55 #ifndef KRB5_GENERAL__ | |
56 #define KRB5_GENERAL__ | |
57 | |
58 /** @defgroup KRB5_H krb5 library API | |
59 * @{ | |
60 */ | |
61 | |
62 /* By default, do not expose deprecated interfaces. */ | |
63 #ifndef KRB5_DEPRECATED | |
64 #define KRB5_DEPRECATED 0 | |
65 #endif | |
66 | |
67 #if defined(__MACH__) && defined(__APPLE__) | |
68 # include <TargetConditionals.h> | |
69 # if TARGET_RT_MAC_CFM | |
70 # error "Use KfM 4.0 SDK headers for CFM compilation." | |
71 # endif | |
72 #endif | |
73 | |
74 #if defined(_MSDOS) || defined(_WIN32) | |
75 #include <win-mac.h> | |
76 #endif | |
77 | |
78 #ifndef KRB5_CONFIG__ | |
79 #ifndef KRB5_CALLCONV | |
80 #define KRB5_CALLCONV | |
81 #define KRB5_CALLCONV_C | |
82 #endif /* !KRB5_CALLCONV */ | |
83 #endif /* !KRB5_CONFIG__ */ | |
84 | |
85 #ifndef KRB5_CALLCONV_WRONG | |
86 #define KRB5_CALLCONV_WRONG | |
87 #endif | |
88 | |
89 #ifndef THREEPARAMOPEN | |
90 #define THREEPARAMOPEN(x,y,z) open(x,y,z) | |
91 #endif | |
92 | |
93 #define KRB5_OLD_CRYPTO | |
94 | |
95 #include <stdlib.h> | |
96 #include <limits.h> /* for *_MAX */ | |
97 #include <stdarg.h> | |
98 #include <stdint.h> | |
99 | |
100 #ifndef KRB5INT_BEGIN_DECLS | |
101 #if defined(__cplusplus) | |
102 #define KRB5INT_BEGIN_DECLS extern "C" { | |
103 #define KRB5INT_END_DECLS } | |
104 #else | |
105 #define KRB5INT_BEGIN_DECLS | |
106 #define KRB5INT_END_DECLS | |
107 #endif | |
108 #endif | |
109 | |
110 KRB5INT_BEGIN_DECLS | |
111 | |
112 #if defined(__APPLE__) && (defined(__ppc__) || defined(__ppc64__) || defined(__i386__) || defined(__x86_64__)) | |
113 #pragma pack(push,2) | |
114 #endif | |
115 | |
116 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 30203 | |
117 # define KRB5_ATTR_DEPRECATED __attribute__((deprecated)) | |
118 #elif defined _WIN32 | |
119 # define KRB5_ATTR_DEPRECATED __declspec(deprecated) | |
120 #else | |
121 # define KRB5_ATTR_DEPRECATED | |
122 #endif | |
123 | |
124 /* from profile.h */ | |
125 struct _profile_t; | |
126 /* typedef struct _profile_t *profile_t; */ | |
127 | |
128 /* | |
129 * begin wordsize.h | |
130 */ | |
131 | |
132 /* | |
133 * Word-size related definition. | |
134 */ | |
135 | |
136 typedef uint8_t krb5_octet; | |
137 typedef int16_t krb5_int16; | |
138 typedef uint16_t krb5_ui_2; | |
139 typedef int32_t krb5_int32; | |
140 typedef uint32_t krb5_ui_4; | |
141 | |
142 #define VALID_INT_BITS INT_MAX | |
143 #define VALID_UINT_BITS UINT_MAX | |
144 | |
145 #define KRB5_INT32_MAX 2147483647 | |
146 /* this strange form is necessary since - is a unary operator, not a sign | |
147 indicator */ | |
148 #define KRB5_INT32_MIN (-KRB5_INT32_MAX-1) | |
149 | |
150 #define KRB5_INT16_MAX 65535 | |
151 /* this strange form is necessary since - is a unary operator, not a sign | |
152 indicator */ | |
153 #define KRB5_INT16_MIN (-KRB5_INT16_MAX-1) | |
154 | |
155 /* | |
156 * end wordsize.h | |
157 */ | |
158 | |
159 /* | |
160 * begin "base-defs.h" | |
161 */ | |
162 | |
163 /* | |
164 * Basic definitions for Kerberos V5 library | |
165 */ | |
166 | |
167 #ifndef FALSE | |
168 #define FALSE 0 | |
169 #endif | |
170 #ifndef TRUE | |
171 #define TRUE 1 | |
172 #endif | |
173 | |
174 typedef unsigned int krb5_boolean; | |
175 typedef unsigned int krb5_msgtype; | |
176 typedef unsigned int krb5_kvno; | |
177 | |
178 typedef krb5_int32 krb5_addrtype; | |
179 typedef krb5_int32 krb5_enctype; | |
180 typedef krb5_int32 krb5_cksumtype; | |
181 typedef krb5_int32 krb5_authdatatype; | |
182 typedef krb5_int32 krb5_keyusage; | |
183 typedef krb5_int32 krb5_cryptotype; | |
184 | |
185 typedef krb5_int32 krb5_preauthtype; /* This may change, later on */ | |
186 typedef krb5_int32 krb5_flags; | |
187 | |
188 /** | |
189 * Represents a timestamp in seconds since the POSIX epoch. This legacy type | |
190 * is used frequently in the ABI, but cannot represent timestamps after 2038 as | |
191 * a positive number. Code which uses this type should cast values of it to | |
192 * uint32_t so that negative values are treated as timestamps between 2038 and | |
193 * 2106 on platforms with 64-bit time_t. | |
194 */ | |
195 typedef krb5_int32 krb5_timestamp; | |
196 | |
197 typedef krb5_int32 krb5_deltat; | |
198 | |
199 /** | |
200 * Used to convey an operation status. The value 0 indicates success; any | |
201 * other values are com_err codes. Use krb5_get_error_message() to obtain a | |
202 * string describing the error. | |
203 */ | |
204 typedef krb5_int32 krb5_error_code; | |
205 | |
206 typedef krb5_error_code krb5_magic; | |
207 | |
208 typedef struct _krb5_data { | |
209 krb5_magic magic; | |
210 unsigned int length; | |
211 char *data; | |
212 } krb5_data; | |
213 | |
214 /* Originally introduced for PKINIT; now unused. Do not use this. */ | |
215 typedef struct _krb5_octet_data { | |
216 krb5_magic magic; | |
217 unsigned int length; | |
218 krb5_octet *data; | |
219 } krb5_octet_data; | |
220 | |
221 /* Originally used to recognize AFS and default salts. No longer used. */ | |
222 #define SALT_TYPE_AFS_LENGTH UINT_MAX | |
223 #define SALT_TYPE_NO_LENGTH UINT_MAX | |
224 | |
225 typedef void * krb5_pointer; | |
226 typedef void const * krb5_const_pointer; | |
227 | |
228 typedef struct krb5_principal_data { | |
229 krb5_magic magic; | |
230 krb5_data realm; | |
231 krb5_data *data; /**< An array of strings */ | |
232 krb5_int32 length; | |
233 krb5_int32 type; | |
234 } krb5_principal_data; | |
235 | |
236 typedef krb5_principal_data * krb5_principal; | |
237 | |
238 /* | |
239 * Per V5 spec on definition of principal types | |
240 */ | |
241 | |
242 #define KRB5_NT_UNKNOWN 0 /**< Name type not known */ | |
243 #define KRB5_NT_PRINCIPAL 1 /**< Just the name of the principal | |
244 as in DCE, or for users */ | |
245 #define KRB5_NT_SRV_INST 2 /**< Service and other unique instance (krbtgt) */ | |
246 #define KRB5_NT_SRV_HST 3 /**< Service with host name as instance | |
247 (telnet, rcommands) */ | |
248 #define KRB5_NT_SRV_XHST 4 /**< Service with host as remaining components */ | |
249 #define KRB5_NT_UID 5 /**< Unique ID */ | |
250 #define KRB5_NT_X500_PRINCIPAL 6 /**< PKINIT */ | |
251 #define KRB5_NT_SMTP_NAME 7 /**< Name in form of SMTP email name */ | |
252 #define KRB5_NT_ENTERPRISE_PRINCIPAL 10 /**< Windows 2000 UPN */ | |
253 #define KRB5_NT_WELLKNOWN 11 /**< Well-known (special) principal */ | |
254 #define KRB5_WELLKNOWN_NAMESTR "WELLKNOWN" /**< First component of | |
255 NT_WELLKNOWN principals */ | |
256 #define KRB5_NT_MS_PRINCIPAL -128 /**< Windows 2000 UPN and SID */ | |
257 #define KRB5_NT_MS_PRINCIPAL_AND_ID -129 /**< NT 4 style name */ | |
258 #define KRB5_NT_ENT_PRINCIPAL_AND_ID -130 /**< NT 4 style name and SID */ | |
259 | |
260 /** Constant version of krb5_principal_data. */ | |
261 typedef const krb5_principal_data *krb5_const_principal; | |
262 | |
263 #define krb5_princ_realm(context, princ) (&(princ)->realm) | |
264 #define krb5_princ_set_realm(context, princ,value) ((princ)->realm = *(value)) | |
265 #define krb5_princ_set_realm_length(context, princ,value) (princ)->realm.length = (value) | |
266 #define krb5_princ_set_realm_data(context, princ,value) (princ)->realm.data = (value) | |
267 #define krb5_princ_size(context, princ) (princ)->length | |
268 #define krb5_princ_type(context, princ) (princ)->type | |
269 #define krb5_princ_name(context, princ) (princ)->data | |
270 #define krb5_princ_component(context, princ,i) \ | |
271 (((i) < krb5_princ_size(context, princ)) \ | |
272 ? (princ)->data + (i) \ | |
273 : NULL) | |
274 | |
275 /** Constant for realm referrals. */ | |
276 #define KRB5_REFERRAL_REALM "" | |
277 | |
278 /* | |
279 * Referral-specific functions. | |
280 */ | |
281 | |
282 /** | |
283 * Check for a match with KRB5_REFERRAL_REALM. | |
284 * | |
285 * @param [in] r Realm to check | |
286 * | |
287 * @return @c TRUE if @a r is zero-length, @c FALSE otherwise | |
288 */ | |
289 krb5_boolean KRB5_CALLCONV | |
290 krb5_is_referral_realm(const krb5_data *r); | |
291 | |
292 /** | |
293 * Return an anonymous realm data. | |
294 * | |
295 * This function returns constant storage that must not be freed. | |
296 * | |
297 * @sa #KRB5_ANONYMOUS_REALMSTR | |
298 */ | |
299 const krb5_data *KRB5_CALLCONV | |
300 krb5_anonymous_realm(void); | |
301 | |
302 /** | |
303 * Build an anonymous principal. | |
304 * | |
305 * This function returns constant storage that must not be freed. | |
306 * | |
307 * @sa #KRB5_ANONYMOUS_PRINCSTR | |
308 */ | |
309 krb5_const_principal KRB5_CALLCONV | |
310 krb5_anonymous_principal(void); | |
311 | |
312 #define KRB5_ANONYMOUS_REALMSTR "WELLKNOWN:ANONYMOUS" /**< Anonymous realm */ | |
313 #define KRB5_ANONYMOUS_PRINCSTR "ANONYMOUS" /**< Anonymous principal name */ | |
314 /* | |
315 * end "base-defs.h" | |
316 */ | |
317 | |
318 /* | |
319 * begin "hostaddr.h" | |
320 */ | |
321 | |
322 /** Structure for address */ | |
323 typedef struct _krb5_address { | |
324 krb5_magic magic; | |
325 krb5_addrtype addrtype; | |
326 unsigned int length; | |
327 krb5_octet *contents; | |
328 } krb5_address; | |
329 | |
330 /* per Kerberos v5 protocol spec */ | |
331 #define ADDRTYPE_INET 0x0002 | |
332 #define ADDRTYPE_CHAOS 0x0005 | |
333 #define ADDRTYPE_XNS 0x0006 | |
334 #define ADDRTYPE_ISO 0x0007 | |
335 #define ADDRTYPE_DDP 0x0010 | |
336 #define ADDRTYPE_NETBIOS 0x0014 | |
337 #define ADDRTYPE_INET6 0x0018 | |
338 /* not yet in the spec... */ | |
339 #define ADDRTYPE_ADDRPORT 0x0100 | |
340 #define ADDRTYPE_IPPORT 0x0101 | |
341 | |
342 /* macros to determine if a type is a local type */ | |
343 #define ADDRTYPE_IS_LOCAL(addrtype) (addrtype & 0x8000) | |
344 | |
345 /* | |
346 * end "hostaddr.h" | |
347 */ | |
348 | |
349 | |
350 struct _krb5_context; | |
351 typedef struct _krb5_context * krb5_context; | |
352 | |
353 struct _krb5_auth_context; | |
354 typedef struct _krb5_auth_context * krb5_auth_context; | |
355 | |
356 struct _krb5_cryptosystem_entry; | |
357 | |
358 /* | |
359 * begin "encryption.h" | |
360 */ | |
361 | |
362 /** Exposed contents of a key. */ | |
363 typedef struct _krb5_keyblock { | |
364 krb5_magic magic; | |
365 krb5_enctype enctype; | |
366 unsigned int length; | |
367 krb5_octet *contents; | |
368 } krb5_keyblock; | |
369 | |
370 struct krb5_key_st; | |
371 /** | |
372 * Opaque identifier for a key. | |
373 * | |
374 * Use with the krb5_k APIs for better performance for repeated operations with | |
375 * the same key and usage. Key identifiers must not be used simultaneously | |
376 * within multiple threads, as they may contain mutable internal state and are | |
377 * not mutex-protected. | |
378 */ | |
379 typedef struct krb5_key_st *krb5_key; | |
380 | |
381 #ifdef KRB5_OLD_CRYPTO | |
382 typedef struct _krb5_encrypt_block { | |
383 krb5_magic magic; | |
384 krb5_enctype crypto_entry; /* to call krb5_encrypt_size, you need | |
385 this. it was a pointer, but it | |
386 doesn't have to be. gross. */ | |
387 krb5_keyblock *key; | |
388 } krb5_encrypt_block; | |
389 #endif | |
390 | |
391 typedef struct _krb5_checksum { | |
392 krb5_magic magic; | |
393 krb5_cksumtype checksum_type; /* checksum type */ | |
394 unsigned int length; | |
395 krb5_octet *contents; | |
396 } krb5_checksum; | |
397 | |
398 typedef struct _krb5_enc_data { | |
399 krb5_magic magic; | |
400 krb5_enctype enctype; | |
401 krb5_kvno kvno; | |
402 krb5_data ciphertext; | |
403 } krb5_enc_data; | |
404 | |
405 /** | |
406 * Structure to describe a region of text to be encrypted or decrypted. | |
407 * | |
408 * The @a flags member describes the type of the iov. | |
409 * The @a data member points to the memory that will be manipulated. | |
410 * All iov APIs take a pointer to the first element of an array of krb5_crypto_iov's | |
411 * along with the size of that array. Buffer contents are manipulated in-place; | |
412 * data is overwritten. Callers must allocate the right number of krb5_crypto_iov | |
413 * structures before calling into an iov API. | |
414 */ | |
415 typedef struct _krb5_crypto_iov { | |
416 krb5_cryptotype flags; /**< @ref KRB5_CRYPTO_TYPE type of the iov */ | |
417 krb5_data data; | |
418 } krb5_crypto_iov; | |
419 | |
420 /* per Kerberos v5 protocol spec */ | |
421 #define ENCTYPE_NULL 0x0000 | |
422 #define ENCTYPE_DES_CBC_CRC 0x0001 /**< @deprecated no longer supported */ | |
423 #define ENCTYPE_DES_CBC_MD4 0x0002 /**< @deprecated no longer supported */ | |
424 #define ENCTYPE_DES_CBC_MD5 0x0003 /**< @deprecated no longer supported */ | |
425 #define ENCTYPE_DES_CBC_RAW 0x0004 /**< @deprecated no longer supported */ | |
426 #define ENCTYPE_DES3_CBC_SHA 0x0005 /**< @deprecated DES-3 cbc with SHA1 */ | |
427 #define ENCTYPE_DES3_CBC_RAW 0x0006 /**< @deprecated DES-3 cbc mode raw */ | |
428 #define ENCTYPE_DES_HMAC_SHA1 0x0008 /**< @deprecated no longer supported */ | |
429 /* PKINIT */ | |
430 #define ENCTYPE_DSA_SHA1_CMS 0x0009 /**< DSA with SHA1, CMS signature */ | |
431 #define ENCTYPE_MD5_RSA_CMS 0x000a /**< MD5 with RSA, CMS signature */ | |
432 #define ENCTYPE_SHA1_RSA_CMS 0x000b /**< SHA1 with RSA, CMS signature */ | |
433 #define ENCTYPE_RC2_CBC_ENV 0x000c /**< RC2 cbc mode, CMS enveloped data */ | |
434 #define ENCTYPE_RSA_ENV 0x000d /**< RSA encryption, CMS enveloped data */ | |
435 #define ENCTYPE_RSA_ES_OAEP_ENV 0x000e /**< RSA w/OEAP encryption, CMS enveloped data */ | |
436 #define ENCTYPE_DES3_CBC_ENV 0x000f /**< DES-3 cbc mode, CMS enveloped data */ | |
437 | |
438 #define ENCTYPE_DES3_CBC_SHA1 0x0010 | |
439 #define ENCTYPE_AES128_CTS_HMAC_SHA1_96 0x0011 /**< RFC 3962 */ | |
440 #define ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x0012 /**< RFC 3962 */ | |
441 #define ENCTYPE_AES128_CTS_HMAC_SHA256_128 0x0013 /**< RFC 8009 */ | |
442 #define ENCTYPE_AES256_CTS_HMAC_SHA384_192 0x0014 /**< RFC 8009 */ | |
443 #define ENCTYPE_ARCFOUR_HMAC 0x0017 /**< RFC 4757 */ | |
444 #define ENCTYPE_ARCFOUR_HMAC_EXP 0x0018 /**< RFC 4757 */ | |
445 #define ENCTYPE_CAMELLIA128_CTS_CMAC 0x0019 /**< RFC 6803 */ | |
446 #define ENCTYPE_CAMELLIA256_CTS_CMAC 0x001a /**< RFC 6803 */ | |
447 #define ENCTYPE_UNKNOWN 0x01ff | |
448 | |
449 /* | |
450 * Historically we used the value 9 for unkeyed SHA-1. RFC 3961 assigns this | |
451 * value to rsa-md5-des3, which fortunately is unused. For ABI compatibility | |
452 * we allow either 9 or 14 for SHA-1. | |
453 */ | |
454 #define CKSUMTYPE_CRC32 0x0001 | |
455 #define CKSUMTYPE_RSA_MD4 0x0002 | |
456 #define CKSUMTYPE_RSA_MD4_DES 0x0003 | |
457 #define CKSUMTYPE_DESCBC 0x0004 | |
458 /* des-mac-k */ | |
459 /* rsa-md4-des-k */ | |
460 #define CKSUMTYPE_RSA_MD5 0x0007 | |
461 #define CKSUMTYPE_RSA_MD5_DES 0x0008 | |
462 #define CKSUMTYPE_NIST_SHA 0x0009 | |
463 #define CKSUMTYPE_HMAC_SHA1_DES3 0x000c | |
464 #define CKSUMTYPE_SHA1 0x000e /**< RFC 3961 */ | |
465 #define CKSUMTYPE_HMAC_SHA1_96_AES128 0x000f /**< RFC 3962. Used with | |
466 ENCTYPE_AES128_CTS_HMAC_SHA1_96 */ | |
467 #define CKSUMTYPE_HMAC_SHA1_96_AES256 0x0010 /**< RFC 3962. Used with | |
468 ENCTYPE_AES256_CTS_HMAC_SHA1_96 */ | |
469 #define CKSUMTYPE_HMAC_SHA256_128_AES128 0x0013 /**< RFC 8009 */ | |
470 #define CKSUMTYPE_HMAC_SHA384_192_AES256 0x0014 /**< RFC 8009 */ | |
471 #define CKSUMTYPE_CMAC_CAMELLIA128 0x0011 /**< RFC 6803 */ | |
472 #define CKSUMTYPE_CMAC_CAMELLIA256 0x0012 /**< RFC 6803 */ | |
473 #define CKSUMTYPE_MD5_HMAC_ARCFOUR -137 /* Microsoft netlogon */ | |
474 #define CKSUMTYPE_HMAC_MD5_ARCFOUR -138 /**< RFC 4757 */ | |
475 | |
476 /* Constants for the deprecated krb5_c_random_add_entropy() */ | |
477 enum { | |
478 KRB5_C_RANDSOURCE_OLDAPI = 0, | |
479 KRB5_C_RANDSOURCE_OSRAND = 1, | |
480 KRB5_C_RANDSOURCE_TRUSTEDPARTY = 2, | |
481 KRB5_C_RANDSOURCE_TIMING = 3, | |
482 KRB5_C_RANDSOURCE_EXTERNAL_PROTOCOL = 4, | |
483 KRB5_C_RANDSOURCE_MAX = 5 | |
484 }; | |
485 | |
486 #ifndef krb5_roundup | |
487 /* round x up to nearest multiple of y */ | |
488 #define krb5_roundup(x, y) ((((x) + (y) - 1)/(y))*(y)) | |
489 #endif /* roundup */ | |
490 | |
491 /* macro function definitions to help clean up code */ | |
492 | |
493 #if 1 | |
494 #define krb5_x(ptr,args) ((ptr)?((*(ptr)) args):(abort(),1)) | |
495 #define krb5_xc(ptr,args) ((ptr)?((*(ptr)) args):(abort(),(char*)0)) | |
496 #else | |
497 #define krb5_x(ptr,args) ((*(ptr)) args) | |
498 #define krb5_xc(ptr,args) ((*(ptr)) args) | |
499 #endif | |
500 | |
501 /** | |
502 * Encrypt data using a key (operates on keyblock). | |
503 * | |
504 * @param [in] context Library context | |
505 * @param [in] key Encryption key | |
506 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
507 * @param [in,out] cipher_state Cipher state; specify NULL if not needed | |
508 * @param [in] input Data to be encrypted | |
509 * @param [out] output Encrypted data | |
510 * | |
511 * This function encrypts the data block @a input and stores the output into @a | |
512 * output. The actual encryption key will be derived from @a key and @a usage | |
513 * if key derivation is specified for the encryption type. If non-null, @a | |
514 * cipher_state specifies the beginning state for the encryption operation, and | |
515 * is updated with the state to be passed as input to the next operation. | |
516 * | |
517 * @note The caller must initialize @a output and allocate at least enough | |
518 * space for the result (using krb5_c_encrypt_length() to determine the amount | |
519 * of space needed). @a output->length will be set to the actual length of the | |
520 * ciphertext. | |
521 * | |
522 * @retval 0 Success; otherwise - Kerberos error codes | |
523 */ | |
524 krb5_error_code KRB5_CALLCONV | |
525 krb5_c_encrypt(krb5_context context, const krb5_keyblock *key, | |
526 krb5_keyusage usage, const krb5_data *cipher_state, | |
527 const krb5_data *input, krb5_enc_data *output); | |
528 | |
529 /** | |
530 * Decrypt data using a key (operates on keyblock). | |
531 * | |
532 * @param [in] context Library context | |
533 * @param [in] key Encryption key | |
534 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
535 * @param [in,out] cipher_state Cipher state; specify NULL if not needed | |
536 * @param [in] input Encrypted data | |
537 * @param [out] output Decrypted data | |
538 * | |
539 * This function decrypts the data block @a input and stores the output into @a | |
540 * output. The actual decryption key will be derived from @a key and @a usage | |
541 * if key derivation is specified for the encryption type. If non-null, @a | |
542 * cipher_state specifies the beginning state for the decryption operation, and | |
543 * is updated with the state to be passed as input to the next operation. | |
544 * | |
545 * @note The caller must initialize @a output and allocate at least enough | |
546 * space for the result. The usual practice is to allocate an output buffer as | |
547 * long as the ciphertext, and let krb5_c_decrypt() trim @a output->length. | |
548 * For some enctypes, the resulting @a output->length may include padding | |
549 * bytes. | |
550 * | |
551 * @retval 0 Success; otherwise - Kerberos error codes | |
552 */ | |
553 krb5_error_code KRB5_CALLCONV | |
554 krb5_c_decrypt(krb5_context context, const krb5_keyblock *key, | |
555 krb5_keyusage usage, const krb5_data *cipher_state, | |
556 const krb5_enc_data *input, krb5_data *output); | |
557 | |
558 /** | |
559 * Compute encrypted data length. | |
560 * | |
561 * @param [in] context Library context | |
562 * @param [in] enctype Encryption type | |
563 * @param [in] inputlen Length of the data to be encrypted | |
564 * @param [out] length Length of the encrypted data | |
565 * | |
566 * This function computes the length of the ciphertext produced by encrypting | |
567 * @a inputlen bytes including padding, confounder, and checksum. | |
568 * | |
569 * @retval 0 Success; otherwise - Kerberos error codes | |
570 */ | |
571 krb5_error_code KRB5_CALLCONV | |
572 krb5_c_encrypt_length(krb5_context context, krb5_enctype enctype, | |
573 size_t inputlen, size_t *length); | |
574 | |
575 /** | |
576 * Return cipher block size. | |
577 * | |
578 * @param [in] context Library context | |
579 * @param [in] enctype Encryption type | |
580 * @param [out] blocksize Block size for @a enctype | |
581 * | |
582 * @retval 0 Success; otherwise - Kerberos error codes | |
583 */ | |
584 krb5_error_code KRB5_CALLCONV | |
585 krb5_c_block_size(krb5_context context, krb5_enctype enctype, | |
586 size_t *blocksize); | |
587 | |
588 /** | |
589 * Return length of the specified key in bytes. | |
590 * | |
591 * @param [in] context Library context | |
592 * @param [in] enctype Encryption type | |
593 * @param [out] keybytes Number of bytes required to make a key | |
594 * @param [out] keylength Length of final key | |
595 * | |
596 * @retval 0 Success; otherwise - Kerberos error codes | |
597 */ | |
598 krb5_error_code KRB5_CALLCONV | |
599 krb5_c_keylengths(krb5_context context, krb5_enctype enctype, | |
600 size_t *keybytes, size_t *keylength); | |
601 | |
602 /** | |
603 * Initialize a new cipher state. | |
604 * | |
605 * @param [in] context Library context | |
606 * @param [in] key Key | |
607 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
608 * @param [out] new_state New cipher state | |
609 * | |
610 * @retval 0 Success; otherwise - Kerberos error codes | |
611 */ | |
612 krb5_error_code KRB5_CALLCONV | |
613 krb5_c_init_state(krb5_context context, const krb5_keyblock *key, | |
614 krb5_keyusage usage, krb5_data *new_state); | |
615 | |
616 /** | |
617 * Free a cipher state previously allocated by krb5_c_init_state(). | |
618 * | |
619 * @param [in] context Library context | |
620 * @param [in] key Key | |
621 * @param [in] state Cipher state to be freed | |
622 * | |
623 * @retval 0 Success; otherwise - Kerberos error codes | |
624 */ | |
625 krb5_error_code KRB5_CALLCONV | |
626 krb5_c_free_state(krb5_context context, const krb5_keyblock *key, | |
627 krb5_data *state); | |
628 | |
629 /** | |
630 * Generate enctype-specific pseudo-random bytes. | |
631 * | |
632 * @param [in] context Library context | |
633 * @param [in] keyblock Key | |
634 * @param [in] input Input data | |
635 * @param [out] output Output data | |
636 * | |
637 * This function selects a pseudo-random function based on @a keyblock and | |
638 * computes its value over @a input, placing the result into @a output. | |
639 * The caller must preinitialize @a output and allocate space for the | |
640 * result, using krb5_c_prf_length() to determine the required length. | |
641 * | |
642 * @retval 0 Success; otherwise - Kerberos error codes | |
643 */ | |
644 krb5_error_code KRB5_CALLCONV | |
645 krb5_c_prf(krb5_context context, const krb5_keyblock *keyblock, | |
646 krb5_data *input, krb5_data *output); | |
647 | |
648 /** | |
649 * Get the output length of pseudo-random functions for an encryption type. | |
650 * | |
651 * @param [in] context Library context | |
652 * @param [in] enctype Encryption type | |
653 * @param [out] len Length of PRF output | |
654 * | |
655 * @retval 0 Success; otherwise - Kerberos error codes | |
656 */ | |
657 krb5_error_code KRB5_CALLCONV | |
658 krb5_c_prf_length(krb5_context context, krb5_enctype enctype, size_t *len); | |
659 | |
660 /** | |
661 * Generate pseudo-random bytes using RFC 6113 PRF+. | |
662 * | |
663 * @param [in] context Library context | |
664 * @param [in] k KDC contribution key | |
665 * @param [in] input Input data | |
666 * @param [out] output Pseudo-random output buffer | |
667 * | |
668 * This function fills @a output with PRF+(k, input) as defined in RFC 6113 | |
669 * section 5.1. The caller must preinitialize @a output and allocate the | |
670 * desired amount of space. The length of the pseudo-random output will match | |
671 * the length of @a output. | |
672 * | |
673 * @note RFC 4402 defines a different PRF+ operation. This function does not | |
674 * implement that operation. | |
675 * | |
676 * @return 0 on success, @c E2BIG if output->length is too large for PRF+ to | |
677 * generate, @c ENOMEM on allocation failure, or an error code from | |
678 * krb5_c_prf() | |
679 */ | |
680 krb5_error_code KRB5_CALLCONV | |
681 krb5_c_prfplus(krb5_context context, const krb5_keyblock *k, | |
682 const krb5_data *input, krb5_data *output); | |
683 | |
684 /** | |
685 * Derive a key using some input data (via RFC 6113 PRF+). | |
686 * | |
687 * @param [in] context Library context | |
688 * @param [in] k KDC contribution key | |
689 * @param [in] input Input string | |
690 * @param [in] enctype Output key enctype (or @c ENCTYPE_NULL) | |
691 * @param [out] out Derived keyblock | |
692 * | |
693 * This function uses PRF+ as defined in RFC 6113 to derive a key from another | |
694 * key and an input string. If @a enctype is @c ENCTYPE_NULL, the output key | |
695 * will have the same enctype as the input key. | |
696 */ | |
697 krb5_error_code KRB5_CALLCONV | |
698 krb5_c_derive_prfplus(krb5_context context, const krb5_keyblock *k, | |
699 const krb5_data *input, krb5_enctype enctype, | |
700 krb5_keyblock **out); | |
701 | |
702 /** | |
703 * Compute the KRB-FX-CF2 combination of two keys and pepper strings. | |
704 * | |
705 * @param [in] context Library context | |
706 * @param [in] k1 KDC contribution key | |
707 * @param [in] pepper1 String "PKINIT" | |
708 * @param [in] k2 Reply key | |
709 * @param [in] pepper2 String "KeyExchange" | |
710 * @param [out] out Output key | |
711 * | |
712 * This function computes the KRB-FX-CF2 function over its inputs and places | |
713 * the results in a newly allocated keyblock. This function is simple in that | |
714 * it assumes that @a pepper1 and @a pepper2 are C strings with no internal | |
715 * nulls and that the enctype of the result will be the same as that of @a k1. | |
716 * @a k1 and @a k2 may be of different enctypes. | |
717 * | |
718 * @retval 0 Success; otherwise - Kerberos error codes | |
719 */ | |
720 krb5_error_code KRB5_CALLCONV | |
721 krb5_c_fx_cf2_simple(krb5_context context, | |
722 const krb5_keyblock *k1, const char *pepper1, | |
723 const krb5_keyblock *k2, const char *pepper2, | |
724 krb5_keyblock **out); | |
725 | |
726 /** | |
727 * Generate an enctype-specific random encryption key. | |
728 * | |
729 * @param [in] context Library context | |
730 * @param [in] enctype Encryption type of the generated key | |
731 * @param [out] k5_random_key An allocated and initialized keyblock | |
732 * | |
733 * Use krb5_free_keyblock_contents() to free @a k5_random_key when | |
734 * no longer needed. | |
735 * | |
736 * @retval 0 Success; otherwise - Kerberos error codes | |
737 */ | |
738 krb5_error_code KRB5_CALLCONV | |
739 krb5_c_make_random_key(krb5_context context, krb5_enctype enctype, | |
740 krb5_keyblock *k5_random_key); | |
741 | |
742 /** | |
743 * Generate an enctype-specific key from random data. | |
744 * | |
745 * @param [in] context Library context | |
746 * @param [in] enctype Encryption type | |
747 * @param [in] random_data Random input data | |
748 * @param [out] k5_random_key Resulting key | |
749 * | |
750 * This function takes random input data @a random_data and produces a valid | |
751 * key @a k5_random_key for a given @a enctype. | |
752 * | |
753 * @note It is assumed that @a k5_random_key has already been initialized and | |
754 * @a k5_random_key->contents has been allocated with the correct length. | |
755 * | |
756 * @sa krb5_c_keylengths() | |
757 * | |
758 * @retval 0 Success; otherwise - Kerberos error codes | |
759 */ | |
760 krb5_error_code KRB5_CALLCONV | |
761 krb5_c_random_to_key(krb5_context context, krb5_enctype enctype, | |
762 krb5_data *random_data, krb5_keyblock *k5_random_key); | |
763 | |
764 /** @deprecated This call is no longer necessary. */ | |
765 krb5_error_code KRB5_CALLCONV | |
766 krb5_c_random_add_entropy(krb5_context context, unsigned int randsource, | |
767 const krb5_data *data); | |
768 | |
769 /** | |
770 * Generate pseudo-random bytes. | |
771 * | |
772 * @param [in] context Library context | |
773 * @param [out] data Random data | |
774 * | |
775 * Fills in @a data with bytes from the PRNG used by krb5 crypto operations. | |
776 * The caller must preinitialize @a data and allocate the desired amount of | |
777 * space. | |
778 * | |
779 * @retval 0 Success; otherwise - Kerberos error codes | |
780 */ | |
781 krb5_error_code KRB5_CALLCONV | |
782 krb5_c_random_make_octets(krb5_context context, krb5_data *data); | |
783 | |
784 /** @deprecated This call is no longer necessary. */ | |
785 krb5_error_code KRB5_CALLCONV | |
786 krb5_c_random_os_entropy(krb5_context context, int strong, int *success); | |
787 | |
788 /** @deprecated This call is no longer necessary. */ | |
789 krb5_error_code KRB5_CALLCONV | |
790 krb5_c_random_seed(krb5_context context, krb5_data *data); | |
791 | |
792 /** | |
793 * Convert a string (such a password) to a key. | |
794 * | |
795 * @param [in] context Library context | |
796 * @param [in] enctype Encryption type | |
797 * @param [in] string String to be converted | |
798 * @param [in] salt Salt value | |
799 * @param [out] key Generated key | |
800 * | |
801 * This function converts @a string to a @a key of encryption type @a enctype, | |
802 * using the specified @a salt. The newly created @a key must be released by | |
803 * calling krb5_free_keyblock_contents() when it is no longer needed. | |
804 * | |
805 * @retval 0 Success; otherwise - Kerberos error codes | |
806 */ | |
807 krb5_error_code KRB5_CALLCONV | |
808 krb5_c_string_to_key(krb5_context context, krb5_enctype enctype, | |
809 const krb5_data *string, const krb5_data *salt, | |
810 krb5_keyblock *key); | |
811 | |
812 /** | |
813 * Convert a string (such as a password) to a key with additional parameters. | |
814 * | |
815 * @param [in] context Library context | |
816 * @param [in] enctype Encryption type | |
817 * @param [in] string String to be converted | |
818 * @param [in] salt Salt value | |
819 * @param [in] params Parameters | |
820 * @param [out] key Generated key | |
821 * | |
822 * This function is similar to krb5_c_string_to_key(), but also takes | |
823 * parameters which may affect the algorithm in an enctype-dependent way. The | |
824 * newly created @a key must be released by calling | |
825 * krb5_free_keyblock_contents() when it is no longer needed. | |
826 * | |
827 * @retval 0 Success; otherwise - Kerberos error codes | |
828 */ | |
829 krb5_error_code KRB5_CALLCONV | |
830 krb5_c_string_to_key_with_params(krb5_context context, | |
831 krb5_enctype enctype, | |
832 const krb5_data *string, | |
833 const krb5_data *salt, | |
834 const krb5_data *params, | |
835 krb5_keyblock *key); | |
836 | |
837 /** | |
838 * Compare two encryption types. | |
839 * | |
840 * @param [in] context Library context | |
841 * @param [in] e1 First encryption type | |
842 * @param [in] e2 Second encryption type | |
843 * @param [out] similar @c TRUE if types are similar, @c FALSE if not | |
844 * | |
845 * This function determines whether two encryption types use the same kind of | |
846 * keys. | |
847 * | |
848 * @retval 0 Success; otherwise - Kerberos error codes | |
849 */ | |
850 krb5_error_code KRB5_CALLCONV | |
851 krb5_c_enctype_compare(krb5_context context, krb5_enctype e1, krb5_enctype e2, | |
852 krb5_boolean *similar); | |
853 | |
854 /** | |
855 * Compute a checksum (operates on keyblock). | |
856 * | |
857 * @param [in] context Library context | |
858 * @param [in] cksumtype Checksum type (0 for mandatory type) | |
859 * @param [in] key Encryption key for a keyed checksum | |
860 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
861 * @param [in] input Input data | |
862 * @param [out] cksum Generated checksum | |
863 * | |
864 * This function computes a checksum of type @a cksumtype over @a input, using | |
865 * @a key if the checksum type is a keyed checksum. If @a cksumtype is 0 and | |
866 * @a key is non-null, the checksum type will be the mandatory-to-implement | |
867 * checksum type for the key's encryption type. The actual checksum key will | |
868 * be derived from @a key and @a usage if key derivation is specified for the | |
869 * checksum type. The newly created @a cksum must be released by calling | |
870 * krb5_free_checksum_contents() when it is no longer needed. | |
871 * | |
872 * @note This function is similar to krb5_k_make_checksum(), but operates | |
873 * on keyblock @a key. | |
874 * | |
875 * @sa krb5_c_verify_checksum() | |
876 * | |
877 * @retval 0 Success; otherwise - Kerberos error codes | |
878 */ | |
879 krb5_error_code KRB5_CALLCONV | |
880 krb5_c_make_checksum(krb5_context context, krb5_cksumtype cksumtype, | |
881 const krb5_keyblock *key, krb5_keyusage usage, | |
882 const krb5_data *input, krb5_checksum *cksum); | |
883 | |
884 /** | |
885 * Verify a checksum (operates on keyblock). | |
886 * | |
887 * @param [in] context Library context | |
888 * @param [in] key Encryption key for a keyed checksum | |
889 * @param [in] usage @a key usage | |
890 * @param [in] data Data to be used to compute a new checksum | |
891 * using @a key to compare @a cksum against | |
892 * @param [in] cksum Checksum to be verified | |
893 * @param [out] valid Non-zero for success, zero for failure | |
894 * | |
895 * This function verifies that @a cksum is a valid checksum for @a data. If | |
896 * the checksum type of @a cksum is a keyed checksum, @a key is used to verify | |
897 * the checksum. If the checksum type in @a cksum is 0 and @a key is not NULL, | |
898 * the mandatory checksum type for @a key will be used. The actual checksum | |
899 * key will be derived from @a key and @a usage if key derivation is specified | |
900 * for the checksum type. | |
901 * | |
902 * @note This function is similar to krb5_k_verify_checksum(), but operates | |
903 * on keyblock @a key. | |
904 * | |
905 * @retval 0 Success; otherwise - Kerberos error codes | |
906 */ | |
907 krb5_error_code KRB5_CALLCONV | |
908 krb5_c_verify_checksum(krb5_context context, const krb5_keyblock *key, | |
909 krb5_keyusage usage, const krb5_data *data, | |
910 const krb5_checksum *cksum, krb5_boolean *valid); | |
911 | |
912 /** | |
913 * Return the length of checksums for a checksum type. | |
914 * | |
915 * @param [in] context Library context | |
916 * @param [in] cksumtype Checksum type | |
917 * @param [out] length Checksum length | |
918 * | |
919 * @retval 0 Success; otherwise - Kerberos error codes | |
920 */ | |
921 krb5_error_code KRB5_CALLCONV | |
922 krb5_c_checksum_length(krb5_context context, krb5_cksumtype cksumtype, | |
923 size_t *length); | |
924 | |
925 /** | |
926 * Return a list of keyed checksum types usable with an encryption type. | |
927 * | |
928 * @param [in] context Library context | |
929 * @param [in] enctype Encryption type | |
930 * @param [out] count Count of allowable checksum types | |
931 * @param [out] cksumtypes Array of allowable checksum types | |
932 * | |
933 * Use krb5_free_cksumtypes() to free @a cksumtypes when it is no longer | |
934 * needed. | |
935 * | |
936 * @retval 0 Success; otherwise - Kerberos error codes | |
937 */ | |
938 krb5_error_code KRB5_CALLCONV | |
939 krb5_c_keyed_checksum_types(krb5_context context, krb5_enctype enctype, | |
940 unsigned int *count, krb5_cksumtype **cksumtypes); | |
941 | |
942 /** @defgroup KRB5_KEYUSAGE KRB5_KEYUSAGE | |
943 * @{ | |
944 */ | |
945 #define KRB5_KEYUSAGE_AS_REQ_PA_ENC_TS 1 | |
946 #define KRB5_KEYUSAGE_KDC_REP_TICKET 2 | |
947 #define KRB5_KEYUSAGE_AS_REP_ENCPART 3 | |
948 #define KRB5_KEYUSAGE_TGS_REQ_AD_SESSKEY 4 | |
949 #define KRB5_KEYUSAGE_TGS_REQ_AD_SUBKEY 5 | |
950 #define KRB5_KEYUSAGE_TGS_REQ_AUTH_CKSUM 6 | |
951 #define KRB5_KEYUSAGE_TGS_REQ_AUTH 7 | |
952 #define KRB5_KEYUSAGE_TGS_REP_ENCPART_SESSKEY 8 | |
953 #define KRB5_KEYUSAGE_TGS_REP_ENCPART_SUBKEY 9 | |
954 #define KRB5_KEYUSAGE_AP_REQ_AUTH_CKSUM 10 | |
955 #define KRB5_KEYUSAGE_AP_REQ_AUTH 11 | |
956 #define KRB5_KEYUSAGE_AP_REP_ENCPART 12 | |
957 #define KRB5_KEYUSAGE_KRB_PRIV_ENCPART 13 | |
958 #define KRB5_KEYUSAGE_KRB_CRED_ENCPART 14 | |
959 #define KRB5_KEYUSAGE_KRB_SAFE_CKSUM 15 | |
960 #define KRB5_KEYUSAGE_APP_DATA_ENCRYPT 16 | |
961 #define KRB5_KEYUSAGE_APP_DATA_CKSUM 17 | |
962 #define KRB5_KEYUSAGE_KRB_ERROR_CKSUM 18 | |
963 #define KRB5_KEYUSAGE_AD_KDCISSUED_CKSUM 19 | |
964 #define KRB5_KEYUSAGE_AD_MTE 20 | |
965 #define KRB5_KEYUSAGE_AD_ITE 21 | |
966 | |
967 /* XXX need to register these */ | |
968 | |
969 #define KRB5_KEYUSAGE_GSS_TOK_MIC 22 | |
970 #define KRB5_KEYUSAGE_GSS_TOK_WRAP_INTEG 23 | |
971 #define KRB5_KEYUSAGE_GSS_TOK_WRAP_PRIV 24 | |
972 | |
973 /* Defined in Integrating SAM Mechanisms with Kerberos draft */ | |
974 #define KRB5_KEYUSAGE_PA_SAM_CHALLENGE_CKSUM 25 | |
975 /** Note conflict with @ref KRB5_KEYUSAGE_PA_S4U_X509_USER_REQUEST */ | |
976 #define KRB5_KEYUSAGE_PA_SAM_CHALLENGE_TRACKID 26 | |
977 /** Note conflict with @ref KRB5_KEYUSAGE_PA_S4U_X509_USER_REPLY */ | |
978 #define KRB5_KEYUSAGE_PA_SAM_RESPONSE 27 | |
979 | |
980 /* Defined in [MS-SFU] */ | |
981 /** Note conflict with @ref KRB5_KEYUSAGE_PA_SAM_CHALLENGE_TRACKID */ | |
982 #define KRB5_KEYUSAGE_PA_S4U_X509_USER_REQUEST 26 | |
983 /** Note conflict with @ref KRB5_KEYUSAGE_PA_SAM_RESPONSE */ | |
984 #define KRB5_KEYUSAGE_PA_S4U_X509_USER_REPLY 27 | |
985 | |
986 /* unused */ | |
987 #define KRB5_KEYUSAGE_PA_REFERRAL 26 | |
988 | |
989 #define KRB5_KEYUSAGE_AD_SIGNEDPATH -21 | |
990 #define KRB5_KEYUSAGE_IAKERB_FINISHED 42 | |
991 #define KRB5_KEYUSAGE_PA_PKINIT_KX 44 | |
992 #define KRB5_KEYUSAGE_PA_OTP_REQUEST 45 /**< See RFC 6560 section 4.2 */ | |
993 /* define in draft-ietf-krb-wg-preauth-framework*/ | |
994 #define KRB5_KEYUSAGE_FAST_REQ_CHKSUM 50 | |
995 #define KRB5_KEYUSAGE_FAST_ENC 51 | |
996 #define KRB5_KEYUSAGE_FAST_REP 52 | |
997 #define KRB5_KEYUSAGE_FAST_FINISHED 53 | |
998 #define KRB5_KEYUSAGE_ENC_CHALLENGE_CLIENT 54 | |
999 #define KRB5_KEYUSAGE_ENC_CHALLENGE_KDC 55 | |
1000 #define KRB5_KEYUSAGE_AS_REQ 56 | |
1001 #define KRB5_KEYUSAGE_CAMMAC 64 | |
1002 #define KRB5_KEYUSAGE_SPAKE 65 | |
1003 | |
1004 /* Key usage values 512-1023 are reserved for uses internal to a Kerberos | |
1005 * implementation. */ | |
1006 #define KRB5_KEYUSAGE_PA_FX_COOKIE 513 /**< Used for encrypted FAST cookies */ | |
1007 #define KRB5_KEYUSAGE_PA_AS_FRESHNESS 514 /**< Used for freshness tokens */ | |
1008 /** @} */ /* end of KRB5_KEYUSAGE group */ | |
1009 | |
1010 /** | |
1011 * Verify that a specified encryption type is a valid Kerberos encryption type. | |
1012 * | |
1013 * @param [in] ktype Encryption type | |
1014 * | |
1015 * @return @c TRUE if @a ktype is valid, @c FALSE if not | |
1016 */ | |
1017 krb5_boolean KRB5_CALLCONV | |
1018 krb5_c_valid_enctype(krb5_enctype ktype); | |
1019 | |
1020 /** | |
1021 * Verify that specified checksum type is a valid Kerberos checksum type. | |
1022 * | |
1023 * @param [in] ctype Checksum type | |
1024 * | |
1025 * @return @c TRUE if @a ctype is valid, @c FALSE if not | |
1026 */ | |
1027 krb5_boolean KRB5_CALLCONV | |
1028 krb5_c_valid_cksumtype(krb5_cksumtype ctype); | |
1029 | |
1030 /** | |
1031 * Test whether a checksum type is collision-proof. | |
1032 * | |
1033 * @param [in] ctype Checksum type | |
1034 * | |
1035 * @return @c TRUE if @a ctype is collision-proof, @c FALSE if it is not | |
1036 * collision-proof or not a valid checksum type. | |
1037 */ | |
1038 krb5_boolean KRB5_CALLCONV | |
1039 krb5_c_is_coll_proof_cksum(krb5_cksumtype ctype); | |
1040 | |
1041 /** | |
1042 * Test whether a checksum type is keyed. | |
1043 * | |
1044 * @param [in] ctype Checksum type | |
1045 * | |
1046 * @return @c TRUE if @a ctype is a keyed checksum type, @c FALSE otherwise. | |
1047 */ | |
1048 krb5_boolean KRB5_CALLCONV | |
1049 krb5_c_is_keyed_cksum(krb5_cksumtype ctype); | |
1050 | |
1051 /* AEAD APIs */ | |
1052 /** @defgroup KRB5_CRYPTO_TYPE KRB5_CRYPTO_TYPE | |
1053 * @{ | |
1054 */ | |
1055 #define KRB5_CRYPTO_TYPE_EMPTY 0 /**< [in] ignored */ | |
1056 #define KRB5_CRYPTO_TYPE_HEADER 1 /**< [out] header */ | |
1057 #define KRB5_CRYPTO_TYPE_DATA 2 /**< [in, out] plaintext */ | |
1058 #define KRB5_CRYPTO_TYPE_SIGN_ONLY 3 /**< [in] associated data */ | |
1059 #define KRB5_CRYPTO_TYPE_PADDING 4 /**< [out] padding */ | |
1060 #define KRB5_CRYPTO_TYPE_TRAILER 5 /**< [out] checksum for encrypt */ | |
1061 #define KRB5_CRYPTO_TYPE_CHECKSUM 6 /**< [out] checksum for MIC */ | |
1062 #define KRB5_CRYPTO_TYPE_STREAM 7 /**< [in] entire message without | |
1063 decomposing the structure into | |
1064 header, data and trailer buffers */ | |
1065 /** @} */ /* end of KRB5_CRYPTO_TYPE group */ | |
1066 | |
1067 /** | |
1068 * Fill in a checksum element in IOV array (operates on keyblock) | |
1069 * | |
1070 * @param [in] context Library context | |
1071 * @param [in] cksumtype Checksum type (0 for mandatory type) | |
1072 * @param [in] key Encryption key for a keyed checksum | |
1073 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
1074 * @param [in,out] data IOV array | |
1075 * @param [in] num_data Size of @a data | |
1076 * | |
1077 * Create a checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element over | |
1078 * #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY chunks in @a data. | |
1079 * Only the #KRB5_CRYPTO_TYPE_CHECKSUM region is modified. | |
1080 * | |
1081 * @note This function is similar to krb5_k_make_checksum_iov(), but operates | |
1082 * on keyblock @a key. | |
1083 * | |
1084 * @sa krb5_c_verify_checksum_iov() | |
1085 * | |
1086 * @retval 0 Success; otherwise - Kerberos error codes | |
1087 */ | |
1088 krb5_error_code KRB5_CALLCONV | |
1089 krb5_c_make_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, | |
1090 const krb5_keyblock *key, krb5_keyusage usage, | |
1091 krb5_crypto_iov *data, size_t num_data); | |
1092 | |
1093 /** | |
1094 * Validate a checksum element in IOV array (operates on keyblock). | |
1095 * | |
1096 * @param [in] context Library context | |
1097 * @param [in] cksumtype Checksum type (0 for mandatory type) | |
1098 * @param [in] key Encryption key for a keyed checksum | |
1099 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
1100 * @param [in] data IOV array | |
1101 * @param [in] num_data Size of @a data | |
1102 * @param [out] valid Non-zero for success, zero for failure | |
1103 * | |
1104 * Confirm that the checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element is a | |
1105 * valid checksum of the #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY | |
1106 * regions in the iov. | |
1107 * | |
1108 * @note This function is similar to krb5_k_verify_checksum_iov(), but operates | |
1109 * on keyblock @a key. | |
1110 * | |
1111 * @sa krb5_c_make_checksum_iov() | |
1112 * | |
1113 * @retval 0 Success; otherwise - Kerberos error codes | |
1114 */ | |
1115 krb5_error_code KRB5_CALLCONV | |
1116 krb5_c_verify_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, | |
1117 const krb5_keyblock *key, krb5_keyusage usage, | |
1118 const krb5_crypto_iov *data, size_t num_data, | |
1119 krb5_boolean *valid); | |
1120 | |
1121 /** | |
1122 * Encrypt data in place supporting AEAD (operates on keyblock). | |
1123 * | |
1124 * @param [in] context Library context | |
1125 * @param [in] keyblock Encryption key | |
1126 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
1127 * @param [in] cipher_state Cipher state; specify NULL if not needed | |
1128 * @param [in,out] data IOV array. Modified in-place. | |
1129 * @param [in] num_data Size of @a data | |
1130 * | |
1131 * This function encrypts the data block @a data and stores the output in-place. | |
1132 * The actual encryption key will be derived from @a keyblock and @a usage | |
1133 * if key derivation is specified for the encryption type. If non-null, @a | |
1134 * cipher_state specifies the beginning state for the encryption operation, and | |
1135 * is updated with the state to be passed as input to the next operation. | |
1136 * The caller must allocate the right number of krb5_crypto_iov | |
1137 * structures before calling into this API. | |
1138 * | |
1139 * @note On return from a krb5_c_encrypt_iov() call, the @a data->length in the | |
1140 * iov structure are adjusted to reflect actual lengths of the ciphertext used. | |
1141 * For example, if the padding length is too large, the length will be reduced. | |
1142 * Lengths are never increased. | |
1143 * | |
1144 * @note This function is similar to krb5_k_encrypt_iov(), but operates | |
1145 * on keyblock @a keyblock. | |
1146 * | |
1147 * @sa krb5_c_decrypt_iov() | |
1148 * | |
1149 * @retval 0 Success; otherwise - Kerberos error codes | |
1150 */ | |
1151 krb5_error_code KRB5_CALLCONV | |
1152 krb5_c_encrypt_iov(krb5_context context, const krb5_keyblock *keyblock, | |
1153 krb5_keyusage usage, const krb5_data *cipher_state, | |
1154 krb5_crypto_iov *data, size_t num_data); | |
1155 | |
1156 /** | |
1157 * Decrypt data in place supporting AEAD (operates on keyblock). | |
1158 * | |
1159 * @param [in] context Library context | |
1160 * @param [in] keyblock Encryption key | |
1161 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
1162 * @param [in] cipher_state Cipher state; specify NULL if not needed | |
1163 * @param [in,out] data IOV array. Modified in-place. | |
1164 * @param [in] num_data Size of @a data | |
1165 * | |
1166 * This function decrypts the data block @a data and stores the output in-place. | |
1167 * The actual decryption key will be derived from @a keyblock and @a usage | |
1168 * if key derivation is specified for the encryption type. If non-null, @a | |
1169 * cipher_state specifies the beginning state for the decryption operation, and | |
1170 * is updated with the state to be passed as input to the next operation. | |
1171 * The caller must allocate the right number of krb5_crypto_iov | |
1172 * structures before calling into this API. | |
1173 * | |
1174 * @note On return from a krb5_c_decrypt_iov() call, the @a data->length in the | |
1175 * iov structure are adjusted to reflect actual lengths of the ciphertext used. | |
1176 * For example, if the padding length is too large, the length will be reduced. | |
1177 * Lengths are never increased. | |
1178 * | |
1179 * @note This function is similar to krb5_k_decrypt_iov(), but operates | |
1180 * on keyblock @a keyblock. | |
1181 * | |
1182 * @sa krb5_c_decrypt_iov() | |
1183 * | |
1184 * @retval 0 Success; otherwise - Kerberos error codes | |
1185 */ | |
1186 krb5_error_code KRB5_CALLCONV | |
1187 krb5_c_decrypt_iov(krb5_context context, const krb5_keyblock *keyblock, | |
1188 krb5_keyusage usage, const krb5_data *cipher_state, | |
1189 krb5_crypto_iov *data, size_t num_data); | |
1190 | |
1191 /** | |
1192 * Return a length of a message field specific to the encryption type. | |
1193 * | |
1194 * @param [in] context Library context | |
1195 * @param [in] enctype Encryption type | |
1196 * @param [in] type Type field (See @ref KRB5_CRYPTO_TYPE types) | |
1197 * @param [out] size Length of the @a type specific to @a enctype | |
1198 * | |
1199 * @retval 0 Success; otherwise - Kerberos error codes | |
1200 */ | |
1201 krb5_error_code KRB5_CALLCONV | |
1202 krb5_c_crypto_length(krb5_context context, krb5_enctype enctype, | |
1203 krb5_cryptotype type, unsigned int *size); | |
1204 | |
1205 /** | |
1206 * Fill in lengths for header, trailer and padding in a IOV array. | |
1207 * | |
1208 * @param [in] context Library context | |
1209 * @param [in] enctype Encryption type | |
1210 * @param [in,out] data IOV array | |
1211 * @param [in] num_data Size of @a data | |
1212 * | |
1213 * Padding is set to the actual padding required based on the provided | |
1214 * @a data buffers. Typically this API is used after setting up the data | |
1215 * buffers and #KRB5_CRYPTO_TYPE_SIGN_ONLY buffers, but before actually | |
1216 * allocating header, trailer and padding. | |
1217 * | |
1218 * @retval 0 Success; otherwise - Kerberos error codes | |
1219 */ | |
1220 krb5_error_code KRB5_CALLCONV | |
1221 krb5_c_crypto_length_iov(krb5_context context, krb5_enctype enctype, | |
1222 krb5_crypto_iov *data, size_t num_data); | |
1223 | |
1224 /** | |
1225 * Return a number of padding octets. | |
1226 * | |
1227 * @param [in] context Library context | |
1228 * @param [in] enctype Encryption type | |
1229 * @param [in] data_length Length of the plaintext to pad | |
1230 * @param [out] size Number of padding octets | |
1231 * | |
1232 * This function returns the number of the padding octets required to pad | |
1233 * @a data_length octets of plaintext. | |
1234 * | |
1235 * @retval 0 Success; otherwise - KRB5_BAD_ENCTYPE | |
1236 */ | |
1237 krb5_error_code KRB5_CALLCONV | |
1238 krb5_c_padding_length(krb5_context context, krb5_enctype enctype, | |
1239 size_t data_length, unsigned int *size); | |
1240 | |
1241 /** | |
1242 * Create a krb5_key from the enctype and key data in a keyblock. | |
1243 * | |
1244 * @param [in] context Library context | |
1245 * @param [in] key_data Keyblock | |
1246 * @param [out] out Opaque key | |
1247 * | |
1248 * The reference count on a key @a out is set to 1. | |
1249 * Use krb5_k_free_key() to free @a out when it is no longer needed. | |
1250 * | |
1251 * @retval 0 Success; otherwise - KRB5_BAD_ENCTYPE | |
1252 */ | |
1253 krb5_error_code KRB5_CALLCONV | |
1254 krb5_k_create_key(krb5_context context, const krb5_keyblock *key_data, | |
1255 krb5_key *out); | |
1256 | |
1257 /** Increment the reference count on a key. */ | |
1258 void KRB5_CALLCONV | |
1259 krb5_k_reference_key(krb5_context context, krb5_key key); | |
1260 | |
1261 /** Decrement the reference count on a key and free it if it hits zero. */ | |
1262 void KRB5_CALLCONV | |
1263 krb5_k_free_key(krb5_context context, krb5_key key); | |
1264 | |
1265 /** Retrieve a copy of the keyblock from a krb5_key structure. */ | |
1266 krb5_error_code KRB5_CALLCONV | |
1267 krb5_k_key_keyblock(krb5_context context, krb5_key key, | |
1268 krb5_keyblock **key_data); | |
1269 | |
1270 /** Retrieve the enctype of a krb5_key structure. */ | |
1271 krb5_enctype KRB5_CALLCONV | |
1272 krb5_k_key_enctype(krb5_context context, krb5_key key); | |
1273 | |
1274 /** | |
1275 * Encrypt data using a key (operates on opaque key). | |
1276 * | |
1277 * @param [in] context Library context | |
1278 * @param [in] key Encryption key | |
1279 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
1280 * @param [in,out] cipher_state Cipher state; specify NULL if not needed | |
1281 * @param [in] input Data to be encrypted | |
1282 * @param [out] output Encrypted data | |
1283 * | |
1284 * This function encrypts the data block @a input and stores the output into @a | |
1285 * output. The actual encryption key will be derived from @a key and @a usage | |
1286 * if key derivation is specified for the encryption type. If non-null, @a | |
1287 * cipher_state specifies the beginning state for the encryption operation, and | |
1288 * is updated with the state to be passed as input to the next operation. | |
1289 * | |
1290 * @note The caller must initialize @a output and allocate at least enough | |
1291 * space for the result (using krb5_c_encrypt_length() to determine the amount | |
1292 * of space needed). @a output->length will be set to the actual length of the | |
1293 * ciphertext. | |
1294 * | |
1295 * @retval 0 Success; otherwise - Kerberos error codes | |
1296 */ | |
1297 krb5_error_code KRB5_CALLCONV | |
1298 krb5_k_encrypt(krb5_context context, krb5_key key, krb5_keyusage usage, | |
1299 const krb5_data *cipher_state, const krb5_data *input, | |
1300 krb5_enc_data *output); | |
1301 | |
1302 /** | |
1303 * Encrypt data in place supporting AEAD (operates on opaque key). | |
1304 * | |
1305 * @param [in] context Library context | |
1306 * @param [in] key Encryption key | |
1307 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
1308 * @param [in] cipher_state Cipher state; specify NULL if not needed | |
1309 * @param [in,out] data IOV array. Modified in-place. | |
1310 * @param [in] num_data Size of @a data | |
1311 * | |
1312 * This function encrypts the data block @a data and stores the output in-place. | |
1313 * The actual encryption key will be derived from @a key and @a usage | |
1314 * if key derivation is specified for the encryption type. If non-null, @a | |
1315 * cipher_state specifies the beginning state for the encryption operation, and | |
1316 * is updated with the state to be passed as input to the next operation. | |
1317 * The caller must allocate the right number of krb5_crypto_iov | |
1318 * structures before calling into this API. | |
1319 * | |
1320 * @note On return from a krb5_c_encrypt_iov() call, the @a data->length in the | |
1321 * iov structure are adjusted to reflect actual lengths of the ciphertext used. | |
1322 * For example, if the padding length is too large, the length will be reduced. | |
1323 * Lengths are never increased. | |
1324 * | |
1325 * @note This function is similar to krb5_c_encrypt_iov(), but operates | |
1326 * on opaque key @a key. | |
1327 * | |
1328 * @sa krb5_k_decrypt_iov() | |
1329 * | |
1330 * @retval 0 Success; otherwise - Kerberos error codes | |
1331 */ | |
1332 krb5_error_code KRB5_CALLCONV | |
1333 krb5_k_encrypt_iov(krb5_context context, krb5_key key, krb5_keyusage usage, | |
1334 const krb5_data *cipher_state, krb5_crypto_iov *data, | |
1335 size_t num_data); | |
1336 | |
1337 /** | |
1338 * Decrypt data using a key (operates on opaque key). | |
1339 * | |
1340 * @param [in] context Library context | |
1341 * @param [in] key Encryption key | |
1342 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
1343 * @param [in,out] cipher_state Cipher state; specify NULL if not needed | |
1344 * @param [in] input Encrypted data | |
1345 * @param [out] output Decrypted data | |
1346 * | |
1347 * This function decrypts the data block @a input and stores the output into @a | |
1348 * output. The actual decryption key will be derived from @a key and @a usage | |
1349 * if key derivation is specified for the encryption type. If non-null, @a | |
1350 * cipher_state specifies the beginning state for the decryption operation, and | |
1351 * is updated with the state to be passed as input to the next operation. | |
1352 * | |
1353 * @note The caller must initialize @a output and allocate at least enough | |
1354 * space for the result. The usual practice is to allocate an output buffer as | |
1355 * long as the ciphertext, and let krb5_c_decrypt() trim @a output->length. | |
1356 * For some enctypes, the resulting @a output->length may include padding | |
1357 * bytes. | |
1358 * | |
1359 * @retval 0 Success; otherwise - Kerberos error codes | |
1360 */ | |
1361 krb5_error_code KRB5_CALLCONV | |
1362 krb5_k_decrypt(krb5_context context, krb5_key key, krb5_keyusage usage, | |
1363 const krb5_data *cipher_state, const krb5_enc_data *input, | |
1364 krb5_data *output); | |
1365 | |
1366 /** | |
1367 * Decrypt data in place supporting AEAD (operates on opaque key). | |
1368 * | |
1369 * @param [in] context Library context | |
1370 * @param [in] key Encryption key | |
1371 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
1372 * @param [in] cipher_state Cipher state; specify NULL if not needed | |
1373 * @param [in,out] data IOV array. Modified in-place. | |
1374 * @param [in] num_data Size of @a data | |
1375 * | |
1376 * This function decrypts the data block @a data and stores the output in-place. | |
1377 * The actual decryption key will be derived from @a key and @a usage | |
1378 * if key derivation is specified for the encryption type. If non-null, @a | |
1379 * cipher_state specifies the beginning state for the decryption operation, and | |
1380 * is updated with the state to be passed as input to the next operation. | |
1381 * The caller must allocate the right number of krb5_crypto_iov | |
1382 * structures before calling into this API. | |
1383 * | |
1384 * @note On return from a krb5_c_decrypt_iov() call, the @a data->length in the | |
1385 * iov structure are adjusted to reflect actual lengths of the ciphertext used. | |
1386 * For example, if the padding length is too large, the length will be reduced. | |
1387 * Lengths are never increased. | |
1388 * | |
1389 * @note This function is similar to krb5_c_decrypt_iov(), but operates | |
1390 * on opaque key @a key. | |
1391 * | |
1392 * @sa krb5_k_encrypt_iov() | |
1393 * | |
1394 * @retval 0 Success; otherwise - Kerberos error codes | |
1395 */ | |
1396 krb5_error_code KRB5_CALLCONV | |
1397 krb5_k_decrypt_iov(krb5_context context, krb5_key key, krb5_keyusage usage, | |
1398 const krb5_data *cipher_state, krb5_crypto_iov *data, | |
1399 size_t num_data); | |
1400 /** | |
1401 * Compute a checksum (operates on opaque key). | |
1402 * | |
1403 * @param [in] context Library context | |
1404 * @param [in] cksumtype Checksum type (0 for mandatory type) | |
1405 * @param [in] key Encryption key for a keyed checksum | |
1406 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
1407 * @param [in] input Input data | |
1408 * @param [out] cksum Generated checksum | |
1409 * | |
1410 * This function computes a checksum of type @a cksumtype over @a input, using | |
1411 * @a key if the checksum type is a keyed checksum. If @a cksumtype is 0 and | |
1412 * @a key is non-null, the checksum type will be the mandatory-to-implement | |
1413 * checksum type for the key's encryption type. The actual checksum key will | |
1414 * be derived from @a key and @a usage if key derivation is specified for the | |
1415 * checksum type. The newly created @a cksum must be released by calling | |
1416 * krb5_free_checksum_contents() when it is no longer needed. | |
1417 * | |
1418 * @note This function is similar to krb5_c_make_checksum(), but operates | |
1419 * on opaque @a key. | |
1420 * | |
1421 * @sa krb5_c_verify_checksum() | |
1422 * | |
1423 * @retval 0 Success; otherwise - Kerberos error codes | |
1424 */ | |
1425 krb5_error_code KRB5_CALLCONV | |
1426 krb5_k_make_checksum(krb5_context context, krb5_cksumtype cksumtype, | |
1427 krb5_key key, krb5_keyusage usage, const krb5_data *input, | |
1428 krb5_checksum *cksum); | |
1429 | |
1430 /** | |
1431 * Fill in a checksum element in IOV array (operates on opaque key) | |
1432 * | |
1433 * @param [in] context Library context | |
1434 * @param [in] cksumtype Checksum type (0 for mandatory type) | |
1435 * @param [in] key Encryption key for a keyed checksum | |
1436 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
1437 * @param [in,out] data IOV array | |
1438 * @param [in] num_data Size of @a data | |
1439 * | |
1440 * Create a checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element over | |
1441 * #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY chunks in @a data. | |
1442 * Only the #KRB5_CRYPTO_TYPE_CHECKSUM region is modified. | |
1443 * | |
1444 * @note This function is similar to krb5_c_make_checksum_iov(), but operates | |
1445 * on opaque @a key. | |
1446 * | |
1447 * @sa krb5_k_verify_checksum_iov() | |
1448 * | |
1449 * @retval 0 Success; otherwise - Kerberos error codes | |
1450 */ | |
1451 krb5_error_code KRB5_CALLCONV | |
1452 krb5_k_make_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, | |
1453 krb5_key key, krb5_keyusage usage, | |
1454 krb5_crypto_iov *data, size_t num_data); | |
1455 | |
1456 /** | |
1457 * Verify a checksum (operates on opaque key). | |
1458 * | |
1459 * @param [in] context Library context | |
1460 * @param [in] key Encryption key for a keyed checksum | |
1461 * @param [in] usage @a key usage | |
1462 * @param [in] data Data to be used to compute a new checksum | |
1463 * using @a key to compare @a cksum against | |
1464 * @param [in] cksum Checksum to be verified | |
1465 * @param [out] valid Non-zero for success, zero for failure | |
1466 * | |
1467 * This function verifies that @a cksum is a valid checksum for @a data. If | |
1468 * the checksum type of @a cksum is a keyed checksum, @a key is used to verify | |
1469 * the checksum. If the checksum type in @a cksum is 0 and @a key is not NULL, | |
1470 * the mandatory checksum type for @a key will be used. The actual checksum | |
1471 * key will be derived from @a key and @a usage if key derivation is specified | |
1472 * for the checksum type. | |
1473 * | |
1474 * @note This function is similar to krb5_c_verify_checksum(), but operates | |
1475 * on opaque @a key. | |
1476 * | |
1477 * @retval 0 Success; otherwise - Kerberos error codes | |
1478 */ | |
1479 krb5_error_code KRB5_CALLCONV | |
1480 krb5_k_verify_checksum(krb5_context context, krb5_key key, krb5_keyusage usage, | |
1481 const krb5_data *data, const krb5_checksum *cksum, | |
1482 krb5_boolean *valid); | |
1483 | |
1484 /** | |
1485 * Validate a checksum element in IOV array (operates on opaque key). | |
1486 * | |
1487 * @param [in] context Library context | |
1488 * @param [in] cksumtype Checksum type (0 for mandatory type) | |
1489 * @param [in] key Encryption key for a keyed checksum | |
1490 * @param [in] usage Key usage (see @ref KRB5_KEYUSAGE types) | |
1491 * @param [in] data IOV array | |
1492 * @param [in] num_data Size of @a data | |
1493 * @param [out] valid Non-zero for success, zero for failure | |
1494 * | |
1495 * Confirm that the checksum in the #KRB5_CRYPTO_TYPE_CHECKSUM element is a | |
1496 * valid checksum of the #KRB5_CRYPTO_TYPE_DATA and #KRB5_CRYPTO_TYPE_SIGN_ONLY | |
1497 * regions in the iov. | |
1498 * | |
1499 * @note This function is similar to krb5_c_verify_checksum_iov(), but operates | |
1500 * on opaque @a key. | |
1501 * | |
1502 * @sa krb5_k_make_checksum_iov() | |
1503 * | |
1504 * @retval 0 Success; otherwise - Kerberos error codes | |
1505 */ | |
1506 krb5_error_code KRB5_CALLCONV | |
1507 krb5_k_verify_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, | |
1508 krb5_key key, krb5_keyusage usage, | |
1509 const krb5_crypto_iov *data, size_t num_data, | |
1510 krb5_boolean *valid); | |
1511 | |
1512 /** | |
1513 * Generate enctype-specific pseudo-random bytes (operates on opaque key). | |
1514 * | |
1515 * @param [in] context Library context | |
1516 * @param [in] key Key | |
1517 * @param [in] input Input data | |
1518 * @param [out] output Output data | |
1519 * | |
1520 * This function selects a pseudo-random function based on @a key and | |
1521 * computes its value over @a input, placing the result into @a output. | |
1522 * The caller must preinitialize @a output and allocate space for the | |
1523 * result. | |
1524 * | |
1525 * @note This function is similar to krb5_c_prf(), but operates | |
1526 * on opaque @a key. | |
1527 * | |
1528 * @retval 0 Success; otherwise - Kerberos error codes | |
1529 */ | |
1530 krb5_error_code KRB5_CALLCONV | |
1531 krb5_k_prf(krb5_context context, krb5_key key, krb5_data *input, krb5_data *output); | |
1532 | |
1533 #ifdef KRB5_OLD_CRYPTO | |
1534 /* | |
1535 * old cryptosystem routine prototypes. These are now layered | |
1536 * on top of the functions above. | |
1537 */ | |
1538 /** @deprecated Replaced by krb5_c_* API family.*/ | |
1539 krb5_error_code KRB5_CALLCONV | |
1540 krb5_encrypt(krb5_context context, krb5_const_pointer inptr, | |
1541 krb5_pointer outptr, size_t size, krb5_encrypt_block *eblock, | |
1542 krb5_pointer ivec); | |
1543 | |
1544 /** @deprecated Replaced by krb5_c_* API family. */ | |
1545 krb5_error_code KRB5_CALLCONV | |
1546 krb5_decrypt(krb5_context context, krb5_const_pointer inptr, | |
1547 krb5_pointer outptr, size_t size, krb5_encrypt_block *eblock, | |
1548 krb5_pointer ivec); | |
1549 | |
1550 /** @deprecated Replaced by krb5_c_* API family. */ | |
1551 krb5_error_code KRB5_CALLCONV | |
1552 krb5_process_key(krb5_context context, krb5_encrypt_block *eblock, | |
1553 const krb5_keyblock * key); | |
1554 | |
1555 /** @deprecated Replaced by krb5_c_* API family. */ | |
1556 krb5_error_code KRB5_CALLCONV | |
1557 krb5_finish_key(krb5_context context, krb5_encrypt_block * eblock); | |
1558 | |
1559 /** @deprecated See krb5_c_string_to_key() */ | |
1560 krb5_error_code KRB5_CALLCONV | |
1561 krb5_string_to_key(krb5_context context, const krb5_encrypt_block *eblock, | |
1562 krb5_keyblock * keyblock, const krb5_data *data, | |
1563 const krb5_data *salt); | |
1564 | |
1565 /** @deprecated Replaced by krb5_c_* API family. */ | |
1566 krb5_error_code KRB5_CALLCONV | |
1567 krb5_init_random_key(krb5_context context, const krb5_encrypt_block *eblock, | |
1568 const krb5_keyblock *keyblock, krb5_pointer *ptr); | |
1569 | |
1570 /** @deprecated Replaced by krb5_c_* API family. */ | |
1571 krb5_error_code KRB5_CALLCONV | |
1572 krb5_finish_random_key(krb5_context context, const krb5_encrypt_block *eblock, | |
1573 krb5_pointer *ptr); | |
1574 | |
1575 /** @deprecated Replaced by krb5_c_* API family. */ | |
1576 krb5_error_code KRB5_CALLCONV | |
1577 krb5_random_key(krb5_context context, const krb5_encrypt_block *eblock, | |
1578 krb5_pointer ptr, krb5_keyblock **keyblock); | |
1579 | |
1580 /** @deprecated Replaced by krb5_c_* API family. */ | |
1581 krb5_enctype KRB5_CALLCONV | |
1582 krb5_eblock_enctype(krb5_context context, const krb5_encrypt_block *eblock); | |
1583 | |
1584 /** @deprecated Replaced by krb5_c_* API family. */ | |
1585 krb5_error_code KRB5_CALLCONV | |
1586 krb5_use_enctype(krb5_context context, krb5_encrypt_block *eblock, | |
1587 krb5_enctype enctype); | |
1588 | |
1589 /** @deprecated Replaced by krb5_c_* API family. */ | |
1590 size_t KRB5_CALLCONV | |
1591 krb5_encrypt_size(size_t length, krb5_enctype crypto); | |
1592 | |
1593 /** @deprecated See krb5_c_checksum_length() */ | |
1594 size_t KRB5_CALLCONV | |
1595 krb5_checksum_size(krb5_context context, krb5_cksumtype ctype); | |
1596 | |
1597 /** @deprecated See krb5_c_make_checksum() */ | |
1598 krb5_error_code KRB5_CALLCONV | |
1599 krb5_calculate_checksum(krb5_context context, krb5_cksumtype ctype, | |
1600 krb5_const_pointer in, size_t in_length, | |
1601 krb5_const_pointer seed, size_t seed_length, | |
1602 krb5_checksum * outcksum); | |
1603 | |
1604 /** @deprecated See krb5_c_verify_checksum() */ | |
1605 krb5_error_code KRB5_CALLCONV | |
1606 krb5_verify_checksum(krb5_context context, krb5_cksumtype ctype, | |
1607 const krb5_checksum * cksum, krb5_const_pointer in, | |
1608 size_t in_length, krb5_const_pointer seed, | |
1609 size_t seed_length); | |
1610 | |
1611 #endif /* KRB5_OLD_CRYPTO */ | |
1612 | |
1613 /* | |
1614 * end "encryption.h" | |
1615 */ | |
1616 | |
1617 /* | |
1618 * begin "fieldbits.h" | |
1619 */ | |
1620 | |
1621 /* kdc_options for kdc_request */ | |
1622 /* options is 32 bits; each host is responsible to put the 4 bytes | |
1623 representing these bits into net order before transmission */ | |
1624 /* #define KDC_OPT_RESERVED 0x80000000 */ | |
1625 #define KDC_OPT_FORWARDABLE 0x40000000 | |
1626 #define KDC_OPT_FORWARDED 0x20000000 | |
1627 #define KDC_OPT_PROXIABLE 0x10000000 | |
1628 #define KDC_OPT_PROXY 0x08000000 | |
1629 #define KDC_OPT_ALLOW_POSTDATE 0x04000000 | |
1630 #define KDC_OPT_POSTDATED 0x02000000 | |
1631 /* #define KDC_OPT_UNUSED 0x01000000 */ | |
1632 #define KDC_OPT_RENEWABLE 0x00800000 | |
1633 /* #define KDC_OPT_UNUSED 0x00400000 */ | |
1634 /* #define KDC_OPT_RESERVED 0x00200000 */ | |
1635 /* #define KDC_OPT_RESERVED 0x00100000 */ | |
1636 /* #define KDC_OPT_RESERVED 0x00080000 */ | |
1637 /* #define KDC_OPT_RESERVED 0x00040000 */ | |
1638 #define KDC_OPT_CNAME_IN_ADDL_TKT 0x00020000 | |
1639 #define KDC_OPT_CANONICALIZE 0x00010000 | |
1640 #define KDC_OPT_REQUEST_ANONYMOUS 0x00008000 | |
1641 /* #define KDC_OPT_RESERVED 0x00004000 */ | |
1642 /* #define KDC_OPT_RESERVED 0x00002000 */ | |
1643 /* #define KDC_OPT_RESERVED 0x00001000 */ | |
1644 /* #define KDC_OPT_RESERVED 0x00000800 */ | |
1645 /* #define KDC_OPT_RESERVED 0x00000400 */ | |
1646 /* #define KDC_OPT_RESERVED 0x00000200 */ | |
1647 /* #define KDC_OPT_RESERVED 0x00000100 */ | |
1648 /* #define KDC_OPT_RESERVED 0x00000080 */ | |
1649 /* #define KDC_OPT_RESERVED 0x00000040 */ | |
1650 #define KDC_OPT_DISABLE_TRANSITED_CHECK 0x00000020 | |
1651 #define KDC_OPT_RENEWABLE_OK 0x00000010 | |
1652 #define KDC_OPT_ENC_TKT_IN_SKEY 0x00000008 | |
1653 /* #define KDC_OPT_UNUSED 0x00000004 */ | |
1654 #define KDC_OPT_RENEW 0x00000002 | |
1655 #define KDC_OPT_VALIDATE 0x00000001 | |
1656 | |
1657 /* | |
1658 * Mask of ticket flags in the TGT which should be converted into KDC | |
1659 * options when using the TGT to get derivative tickets. | |
1660 * | |
1661 * New mask = KDC_OPT_FORWARDABLE | KDC_OPT_PROXIABLE | | |
1662 * KDC_OPT_ALLOW_POSTDATE | KDC_OPT_RENEWABLE | |
1663 */ | |
1664 #define KDC_TKT_COMMON_MASK 0x54800000 | |
1665 | |
1666 /* definitions for ap_options fields */ | |
1667 | |
1668 /** @defgroup AP_OPTS AP_OPTS | |
1669 * | |
1670 * ap_options are 32 bits; each host is responsible to put the 4 bytes | |
1671 * representing these bits into net order before transmission | |
1672 * @{ | |
1673 */ | |
1674 #define AP_OPTS_RESERVED 0x80000000 | |
1675 #define AP_OPTS_USE_SESSION_KEY 0x40000000 /**< Use session key */ | |
1676 #define AP_OPTS_MUTUAL_REQUIRED 0x20000000 /**< Perform a mutual | |
1677 authentication exchange */ | |
1678 #define AP_OPTS_ETYPE_NEGOTIATION 0x00000002 | |
1679 #define AP_OPTS_USE_SUBKEY 0x00000001 /**< Generate a subsession key | |
1680 from the current session key | |
1681 obtained from the | |
1682 credentials */ | |
1683 /* #define AP_OPTS_RESERVED 0x10000000 */ | |
1684 /* #define AP_OPTS_RESERVED 0x08000000 */ | |
1685 /* #define AP_OPTS_RESERVED 0x04000000 */ | |
1686 /* #define AP_OPTS_RESERVED 0x02000000 */ | |
1687 /* #define AP_OPTS_RESERVED 0x01000000 */ | |
1688 /* #define AP_OPTS_RESERVED 0x00800000 */ | |
1689 /* #define AP_OPTS_RESERVED 0x00400000 */ | |
1690 /* #define AP_OPTS_RESERVED 0x00200000 */ | |
1691 /* #define AP_OPTS_RESERVED 0x00100000 */ | |
1692 /* #define AP_OPTS_RESERVED 0x00080000 */ | |
1693 /* #define AP_OPTS_RESERVED 0x00040000 */ | |
1694 /* #define AP_OPTS_RESERVED 0x00020000 */ | |
1695 /* #define AP_OPTS_RESERVED 0x00010000 */ | |
1696 /* #define AP_OPTS_RESERVED 0x00008000 */ | |
1697 /* #define AP_OPTS_RESERVED 0x00004000 */ | |
1698 /* #define AP_OPTS_RESERVED 0x00002000 */ | |
1699 /* #define AP_OPTS_RESERVED 0x00001000 */ | |
1700 /* #define AP_OPTS_RESERVED 0x00000800 */ | |
1701 /* #define AP_OPTS_RESERVED 0x00000400 */ | |
1702 /* #define AP_OPTS_RESERVED 0x00000200 */ | |
1703 /* #define AP_OPTS_RESERVED 0x00000100 */ | |
1704 /* #define AP_OPTS_RESERVED 0x00000080 */ | |
1705 /* #define AP_OPTS_RESERVED 0x00000040 */ | |
1706 /* #define AP_OPTS_RESERVED 0x00000020 */ | |
1707 /* #define AP_OPTS_RESERVED 0x00000010 */ | |
1708 /* #define AP_OPTS_RESERVED 0x00000008 */ | |
1709 /* #define AP_OPTS_RESERVED 0x00000004 */ | |
1710 | |
1711 | |
1712 #define AP_OPTS_WIRE_MASK 0xfffffff0 | |
1713 /** @} */ /* end of AP_OPTS group */ | |
1714 | |
1715 /* definitions for ad_type fields. */ | |
1716 #define AD_TYPE_RESERVED 0x8000 | |
1717 #define AD_TYPE_EXTERNAL 0x4000 | |
1718 #define AD_TYPE_REGISTERED 0x2000 | |
1719 | |
1720 #define AD_TYPE_FIELD_TYPE_MASK 0x1fff | |
1721 | |
1722 /* Ticket flags */ | |
1723 /* flags are 32 bits; each host is responsible to put the 4 bytes | |
1724 representing these bits into net order before transmission */ | |
1725 /* #define TKT_FLG_RESERVED 0x80000000 */ | |
1726 #define TKT_FLG_FORWARDABLE 0x40000000 | |
1727 #define TKT_FLG_FORWARDED 0x20000000 | |
1728 #define TKT_FLG_PROXIABLE 0x10000000 | |
1729 #define TKT_FLG_PROXY 0x08000000 | |
1730 #define TKT_FLG_MAY_POSTDATE 0x04000000 | |
1731 #define TKT_FLG_POSTDATED 0x02000000 | |
1732 #define TKT_FLG_INVALID 0x01000000 | |
1733 #define TKT_FLG_RENEWABLE 0x00800000 | |
1734 #define TKT_FLG_INITIAL 0x00400000 | |
1735 #define TKT_FLG_PRE_AUTH 0x00200000 | |
1736 #define TKT_FLG_HW_AUTH 0x00100000 | |
1737 #define TKT_FLG_TRANSIT_POLICY_CHECKED 0x00080000 | |
1738 #define TKT_FLG_OK_AS_DELEGATE 0x00040000 | |
1739 #define TKT_FLG_ENC_PA_REP 0x00010000 | |
1740 #define TKT_FLG_ANONYMOUS 0x00008000 | |
1741 /* #define TKT_FLG_RESERVED 0x00004000 */ | |
1742 /* #define TKT_FLG_RESERVED 0x00002000 */ | |
1743 /* #define TKT_FLG_RESERVED 0x00001000 */ | |
1744 /* #define TKT_FLG_RESERVED 0x00000800 */ | |
1745 /* #define TKT_FLG_RESERVED 0x00000400 */ | |
1746 /* #define TKT_FLG_RESERVED 0x00000200 */ | |
1747 /* #define TKT_FLG_RESERVED 0x00000100 */ | |
1748 /* #define TKT_FLG_RESERVED 0x00000080 */ | |
1749 /* #define TKT_FLG_RESERVED 0x00000040 */ | |
1750 /* #define TKT_FLG_RESERVED 0x00000020 */ | |
1751 /* #define TKT_FLG_RESERVED 0x00000010 */ | |
1752 /* #define TKT_FLG_RESERVED 0x00000008 */ | |
1753 /* #define TKT_FLG_RESERVED 0x00000004 */ | |
1754 /* #define TKT_FLG_RESERVED 0x00000002 */ | |
1755 /* #define TKT_FLG_RESERVED 0x00000001 */ | |
1756 | |
1757 /* definitions for lr_type fields. */ | |
1758 #define LR_TYPE_THIS_SERVER_ONLY 0x8000 | |
1759 | |
1760 #define LR_TYPE_INTERPRETATION_MASK 0x7fff | |
1761 | |
1762 /* definitions for msec direction bit for KRB_SAFE, KRB_PRIV */ | |
1763 #define MSEC_DIRBIT 0x8000 | |
1764 #define MSEC_VAL_MASK 0x7fff | |
1765 | |
1766 /* | |
1767 * end "fieldbits.h" | |
1768 */ | |
1769 | |
1770 /* | |
1771 * begin "proto.h" | |
1772 */ | |
1773 | |
1774 /** Protocol version number */ | |
1775 #define KRB5_PVNO 5 | |
1776 | |
1777 /* Message types */ | |
1778 | |
1779 #define KRB5_AS_REQ ((krb5_msgtype)10) /**< Initial authentication request */ | |
1780 #define KRB5_AS_REP ((krb5_msgtype)11) /**< Response to AS request */ | |
1781 #define KRB5_TGS_REQ ((krb5_msgtype)12) /**< Ticket granting server request */ | |
1782 #define KRB5_TGS_REP ((krb5_msgtype)13) /**< Response to TGS request */ | |
1783 #define KRB5_AP_REQ ((krb5_msgtype)14) /**< Auth req to application server */ | |
1784 #define KRB5_AP_REP ((krb5_msgtype)15) /**< Response to mutual AP request */ | |
1785 #define KRB5_SAFE ((krb5_msgtype)20) /**< Safe application message */ | |
1786 #define KRB5_PRIV ((krb5_msgtype)21) /**< Private application message */ | |
1787 #define KRB5_CRED ((krb5_msgtype)22) /**< Cred forwarding message */ | |
1788 #define KRB5_ERROR ((krb5_msgtype)30) /**< Error response */ | |
1789 | |
1790 /* LastReq types */ | |
1791 #define KRB5_LRQ_NONE 0 | |
1792 #define KRB5_LRQ_ALL_LAST_TGT 1 | |
1793 #define KRB5_LRQ_ONE_LAST_TGT (-1) | |
1794 #define KRB5_LRQ_ALL_LAST_INITIAL 2 | |
1795 #define KRB5_LRQ_ONE_LAST_INITIAL (-2) | |
1796 #define KRB5_LRQ_ALL_LAST_TGT_ISSUED 3 | |
1797 #define KRB5_LRQ_ONE_LAST_TGT_ISSUED (-3) | |
1798 #define KRB5_LRQ_ALL_LAST_RENEWAL 4 | |
1799 #define KRB5_LRQ_ONE_LAST_RENEWAL (-4) | |
1800 #define KRB5_LRQ_ALL_LAST_REQ 5 | |
1801 #define KRB5_LRQ_ONE_LAST_REQ (-5) | |
1802 #define KRB5_LRQ_ALL_PW_EXPTIME 6 | |
1803 #define KRB5_LRQ_ONE_PW_EXPTIME (-6) | |
1804 #define KRB5_LRQ_ALL_ACCT_EXPTIME 7 | |
1805 #define KRB5_LRQ_ONE_ACCT_EXPTIME (-7) | |
1806 | |
1807 /* PADATA types */ | |
1808 #define KRB5_PADATA_NONE 0 | |
1809 #define KRB5_PADATA_AP_REQ 1 | |
1810 #define KRB5_PADATA_TGS_REQ KRB5_PADATA_AP_REQ | |
1811 #define KRB5_PADATA_ENC_TIMESTAMP 2 /**< RFC 4120 */ | |
1812 #define KRB5_PADATA_PW_SALT 3 /**< RFC 4120 */ | |
1813 #if 0 /* Not used */ | |
1814 #define KRB5_PADATA_ENC_ENCKEY 4 /* Key encrypted within itself */ | |
1815 #endif | |
1816 #define KRB5_PADATA_ENC_UNIX_TIME 5 /**< timestamp encrypted in key. RFC 4120 */ | |
1817 #define KRB5_PADATA_ENC_SANDIA_SECURID 6 /**< SecurId passcode. RFC 4120 */ | |
1818 #define KRB5_PADATA_SESAME 7 /**< Sesame project. RFC 4120 */ | |
1819 #define KRB5_PADATA_OSF_DCE 8 /**< OSF DCE. RFC 4120 */ | |
1820 #define KRB5_CYBERSAFE_SECUREID 9 /**< Cybersafe. RFC 4120 */ | |
1821 #define KRB5_PADATA_AFS3_SALT 10 /**< Cygnus. RFC 4120, 3961 */ | |
1822 #define KRB5_PADATA_ETYPE_INFO 11 /**< Etype info for preauth. RFC 4120 */ | |
1823 #define KRB5_PADATA_SAM_CHALLENGE 12 /**< SAM/OTP */ | |
1824 #define KRB5_PADATA_SAM_RESPONSE 13 /**< SAM/OTP */ | |
1825 #define KRB5_PADATA_PK_AS_REQ_OLD 14 /**< PKINIT */ | |
1826 #define KRB5_PADATA_PK_AS_REP_OLD 15 /**< PKINIT */ | |
1827 #define KRB5_PADATA_PK_AS_REQ 16 /**< PKINIT. RFC 4556 */ | |
1828 #define KRB5_PADATA_PK_AS_REP 17 /**< PKINIT. RFC 4556 */ | |
1829 #define KRB5_PADATA_ETYPE_INFO2 19 /**< RFC 4120 */ | |
1830 #define KRB5_PADATA_USE_SPECIFIED_KVNO 20 /**< RFC 4120 */ | |
1831 #define KRB5_PADATA_SVR_REFERRAL_INFO 20 /**< Windows 2000 referrals. RFC 6820 */ | |
1832 #define KRB5_PADATA_SAM_REDIRECT 21 /**< SAM/OTP. RFC 4120 */ | |
1833 #define KRB5_PADATA_GET_FROM_TYPED_DATA 22 /**< Embedded in typed data. RFC 4120 */ | |
1834 #define KRB5_PADATA_REFERRAL 25 /**< draft referral system */ | |
1835 #define KRB5_PADATA_SAM_CHALLENGE_2 30 /**< draft challenge system, updated */ | |
1836 #define KRB5_PADATA_SAM_RESPONSE_2 31 /**< draft challenge system, updated */ | |
1837 /* MS-KILE */ | |
1838 #define KRB5_PADATA_PAC_REQUEST 128 /**< include Windows PAC */ | |
1839 #define KRB5_PADATA_FOR_USER 129 /**< username protocol transition request */ | |
1840 #define KRB5_PADATA_S4U_X509_USER 130 /**< certificate protocol transition request */ | |
1841 #define KRB5_PADATA_AS_CHECKSUM 132 /**< AS checksum */ | |
1842 #define KRB5_PADATA_FX_COOKIE 133 /**< RFC 6113 */ | |
1843 #define KRB5_PADATA_FX_FAST 136 /**< RFC 6113 */ | |
1844 #define KRB5_PADATA_FX_ERROR 137 /**< RFC 6113 */ | |
1845 #define KRB5_PADATA_ENCRYPTED_CHALLENGE 138 /**< RFC 6113 */ | |
1846 #define KRB5_PADATA_OTP_CHALLENGE 141 /**< RFC 6560 section 4.1 */ | |
1847 #define KRB5_PADATA_OTP_REQUEST 142 /**< RFC 6560 section 4.2 */ | |
1848 #define KRB5_PADATA_OTP_PIN_CHANGE 144 /**< RFC 6560 section 4.3 */ | |
1849 #define KRB5_PADATA_PKINIT_KX 147 /**< RFC 6112 */ | |
1850 #define KRB5_ENCPADATA_REQ_ENC_PA_REP 149 /**< RFC 6806 */ | |
1851 #define KRB5_PADATA_AS_FRESHNESS 150 /**< RFC 8070 */ | |
1852 #define KRB5_PADATA_SPAKE 151 | |
1853 #define KRB5_PADATA_REDHAT_IDP_OAUTH2 152 /**< Red Hat IdP mechanism */ | |
1854 #define KRB5_PADATA_PAC_OPTIONS 167 /**< MS-KILE and MS-SFU */ | |
1855 | |
1856 #define KRB5_SAM_USE_SAD_AS_KEY 0x80000000 | |
1857 #define KRB5_SAM_SEND_ENCRYPTED_SAD 0x40000000 | |
1858 #define KRB5_SAM_MUST_PK_ENCRYPT_SAD 0x20000000 /**< currently must be zero */ | |
1859 | |
1860 /** Transited encoding types */ | |
1861 #define KRB5_DOMAIN_X500_COMPRESS 1 | |
1862 | |
1863 /** alternate authentication types */ | |
1864 #define KRB5_ALTAUTH_ATT_CHALLENGE_RESPONSE 64 | |
1865 | |
1866 /* authorization data types. See RFC 4120 section 5.2.6 */ | |
1867 | |
1868 /** @defgroup KRB5_AUTHDATA KRB5_AUTHDATA | |
1869 * @{ | |
1870 */ | |
1871 #define KRB5_AUTHDATA_IF_RELEVANT 1 | |
1872 #define KRB5_AUTHDATA_KDC_ISSUED 4 | |
1873 #define KRB5_AUTHDATA_AND_OR 5 | |
1874 #define KRB5_AUTHDATA_MANDATORY_FOR_KDC 8 | |
1875 #define KRB5_AUTHDATA_INITIAL_VERIFIED_CAS 9 | |
1876 #define KRB5_AUTHDATA_OSF_DCE 64 | |
1877 #define KRB5_AUTHDATA_SESAME 65 | |
1878 #define KRB5_AUTHDATA_CAMMAC 96 | |
1879 #define KRB5_AUTHDATA_WIN2K_PAC 128 | |
1880 #define KRB5_AUTHDATA_ETYPE_NEGOTIATION 129 /**< RFC 4537 */ | |
1881 #define KRB5_AUTHDATA_SIGNTICKET 512 /**< @deprecated use PAC */ | |
1882 #define KRB5_AUTHDATA_FX_ARMOR 71 | |
1883 #define KRB5_AUTHDATA_AUTH_INDICATOR 97 | |
1884 #define KRB5_AUTHDATA_AP_OPTIONS 143 | |
1885 /** @} */ /* end of KRB5_AUTHDATA group */ | |
1886 | |
1887 /* password change constants */ | |
1888 #define KRB5_KPASSWD_SUCCESS 0 /**< Success */ | |
1889 #define KRB5_KPASSWD_MALFORMED 1 /**< Malformed request */ | |
1890 #define KRB5_KPASSWD_HARDERROR 2 /**< Server error */ | |
1891 #define KRB5_KPASSWD_AUTHERROR 3 /**< Authentication error */ | |
1892 #define KRB5_KPASSWD_SOFTERROR 4 /**< Password change rejected */ | |
1893 /* These are Microsoft's extensions in RFC 3244, and it looks like | |
1894 they'll become standardized, possibly with other additions. */ | |
1895 #define KRB5_KPASSWD_ACCESSDENIED 5 /**< Not authorized */ | |
1896 #define KRB5_KPASSWD_BAD_VERSION 6 /**< Unknown RPC version */ | |
1897 /** The presented credentials were not obtained using a password directly */ | |
1898 #define KRB5_KPASSWD_INITIAL_FLAG_NEEDED 7 | |
1899 | |
1900 /* | |
1901 * end "proto.h" | |
1902 */ | |
1903 | |
1904 /* Time set */ | |
1905 /** Ticket start time, end time, and renewal duration. */ | |
1906 typedef struct _krb5_ticket_times { | |
1907 krb5_timestamp authtime; /**< Time at which KDC issued the initial ticket that corresponds to this ticket */ | |
1908 /* XXX ? should ktime in KDC_REP == authtime | |
1909 in ticket? otherwise client can't get this */ | |
1910 krb5_timestamp starttime; /**< optional in ticket, if not present, use @a authtime */ | |
1911 krb5_timestamp endtime; /**< Ticket expiration time */ | |
1912 krb5_timestamp renew_till; /**< Latest time at which renewal of ticket can be valid */ | |
1913 } krb5_ticket_times; | |
1914 | |
1915 /** Structure for auth data */ | |
1916 typedef struct _krb5_authdata { | |
1917 krb5_magic magic; | |
1918 krb5_authdatatype ad_type; /**< ADTYPE */ | |
1919 unsigned int length; /**< Length of data */ | |
1920 krb5_octet *contents; /**< Data */ | |
1921 } krb5_authdata; | |
1922 | |
1923 /** Structure for transited encoding */ | |
1924 typedef struct _krb5_transited { | |
1925 krb5_magic magic; | |
1926 krb5_octet tr_type; /**< Transited encoding type */ | |
1927 krb5_data tr_contents; /**< Contents */ | |
1928 } krb5_transited; | |
1929 | |
1930 /** Encrypted part of ticket. */ | |
1931 typedef struct _krb5_enc_tkt_part { | |
1932 krb5_magic magic; | |
1933 /* to-be-encrypted portion */ | |
1934 krb5_flags flags; /**< flags */ | |
1935 krb5_keyblock *session; /**< session key: includes enctype */ | |
1936 krb5_principal client; /**< client name/realm */ | |
1937 krb5_transited transited; /**< list of transited realms */ | |
1938 krb5_ticket_times times; /**< auth, start, end, renew_till */ | |
1939 krb5_address **caddrs; /**< array of ptrs to addresses */ | |
1940 krb5_authdata **authorization_data; /**< auth data */ | |
1941 } krb5_enc_tkt_part; | |
1942 | |
1943 /** | |
1944 * Ticket structure. | |
1945 * | |
1946 * The C representation of the ticket message, with a pointer to the | |
1947 * C representation of the encrypted part. | |
1948 */ | |
1949 typedef struct _krb5_ticket { | |
1950 krb5_magic magic; | |
1951 /* cleartext portion */ | |
1952 krb5_principal server; /**< server name/realm */ | |
1953 krb5_enc_data enc_part; /**< encryption type, kvno, encrypted encoding */ | |
1954 krb5_enc_tkt_part *enc_part2; /**< ptr to decrypted version, if available */ | |
1955 } krb5_ticket; | |
1956 | |
1957 /* the unencrypted version */ | |
1958 /** | |
1959 * Ticket authenticator. | |
1960 * | |
1961 * The C representation of an unencrypted authenticator. | |
1962 */ | |
1963 typedef struct _krb5_authenticator { | |
1964 krb5_magic magic; | |
1965 krb5_principal client; /**< client name/realm */ | |
1966 krb5_checksum *checksum; /**< checksum, includes type, optional */ | |
1967 krb5_int32 cusec; /**< client usec portion */ | |
1968 krb5_timestamp ctime; /**< client sec portion */ | |
1969 krb5_keyblock *subkey; /**< true session key, optional */ | |
1970 krb5_ui_4 seq_number; /**< sequence #, optional */ | |
1971 krb5_authdata **authorization_data; /**< authoriazation data */ | |
1972 } krb5_authenticator; | |
1973 | |
1974 /** Ticket authentication data. */ | |
1975 typedef struct _krb5_tkt_authent { | |
1976 krb5_magic magic; | |
1977 krb5_ticket *ticket; | |
1978 krb5_authenticator *authenticator; | |
1979 krb5_flags ap_options; | |
1980 } krb5_tkt_authent; | |
1981 | |
1982 /** Credentials structure including ticket, session key, and lifetime info. */ | |
1983 typedef struct _krb5_creds { | |
1984 krb5_magic magic; | |
1985 krb5_principal client; /**< client's principal identifier */ | |
1986 krb5_principal server; /**< server's principal identifier */ | |
1987 krb5_keyblock keyblock; /**< session encryption key info */ | |
1988 krb5_ticket_times times; /**< lifetime info */ | |
1989 krb5_boolean is_skey; /**< true if ticket is encrypted in | |
1990 another ticket's skey */ | |
1991 krb5_flags ticket_flags; /**< flags in ticket */ | |
1992 krb5_address **addresses; /**< addrs in ticket */ | |
1993 krb5_data ticket; /**< ticket string itself */ | |
1994 krb5_data second_ticket; /**< second ticket, if related to | |
1995 ticket (via DUPLICATE-SKEY or | |
1996 ENC-TKT-IN-SKEY) */ | |
1997 krb5_authdata **authdata; /**< authorization data */ | |
1998 } krb5_creds; | |
1999 | |
2000 /** Last request entry */ | |
2001 typedef struct _krb5_last_req_entry { | |
2002 krb5_magic magic; | |
2003 krb5_int32 lr_type; /**< LR type */ | |
2004 krb5_timestamp value; /**< Timestamp */ | |
2005 } krb5_last_req_entry; | |
2006 | |
2007 /** Pre-authentication data */ | |
2008 typedef struct _krb5_pa_data { | |
2009 krb5_magic magic; | |
2010 krb5_preauthtype pa_type; /**< Preauthentication data type */ | |
2011 unsigned int length; /**< Length of data */ | |
2012 krb5_octet *contents; /**< Data */ | |
2013 } krb5_pa_data; | |
2014 | |
2015 /* Don't use this; use krb5_pa_data instead. */ | |
2016 typedef struct _krb5_typed_data { | |
2017 krb5_magic magic; | |
2018 krb5_int32 type; | |
2019 unsigned int length; | |
2020 krb5_octet *data; | |
2021 } krb5_typed_data; | |
2022 | |
2023 /** C representation of KDC-REQ protocol message, including KDC-REQ-BODY */ | |
2024 typedef struct _krb5_kdc_req { | |
2025 krb5_magic magic; | |
2026 krb5_msgtype msg_type; /**< KRB5_AS_REQ or KRB5_TGS_REQ */ | |
2027 krb5_pa_data **padata; /**< Preauthentication data */ | |
2028 /* real body */ | |
2029 krb5_flags kdc_options; /**< Requested options */ | |
2030 krb5_principal client; /**< Client principal and realm */ | |
2031 krb5_principal server; /**< Server principal and realm */ | |
2032 krb5_timestamp from; /**< Requested start time */ | |
2033 krb5_timestamp till; /**< Requested end time */ | |
2034 krb5_timestamp rtime; /**< Requested renewable end time */ | |
2035 krb5_int32 nonce; /**< Nonce to match request and response */ | |
2036 int nktypes; /**< Number of enctypes */ | |
2037 krb5_enctype *ktype; /**< Requested enctypes */ | |
2038 krb5_address **addresses; /**< Requested addresses (optional) */ | |
2039 krb5_enc_data authorization_data; /**< Encrypted authz data (optional) */ | |
2040 krb5_authdata **unenc_authdata; /**< Unencrypted authz data */ | |
2041 krb5_ticket **second_ticket; /**< Second ticket array (optional) */ | |
2042 } krb5_kdc_req; | |
2043 | |
2044 /** | |
2045 * C representation of @c EncKDCRepPart protocol message. | |
2046 * | |
2047 * This is the cleartext message that is encrypted and inserted in @c KDC-REP. | |
2048 */ | |
2049 typedef struct _krb5_enc_kdc_rep_part { | |
2050 krb5_magic magic; | |
2051 /* encrypted part: */ | |
2052 krb5_msgtype msg_type; /**< krb5 message type */ | |
2053 krb5_keyblock *session; /**< Session key */ | |
2054 krb5_last_req_entry **last_req; /**< Array of pointers to entries */ | |
2055 krb5_int32 nonce; /**< Nonce from request */ | |
2056 krb5_timestamp key_exp; /**< Expiration date */ | |
2057 krb5_flags flags; /**< Ticket flags */ | |
2058 krb5_ticket_times times; /**< Lifetime info */ | |
2059 krb5_principal server; /**< Server's principal identifier */ | |
2060 krb5_address **caddrs; /**< Array of ptrs to addrs, optional */ | |
2061 krb5_pa_data **enc_padata; /**< Encrypted preauthentication data */ | |
2062 } krb5_enc_kdc_rep_part; | |
2063 | |
2064 /** Representation of the @c KDC-REP protocol message. */ | |
2065 typedef struct _krb5_kdc_rep { | |
2066 krb5_magic magic; | |
2067 /* cleartext part: */ | |
2068 krb5_msgtype msg_type; /**< KRB5_AS_REP or KRB5_KDC_REP */ | |
2069 krb5_pa_data **padata; /**< Preauthentication data from KDC */ | |
2070 krb5_principal client; /**< Client principal and realm */ | |
2071 krb5_ticket *ticket; /**< Ticket */ | |
2072 krb5_enc_data enc_part; /**< Encrypted part of reply */ | |
2073 krb5_enc_kdc_rep_part *enc_part2; /**< Unencrypted version, if available */ | |
2074 } krb5_kdc_rep; | |
2075 | |
2076 /** Error message structure */ | |
2077 typedef struct _krb5_error { | |
2078 krb5_magic magic; | |
2079 /* some of these may be meaningless in certain contexts */ | |
2080 krb5_timestamp ctime; /**< Client sec portion; optional */ | |
2081 krb5_int32 cusec; /**< Client usec portion; optional */ | |
2082 krb5_int32 susec; /**< Server usec portion */ | |
2083 krb5_timestamp stime; /**< Server sec portion */ | |
2084 krb5_ui_4 error; /**< Error code (protocol error #'s) */ | |
2085 krb5_principal client; /**< Client principal and realm */ | |
2086 krb5_principal server; /**< Server principal and realm */ | |
2087 krb5_data text; /**< Descriptive text */ | |
2088 krb5_data e_data; /**< Additional error-describing data */ | |
2089 } krb5_error; | |
2090 | |
2091 /** Authentication header. */ | |
2092 typedef struct _krb5_ap_req { | |
2093 krb5_magic magic; | |
2094 krb5_flags ap_options; /**< Requested options */ | |
2095 krb5_ticket *ticket; /**< Ticket */ | |
2096 krb5_enc_data authenticator; /**< Encrypted authenticator */ | |
2097 } krb5_ap_req; | |
2098 | |
2099 /** | |
2100 * C representaton of AP-REP message. | |
2101 * | |
2102 * The server's response to a client's request for mutual authentication. | |
2103 */ | |
2104 typedef struct _krb5_ap_rep { | |
2105 krb5_magic magic; | |
2106 krb5_enc_data enc_part; /**< Ciphertext of ApRepEncPart */ | |
2107 } krb5_ap_rep; | |
2108 | |
2109 /** Cleartext that is encrypted and put into @c _krb5_ap_rep. */ | |
2110 typedef struct _krb5_ap_rep_enc_part { | |
2111 krb5_magic magic; | |
2112 krb5_timestamp ctime; /**< Client time, seconds portion */ | |
2113 krb5_int32 cusec; /**< Client time, microseconds portion */ | |
2114 krb5_keyblock *subkey; /**< Subkey (optional) */ | |
2115 krb5_ui_4 seq_number; /**< Sequence number */ | |
2116 } krb5_ap_rep_enc_part; | |
2117 | |
2118 /* Unused */ | |
2119 typedef struct _krb5_response { | |
2120 krb5_magic magic; | |
2121 krb5_octet message_type; | |
2122 krb5_data response; | |
2123 krb5_int32 expected_nonce; | |
2124 krb5_timestamp request_time; | |
2125 } krb5_response; | |
2126 | |
2127 /** Credentials information inserted into @c EncKrbCredPart. */ | |
2128 typedef struct _krb5_cred_info { | |
2129 krb5_magic magic; | |
2130 krb5_keyblock *session; /**< Session key used to encrypt ticket */ | |
2131 krb5_principal client; /**< Client principal and realm */ | |
2132 krb5_principal server; /**< Server principal and realm */ | |
2133 krb5_flags flags; /**< Ticket flags */ | |
2134 krb5_ticket_times times; /**< Auth, start, end, renew_till */ | |
2135 krb5_address **caddrs; /**< Array of pointers to addrs (optional) */ | |
2136 } krb5_cred_info; | |
2137 | |
2138 /** Cleartext credentials information. */ | |
2139 typedef struct _krb5_cred_enc_part { | |
2140 krb5_magic magic; | |
2141 krb5_int32 nonce; /**< Nonce (optional) */ | |
2142 krb5_timestamp timestamp; /**< Generation time, seconds portion */ | |
2143 krb5_int32 usec; /**< Generation time, microseconds portion */ | |
2144 krb5_address *s_address; /**< Sender address (optional) */ | |
2145 krb5_address *r_address; /**< Recipient address (optional) */ | |
2146 krb5_cred_info **ticket_info; | |
2147 } krb5_cred_enc_part; | |
2148 | |
2149 /** Credentials data structure.*/ | |
2150 typedef struct _krb5_cred { | |
2151 krb5_magic magic; | |
2152 krb5_ticket **tickets; /**< Tickets */ | |
2153 krb5_enc_data enc_part; /**< Encrypted part */ | |
2154 krb5_cred_enc_part *enc_part2; /**< Unencrypted version, if available */ | |
2155 } krb5_cred; | |
2156 | |
2157 /* Unused, but here for API compatibility. */ | |
2158 typedef struct _passwd_phrase_element { | |
2159 krb5_magic magic; | |
2160 krb5_data *passwd; | |
2161 krb5_data *phrase; | |
2162 } passwd_phrase_element; | |
2163 | |
2164 /* Unused, but here for API compatibility. */ | |
2165 typedef struct _krb5_pwd_data { | |
2166 krb5_magic magic; | |
2167 int sequence_count; | |
2168 passwd_phrase_element **element; | |
2169 } krb5_pwd_data; | |
2170 | |
2171 /* Unused, but here for API compatibility. */ | |
2172 typedef struct _krb5_pa_svr_referral_data { | |
2173 /** Referred name, only realm is required */ | |
2174 krb5_principal principal; | |
2175 } krb5_pa_svr_referral_data; | |
2176 | |
2177 /* Unused, but here for API compatibility. */ | |
2178 typedef struct _krb5_pa_server_referral_data { | |
2179 krb5_data *referred_realm; | |
2180 krb5_principal true_principal_name; | |
2181 krb5_principal requested_principal_name; | |
2182 krb5_timestamp referral_valid_until; | |
2183 krb5_checksum rep_cksum; | |
2184 } krb5_pa_server_referral_data; | |
2185 | |
2186 typedef struct _krb5_pa_pac_req { | |
2187 /** TRUE if a PAC should be included in TGS-REP */ | |
2188 krb5_boolean include_pac; | |
2189 } krb5_pa_pac_req; | |
2190 | |
2191 /* | |
2192 * begin "safepriv.h" | |
2193 */ | |
2194 | |
2195 /** @defgroup KRB5_AUTH_CONTEXT KRB5_AUTH_CONTEXT | |
2196 * @{ | |
2197 */ | |
2198 /** Prevent replays with timestamps and replay cache. */ | |
2199 #define KRB5_AUTH_CONTEXT_DO_TIME 0x00000001 | |
2200 /** Save timestamps for application. */ | |
2201 #define KRB5_AUTH_CONTEXT_RET_TIME 0x00000002 | |
2202 /** Prevent replays with sequence numbers. */ | |
2203 #define KRB5_AUTH_CONTEXT_DO_SEQUENCE 0x00000004 | |
2204 /** Save sequence numbers for application. */ | |
2205 #define KRB5_AUTH_CONTEXT_RET_SEQUENCE 0x00000008 | |
2206 #define KRB5_AUTH_CONTEXT_PERMIT_ALL 0x00000010 | |
2207 #define KRB5_AUTH_CONTEXT_USE_SUBKEY 0x00000020 | |
2208 /** @} */ /* end of KRB5_AUTH_CONTEXT group */ | |
2209 | |
2210 /** | |
2211 * Replay data. | |
2212 * | |
2213 * Sequence number and timestamp information output by krb5_rd_priv() and | |
2214 * krb5_rd_safe(). | |
2215 */ | |
2216 typedef struct krb5_replay_data { | |
2217 krb5_timestamp timestamp; /**< Timestamp, seconds portion */ | |
2218 krb5_int32 usec; /**< Timestamp, microseconds portion */ | |
2219 krb5_ui_4 seq; /**< Sequence number */ | |
2220 } krb5_replay_data; | |
2221 | |
2222 /* Flags for krb5_auth_con_genaddrs(). */ | |
2223 | |
2224 /** Generate the local network address. */ | |
2225 #define KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR 0x00000001 | |
2226 /** Generate the remote network address. */ | |
2227 #define KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR 0x00000002 | |
2228 /** Generate the local network address and the local port. */ | |
2229 #define KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR 0x00000004 | |
2230 /** Generate the remote network address and the remote port. */ | |
2231 #define KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR 0x00000008 | |
2232 | |
2233 /** Type of function used as a callback to generate checksum data for mk_req */ | |
2234 typedef krb5_error_code | |
2235 (KRB5_CALLCONV * krb5_mk_req_checksum_func)(krb5_context, krb5_auth_context, | |
2236 void *, krb5_data **); | |
2237 | |
2238 /* | |
2239 * end "safepriv.h" | |
2240 */ | |
2241 | |
2242 | |
2243 /* | |
2244 * begin "ccache.h" | |
2245 */ | |
2246 | |
2247 /** Cursor for sequential lookup */ | |
2248 typedef krb5_pointer krb5_cc_cursor; | |
2249 | |
2250 struct _krb5_ccache; | |
2251 typedef struct _krb5_ccache *krb5_ccache; | |
2252 struct _krb5_cc_ops; | |
2253 typedef struct _krb5_cc_ops krb5_cc_ops; | |
2254 | |
2255 struct _krb5_cccol_cursor; | |
2256 /** Cursor for iterating over all ccaches */ | |
2257 typedef struct _krb5_cccol_cursor *krb5_cccol_cursor; | |
2258 | |
2259 /* Flags for krb5_cc_retrieve_cred. */ | |
2260 /** The requested lifetime must be at least as great as the time specified. */ | |
2261 #define KRB5_TC_MATCH_TIMES 0x00000001 | |
2262 /** The is_skey field must match exactly. */ | |
2263 #define KRB5_TC_MATCH_IS_SKEY 0x00000002 | |
2264 /** All the flags set in the match credentials must be set. */ | |
2265 #define KRB5_TC_MATCH_FLAGS 0x00000004 | |
2266 /** All the time fields must match exactly. */ | |
2267 #define KRB5_TC_MATCH_TIMES_EXACT 0x00000008 | |
2268 /** All the flags must match exactly. */ | |
2269 #define KRB5_TC_MATCH_FLAGS_EXACT 0x00000010 | |
2270 /** The authorization data must match. */ | |
2271 #define KRB5_TC_MATCH_AUTHDATA 0x00000020 | |
2272 /** Only the name portion of the principal name must match. */ | |
2273 #define KRB5_TC_MATCH_SRV_NAMEONLY 0x00000040 | |
2274 /** The second ticket must match. */ | |
2275 #define KRB5_TC_MATCH_2ND_TKT 0x00000080 | |
2276 /** The encryption key type must match. */ | |
2277 #define KRB5_TC_MATCH_KTYPE 0x00000100 | |
2278 /** The supported key types must match. */ | |
2279 #define KRB5_TC_SUPPORTED_KTYPES 0x00000200 | |
2280 | |
2281 /* Flags for krb5_cc_set_flags and similar. */ | |
2282 /** Open and close the file for each cache operation. */ | |
2283 #define KRB5_TC_OPENCLOSE 0x00000001 /**< @deprecated has no effect */ | |
2284 #define KRB5_TC_NOTICKET 0x00000002 | |
2285 | |
2286 /** | |
2287 * Retrieve the name, but not type of a credential cache. | |
2288 * | |
2289 * @param [in] context Library context | |
2290 * @param [in] cache Credential cache handle | |
2291 * | |
2292 * @warning Returns the name of the credential cache. The result is an alias | |
2293 * into @a cache and should not be freed or modified by the caller. This name | |
2294 * does not include the cache type, so should not be used as input to | |
2295 * krb5_cc_resolve(). | |
2296 * | |
2297 * @return | |
2298 * On success - the name of the credential cache. | |
2299 */ | |
2300 const char * KRB5_CALLCONV | |
2301 krb5_cc_get_name(krb5_context context, krb5_ccache cache); | |
2302 | |
2303 /** | |
2304 * Retrieve the full name of a credential cache. | |
2305 * | |
2306 * @param [in] context Library context | |
2307 * @param [in] cache Credential cache handle | |
2308 * @param [out] fullname_out Full name of cache | |
2309 * | |
2310 * Use krb5_free_string() to free @a fullname_out when it is no longer needed. | |
2311 * | |
2312 * @version New in 1.10 | |
2313 */ | |
2314 krb5_error_code KRB5_CALLCONV | |
2315 krb5_cc_get_full_name(krb5_context context, krb5_ccache cache, | |
2316 char **fullname_out); | |
2317 | |
2318 #if KRB5_DEPRECATED | |
2319 krb5_error_code KRB5_CALLCONV | |
2320 krb5_cc_gen_new(krb5_context context, krb5_ccache *cache); | |
2321 #endif /* KRB5_DEPRECATED */ | |
2322 | |
2323 /** | |
2324 * Initialize a credential cache. | |
2325 * | |
2326 * @param [in] context Library context | |
2327 * @param [in] cache Credential cache handle | |
2328 * @param [in] principal Default principal name | |
2329 * | |
2330 * Destroy any existing contents of @a cache and initialize it for the default | |
2331 * principal @a principal. | |
2332 * | |
2333 * @retval | |
2334 * 0 Success | |
2335 * @return | |
2336 * System errors; Permission errors; Kerberos error codes | |
2337 */ | |
2338 krb5_error_code KRB5_CALLCONV | |
2339 krb5_cc_initialize(krb5_context context, krb5_ccache cache, | |
2340 krb5_principal principal); | |
2341 | |
2342 /** | |
2343 * Destroy a credential cache. | |
2344 * | |
2345 * @param [in] context Library context | |
2346 * @param [in] cache Credential cache handle | |
2347 * | |
2348 * This function destroys any existing contents of @a cache and closes the | |
2349 * handle to it. | |
2350 * | |
2351 * @retval | |
2352 * 0 Success | |
2353 * @return | |
2354 * Permission errors | |
2355 */ | |
2356 krb5_error_code KRB5_CALLCONV | |
2357 krb5_cc_destroy(krb5_context context, krb5_ccache cache); | |
2358 | |
2359 /** | |
2360 * Close a credential cache handle. | |
2361 * | |
2362 * @param [in] context Library context | |
2363 * @param [in] cache Credential cache handle | |
2364 * | |
2365 * This function closes a credential cache handle @a cache without affecting | |
2366 * the contents of the cache. | |
2367 * | |
2368 * @retval | |
2369 * 0 Success | |
2370 * @return | |
2371 * Kerberos error codes | |
2372 */ | |
2373 krb5_error_code KRB5_CALLCONV | |
2374 krb5_cc_close(krb5_context context, krb5_ccache cache); | |
2375 | |
2376 /** | |
2377 * Store credentials in a credential cache. | |
2378 * | |
2379 * @param [in] context Library context | |
2380 * @param [in] cache Credential cache handle | |
2381 * @param [in] creds Credentials to be stored in cache | |
2382 * | |
2383 * This function stores @a creds into @a cache. If @a creds->server and the | |
2384 * server in the decoded ticket @a creds->ticket differ, the credentials will | |
2385 * be stored under both server principal names. | |
2386 * | |
2387 * @retval | |
2388 * 0 Success | |
2389 * @return Permission errors; storage failure errors; Kerberos error codes | |
2390 */ | |
2391 krb5_error_code KRB5_CALLCONV | |
2392 krb5_cc_store_cred(krb5_context context, krb5_ccache cache, krb5_creds *creds); | |
2393 | |
2394 /** | |
2395 * Retrieve a specified credentials from a credential cache. | |
2396 * | |
2397 * @param [in] context Library context | |
2398 * @param [in] cache Credential cache handle | |
2399 * @param [in] flags Flags bit mask | |
2400 * @param [in] mcreds Credentials to match | |
2401 * @param [out] creds Credentials matching the requested value | |
2402 * | |
2403 * This function searches a credential cache for credentials matching @a mcreds | |
2404 * and returns it if found. | |
2405 * | |
2406 * Valid values for @a flags are: | |
2407 * | |
2408 * @li #KRB5_TC_MATCH_TIMES The requested lifetime must be at least as | |
2409 * great as in @a mcreds . | |
2410 * @li #KRB5_TC_MATCH_IS_SKEY The @a is_skey field much match exactly. | |
2411 * @li #KRB5_TC_MATCH_FLAGS Flags set in @a mcreds must be set. | |
2412 * @li #KRB5_TC_MATCH_TIMES_EXACT The requested lifetime must match exactly. | |
2413 * @li #KRB5_TC_MATCH_FLAGS_EXACT Flags must match exactly. | |
2414 * @li #KRB5_TC_MATCH_AUTHDATA The authorization data must match. | |
2415 * @li #KRB5_TC_MATCH_SRV_NAMEONLY Only the name portion of the principal | |
2416 * name must match, not the realm. | |
2417 * @li #KRB5_TC_MATCH_2ND_TKT The second tickets must match. | |
2418 * @li #KRB5_TC_MATCH_KTYPE The encryption key types must match. | |
2419 * @li #KRB5_TC_SUPPORTED_KTYPES Check all matching entries that have any | |
2420 * supported encryption type and return the | |
2421 * one with the encryption type listed earliest. | |
2422 * | |
2423 * Use krb5_free_cred_contents() to free @a creds when it is no longer needed. | |
2424 * | |
2425 * @retval 0 Success; otherwise - Kerberos error codes | |
2426 */ | |
2427 krb5_error_code KRB5_CALLCONV | |
2428 krb5_cc_retrieve_cred(krb5_context context, krb5_ccache cache, | |
2429 krb5_flags flags, krb5_creds *mcreds, | |
2430 krb5_creds *creds); | |
2431 | |
2432 /** | |
2433 * Get the default principal of a credential cache. | |
2434 * | |
2435 * @param [in] context Library context | |
2436 * @param [in] cache Credential cache handle | |
2437 * @param [out] principal Primary principal | |
2438 * | |
2439 * Returns the default client principal of a credential cache as set by | |
2440 * krb5_cc_initialize(). | |
2441 * | |
2442 * Use krb5_free_principal() to free @a principal when it is no longer needed. | |
2443 * | |
2444 * @retval | |
2445 * 0 Success | |
2446 * @return | |
2447 * Kerberos error codes | |
2448 */ | |
2449 krb5_error_code KRB5_CALLCONV | |
2450 krb5_cc_get_principal(krb5_context context, krb5_ccache cache, | |
2451 krb5_principal *principal); | |
2452 | |
2453 /** | |
2454 * Prepare to sequentially read every credential in a credential cache. | |
2455 * | |
2456 * @param [in] context Library context | |
2457 * @param [in] cache Credential cache handle | |
2458 * @param [out] cursor Cursor | |
2459 * | |
2460 * krb5_cc_end_seq_get() must be called to complete the retrieve operation. | |
2461 * | |
2462 * @note If the cache represented by @a cache is modified between the time of | |
2463 * the call to this function and the time of the final krb5_cc_end_seq_get(), | |
2464 * these changes may not be reflected in the results of krb5_cc_next_cred() | |
2465 * calls. | |
2466 * | |
2467 * @retval 0 Success; otherwise - Kerberos error codes | |
2468 */ | |
2469 krb5_error_code KRB5_CALLCONV | |
2470 krb5_cc_start_seq_get(krb5_context context, krb5_ccache cache, | |
2471 krb5_cc_cursor *cursor); | |
2472 | |
2473 /** | |
2474 * Retrieve the next entry from the credential cache. | |
2475 * | |
2476 * @param [in] context Library context | |
2477 * @param [in] cache Credential cache handle | |
2478 * @param [in] cursor Cursor | |
2479 * @param [out] creds Next credential cache entry | |
2480 * | |
2481 * This function fills in @a creds with the next entry in @a cache and advances | |
2482 * @a cursor. | |
2483 * | |
2484 * Use krb5_free_cred_contents() to free @a creds when it is no longer needed. | |
2485 * | |
2486 * @sa krb5_cc_start_seq_get(), krb5_end_seq_get() | |
2487 * | |
2488 * @retval 0 Success; otherwise - Kerberos error codes | |
2489 */ | |
2490 krb5_error_code KRB5_CALLCONV | |
2491 krb5_cc_next_cred(krb5_context context, krb5_ccache cache, | |
2492 krb5_cc_cursor *cursor, krb5_creds *creds); | |
2493 | |
2494 /** | |
2495 * Finish a series of sequential processing credential cache entries. | |
2496 * | |
2497 * @param [in] context Library context | |
2498 * @param [in] cache Credential cache handle | |
2499 * @param [in] cursor Cursor | |
2500 * | |
2501 * This function finishes processing credential cache entries and invalidates | |
2502 * @a cursor. | |
2503 * | |
2504 * @sa krb5_cc_start_seq_get(), krb5_cc_next_cred() | |
2505 * | |
2506 * @retval 0 (always) | |
2507 */ | |
2508 krb5_error_code KRB5_CALLCONV | |
2509 krb5_cc_end_seq_get(krb5_context context, krb5_ccache cache, | |
2510 krb5_cc_cursor *cursor); | |
2511 | |
2512 /** | |
2513 * Remove credentials from a credential cache. | |
2514 * | |
2515 * @param [in] context Library context | |
2516 * @param [in] cache Credential cache handle | |
2517 * @param [in] flags Bitwise-ORed search flags | |
2518 * @param [in] creds Credentials to be matched | |
2519 * | |
2520 * @warning This function is not implemented for some cache types. | |
2521 * | |
2522 * This function accepts the same flag values as krb5_cc_retrieve_cred(). | |
2523 * | |
2524 * @retval KRB5_CC_NOSUPP Not implemented for this cache type | |
2525 * @return No matches found; Data cannot be deleted; Kerberos error codes | |
2526 */ | |
2527 krb5_error_code KRB5_CALLCONV | |
2528 krb5_cc_remove_cred(krb5_context context, krb5_ccache cache, krb5_flags flags, | |
2529 krb5_creds *creds); | |
2530 | |
2531 /** | |
2532 * Set options flags on a credential cache. | |
2533 * | |
2534 * @param [in] context Library context | |
2535 * @param [in] cache Credential cache handle | |
2536 * @param [in] flags Flag bit mask | |
2537 * | |
2538 * This function resets @a cache flags to @a flags. | |
2539 * | |
2540 * @retval 0 Success; otherwise - Kerberos error codes | |
2541 */ | |
2542 krb5_error_code KRB5_CALLCONV | |
2543 krb5_cc_set_flags(krb5_context context, krb5_ccache cache, krb5_flags flags); | |
2544 | |
2545 /** | |
2546 * Retrieve flags from a credential cache structure. | |
2547 * | |
2548 * @param [in] context Library context | |
2549 * @param [in] cache Credential cache handle | |
2550 * @param [out] flags Flag bit mask | |
2551 * | |
2552 * @warning For memory credential cache always returns a flag mask of 0. | |
2553 * | |
2554 * @retval 0 Success; otherwise - Kerberos error codes | |
2555 */ | |
2556 krb5_error_code KRB5_CALLCONV | |
2557 krb5_cc_get_flags(krb5_context context, krb5_ccache cache, krb5_flags *flags); | |
2558 | |
2559 /** | |
2560 * Retrieve the type of a credential cache. | |
2561 * | |
2562 * @param [in] context Library context | |
2563 * @param [in] cache Credential cache handle | |
2564 * | |
2565 * @return The type of a credential cache as an alias that must not be modified | |
2566 * or freed by the caller. | |
2567 */ | |
2568 const char * KRB5_CALLCONV | |
2569 krb5_cc_get_type(krb5_context context, krb5_ccache cache); | |
2570 | |
2571 /** | |
2572 * Move a credential cache. | |
2573 * | |
2574 * @param [in] context Library context | |
2575 * @param [in] src The credential cache to move the content from | |
2576 * @param [in] dst The credential cache to move the content to | |
2577 * | |
2578 * This function reinitializes @a dst and populates it with the credentials and | |
2579 * default principal of @a src; then, if successful, destroys @a src. | |
2580 * | |
2581 * @retval | |
2582 * 0 Success; @a src is closed. | |
2583 * @return | |
2584 * Kerberos error codes; @a src is still allocated. | |
2585 */ | |
2586 krb5_error_code KRB5_CALLCONV | |
2587 krb5_cc_move(krb5_context context, krb5_ccache src, krb5_ccache dst); | |
2588 | |
2589 /** | |
2590 * Prepare to iterate over the collection of known credential caches. | |
2591 * | |
2592 * @param [in] context Library context | |
2593 * @param [out] cursor Cursor | |
2594 * | |
2595 * Get a new cache iteration @a cursor that will iterate over all known | |
2596 * credential caches independent of type. | |
2597 * | |
2598 * Use krb5_cccol_cursor_free() to release @a cursor when it is no longer | |
2599 * needed. | |
2600 * | |
2601 * @sa krb5_cccol_cursor_next() | |
2602 * | |
2603 * @retval 0 Success; otherwise - Kerberos error codes | |
2604 */ | |
2605 krb5_error_code KRB5_CALLCONV | |
2606 krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor); | |
2607 | |
2608 /** | |
2609 * Get the next credential cache in the collection. | |
2610 * | |
2611 * @param [in] context Library context | |
2612 * @param [in] cursor Cursor | |
2613 * @param [out] ccache Credential cache handle | |
2614 * | |
2615 * @note When all caches are iterated over and the end of the list is reached, | |
2616 * @a ccache is set to NULL. | |
2617 * | |
2618 * Use krb5_cc_close() to close @a ccache when it is no longer needed. | |
2619 * | |
2620 * @sa krb5_cccol_cursor_new(), krb5_cccol_cursor_free() | |
2621 * | |
2622 * @retval 0 Success; otherwise - Kerberos error codes | |
2623 */ | |
2624 krb5_error_code KRB5_CALLCONV | |
2625 krb5_cccol_cursor_next(krb5_context context, krb5_cccol_cursor cursor, | |
2626 krb5_ccache *ccache); | |
2627 | |
2628 /** | |
2629 * Free a credential cache collection cursor. | |
2630 * | |
2631 * @param [in] context Library context | |
2632 * @param [in] cursor Cursor | |
2633 * | |
2634 * @sa krb5_cccol_cursor_new(), krb5_cccol_cursor_next() | |
2635 * | |
2636 * @retval 0 Success; otherwise - Kerberos error codes | |
2637 */ | |
2638 krb5_error_code KRB5_CALLCONV | |
2639 krb5_cccol_cursor_free(krb5_context context, krb5_cccol_cursor *cursor); | |
2640 | |
2641 /** | |
2642 * Check if the credential cache collection contains any initialized caches. | |
2643 * | |
2644 * @param [in] context Library context | |
2645 * | |
2646 * @version New in 1.11 | |
2647 * | |
2648 * @retval 0 At least one initialized cache is present in the collection | |
2649 * @retval KRB5_CC_NOTFOUND The collection contains no caches | |
2650 */ | |
2651 krb5_error_code KRB5_CALLCONV | |
2652 krb5_cccol_have_content(krb5_context context); | |
2653 | |
2654 /** | |
2655 * Create a new credential cache of the specified type with a unique name. | |
2656 * | |
2657 * @param [in] context Library context | |
2658 * @param [in] type Credential cache type name | |
2659 * @param [in] hint Unused | |
2660 * @param [out] id Credential cache handle | |
2661 * | |
2662 * @retval | |
2663 * 0 Success | |
2664 * @return | |
2665 * Kerberos error codes | |
2666 */ | |
2667 krb5_error_code KRB5_CALLCONV | |
2668 krb5_cc_new_unique(krb5_context context, const char *type, const char *hint, | |
2669 krb5_ccache *id); | |
2670 | |
2671 /* | |
2672 * end "ccache.h" | |
2673 */ | |
2674 | |
2675 /* | |
2676 * begin "rcache.h" | |
2677 */ | |
2678 | |
2679 struct krb5_rc_st; | |
2680 typedef struct krb5_rc_st *krb5_rcache; | |
2681 | |
2682 /* | |
2683 * end "rcache.h" | |
2684 */ | |
2685 | |
2686 /* | |
2687 * begin "keytab.h" | |
2688 */ | |
2689 | |
2690 | |
2691 /* XXX */ | |
2692 #define MAX_KEYTAB_NAME_LEN 1100 /**< Long enough for MAXPATHLEN + some extra */ | |
2693 | |
2694 typedef krb5_pointer krb5_kt_cursor; | |
2695 | |
2696 /** A key table entry. */ | |
2697 typedef struct krb5_keytab_entry_st { | |
2698 krb5_magic magic; | |
2699 krb5_principal principal; /**< Principal of this key */ | |
2700 krb5_timestamp timestamp; /**< Time entry written to keytable */ | |
2701 krb5_kvno vno; /**< Key version number */ | |
2702 krb5_keyblock key; /**< The secret key */ | |
2703 } krb5_keytab_entry; | |
2704 | |
2705 struct _krb5_kt; | |
2706 typedef struct _krb5_kt *krb5_keytab; | |
2707 | |
2708 /** | |
2709 * Return the type of a key table. | |
2710 * | |
2711 * @param [in] context Library context | |
2712 * @param [in] keytab Key table handle | |
2713 * | |
2714 * @return The type of a key table as an alias that must not be modified or | |
2715 * freed by the caller. | |
2716 */ | |
2717 const char * KRB5_CALLCONV | |
2718 krb5_kt_get_type(krb5_context context, krb5_keytab keytab); | |
2719 | |
2720 /** | |
2721 * Get a key table name. | |
2722 * | |
2723 * @param [in] context Library context | |
2724 * @param [in] keytab Key table handle | |
2725 * @param [out] name Key table name | |
2726 * @param [in] namelen Maximum length to fill in name | |
2727 * | |
2728 * Fill @a name with the name of @a keytab including the type and delimiter. | |
2729 * | |
2730 * @sa MAX_KEYTAB_NAME_LEN | |
2731 * | |
2732 * @retval | |
2733 * 0 Success | |
2734 * @retval | |
2735 * KRB5_KT_NAME_TOOLONG Key table name does not fit in @a namelen bytes | |
2736 * | |
2737 * @return | |
2738 * Kerberos error codes | |
2739 */ | |
2740 krb5_error_code KRB5_CALLCONV | |
2741 krb5_kt_get_name(krb5_context context, krb5_keytab keytab, char *name, | |
2742 unsigned int namelen); | |
2743 | |
2744 /** | |
2745 * Close a key table handle. | |
2746 * | |
2747 * @param [in] context Library context | |
2748 * @param [in] keytab Key table handle | |
2749 * | |
2750 * @retval 0 | |
2751 */ | |
2752 krb5_error_code KRB5_CALLCONV | |
2753 krb5_kt_close(krb5_context context, krb5_keytab keytab); | |
2754 | |
2755 /** | |
2756 * Get an entry from a key table. | |
2757 * | |
2758 * @param [in] context Library context | |
2759 * @param [in] keytab Key table handle | |
2760 * @param [in] principal Principal name | |
2761 * @param [in] vno Key version number (0 for highest available) | |
2762 * @param [in] enctype Encryption type (0 zero for any enctype) | |
2763 * @param [out] entry Returned entry from key table | |
2764 * | |
2765 * Retrieve an entry from a key table which matches the @a keytab, @a | |
2766 * principal, @a vno, and @a enctype. If @a vno is zero, retrieve the | |
2767 * highest-numbered kvno matching the other fields. If @a enctype is 0, match | |
2768 * any enctype. | |
2769 * | |
2770 * Use krb5_free_keytab_entry_contents() to free @a entry when it is no longer | |
2771 * needed. | |
2772 * | |
2773 * @note If @a vno is zero, the function retrieves the highest-numbered-kvno | |
2774 * entry that matches the specified principal. | |
2775 * | |
2776 * @retval | |
2777 * 0 Success | |
2778 * @retval | |
2779 * Kerberos error codes on failure | |
2780 */ | |
2781 krb5_error_code KRB5_CALLCONV | |
2782 krb5_kt_get_entry(krb5_context context, krb5_keytab keytab, | |
2783 krb5_const_principal principal, krb5_kvno vno, | |
2784 krb5_enctype enctype, krb5_keytab_entry *entry); | |
2785 | |
2786 /** | |
2787 * Start a sequential retrieval of key table entries. | |
2788 * | |
2789 * @param [in] context Library context | |
2790 * @param [in] keytab Key table handle | |
2791 * @param [out] cursor Cursor | |
2792 * | |
2793 * Prepare to read sequentially every key in the specified key table. Use | |
2794 * krb5_kt_end_seq_get() to release the cursor when it is no longer needed. | |
2795 * | |
2796 * @sa krb5_kt_next_entry(), krb5_kt_end_seq_get() | |
2797 * | |
2798 * @retval | |
2799 * 0 Success | |
2800 * @return | |
2801 * Kerberos error codes | |
2802 */ | |
2803 krb5_error_code KRB5_CALLCONV | |
2804 krb5_kt_start_seq_get(krb5_context context, krb5_keytab keytab, | |
2805 krb5_kt_cursor *cursor); | |
2806 | |
2807 /** | |
2808 * Retrieve the next entry from the key table. | |
2809 * | |
2810 * @param [in] context Library context | |
2811 * @param [in] keytab Key table handle | |
2812 * @param [out] entry Returned key table entry | |
2813 * @param [in] cursor Key table cursor | |
2814 * | |
2815 * Return the next sequential entry in @a keytab and advance @a cursor. | |
2816 * Callers must release the returned entry with krb5_kt_free_entry(). | |
2817 * | |
2818 * @sa krb5_kt_start_seq_get(), krb5_kt_end_seq_get() | |
2819 * | |
2820 * @retval | |
2821 * 0 Success | |
2822 * @retval | |
2823 * KRB5_KT_END - if the last entry was reached | |
2824 * @return | |
2825 * Kerberos error codes | |
2826 */ | |
2827 krb5_error_code KRB5_CALLCONV | |
2828 krb5_kt_next_entry(krb5_context context, krb5_keytab keytab, | |
2829 krb5_keytab_entry *entry, krb5_kt_cursor *cursor); | |
2830 | |
2831 /** | |
2832 * Release a keytab cursor. | |
2833 * | |
2834 * @param [in] context Library context | |
2835 * @param [in] keytab Key table handle | |
2836 * @param [out] cursor Cursor | |
2837 * | |
2838 * This function should be called to release the cursor created by | |
2839 * krb5_kt_start_seq_get(). | |
2840 * | |
2841 * @retval | |
2842 * 0 Success | |
2843 * @return | |
2844 * Kerberos error codes | |
2845 */ | |
2846 krb5_error_code KRB5_CALLCONV | |
2847 krb5_kt_end_seq_get(krb5_context context, krb5_keytab keytab, | |
2848 krb5_kt_cursor *cursor); | |
2849 | |
2850 /** | |
2851 * Check if a keytab exists and contains entries. | |
2852 * | |
2853 * @param [in] context Library context | |
2854 * @param [in] keytab Key table handle | |
2855 * | |
2856 * @version New in 1.11 | |
2857 * | |
2858 * @retval 0 Keytab exists and contains entries | |
2859 * @retval KRB5_KT_NOTFOUND Keytab does not contain entries | |
2860 */ | |
2861 krb5_error_code KRB5_CALLCONV | |
2862 krb5_kt_have_content(krb5_context context, krb5_keytab keytab); | |
2863 | |
2864 /* | |
2865 * end "keytab.h" | |
2866 */ | |
2867 | |
2868 /* | |
2869 * begin "func-proto.h" | |
2870 */ | |
2871 | |
2872 #define KRB5_INIT_CONTEXT_SECURE 0x1 /**< Use secure context configuration */ | |
2873 #define KRB5_INIT_CONTEXT_KDC 0x2 /**< Use KDC configuration if available */ | |
2874 | |
2875 /** | |
2876 * Create a krb5 library context. | |
2877 * | |
2878 * @param [out] context Library context | |
2879 * | |
2880 * The @a context must be released by calling krb5_free_context() when | |
2881 * it is no longer needed. | |
2882 * | |
2883 * @warning Any program or module that needs the Kerberos code to not trust the | |
2884 * environment must use krb5_init_secure_context(), or clean out the | |
2885 * environment. | |
2886 * | |
2887 * @retval | |
2888 * 0 Success | |
2889 * @return | |
2890 * Kerberos error codes | |
2891 */ | |
2892 krb5_error_code KRB5_CALLCONV | |
2893 krb5_init_context(krb5_context *context); | |
2894 | |
2895 /** | |
2896 * Create a krb5 library context using only configuration files. | |
2897 * | |
2898 * @param [out] context Library context | |
2899 * | |
2900 * Create a context structure, using only system configuration files. All | |
2901 * information passed through the environment variables is ignored. | |
2902 * | |
2903 * The @a context must be released by calling krb5_free_context() when | |
2904 * it is no longer needed. | |
2905 * | |
2906 * @retval | |
2907 * 0 Success | |
2908 * @return | |
2909 * Kerberos error codes | |
2910 */ | |
2911 krb5_error_code KRB5_CALLCONV | |
2912 krb5_init_secure_context(krb5_context *context); | |
2913 | |
2914 /** | |
2915 * Create a krb5 library context using a specified profile. | |
2916 * | |
2917 * @param [in] profile Profile object (NULL to create default profile) | |
2918 * @param [in] flags Context initialization flags | |
2919 * @param [out] context Library context | |
2920 * | |
2921 * Create a context structure, optionally using a specified profile and | |
2922 * initialization flags. If @a profile is NULL, the default profile will be | |
2923 * created from config files. If @a profile is non-null, a copy of it will be | |
2924 * made for the new context; the caller should still clean up its copy. Valid | |
2925 * flag values are: | |
2926 * | |
2927 * @li #KRB5_INIT_CONTEXT_SECURE Ignore environment variables | |
2928 * @li #KRB5_INIT_CONTEXT_KDC Use KDC configuration if creating profile | |
2929 */ | |
2930 krb5_error_code KRB5_CALLCONV | |
2931 krb5_init_context_profile(struct _profile_t *profile, krb5_flags flags, | |
2932 krb5_context *context); | |
2933 | |
2934 /** | |
2935 * Free a krb5 library context. | |
2936 * | |
2937 * @param [in] context Library context | |
2938 * | |
2939 * This function frees a @a context that was created by krb5_init_context() | |
2940 * or krb5_init_secure_context(). | |
2941 */ | |
2942 void KRB5_CALLCONV | |
2943 krb5_free_context(krb5_context context); | |
2944 | |
2945 /** | |
2946 * Copy a krb5_context structure. | |
2947 * | |
2948 * @param [in] ctx Library context | |
2949 * @param [out] nctx_out New context structure | |
2950 * | |
2951 * The newly created context must be released by calling krb5_free_context() | |
2952 * when it is no longer needed. | |
2953 * | |
2954 * @retval | |
2955 * 0 Success | |
2956 * @return | |
2957 * Kerberos error codes | |
2958 */ | |
2959 krb5_error_code KRB5_CALLCONV | |
2960 krb5_copy_context(krb5_context ctx, krb5_context *nctx_out); | |
2961 | |
2962 /** | |
2963 * Set default TGS encryption types in a krb5_context structure. | |
2964 * | |
2965 * @param [in] context Library context | |
2966 * @param [in] etypes Encryption type(s) to set | |
2967 * | |
2968 * This function sets the default enctype list for TGS requests | |
2969 * made using @a context to @a etypes. | |
2970 * | |
2971 * @note This overrides the default list (from config file or built-in). | |
2972 * | |
2973 * @retval | |
2974 * 0 Success | |
2975 * @retval | |
2976 * KRB5_PROG_ETYPE_NOSUPP Program lacks support for encryption type | |
2977 * @return | |
2978 * Kerberos error codes | |
2979 */ | |
2980 krb5_error_code KRB5_CALLCONV | |
2981 krb5_set_default_tgs_enctypes(krb5_context context, const krb5_enctype *etypes); | |
2982 | |
2983 /** | |
2984 * Return a list of encryption types permitted for session keys. | |
2985 * | |
2986 * @param [in] context Library context | |
2987 * @param [out] ktypes Zero-terminated list of encryption types | |
2988 * | |
2989 * This function returns the list of encryption types permitted for session | |
2990 * keys within @a context, as determined by configuration or by a previous call | |
2991 * to krb5_set_default_tgs_enctypes(). | |
2992 * | |
2993 * Use krb5_free_enctypes() to free @a ktypes when it is no longer needed. | |
2994 * | |
2995 * @retval 0 Success; otherwise - Kerberos error codes | |
2996 */ | |
2997 krb5_error_code KRB5_CALLCONV | |
2998 krb5_get_permitted_enctypes(krb5_context context, krb5_enctype **ktypes); | |
2999 | |
3000 /** | |
3001 * Test whether the Kerberos library was built with multithread support. | |
3002 * | |
3003 * @retval | |
3004 * TRUE if the library is threadsafe; FALSE otherwise | |
3005 */ | |
3006 krb5_boolean KRB5_CALLCONV | |
3007 krb5_is_thread_safe(void); | |
3008 | |
3009 /* libkrb.spec */ | |
3010 | |
3011 /** | |
3012 * Decrypt a ticket using the specified key table. | |
3013 * | |
3014 * @param [in] context Library context | |
3015 * @param [in] kt Key table | |
3016 * @param [in] ticket Ticket to be decrypted | |
3017 * | |
3018 * This function takes a @a ticket as input and decrypts it using | |
3019 * key data from @a kt. The result is placed into @a ticket->enc_part2. | |
3020 * | |
3021 * @retval 0 Success; otherwise - Kerberos error codes | |
3022 */ | |
3023 krb5_error_code KRB5_CALLCONV | |
3024 krb5_server_decrypt_ticket_keytab(krb5_context context, const krb5_keytab kt, | |
3025 krb5_ticket *ticket); | |
3026 | |
3027 /** | |
3028 * Free an array of credential structures. | |
3029 * | |
3030 * @param [in] context Library context | |
3031 * @param [in] tgts Null-terminated array of credentials to free | |
3032 * | |
3033 * @note The last entry in the array @a tgts must be a NULL pointer. | |
3034 */ | |
3035 void KRB5_CALLCONV | |
3036 krb5_free_tgt_creds(krb5_context context, krb5_creds **tgts); | |
3037 | |
3038 /** @defgroup KRB5_GC KRB5_GC | |
3039 * @{ | |
3040 */ | |
3041 #define KRB5_GC_USER_USER 1 /**< Want user-user ticket */ | |
3042 #define KRB5_GC_CACHED 2 /**< Want cached ticket only */ | |
3043 #define KRB5_GC_CANONICALIZE 4 /**< Set canonicalize KDC option */ | |
3044 #define KRB5_GC_NO_STORE 8 /**< Do not store in credential cache */ | |
3045 #define KRB5_GC_FORWARDABLE 16 /**< Acquire forwardable tickets */ | |
3046 #define KRB5_GC_NO_TRANSIT_CHECK 32 /**< Disable transited check */ | |
3047 #define KRB5_GC_CONSTRAINED_DELEGATION 64 /**< Constrained delegation */ | |
3048 /** @} */ /* end of KRB5_GC group */ | |
3049 | |
3050 /** | |
3051 * Get an additional ticket. | |
3052 * | |
3053 * @param [in] context Library context | |
3054 * @param [in] options Options | |
3055 * @param [in] ccache Credential cache handle | |
3056 * @param [in] in_creds Input credentials | |
3057 * @param [out] out_creds Output updated credentials | |
3058 * | |
3059 * Use @a ccache or a TGS exchange to get a service ticket matching @a | |
3060 * in_creds. | |
3061 * | |
3062 * Valid values for @a options are: | |
3063 * @li #KRB5_GC_CACHED Search only credential cache for the ticket | |
3064 * @li #KRB5_GC_USER_USER Return a user to user authentication ticket | |
3065 * | |
3066 * @a in_creds must be non-null. @a in_creds->client and @a in_creds->server | |
3067 * must be filled in to specify the client and the server respectively. If any | |
3068 * authorization data needs to be requested for the service ticket (such as | |
3069 * restrictions on how the ticket can be used), specify it in @a | |
3070 * in_creds->authdata; otherwise set @a in_creds->authdata to NULL. The | |
3071 * session key type is specified in @a in_creds->keyblock.enctype, if it is | |
3072 * nonzero. | |
3073 * | |
3074 * The expiration date is specified in @a in_creds->times.endtime. | |
3075 * The KDC may return tickets with an earlier expiration date. | |
3076 * If @a in_creds->times.endtime is set to 0, the latest possible | |
3077 * expiration date will be requested. | |
3078 * | |
3079 * Any returned ticket and intermediate ticket-granting tickets are stored | |
3080 * in @a ccache. | |
3081 * | |
3082 * Use krb5_free_creds() to free @a out_creds when it is no longer needed. | |
3083 * | |
3084 * @retval | |
3085 * 0 Success | |
3086 * @return | |
3087 * Kerberos error codes | |
3088 */ | |
3089 krb5_error_code KRB5_CALLCONV | |
3090 krb5_get_credentials(krb5_context context, krb5_flags options, | |
3091 krb5_ccache ccache, krb5_creds *in_creds, | |
3092 krb5_creds **out_creds); | |
3093 | |
3094 /** | |
3095 * Serialize a @c krb5_creds object. | |
3096 * | |
3097 * @param [in] context Library context | |
3098 * @param [in] in_creds The credentials object to serialize | |
3099 * @param [out] data_out The serialized credentials | |
3100 * | |
3101 * Serialize @a creds in the format used by the FILE ccache format (vesion 4) | |
3102 * and KCM ccache protocol. | |
3103 * | |
3104 * Use krb5_free_data() to free @a data_out when it is no longer needed. | |
3105 * | |
3106 * @retval 0 Success; otherwise - Kerberos error codes | |
3107 */ | |
3108 krb5_error_code KRB5_CALLCONV | |
3109 krb5_marshal_credentials(krb5_context context, krb5_creds *in_creds, | |
3110 krb5_data **data_out); | |
3111 | |
3112 /** | |
3113 * Deserialize a @c krb5_creds object. | |
3114 * | |
3115 * @param [in] context Library context | |
3116 * @param [in] data The serialized credentials | |
3117 * @param [out] creds_out The resulting creds object | |
3118 * | |
3119 * Deserialize @a data to credentials in the format used by the FILE ccache | |
3120 * format (vesion 4) and KCM ccache protocol. | |
3121 * | |
3122 * Use krb5_free_creds() to free @a creds_out when it is no longer needed. | |
3123 * | |
3124 * @retval 0 Success; otherwise - Kerberos error codes | |
3125 */ | |
3126 krb5_error_code KRB5_CALLCONV | |
3127 krb5_unmarshal_credentials(krb5_context context, const krb5_data *data, | |
3128 krb5_creds **creds_out); | |
3129 | |
3130 /** @deprecated Replaced by krb5_get_validated_creds. */ | |
3131 krb5_error_code KRB5_CALLCONV | |
3132 krb5_get_credentials_validate(krb5_context context, krb5_flags options, | |
3133 krb5_ccache ccache, krb5_creds *in_creds, | |
3134 krb5_creds **out_creds); | |
3135 | |
3136 /** @deprecated Replaced by krb5_get_renewed_creds. */ | |
3137 krb5_error_code KRB5_CALLCONV | |
3138 krb5_get_credentials_renew(krb5_context context, krb5_flags options, | |
3139 krb5_ccache ccache, krb5_creds *in_creds, | |
3140 krb5_creds **out_creds); | |
3141 | |
3142 /** | |
3143 * Create a @c KRB_AP_REQ message. | |
3144 * | |
3145 * @param [in] context Library context | |
3146 * @param [in,out] auth_context Pre-existing or newly created auth context | |
3147 * @param [in] ap_req_options @ref AP_OPTS options | |
3148 * @param [in] service Service name, or NULL to use @c "host" | |
3149 * @param [in] hostname Host name, or NULL to use local hostname | |
3150 * @param [in] in_data Application data to be checksummed in the | |
3151 * authenticator, or NULL | |
3152 * @param [in] ccache Credential cache used to obtain credentials | |
3153 * for the desired service. | |
3154 * @param [out] outbuf @c AP-REQ message | |
3155 * | |
3156 * This function is similar to krb5_mk_req_extended() except that it uses a | |
3157 * given @a hostname, @a service, and @a ccache to construct a service | |
3158 * principal name and obtain credentials. | |
3159 * | |
3160 * Use krb5_free_data_contents() to free @a outbuf when it is no longer needed. | |
3161 * | |
3162 * @retval 0 Success; otherwise - Kerberos error codes | |
3163 */ | |
3164 krb5_error_code KRB5_CALLCONV | |
3165 krb5_mk_req(krb5_context context, krb5_auth_context *auth_context, | |
3166 krb5_flags ap_req_options, const char *service, | |
3167 const char *hostname, krb5_data *in_data, krb5_ccache ccache, | |
3168 krb5_data *outbuf); | |
3169 | |
3170 /** | |
3171 * Create a @c KRB_AP_REQ message using supplied credentials. | |
3172 * | |
3173 * @param [in] context Library context | |
3174 * @param [in,out] auth_context Pre-existing or newly created auth context | |
3175 * @param [in] ap_req_options @ref AP_OPTS options | |
3176 * @param [in] in_data Application data to be checksummed in the | |
3177 * authenticator, or NULL | |
3178 * @param [in] in_creds Credentials for the service with valid ticket | |
3179 * and key | |
3180 * @param [out] outbuf @c AP-REQ message | |
3181 * | |
3182 * Valid @a ap_req_options are: | |
3183 * @li #AP_OPTS_USE_SESSION_KEY - Use the session key when creating the | |
3184 * request used for user to user | |
3185 * authentication. | |
3186 * @li #AP_OPTS_MUTUAL_REQUIRED - Request a mutual authentication packet from | |
3187 * the receiver. | |
3188 * @li #AP_OPTS_USE_SUBKEY - Generate a subsession key from the current | |
3189 * session key obtained from the credentials. | |
3190 * | |
3191 * This function creates a KRB_AP_REQ message using supplied credentials @a | |
3192 * in_creds. @a auth_context may point to an existing auth context or to NULL, | |
3193 * in which case a new one will be created. If @a in_data is non-null, a | |
3194 * checksum of it will be included in the authenticator contained in the | |
3195 * KRB_AP_REQ message. Use krb5_free_data_contents() to free @a outbuf when it | |
3196 * is no longer needed. | |
3197 * | |
3198 * On successful return, the authenticator is stored in @a auth_context with | |
3199 * the @a client and @a checksum fields nulled out. (This is to prevent | |
3200 * pointer-sharing problems; the caller should not need these fields anyway, | |
3201 * since the caller supplied them.) | |
3202 * | |
3203 * @sa krb5_mk_req() | |
3204 * | |
3205 * @retval 0 Success; otherwise - Kerberos error codes | |
3206 */ | |
3207 krb5_error_code KRB5_CALLCONV | |
3208 krb5_mk_req_extended(krb5_context context, krb5_auth_context *auth_context, | |
3209 krb5_flags ap_req_options, krb5_data *in_data, | |
3210 krb5_creds *in_creds, krb5_data *outbuf); | |
3211 | |
3212 /** | |
3213 * Format and encrypt a @c KRB_AP_REP message. | |
3214 * | |
3215 * @param [in] context Library context | |
3216 * @param [in] auth_context Authentication context | |
3217 * @param [out] outbuf @c AP-REP message | |
3218 * | |
3219 * This function fills in @a outbuf with an AP-REP message using information | |
3220 * from @a auth_context. | |
3221 * | |
3222 * If the flags in @a auth_context indicate that a sequence number should be | |
3223 * used (either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or | |
3224 * #KRB5_AUTH_CONTEXT_RET_SEQUENCE) and the local sequence number in @a | |
3225 * auth_context is 0, a new number will be generated with | |
3226 * krb5_generate_seq_number(). | |
3227 * | |
3228 * Use krb5_free_data_contents() to free @a outbuf when it is no longer needed. | |
3229 * | |
3230 * @retval 0 Success; otherwise - Kerberos error codes | |
3231 */ | |
3232 krb5_error_code KRB5_CALLCONV | |
3233 krb5_mk_rep(krb5_context context, krb5_auth_context auth_context, krb5_data *outbuf); | |
3234 | |
3235 /** | |
3236 * Format and encrypt a @c KRB_AP_REP message for DCE RPC. | |
3237 * | |
3238 * @param [in] context Library context | |
3239 * @param [in] auth_context Authentication context | |
3240 * @param [out] outbuf @c AP-REP message | |
3241 * | |
3242 * Use krb5_free_data_contents() to free @a outbuf when it is no longer needed. | |
3243 * | |
3244 * @retval 0 Success; otherwise - Kerberos error codes | |
3245 */ | |
3246 krb5_error_code KRB5_CALLCONV | |
3247 krb5_mk_rep_dce(krb5_context context, krb5_auth_context auth_context, krb5_data *outbuf); | |
3248 | |
3249 /** | |
3250 * Parse and decrypt a @c KRB_AP_REP message. | |
3251 * | |
3252 * @param [in] context Library context | |
3253 * @param [in] auth_context Authentication context | |
3254 * @param [in] inbuf AP-REP message | |
3255 * @param [out] repl Decrypted reply message | |
3256 * | |
3257 * This function parses, decrypts and verifies a message from @a inbuf and | |
3258 * fills in @a repl with a pointer to allocated memory containing the fields | |
3259 * from the encrypted response. | |
3260 * | |
3261 * Use krb5_free_ap_rep_enc_part() to free @a repl when it is no longer needed. | |
3262 * | |
3263 * @retval 0 Success; otherwise - Kerberos error codes | |
3264 */ | |
3265 krb5_error_code KRB5_CALLCONV | |
3266 krb5_rd_rep(krb5_context context, krb5_auth_context auth_context, | |
3267 const krb5_data *inbuf, krb5_ap_rep_enc_part **repl); | |
3268 | |
3269 /** | |
3270 * Parse and decrypt a @c KRB_AP_REP message for DCE RPC. | |
3271 * | |
3272 * @param [in] context Library context | |
3273 * @param [in] auth_context Authentication context | |
3274 * @param [in] inbuf AP-REP message | |
3275 * @param [out] nonce Sequence number from the decrypted reply | |
3276 * | |
3277 * This function parses, decrypts and verifies a message from @a inbuf and | |
3278 * fills in @a nonce with a decrypted reply sequence number. | |
3279 * | |
3280 * @retval 0 Success; otherwise - Kerberos error codes | |
3281 */ | |
3282 krb5_error_code KRB5_CALLCONV | |
3283 krb5_rd_rep_dce(krb5_context context, krb5_auth_context auth_context, | |
3284 const krb5_data *inbuf, krb5_ui_4 *nonce); | |
3285 | |
3286 /** | |
3287 * Format and encode a @c KRB_ERROR message. | |
3288 * | |
3289 * @param [in] context Library context | |
3290 * @param [in] dec_err Error structure to be encoded | |
3291 * @param [out] enc_err Encoded error structure | |
3292 * | |
3293 * This function creates a @c KRB_ERROR message in @a enc_err. Use | |
3294 * krb5_free_data_contents() to free @a enc_err when it is no longer needed. | |
3295 * | |
3296 * @retval 0 Success; otherwise - Kerberos error codes | |
3297 */ | |
3298 krb5_error_code KRB5_CALLCONV | |
3299 krb5_mk_error(krb5_context context, const krb5_error *dec_err, | |
3300 krb5_data *enc_err); | |
3301 | |
3302 /** | |
3303 * Decode a @c KRB-ERROR message. | |
3304 * | |
3305 * @param [in] context Library context | |
3306 * @param [in] enc_errbuf Encoded error message | |
3307 * @param [out] dec_error Decoded error message | |
3308 * | |
3309 * This function processes @c KRB-ERROR message @a enc_errbuf and returns | |
3310 * an allocated structure @a dec_error containing the error message. | |
3311 * Use krb5_free_error() to free @a dec_error when it is no longer needed. | |
3312 * | |
3313 * @retval 0 Success; otherwise - Kerberos error codes | |
3314 */ | |
3315 krb5_error_code KRB5_CALLCONV | |
3316 krb5_rd_error(krb5_context context, const krb5_data *enc_errbuf, | |
3317 krb5_error **dec_error); | |
3318 | |
3319 /** | |
3320 * Process @c KRB-SAFE message. | |
3321 * | |
3322 * @param [in] context Library context | |
3323 * @param [in] auth_context Authentication context | |
3324 * @param [in] inbuf @c KRB-SAFE message to be parsed | |
3325 * @param [out] userdata_out Data parsed from @c KRB-SAFE message | |
3326 * @param [out] rdata_out Replay data. Specify NULL if not needed | |
3327 * | |
3328 * This function parses a @c KRB-SAFE message, verifies its integrity, and | |
3329 * stores its data into @a userdata_out. | |
3330 * | |
3331 * @note The @a rdata_out argument is required if the | |
3332 * #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set | |
3333 * in @a auth_context. | |
3334 * | |
3335 * If @a auth_context has a remote address set, the address will be used to | |
3336 * verify the sender address in the KRB-SAFE message. If @a auth_context has a | |
3337 * local address set, it will be used to verify the receiver address in the | |
3338 * KRB-SAFE message if the message contains one. | |
3339 * | |
3340 * If the #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag is set in @a auth_context, the | |
3341 * sequence number of the KRB-SAFE message is checked against the remote | |
3342 * sequence number field of @a auth_context. Otherwise, the sequence number is | |
3343 * not used. | |
3344 * | |
3345 * If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, then the | |
3346 * timestamp in the message is verified to be within the permitted clock skew | |
3347 * of the current time, and the message is checked against an in-memory replay | |
3348 * cache to detect reflections or replays. | |
3349 * | |
3350 * Use krb5_free_data_contents() to free @a userdata_out when it is no longer | |
3351 * needed. | |
3352 * | |
3353 * @retval 0 Success; otherwise - Kerberos error codes | |
3354 */ | |
3355 krb5_error_code KRB5_CALLCONV | |
3356 krb5_rd_safe(krb5_context context, krb5_auth_context auth_context, | |
3357 const krb5_data *inbuf, krb5_data *userdata_out, | |
3358 krb5_replay_data *rdata_out); | |
3359 | |
3360 /** | |
3361 * Process a @c KRB-PRIV message. | |
3362 * | |
3363 * @param [in] context Library context | |
3364 * @param [in] auth_context Authentication structure | |
3365 * @param [in] inbuf @c KRB-PRIV message to be parsed | |
3366 * @param [out] userdata_out Data parsed from @c KRB-PRIV message | |
3367 * @param [out] rdata_out Replay data. Specify NULL if not needed | |
3368 * | |
3369 * This function parses a @c KRB-PRIV message, verifies its integrity, and | |
3370 * stores its unencrypted data into @a userdata_out. | |
3371 * | |
3372 * @note The @a rdata_out argument is required if the | |
3373 * #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set | |
3374 * in @a auth_context. | |
3375 * | |
3376 * If @a auth_context has a remote address set, the address will be used to | |
3377 * verify the sender address in the KRB-PRIV message. If @a auth_context has a | |
3378 * local address set, it will be used to verify the receiver address in the | |
3379 * KRB-PRIV message if the message contains one. | |
3380 * | |
3381 * If the #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag is set in @a auth_context, the | |
3382 * sequence number of the KRB-PRIV message is checked against the remote | |
3383 * sequence number field of @a auth_context. Otherwise, the sequence number is | |
3384 * not used. | |
3385 * | |
3386 * If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, then the | |
3387 * timestamp in the message is verified to be within the permitted clock skew | |
3388 * of the current time, and the message is checked against an in-memory replay | |
3389 * cache to detect reflections or replays. | |
3390 * | |
3391 * Use krb5_free_data_contents() to free @a userdata_out when it is no longer | |
3392 * needed. | |
3393 * | |
3394 * @retval 0 Success; otherwise - Kerberos error codes | |
3395 */ | |
3396 krb5_error_code KRB5_CALLCONV | |
3397 krb5_rd_priv(krb5_context context, krb5_auth_context auth_context, | |
3398 const krb5_data *inbuf, krb5_data *userdata_out, | |
3399 krb5_replay_data *rdata_out); | |
3400 | |
3401 /** | |
3402 * Convert a string principal name to a krb5_principal structure. | |
3403 * | |
3404 * @param [in] context Library context | |
3405 * @param [in] name String representation of a principal name | |
3406 * @param [out] principal_out New principal | |
3407 * | |
3408 * Convert a string representation of a principal name to a krb5_principal | |
3409 * structure. | |
3410 * | |
3411 * A string representation of a Kerberos name consists of one or more principal | |
3412 * name components, separated by slashes, optionally followed by the \@ | |
3413 * character and a realm name. If the realm name is not specified, the local | |
3414 * realm is used. | |
3415 * | |
3416 * To use the slash and \@ symbols as part of a component (quoted) instead of | |
3417 * using them as a component separator or as a realm prefix), put a backslash | |
3418 * (\) character in front of the symbol. Similarly, newline, tab, backspace, | |
3419 * and NULL characters can be included in a component by using @c n, @c t, @c b | |
3420 * or @c 0, respectively. | |
3421 * | |
3422 * @note The realm in a Kerberos @a name cannot contain slash, colon, | |
3423 * or NULL characters. | |
3424 * | |
3425 * Beginning with release 1.20, the name type of the principal will be inferred | |
3426 * as @c KRB5_NT_SRV_INST or @c KRB5_NT_WELLKNOWN based on the principal name. | |
3427 * The type will be @c KRB5_NT_PRINCIPAL if a type cannot be inferred. | |
3428 * | |
3429 * Use krb5_free_principal() to free @a principal_out when it is no longer | |
3430 * needed. | |
3431 * | |
3432 * @retval | |
3433 * 0 Success | |
3434 * @return | |
3435 * Kerberos error codes | |
3436 */ | |
3437 krb5_error_code KRB5_CALLCONV | |
3438 krb5_parse_name(krb5_context context, const char *name, | |
3439 krb5_principal *principal_out); | |
3440 | |
3441 #define KRB5_PRINCIPAL_PARSE_NO_REALM 0x1 /**< Error if realm is present */ | |
3442 #define KRB5_PRINCIPAL_PARSE_REQUIRE_REALM 0x2 /**< Error if realm is not present */ | |
3443 #define KRB5_PRINCIPAL_PARSE_ENTERPRISE 0x4 /**< Create single-component | |
3444 enterprise principle */ | |
3445 #define KRB5_PRINCIPAL_PARSE_IGNORE_REALM 0x8 /**< Ignore realm if present */ | |
3446 #define KRB5_PRINCIPAL_PARSE_NO_DEF_REALM 0x10 /**< Don't add default realm */ | |
3447 | |
3448 /** | |
3449 * Convert a string principal name to a krb5_principal with flags. | |
3450 * | |
3451 * @param [in] context Library context | |
3452 * @param [in] name String representation of a principal name | |
3453 * @param [in] flags Flag | |
3454 * @param [out] principal_out New principal | |
3455 * | |
3456 * Similar to krb5_parse_name(), this function converts a single-string | |
3457 * representation of a principal name to a krb5_principal structure. | |
3458 * | |
3459 * The following flags are valid: | |
3460 * @li #KRB5_PRINCIPAL_PARSE_NO_REALM - no realm must be present in @a name | |
3461 * @li #KRB5_PRINCIPAL_PARSE_REQUIRE_REALM - realm must be present in @a name | |
3462 * @li #KRB5_PRINCIPAL_PARSE_ENTERPRISE - create single-component enterprise | |
3463 * principal | |
3464 * @li #KRB5_PRINCIPAL_PARSE_IGNORE_REALM - ignore realm if present in @a name | |
3465 * | |
3466 * If @c KRB5_PRINCIPAL_PARSE_NO_REALM or @c KRB5_PRINCIPAL_PARSE_IGNORE_REALM | |
3467 * is specified in @a flags, the realm of the new principal will be empty. | |
3468 * Otherwise, the default realm for @a context will be used if @a name does not | |
3469 * specify a realm. | |
3470 * | |
3471 * Use krb5_free_principal() to free @a principal_out when it is no longer | |
3472 * needed. | |
3473 * | |
3474 * @retval | |
3475 * 0 Success | |
3476 * @return | |
3477 * Kerberos error codes | |
3478 */ | |
3479 krb5_error_code KRB5_CALLCONV | |
3480 krb5_parse_name_flags(krb5_context context, const char *name, | |
3481 int flags, krb5_principal *principal_out); | |
3482 | |
3483 /** | |
3484 * Convert a krb5_principal structure to a string representation. | |
3485 * | |
3486 * @param [in] context Library context | |
3487 * @param [in] principal Principal | |
3488 * @param [out] name String representation of principal name | |
3489 * | |
3490 * The resulting string representation uses the format and quoting conventions | |
3491 * described for krb5_parse_name(). | |
3492 * | |
3493 * Use krb5_free_unparsed_name() to free @a name when it is no longer needed. | |
3494 * | |
3495 * @retval | |
3496 * 0 Success | |
3497 * @return | |
3498 * Kerberos error codes | |
3499 */ | |
3500 krb5_error_code KRB5_CALLCONV | |
3501 krb5_unparse_name(krb5_context context, krb5_const_principal principal, | |
3502 char **name); | |
3503 | |
3504 /** | |
3505 * Convert krb5_principal structure to string and length. | |
3506 * | |
3507 * @param [in] context Library context | |
3508 * @param [in] principal Principal | |
3509 * @param [in,out] name String representation of principal name | |
3510 * @param [in,out] size Size of unparsed name | |
3511 * | |
3512 * This function is similar to krb5_unparse_name(), but allows the use of an | |
3513 * existing buffer for the result. If size is not NULL, then @a name must | |
3514 * point to either NULL or an existing buffer of at least the size pointed to | |
3515 * by @a size. The buffer will be allocated or resized if necessary, with the | |
3516 * new pointer stored into @a name. Whether or not the buffer is resized, the | |
3517 * necessary space for the result, including null terminator, will be stored | |
3518 * into @a size. | |
3519 * | |
3520 * If size is NULL, this function behaves exactly as krb5_unparse_name(). | |
3521 * | |
3522 * @retval | |
3523 * 0 Success | |
3524 * @return | |
3525 * Kerberos error codes. On failure @a name is set to NULL | |
3526 */ | |
3527 krb5_error_code KRB5_CALLCONV | |
3528 krb5_unparse_name_ext(krb5_context context, krb5_const_principal principal, | |
3529 char **name, unsigned int *size); | |
3530 | |
3531 #define KRB5_PRINCIPAL_UNPARSE_SHORT 0x1 /**< Omit realm if it is the local realm */ | |
3532 #define KRB5_PRINCIPAL_UNPARSE_NO_REALM 0x2 /**< Omit realm always */ | |
3533 #define KRB5_PRINCIPAL_UNPARSE_DISPLAY 0x4 /**< Don't escape special characters */ | |
3534 | |
3535 /** | |
3536 * Convert krb5_principal structure to a string with flags. | |
3537 * | |
3538 * @param [in] context Library context | |
3539 * @param [in] principal Principal | |
3540 * @param [in] flags Flags | |
3541 * @param [out] name String representation of principal name | |
3542 * | |
3543 * Similar to krb5_unparse_name(), this function converts a krb5_principal | |
3544 * structure to a string representation. | |
3545 * | |
3546 * The following flags are valid: | |
3547 * @li #KRB5_PRINCIPAL_UNPARSE_SHORT - omit realm if it is the local realm | |
3548 * @li #KRB5_PRINCIPAL_UNPARSE_NO_REALM - omit realm | |
3549 * @li #KRB5_PRINCIPAL_UNPARSE_DISPLAY - do not quote special characters | |
3550 * | |
3551 * Use krb5_free_unparsed_name() to free @a name when it is no longer needed. | |
3552 * | |
3553 * @retval | |
3554 * 0 Success | |
3555 * @return | |
3556 * Kerberos error codes. On failure @a name is set to NULL | |
3557 */ | |
3558 krb5_error_code KRB5_CALLCONV | |
3559 krb5_unparse_name_flags(krb5_context context, krb5_const_principal principal, | |
3560 int flags, char **name); | |
3561 | |
3562 /** | |
3563 * Convert krb5_principal structure to string format with flags. | |
3564 * | |
3565 * @param [in] context Library context | |
3566 * @param [in] principal Principal | |
3567 * @param [in] flags Flags | |
3568 * @param [out] name Single string format of principal name | |
3569 * @param [out] size Size of unparsed name buffer | |
3570 * | |
3571 * @sa krb5_unparse_name() krb5_unparse_name_flags() krb5_unparse_name_ext() | |
3572 * | |
3573 * @retval | |
3574 * 0 Success | |
3575 * @return | |
3576 * Kerberos error codes. On failure @a name is set to NULL | |
3577 */ | |
3578 krb5_error_code KRB5_CALLCONV | |
3579 krb5_unparse_name_flags_ext(krb5_context context, krb5_const_principal principal, | |
3580 int flags, char **name, unsigned int *size); | |
3581 | |
3582 /** | |
3583 * Set the realm field of a principal | |
3584 * | |
3585 * @param [in] context Library context | |
3586 * @param [in] principal Principal name | |
3587 * @param [in] realm Realm name | |
3588 * | |
3589 * Set the realm name part of @a principal to @a realm, overwriting the | |
3590 * previous realm. | |
3591 * | |
3592 * @retval | |
3593 * 0 Success | |
3594 * @return | |
3595 * Kerberos error codes | |
3596 */ | |
3597 krb5_error_code KRB5_CALLCONV | |
3598 krb5_set_principal_realm(krb5_context context, krb5_principal principal, | |
3599 const char *realm); | |
3600 | |
3601 /** | |
3602 * Search a list of addresses for a specified address. | |
3603 * | |
3604 * @param [in] context Library context | |
3605 * @param [in] addr Address to search for | |
3606 * @param [in] addrlist Address list to be searched (or NULL) | |
3607 * | |
3608 * @note If @a addrlist contains only a NetBIOS addresses, it will be treated | |
3609 * as a null list. | |
3610 * | |
3611 * @return | |
3612 * TRUE if @a addr is listed in @a addrlist, or @c addrlist is NULL; FALSE | |
3613 * otherwise | |
3614 */ | |
3615 krb5_boolean KRB5_CALLCONV_WRONG | |
3616 krb5_address_search(krb5_context context, const krb5_address *addr, | |
3617 krb5_address *const *addrlist); | |
3618 | |
3619 /** | |
3620 * Compare two Kerberos addresses. | |
3621 * | |
3622 * @param [in] context Library context | |
3623 * @param [in] addr1 First address to be compared | |
3624 * @param [in] addr2 Second address to be compared | |
3625 * | |
3626 * @return | |
3627 * TRUE if the addresses are the same, FALSE otherwise | |
3628 */ | |
3629 krb5_boolean KRB5_CALLCONV | |
3630 krb5_address_compare(krb5_context context, const krb5_address *addr1, | |
3631 const krb5_address *addr2); | |
3632 | |
3633 /** | |
3634 * Return an ordering of the specified addresses. | |
3635 * | |
3636 * @param [in] context Library context | |
3637 * @param [in] addr1 First address | |
3638 * @param [in] addr2 Second address | |
3639 * | |
3640 * @retval 0 if The two addresses are the same | |
3641 * @retval < 0 First address is less than second | |
3642 * @retval > 0 First address is greater than second | |
3643 */ | |
3644 int KRB5_CALLCONV | |
3645 krb5_address_order(krb5_context context, const krb5_address *addr1, | |
3646 const krb5_address *addr2); | |
3647 | |
3648 /** | |
3649 * Compare the realms of two principals. | |
3650 * | |
3651 * @param [in] context Library context | |
3652 * @param [in] princ1 First principal | |
3653 * @param [in] princ2 Second principal | |
3654 * | |
3655 * @retval | |
3656 * TRUE if the realm names are the same; FALSE otherwise | |
3657 */ | |
3658 krb5_boolean KRB5_CALLCONV | |
3659 krb5_realm_compare(krb5_context context, krb5_const_principal princ1, | |
3660 krb5_const_principal princ2); | |
3661 | |
3662 /** | |
3663 * Compare two principals. | |
3664 * | |
3665 * @param [in] context Library context | |
3666 * @param [in] princ1 First principal | |
3667 * @param [in] princ2 Second principal | |
3668 * | |
3669 * @retval | |
3670 * TRUE if the principals are the same; FALSE otherwise | |
3671 */ | |
3672 krb5_boolean KRB5_CALLCONV | |
3673 krb5_principal_compare(krb5_context context, | |
3674 krb5_const_principal princ1, | |
3675 krb5_const_principal princ2); | |
3676 | |
3677 /** | |
3678 * Compare two principals ignoring realm components. | |
3679 * | |
3680 * @param [in] context Library context | |
3681 * @param [in] princ1 First principal | |
3682 * @param [in] princ2 Second principal | |
3683 * | |
3684 * Similar to krb5_principal_compare(), but do not compare the realm | |
3685 * components of the principals. | |
3686 * | |
3687 * @retval | |
3688 * TRUE if the principals are the same; FALSE otherwise | |
3689 */ | |
3690 krb5_boolean KRB5_CALLCONV | |
3691 krb5_principal_compare_any_realm(krb5_context context, | |
3692 krb5_const_principal princ1, | |
3693 krb5_const_principal princ2); | |
3694 | |
3695 #define KRB5_PRINCIPAL_COMPARE_IGNORE_REALM 1 /**< ignore realm component */ | |
3696 #define KRB5_PRINCIPAL_COMPARE_ENTERPRISE 2 /**< UPNs as real principals */ | |
3697 #define KRB5_PRINCIPAL_COMPARE_CASEFOLD 4 /**< case-insensitive */ | |
3698 #define KRB5_PRINCIPAL_COMPARE_UTF8 8 /**< treat principals as UTF-8 */ | |
3699 | |
3700 /** | |
3701 * Compare two principals with additional flags. | |
3702 * | |
3703 * @param [in] context Library context | |
3704 * @param [in] princ1 First principal | |
3705 * @param [in] princ2 Second principal | |
3706 * @param [in] flags Flags | |
3707 * | |
3708 * Valid flags are: | |
3709 * @li #KRB5_PRINCIPAL_COMPARE_IGNORE_REALM - ignore realm component | |
3710 * @li #KRB5_PRINCIPAL_COMPARE_ENTERPRISE - UPNs as real principals | |
3711 * @li #KRB5_PRINCIPAL_COMPARE_CASEFOLD case-insensitive | |
3712 * @li #KRB5_PRINCIPAL_COMPARE_UTF8 - treat principals as UTF-8 | |
3713 * | |
3714 * @sa krb5_principal_compare() | |
3715 * | |
3716 * @retval | |
3717 * TRUE if the principal names are the same; FALSE otherwise | |
3718 */ | |
3719 krb5_boolean KRB5_CALLCONV | |
3720 krb5_principal_compare_flags(krb5_context context, | |
3721 krb5_const_principal princ1, | |
3722 krb5_const_principal princ2, | |
3723 int flags); | |
3724 | |
3725 /** | |
3726 * Initialize an empty @c krb5_keyblock. | |
3727 * | |
3728 * @param [in] context Library context | |
3729 * @param [in] enctype Encryption type | |
3730 * @param [in] length Length of keyblock (or 0) | |
3731 * @param [out] out New keyblock structure | |
3732 * | |
3733 * Initialize a new keyblock and allocate storage for the contents of the key. | |
3734 * It is legal to pass in a length of 0, in which case contents are left | |
3735 * unallocated. Use krb5_free_keyblock() to free @a out when it is no longer | |
3736 * needed. | |
3737 * | |
3738 * @note If @a length is set to 0, contents are left unallocated. | |
3739 * | |
3740 * @retval 0 Success; otherwise - Kerberos error codes | |
3741 */ | |
3742 krb5_error_code KRB5_CALLCONV | |
3743 krb5_init_keyblock(krb5_context context, krb5_enctype enctype, | |
3744 size_t length, krb5_keyblock **out); | |
3745 | |
3746 /** | |
3747 * Copy a keyblock. | |
3748 * | |
3749 * @param [in] context Library context | |
3750 * @param [in] from Keyblock to be copied | |
3751 * @param [out] to Copy of keyblock @a from | |
3752 * | |
3753 * This function creates a new keyblock with the same contents as @a from. Use | |
3754 * krb5_free_keyblock() to free @a to when it is no longer needed. | |
3755 * | |
3756 * @retval 0 Success; otherwise - Kerberos error codes | |
3757 */ | |
3758 krb5_error_code KRB5_CALLCONV | |
3759 krb5_copy_keyblock(krb5_context context, const krb5_keyblock *from, | |
3760 krb5_keyblock **to); | |
3761 | |
3762 /** | |
3763 * Copy the contents of a keyblock. | |
3764 * | |
3765 * @param [in] context Library context | |
3766 * @param [in] from Key to be copied | |
3767 * @param [out] to Output key | |
3768 * | |
3769 * This function copies the contents of @a from to @a to. Use | |
3770 * krb5_free_keyblock_contents() to free @a to when it is no longer needed. | |
3771 * | |
3772 * @retval 0 Success; otherwise - Kerberos error codes | |
3773 */ | |
3774 krb5_error_code KRB5_CALLCONV | |
3775 krb5_copy_keyblock_contents(krb5_context context, const krb5_keyblock *from, | |
3776 krb5_keyblock *to); | |
3777 | |
3778 /** | |
3779 * Copy a krb5_creds structure. | |
3780 * | |
3781 * @param [in] context Library context | |
3782 * @param [in] incred Credentials structure to be copied | |
3783 * @param [out] outcred Copy of @a incred | |
3784 * | |
3785 * This function creates a new credential with the contents of @a incred. Use | |
3786 * krb5_free_creds() to free @a outcred when it is no longer needed. | |
3787 * | |
3788 * @retval 0 Success; otherwise - Kerberos error codes | |
3789 */ | |
3790 krb5_error_code KRB5_CALLCONV | |
3791 krb5_copy_creds(krb5_context context, const krb5_creds *incred, krb5_creds **outcred); | |
3792 | |
3793 /** | |
3794 * Copy a krb5_data object. | |
3795 * | |
3796 * @param [in] context Library context | |
3797 * @param [in] indata Data object to be copied | |
3798 * @param [out] outdata Copy of @a indata | |
3799 * | |
3800 * This function creates a new krb5_data object with the contents of @a indata. | |
3801 * Use krb5_free_data() to free @a outdata when it is no longer needed. | |
3802 * | |
3803 * @retval 0 Success; otherwise - Kerberos error codes | |
3804 */ | |
3805 krb5_error_code KRB5_CALLCONV | |
3806 krb5_copy_data(krb5_context context, const krb5_data *indata, krb5_data **outdata); | |
3807 | |
3808 /** | |
3809 * Copy a principal. | |
3810 * | |
3811 * @param [in] context Library context | |
3812 * @param [in] inprinc Principal to be copied | |
3813 * @param [out] outprinc Copy of @a inprinc | |
3814 * | |
3815 * This function creates a new principal structure with the contents of @a | |
3816 * inprinc. Use krb5_free_principal() to free @a outprinc when it is no longer | |
3817 * needed. | |
3818 * | |
3819 * @retval 0 Success; otherwise - Kerberos error codes | |
3820 */ | |
3821 krb5_error_code KRB5_CALLCONV | |
3822 krb5_copy_principal(krb5_context context, krb5_const_principal inprinc, | |
3823 krb5_principal *outprinc); | |
3824 | |
3825 /** | |
3826 * Copy an array of addresses. | |
3827 * | |
3828 * @param [in] context Library context | |
3829 * @param [in] inaddr Array of addresses to be copied | |
3830 * @param [out] outaddr Copy of array of addresses | |
3831 * | |
3832 * This function creates a new address array containing a copy of @a inaddr. | |
3833 * Use krb5_free_addresses() to free @a outaddr when it is no longer needed. | |
3834 * | |
3835 * @retval 0 Success; otherwise - Kerberos error codes | |
3836 */ | |
3837 krb5_error_code KRB5_CALLCONV | |
3838 krb5_copy_addresses(krb5_context context, krb5_address *const *inaddr, | |
3839 krb5_address ***outaddr); | |
3840 | |
3841 /** | |
3842 * Copy a krb5_ticket structure. | |
3843 * | |
3844 * @param [in] context Library context | |
3845 * @param [in] from Ticket to be copied | |
3846 * @param [out] pto Copy of ticket | |
3847 * | |
3848 * This function creates a new krb5_ticket structure containing the contents of | |
3849 * @a from. Use krb5_free_ticket() to free @a pto when it is no longer needed. | |
3850 * | |
3851 * @retval 0 Success; otherwise - Kerberos error codes | |
3852 */ | |
3853 krb5_error_code KRB5_CALLCONV | |
3854 krb5_copy_ticket(krb5_context context, const krb5_ticket *from, krb5_ticket **pto); | |
3855 | |
3856 /** | |
3857 * Copy an authorization data list. | |
3858 * | |
3859 * @param [in] context Library context | |
3860 * @param [in] in_authdat List of @a krb5_authdata structures | |
3861 * @param [out] out New array of @a krb5_authdata structures | |
3862 * | |
3863 * This function creates a new authorization data list containing a copy of @a | |
3864 * in_authdat, which must be null-terminated. Use krb5_free_authdata() to free | |
3865 * @a out when it is no longer needed. | |
3866 * | |
3867 * @note The last array entry in @a in_authdat must be a NULL pointer. | |
3868 * | |
3869 * @retval 0 Success; otherwise - Kerberos error codes | |
3870 */ | |
3871 krb5_error_code KRB5_CALLCONV | |
3872 krb5_copy_authdata(krb5_context context, | |
3873 krb5_authdata *const *in_authdat, krb5_authdata ***out); | |
3874 | |
3875 /** | |
3876 * Find authorization data elements. | |
3877 * | |
3878 * @param [in] context Library context | |
3879 * @param [in] ticket_authdata Authorization data list from ticket | |
3880 * @param [in] ap_req_authdata Authorization data list from AP request | |
3881 * @param [in] ad_type Authorization data type to find | |
3882 * @param [out] results List of matching entries | |
3883 * | |
3884 * This function searches @a ticket_authdata and @a ap_req_authdata for | |
3885 * elements of type @a ad_type. Either input list may be NULL, in which case | |
3886 * it will not be searched; otherwise, the input lists must be terminated by | |
3887 * NULL entries. This function will search inside AD-IF-RELEVANT containers if | |
3888 * found in either list. Use krb5_free_authdata() to free @a results when it | |
3889 * is no longer needed. | |
3890 * | |
3891 * @version New in 1.10 | |
3892 */ | |
3893 krb5_error_code KRB5_CALLCONV | |
3894 krb5_find_authdata(krb5_context context, krb5_authdata *const *ticket_authdata, | |
3895 krb5_authdata *const *ap_req_authdata, | |
3896 krb5_authdatatype ad_type, krb5_authdata ***results); | |
3897 | |
3898 /** | |
3899 * Merge two authorization data lists into a new list. | |
3900 * | |
3901 * @param [in] context Library context | |
3902 * @param [in] inauthdat1 First list of @a krb5_authdata structures | |
3903 * @param [in] inauthdat2 Second list of @a krb5_authdata structures | |
3904 * @param [out] outauthdat Merged list of @a krb5_authdata structures | |
3905 * | |
3906 * Merge two authdata arrays, such as the array from a ticket | |
3907 * and authenticator. | |
3908 * Use krb5_free_authdata() to free @a outauthdat when it is no longer needed. | |
3909 * | |
3910 * @note The last array entry in @a inauthdat1 and @a inauthdat2 | |
3911 * must be a NULL pointer. | |
3912 * | |
3913 * @retval 0 Success; otherwise - Kerberos error codes | |
3914 */ | |
3915 krb5_error_code KRB5_CALLCONV | |
3916 krb5_merge_authdata(krb5_context context, | |
3917 krb5_authdata *const *inauthdat1, | |
3918 krb5_authdata * const *inauthdat2, | |
3919 krb5_authdata ***outauthdat); | |
3920 | |
3921 /** | |
3922 * Copy a krb5_authenticator structure. | |
3923 * | |
3924 * @param [in] context Library context | |
3925 * @param [in] authfrom krb5_authenticator structure to be copied | |
3926 * @param [out] authto Copy of krb5_authenticator structure | |
3927 * | |
3928 * This function creates a new krb5_authenticator structure with the content of | |
3929 * @a authfrom. Use krb5_free_authenticator() to free @a authto when it is no | |
3930 * longer needed. | |
3931 * | |
3932 * @retval 0 Success; otherwise - Kerberos error codes | |
3933 */ | |
3934 krb5_error_code KRB5_CALLCONV | |
3935 krb5_copy_authenticator(krb5_context context, const krb5_authenticator *authfrom, | |
3936 krb5_authenticator **authto); | |
3937 | |
3938 /** | |
3939 * Copy a krb5_checksum structure. | |
3940 * | |
3941 * @param [in] context Library context | |
3942 * @param [in] ckfrom Checksum to be copied | |
3943 * @param [out] ckto Copy of krb5_checksum structure | |
3944 * | |
3945 * This function creates a new krb5_checksum structure with the contents of @a | |
3946 * ckfrom. Use krb5_free_checksum() to free @a ckto when it is no longer | |
3947 * needed. | |
3948 * | |
3949 * @retval 0 Success; otherwise - Kerberos error codes | |
3950 */ | |
3951 krb5_error_code KRB5_CALLCONV | |
3952 krb5_copy_checksum(krb5_context context, const krb5_checksum *ckfrom, | |
3953 krb5_checksum **ckto); | |
3954 | |
3955 /** | |
3956 * Generate a replay cache object for server use and open it. | |
3957 * | |
3958 * @param [in] context Library context | |
3959 * @param [in] piece Unused (replay cache identifier) | |
3960 * @param [out] rcptr Handle to an open rcache | |
3961 * | |
3962 * This function creates a handle to the default replay cache. Use | |
3963 * krb5_rc_close() to close @a rcptr when it is no longer needed. | |
3964 * | |
3965 * @version Prior to release 1.18, this function creates a handle to a | |
3966 * different replay cache for each unique value of @a piece. | |
3967 * | |
3968 * @retval 0 Success; otherwise - Kerberos error codes | |
3969 */ | |
3970 krb5_error_code KRB5_CALLCONV | |
3971 krb5_get_server_rcache(krb5_context context, const krb5_data *piece, | |
3972 krb5_rcache *rcptr); | |
3973 | |
3974 /** | |
3975 * Build a principal name using length-counted strings. | |
3976 * | |
3977 * @param [in] context Library context | |
3978 * @param [out] princ Principal name | |
3979 * @param [in] rlen Realm name length | |
3980 * @param [in] realm Realm name | |
3981 * @param [in] ... List of unsigned int/char * components, followed by 0 | |
3982 * | |
3983 * This function creates a principal from a length-counted string and a | |
3984 * variable-length list of length-counted components. The list of components | |
3985 * ends with the first 0 length argument (so it is not possible to specify an | |
3986 * empty component with this function). Call krb5_free_principal() to free | |
3987 * allocated memory for principal when it is no longer needed. | |
3988 * | |
3989 * Beginning with release 1.20, the name type of the principal will be inferred | |
3990 * as @c KRB5_NT_SRV_INST or @c KRB5_NT_WELLKNOWN based on the principal name. | |
3991 * The type will be @c KRB5_NT_PRINCIPAL if a type cannot be inferred. | |
3992 * | |
3993 * @code | |
3994 * Example of how to build principal WELLKNOWN/ANONYMOUS@R | |
3995 * krb5_build_principal_ext(context, &principal, strlen("R"), "R", | |
3996 * (unsigned int)strlen(KRB5_WELLKNOWN_NAMESTR), | |
3997 * KRB5_WELLKNOWN_NAMESTR, | |
3998 * (unsigned int)strlen(KRB5_ANONYMOUS_PRINCSTR), | |
3999 * KRB5_ANONYMOUS_PRINCSTR, 0); | |
4000 * @endcode | |
4001 * | |
4002 * @retval | |
4003 * 0 Success | |
4004 * @return | |
4005 * Kerberos error codes | |
4006 */ | |
4007 krb5_error_code KRB5_CALLCONV_C | |
4008 krb5_build_principal_ext(krb5_context context, krb5_principal * princ, | |
4009 unsigned int rlen, const char * realm, ...); | |
4010 | |
4011 /** | |
4012 * Build a principal name using null-terminated strings. | |
4013 * | |
4014 * @param [in] context Library context | |
4015 * @param [out] princ Principal name | |
4016 * @param [in] rlen Realm name length | |
4017 * @param [in] realm Realm name | |
4018 * @param [in] ... List of char * components, ending with NULL | |
4019 * | |
4020 * Call krb5_free_principal() to free @a princ when it is no longer needed. | |
4021 * | |
4022 * Beginning with release 1.20, the name type of the principal will be inferred | |
4023 * as @c KRB5_NT_SRV_INST or @c KRB5_NT_WELLKNOWN based on the principal name. | |
4024 * The type will be @c KRB5_NT_PRINCIPAL if a type cannot be inferred. | |
4025 * | |
4026 * @note krb5_build_principal() and krb5_build_principal_alloc_va() perform the | |
4027 * same task. krb5_build_principal() takes variadic arguments. | |
4028 * krb5_build_principal_alloc_va() takes a pre-computed @a varargs pointer. | |
4029 * | |
4030 * @code | |
4031 * Example of how to build principal H/S@R | |
4032 * krb5_build_principal(context, &principal, | |
4033 * strlen("R"), "R", "H", "S", (char*)NULL); | |
4034 * @endcode | |
4035 * | |
4036 * @retval | |
4037 * 0 Success | |
4038 * @return | |
4039 * Kerberos error codes | |
4040 */ | |
4041 krb5_error_code KRB5_CALLCONV_C | |
4042 krb5_build_principal(krb5_context context, | |
4043 krb5_principal * princ, | |
4044 unsigned int rlen, | |
4045 const char * realm, ...) | |
4046 #if __GNUC__ >= 4 | |
4047 __attribute__ ((sentinel)) | |
4048 #endif | |
4049 ; | |
4050 #if KRB5_DEPRECATED | |
4051 /** @deprecated Replaced by krb5_build_principal_alloc_va(). */ | |
4052 KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV | |
4053 krb5_build_principal_va(krb5_context context, | |
4054 krb5_principal princ, | |
4055 unsigned int rlen, | |
4056 const char *realm, | |
4057 va_list ap); | |
4058 #endif | |
4059 | |
4060 /** | |
4061 * Build a principal name, using a precomputed variable argument list | |
4062 * | |
4063 * @param [in] context Library context | |
4064 * @param [out] princ Principal structure | |
4065 * @param [in] rlen Realm name length | |
4066 * @param [in] realm Realm name | |
4067 * @param [in] ap List of char * components, ending with NULL | |
4068 * | |
4069 * Similar to krb5_build_principal(), this function builds a principal name, | |
4070 * but its name components are specified as a va_list. | |
4071 * | |
4072 * Use krb5_free_principal() to deallocate @a princ when it is no longer | |
4073 * needed. | |
4074 * | |
4075 * @code | |
4076 * Function usage example: | |
4077 * va_list ap; | |
4078 * va_start(ap, realm); | |
4079 * krb5_build_principal_alloc_va(context, princ, rlen, realm, ap); | |
4080 * va_end(ap); | |
4081 * @endcode | |
4082 * | |
4083 * @retval | |
4084 * 0 Success | |
4085 * @return | |
4086 * Kerberos error codes | |
4087 */ | |
4088 krb5_error_code KRB5_CALLCONV | |
4089 krb5_build_principal_alloc_va(krb5_context context, | |
4090 krb5_principal *princ, | |
4091 unsigned int rlen, | |
4092 const char *realm, | |
4093 va_list ap); | |
4094 | |
4095 /** | |
4096 * Convert a Kerberos V4 principal to a Kerberos V5 principal. | |
4097 * | |
4098 * @param [in] context Library context | |
4099 * @param [in] name V4 name | |
4100 * @param [in] instance V4 instance | |
4101 * @param [in] realm Realm | |
4102 * @param [out] princ V5 principal | |
4103 * | |
4104 * This function builds a @a princ from V4 specification based on given input | |
4105 * @a name.instance\@realm. | |
4106 * | |
4107 * Use krb5_free_principal() to free @a princ when it is no longer needed. | |
4108 * | |
4109 * @retval 0 Success; otherwise - Kerberos error codes | |
4110 */ | |
4111 krb5_error_code KRB5_CALLCONV | |
4112 krb5_425_conv_principal(krb5_context context, const char *name, | |
4113 const char *instance, const char *realm, | |
4114 krb5_principal *princ); | |
4115 | |
4116 /** | |
4117 * Convert a Kerberos V5 principal to a Kerberos V4 principal. | |
4118 * | |
4119 * @param [in] context Library context | |
4120 * @param [in] princ V5 Principal | |
4121 * @param [out] name V4 principal's name to be filled in | |
4122 * @param [out] inst V4 principal's instance name to be filled in | |
4123 * @param [out] realm Principal's realm name to be filled in | |
4124 * | |
4125 * This function separates a V5 principal @a princ into @a name, @a instance, | |
4126 * and @a realm. | |
4127 * | |
4128 * @retval | |
4129 * 0 Success | |
4130 * @retval | |
4131 * KRB5_INVALID_PRINCIPAL Invalid principal name | |
4132 * @retval | |
4133 * KRB5_CONFIG_CANTOPEN Can't open or find Kerberos configuration file | |
4134 * @return | |
4135 * Kerberos error codes | |
4136 */ | |
4137 krb5_error_code KRB5_CALLCONV | |
4138 krb5_524_conv_principal(krb5_context context, krb5_const_principal princ, | |
4139 char *name, char *inst, char *realm); | |
4140 /** | |
4141 *@deprecated | |
4142 */ | |
4143 struct credentials; | |
4144 | |
4145 /** | |
4146 * Convert a Kerberos V5 credentials to a Kerberos V4 credentials | |
4147 * | |
4148 * @note Not implemented | |
4149 * | |
4150 * @retval KRB524_KRB4_DISABLED (always) | |
4151 */ | |
4152 int KRB5_CALLCONV | |
4153 krb5_524_convert_creds(krb5_context context, krb5_creds *v5creds, | |
4154 struct credentials *v4creds); | |
4155 | |
4156 #if KRB5_DEPRECATED | |
4157 #define krb524_convert_creds_kdc krb5_524_convert_creds | |
4158 #define krb524_init_ets(x) (0) | |
4159 #endif | |
4160 | |
4161 /* libkt.spec */ | |
4162 | |
4163 /** | |
4164 * Get a handle for a key table. | |
4165 * | |
4166 * @param [in] context Library context | |
4167 * @param [in] name Name of the key table | |
4168 * @param [out] ktid Key table handle | |
4169 * | |
4170 * Resolve the key table name @a name and set @a ktid to a handle identifying | |
4171 * the key table. Use krb5_kt_close() to free @a ktid when it is no longer | |
4172 * needed. | |
4173 * | |
4174 * @a name must be of the form @c type:residual, where @a type must be a type | |
4175 * known to the library and @a residual portion should be specific to the | |
4176 * particular keytab type. If no @a type is given, the default is @c FILE. | |
4177 * | |
4178 * If @a name is of type @c FILE, the keytab file is not opened by this call. | |
4179 * | |
4180 * @code | |
4181 * Example: krb5_kt_resolve(context, "FILE:/tmp/filename", &ktid); | |
4182 * @endcode | |
4183 * | |
4184 * @retval | |
4185 * 0 Success | |
4186 * @return | |
4187 * Kerberos error codes | |
4188 */ | |
4189 krb5_error_code KRB5_CALLCONV | |
4190 krb5_kt_resolve(krb5_context context, const char *name, krb5_keytab *ktid); | |
4191 | |
4192 /** | |
4193 * Duplicate keytab handle. | |
4194 * | |
4195 * @param [in] context Library context | |
4196 * @param [in] in Key table handle to be duplicated | |
4197 * @param [out] out Key table handle | |
4198 * | |
4199 * Create a new handle referring to the same key table as @a in. The new | |
4200 * handle and @a in can be closed independently. | |
4201 * | |
4202 * @version New in 1.12 | |
4203 */ | |
4204 krb5_error_code KRB5_CALLCONV | |
4205 krb5_kt_dup(krb5_context context, krb5_keytab in, krb5_keytab *out); | |
4206 | |
4207 /** | |
4208 * Get the default key table name. | |
4209 * | |
4210 * @param [in] context Library context | |
4211 * @param [out] name Default key table name | |
4212 * @param [in] name_size Space available in @a name | |
4213 * | |
4214 * Fill @a name with the name of the default key table for @a context. | |
4215 * | |
4216 * @sa MAX_KEYTAB_NAME_LEN | |
4217 * | |
4218 * @retval | |
4219 * 0 Success | |
4220 * @retval | |
4221 * KRB5_CONFIG_NOTENUFSPACE Buffer is too short | |
4222 * @return | |
4223 * Kerberos error codes | |
4224 */ | |
4225 krb5_error_code KRB5_CALLCONV | |
4226 krb5_kt_default_name(krb5_context context, char *name, int name_size); | |
4227 | |
4228 /** | |
4229 * Resolve the default key table. | |
4230 * | |
4231 * @param [in] context Library context | |
4232 * @param [out] id Key table handle | |
4233 * | |
4234 * Set @a id to a handle to the default key table. The key table is not | |
4235 * opened. | |
4236 * | |
4237 * @retval | |
4238 * 0 Success | |
4239 * @return | |
4240 * Kerberos error codes | |
4241 */ | |
4242 krb5_error_code KRB5_CALLCONV | |
4243 krb5_kt_default(krb5_context context, krb5_keytab *id); | |
4244 | |
4245 /** | |
4246 * Resolve the default client key table. | |
4247 * | |
4248 * @param [in] context Library context | |
4249 * @param [out] keytab_out Key table handle | |
4250 * | |
4251 * Fill @a keytab_out with a handle to the default client key table. | |
4252 * | |
4253 * @version New in 1.11 | |
4254 * | |
4255 * @retval | |
4256 * 0 Success | |
4257 * @return | |
4258 * Kerberos error codes | |
4259 */ | |
4260 krb5_error_code KRB5_CALLCONV | |
4261 krb5_kt_client_default(krb5_context context, krb5_keytab *keytab_out); | |
4262 | |
4263 /** | |
4264 * Free the contents of a key table entry. | |
4265 * | |
4266 * @param [in] context Library context | |
4267 * @param [in] entry Key table entry whose contents are to be freed | |
4268 * | |
4269 * @note The pointer is not freed. | |
4270 * | |
4271 * @retval 0 Success; otherwise - Kerberos error codes | |
4272 */ | |
4273 krb5_error_code KRB5_CALLCONV | |
4274 krb5_free_keytab_entry_contents(krb5_context context, krb5_keytab_entry *entry); | |
4275 | |
4276 /** @deprecated Use krb5_free_keytab_entry_contents instead. */ | |
4277 krb5_error_code KRB5_CALLCONV | |
4278 krb5_kt_free_entry(krb5_context context, krb5_keytab_entry *entry); | |
4279 | |
4280 | |
4281 /* remove and add are functions, so that they can return NOWRITE | |
4282 if not a writable keytab */ | |
4283 | |
4284 /** | |
4285 * Remove an entry from a key table. | |
4286 * | |
4287 * @param [in] context Library context | |
4288 * @param [in] id Key table handle | |
4289 * @param [in] entry Entry to remove from key table | |
4290 * | |
4291 * @retval | |
4292 * 0 Success | |
4293 * @retval | |
4294 * KRB5_KT_NOWRITE Key table is not writable | |
4295 * @return | |
4296 * Kerberos error codes | |
4297 */ | |
4298 krb5_error_code KRB5_CALLCONV | |
4299 krb5_kt_remove_entry(krb5_context context, krb5_keytab id, krb5_keytab_entry *entry); | |
4300 | |
4301 /** | |
4302 * Add a new entry to a key table. | |
4303 * | |
4304 * @param [in] context Library context | |
4305 * @param [in] id Key table handle | |
4306 * @param [in] entry Entry to be added | |
4307 * | |
4308 * @retval | |
4309 * 0 Success | |
4310 * @retval | |
4311 * ENOMEM Insufficient memory | |
4312 * @retval | |
4313 * KRB5_KT_NOWRITE Key table is not writeable | |
4314 * @return | |
4315 * Kerberos error codes | |
4316 */ | |
4317 krb5_error_code KRB5_CALLCONV | |
4318 krb5_kt_add_entry(krb5_context context, krb5_keytab id, krb5_keytab_entry *entry); | |
4319 | |
4320 /** | |
4321 * Convert a principal name into the default salt for that principal. | |
4322 * | |
4323 * @param [in] context Library context | |
4324 * @param [in] pr Principal name | |
4325 * @param [out] ret Default salt for @a pr to be filled in | |
4326 * | |
4327 * @retval 0 Success; otherwise - Kerberos error codes | |
4328 */ | |
4329 krb5_error_code KRB5_CALLCONV_WRONG | |
4330 krb5_principal2salt(krb5_context context, | |
4331 krb5_const_principal pr, krb5_data *ret); | |
4332 /* librc.spec--see rcache.h */ | |
4333 | |
4334 /* libcc.spec */ | |
4335 | |
4336 /** | |
4337 * Resolve a credential cache name. | |
4338 * | |
4339 * @param [in] context Library context | |
4340 * @param [in] name Credential cache name to be resolved | |
4341 * @param [out] cache Credential cache handle | |
4342 * | |
4343 * Fills in @a cache with a @a cache handle that corresponds to the name in @a | |
4344 * name. @a name should be of the form @c type:residual, and @a type must be a | |
4345 * type known to the library. If the @a name does not contain a colon, | |
4346 * interpret it as a file name. | |
4347 * | |
4348 * @code | |
4349 * Example: krb5_cc_resolve(context, "MEMORY:C_", &cache); | |
4350 * @endcode | |
4351 * | |
4352 * @retval | |
4353 * 0 Success | |
4354 * @return | |
4355 * Kerberos error codes | |
4356 */ | |
4357 krb5_error_code KRB5_CALLCONV | |
4358 krb5_cc_resolve(krb5_context context, const char *name, krb5_ccache *cache); | |
4359 | |
4360 /** | |
4361 * Duplicate ccache handle. | |
4362 * | |
4363 * @param [in] context Library context | |
4364 * @param [in] in Credential cache handle to be duplicated | |
4365 * @param [out] out Credential cache handle | |
4366 * | |
4367 * Create a new handle referring to the same cache as @a in. | |
4368 * The new handle and @a in can be closed independently. | |
4369 */ | |
4370 krb5_error_code KRB5_CALLCONV | |
4371 krb5_cc_dup(krb5_context context, krb5_ccache in, krb5_ccache *out); | |
4372 | |
4373 /** | |
4374 * Return the name of the default credential cache. | |
4375 * | |
4376 * @param [in] context Library context | |
4377 * | |
4378 * Return a pointer to the default credential cache name for @a context, as | |
4379 * determined by a prior call to krb5_cc_set_default_name(), by the KRB5CCNAME | |
4380 * environment variable, by the default_ccache_name profile variable, or by the | |
4381 * operating system or build-time default value. The returned value must not | |
4382 * be modified or freed by the caller. The returned value becomes invalid when | |
4383 * @a context is destroyed krb5_free_context() or if a subsequent call to | |
4384 * krb5_cc_set_default_name() is made on @a context. | |
4385 * | |
4386 * The default credential cache name is cached in @a context between calls to | |
4387 * this function, so if the value of KRB5CCNAME changes in the process | |
4388 * environment after the first call to this function on, that change will not | |
4389 * be reflected in later calls with the same context. The caller can invoke | |
4390 * krb5_cc_set_default_name() with a NULL value of @a name to clear the cached | |
4391 * value and force the default name to be recomputed. | |
4392 * | |
4393 * @return | |
4394 * Name of default credential cache for the current user. | |
4395 */ | |
4396 const char *KRB5_CALLCONV | |
4397 krb5_cc_default_name(krb5_context context); | |
4398 | |
4399 /** | |
4400 * Set the default credential cache name. | |
4401 * | |
4402 * @param [in] context Library context | |
4403 * @param [in] name Default credential cache name or NULL | |
4404 * | |
4405 * Set the default credential cache name to @a name for future operations using | |
4406 * @a context. If @a name is NULL, clear any previous application-set default | |
4407 * name and forget any cached value of the default name for @a context. | |
4408 * | |
4409 * Calls to this function invalidate the result of any previous calls to | |
4410 * krb5_cc_default_name() using @a context. | |
4411 * | |
4412 * @retval | |
4413 * 0 Success | |
4414 * @retval | |
4415 * KV5M_CONTEXT Bad magic number for @c _krb5_context structure | |
4416 * @return | |
4417 * Kerberos error codes | |
4418 */ | |
4419 krb5_error_code KRB5_CALLCONV | |
4420 krb5_cc_set_default_name(krb5_context context, const char *name); | |
4421 | |
4422 /** | |
4423 * Resolve the default credential cache name. | |
4424 * | |
4425 * @param [in] context Library context | |
4426 * @param [out] ccache Pointer to credential cache name | |
4427 * | |
4428 * Create a handle to the default credential cache as given by | |
4429 * krb5_cc_default_name(). | |
4430 * | |
4431 * @retval | |
4432 * 0 Success | |
4433 * @retval | |
4434 * KV5M_CONTEXT Bad magic number for @c _krb5_context structure | |
4435 * @retval | |
4436 * KRB5_FCC_INTERNAL The name of the default credential cache cannot be | |
4437 * obtained | |
4438 * @return | |
4439 * Kerberos error codes | |
4440 */ | |
4441 krb5_error_code KRB5_CALLCONV | |
4442 krb5_cc_default(krb5_context context, krb5_ccache *ccache); | |
4443 | |
4444 /** | |
4445 * Copy a credential cache. | |
4446 * | |
4447 * @param [in] context Library context | |
4448 * @param [in] incc Credential cache to be copied | |
4449 * @param [out] outcc Copy of credential cache to be filled in | |
4450 * | |
4451 * @retval 0 Success; otherwise - Kerberos error codes | |
4452 */ | |
4453 krb5_error_code KRB5_CALLCONV | |
4454 krb5_cc_copy_creds(krb5_context context, krb5_ccache incc, krb5_ccache outcc); | |
4455 | |
4456 /** | |
4457 * Get a configuration value from a credential cache. | |
4458 * | |
4459 * @param [in] context Library context | |
4460 * @param [in] id Credential cache handle | |
4461 * @param [in] principal Configuration for this principal; | |
4462 * if NULL, global for the whole cache | |
4463 * @param [in] key Name of config variable | |
4464 * @param [out] data Data to be fetched | |
4465 * | |
4466 * Use krb5_free_data_contents() to free @a data when it is no longer needed. | |
4467 * | |
4468 * @retval | |
4469 * 0 Success | |
4470 * @return | |
4471 * Kerberos error codes | |
4472 */ | |
4473 krb5_error_code KRB5_CALLCONV | |
4474 krb5_cc_get_config(krb5_context context, krb5_ccache id, | |
4475 krb5_const_principal principal, | |
4476 const char *key, krb5_data *data); | |
4477 | |
4478 /** | |
4479 * Store a configuration value in a credential cache. | |
4480 * | |
4481 * @param [in] context Library context | |
4482 * @param [in] id Credential cache handle | |
4483 * @param [in] principal Configuration for a specific principal; | |
4484 * if NULL, global for the whole cache | |
4485 * @param [in] key Name of config variable | |
4486 * @param [in] data Data to store, or NULL to remove | |
4487 * | |
4488 * @note Existing configuration under the same key is over-written. | |
4489 * | |
4490 * @warning Before version 1.10 @a data was assumed to be always non-null. | |
4491 * | |
4492 * @retval | |
4493 * 0 Success | |
4494 * @return | |
4495 * Kerberos error codes | |
4496 */ | |
4497 krb5_error_code KRB5_CALLCONV | |
4498 krb5_cc_set_config(krb5_context context, krb5_ccache id, | |
4499 krb5_const_principal principal, | |
4500 const char *key, krb5_data *data); | |
4501 | |
4502 /** | |
4503 * Test whether a principal is a configuration principal. | |
4504 * | |
4505 * @param [in] context Library context | |
4506 * @param [in] principal Principal to check | |
4507 * | |
4508 * @return | |
4509 * @c TRUE if the principal is a configuration principal (generated part of | |
4510 * krb5_cc_set_config()); @c FALSE otherwise. | |
4511 */ | |
4512 krb5_boolean KRB5_CALLCONV | |
4513 krb5_is_config_principal(krb5_context context, krb5_const_principal principal); | |
4514 | |
4515 /** | |
4516 * Make a credential cache the primary cache for its collection. | |
4517 * | |
4518 * @param [in] context Library context | |
4519 * @param [in] cache Credential cache handle | |
4520 * | |
4521 * If the type of @a cache supports it, set @a cache to be the primary | |
4522 * credential cache for the collection it belongs to. | |
4523 * | |
4524 * @retval | |
4525 * 0 Success, or the type of @a cache doesn't support switching | |
4526 * @return | |
4527 * Kerberos error codes | |
4528 */ | |
4529 krb5_error_code KRB5_CALLCONV | |
4530 krb5_cc_switch(krb5_context context, krb5_ccache cache); | |
4531 | |
4532 /** | |
4533 * Determine whether a credential cache type supports switching. | |
4534 * | |
4535 * @param [in] context Library context | |
4536 * @param [in] type Credential cache type | |
4537 * | |
4538 * @version New in 1.10 | |
4539 * | |
4540 * @retval TRUE if @a type supports switching | |
4541 * @retval FALSE if it does not or is not a valid credential cache type. | |
4542 */ | |
4543 krb5_boolean KRB5_CALLCONV | |
4544 krb5_cc_support_switch(krb5_context context, const char *type); | |
4545 | |
4546 /** | |
4547 * Find a credential cache with a specified client principal. | |
4548 * | |
4549 * @param [in] context Library context | |
4550 * @param [in] client Client principal | |
4551 * @param [out] cache_out Credential cache handle | |
4552 * | |
4553 * Find a cache within the collection whose default principal is @a client. | |
4554 * Use @a krb5_cc_close to close @a ccache when it is no longer needed. | |
4555 * | |
4556 * @retval 0 Success | |
4557 * @retval KRB5_CC_NOTFOUND | |
4558 * | |
4559 * @sa krb5_cccol_cursor_new | |
4560 * | |
4561 * @version New in 1.10 | |
4562 */ | |
4563 krb5_error_code KRB5_CALLCONV | |
4564 krb5_cc_cache_match(krb5_context context, krb5_principal client, | |
4565 krb5_ccache *cache_out); | |
4566 | |
4567 /** | |
4568 * Select a credential cache to use with a server principal. | |
4569 * | |
4570 * @param [in] context Library context | |
4571 * @param [in] server Server principal | |
4572 * @param [out] cache_out Credential cache handle | |
4573 * @param [out] princ_out Client principal | |
4574 * | |
4575 * Select a cache within the collection containing credentials most appropriate | |
4576 * for use with @a server, according to configured rules and heuristics. | |
4577 * | |
4578 * Use krb5_cc_close() to release @a cache_out when it is no longer needed. | |
4579 * Use krb5_free_principal() to release @a princ_out when it is no longer | |
4580 * needed. Note that @a princ_out is set in some error conditions. | |
4581 * | |
4582 * @return | |
4583 * If an appropriate cache is found, 0 is returned, @a cache_out is set to the | |
4584 * selected cache, and @a princ_out is set to the default principal of that | |
4585 * cache. | |
4586 * | |
4587 * If the appropriate client principal can be authoritatively determined but | |
4588 * the cache collection contains no credentials for that principal, then | |
4589 * KRB5_CC_NOTFOUND is returned, @a cache_out is set to NULL, and @a princ_out | |
4590 * is set to the appropriate client principal. | |
4591 * | |
4592 * If no configured mechanism can determine the appropriate cache or principal, | |
4593 * KRB5_CC_NOTFOUND is returned and @a cache_out and @a princ_out are set to | |
4594 * NULL. | |
4595 * | |
4596 * Any other error code indicates a fatal error in the processing of a cache | |
4597 * selection mechanism. | |
4598 * | |
4599 * @version New in 1.10 | |
4600 */ | |
4601 krb5_error_code KRB5_CALLCONV | |
4602 krb5_cc_select(krb5_context context, krb5_principal server, | |
4603 krb5_ccache *cache_out, krb5_principal *princ_out); | |
4604 | |
4605 /* krb5_free.c */ | |
4606 /** | |
4607 * Free the storage assigned to a principal. | |
4608 * | |
4609 * @param [in] context Library context | |
4610 * @param [in] val Principal to be freed | |
4611 */ | |
4612 void KRB5_CALLCONV | |
4613 krb5_free_principal(krb5_context context, krb5_principal val); | |
4614 | |
4615 /** | |
4616 * Free a krb5_authenticator structure. | |
4617 * | |
4618 * @param [in] context Library context | |
4619 * @param [in] val Authenticator structure to be freed | |
4620 * | |
4621 * This function frees the contents of @a val and the structure itself. | |
4622 */ | |
4623 void KRB5_CALLCONV | |
4624 krb5_free_authenticator(krb5_context context, krb5_authenticator *val); | |
4625 | |
4626 /** | |
4627 * Free the data stored in array of addresses. | |
4628 * | |
4629 * @param [in] context Library context | |
4630 * @param [in] val Array of addresses to be freed | |
4631 * | |
4632 * This function frees the contents of @a val and the array itself. | |
4633 * | |
4634 * @note The last entry in the array must be a NULL pointer. | |
4635 */ | |
4636 void KRB5_CALLCONV | |
4637 krb5_free_addresses(krb5_context context, krb5_address **val); | |
4638 | |
4639 /** | |
4640 * Free the storage assigned to array of authentication data. | |
4641 * | |
4642 * @param [in] context Library context | |
4643 * @param [in] val Array of authentication data to be freed | |
4644 * | |
4645 * This function frees the contents of @a val and the array itself. | |
4646 * | |
4647 * @note The last entry in the array must be a NULL pointer. | |
4648 */ | |
4649 void KRB5_CALLCONV | |
4650 krb5_free_authdata(krb5_context context, krb5_authdata **val); | |
4651 | |
4652 /** | |
4653 * Free a ticket. | |
4654 * | |
4655 * @param [in] context Library context | |
4656 * @param [in] val Ticket to be freed | |
4657 * | |
4658 * This function frees the contents of @a val and the structure itself. | |
4659 */ | |
4660 void KRB5_CALLCONV | |
4661 krb5_free_ticket(krb5_context context, krb5_ticket *val); | |
4662 | |
4663 /** | |
4664 * Free an error allocated by krb5_read_error() or krb5_sendauth(). | |
4665 * | |
4666 * @param [in] context Library context | |
4667 * @param [in] val Error data structure to be freed | |
4668 * | |
4669 * This function frees the contents of @a val and the structure itself. | |
4670 */ | |
4671 void KRB5_CALLCONV | |
4672 krb5_free_error(krb5_context context, krb5_error *val); | |
4673 | |
4674 /** | |
4675 * Free a krb5_creds structure. | |
4676 * | |
4677 * @param [in] context Library context | |
4678 * @param [in] val Credential structure to be freed. | |
4679 * | |
4680 * This function frees the contents of @a val and the structure itself. | |
4681 */ | |
4682 void KRB5_CALLCONV | |
4683 krb5_free_creds(krb5_context context, krb5_creds *val); | |
4684 | |
4685 /** | |
4686 * Free the contents of a krb5_creds structure. | |
4687 * | |
4688 * @param [in] context Library context | |
4689 * @param [in] val Credential structure to free contents of | |
4690 * | |
4691 * This function frees the contents of @a val, but not the structure itself. | |
4692 */ | |
4693 void KRB5_CALLCONV | |
4694 krb5_free_cred_contents(krb5_context context, krb5_creds *val); | |
4695 | |
4696 /** | |
4697 * Free a krb5_checksum structure. | |
4698 * | |
4699 * @param [in] context Library context | |
4700 * @param [in] val Checksum structure to be freed | |
4701 * | |
4702 * This function frees the contents of @a val and the structure itself. | |
4703 */ | |
4704 void KRB5_CALLCONV | |
4705 krb5_free_checksum(krb5_context context, krb5_checksum *val); | |
4706 | |
4707 /** | |
4708 * Free the contents of a krb5_checksum structure. | |
4709 * | |
4710 * @param [in] context Library context | |
4711 * @param [in] val Checksum structure to free contents of | |
4712 * | |
4713 * This function frees the contents of @a val, but not the structure itself. | |
4714 * It sets the checksum's data pointer to null and (beginning in release 1.19) | |
4715 * sets its length to zero. | |
4716 */ | |
4717 void KRB5_CALLCONV | |
4718 krb5_free_checksum_contents(krb5_context context, krb5_checksum *val); | |
4719 | |
4720 /** | |
4721 * Free a krb5_keyblock structure. | |
4722 * | |
4723 * @param [in] context Library context | |
4724 * @param [in] val Keyblock to be freed | |
4725 * | |
4726 * This function frees the contents of @a val and the structure itself. | |
4727 */ | |
4728 void KRB5_CALLCONV | |
4729 krb5_free_keyblock(krb5_context context, krb5_keyblock *val); | |
4730 | |
4731 /** | |
4732 * Free the contents of a krb5_keyblock structure. | |
4733 * | |
4734 * @param [in] context Library context | |
4735 * @param [in] key Keyblock to be freed | |
4736 * | |
4737 * This function frees the contents of @a key, but not the structure itself. | |
4738 */ | |
4739 void KRB5_CALLCONV | |
4740 krb5_free_keyblock_contents(krb5_context context, krb5_keyblock *key); | |
4741 | |
4742 /** | |
4743 * Free a krb5_ap_rep_enc_part structure. | |
4744 * | |
4745 * @param [in] context Library context | |
4746 * @param [in] val AP-REP enc part to be freed | |
4747 * | |
4748 * This function frees the contents of @a val and the structure itself. | |
4749 */ | |
4750 void KRB5_CALLCONV | |
4751 krb5_free_ap_rep_enc_part(krb5_context context, krb5_ap_rep_enc_part *val); | |
4752 | |
4753 /** | |
4754 * Free a krb5_data structure. | |
4755 * | |
4756 * @param [in] context Library context | |
4757 * @param [in] val Data structure to be freed | |
4758 * | |
4759 * This function frees the contents of @a val and the structure itself. | |
4760 */ | |
4761 void KRB5_CALLCONV | |
4762 krb5_free_data(krb5_context context, krb5_data *val); | |
4763 | |
4764 /* Free a krb5_octet_data structure (should be unused). */ | |
4765 void KRB5_CALLCONV | |
4766 krb5_free_octet_data(krb5_context context, krb5_octet_data *val); | |
4767 | |
4768 /** | |
4769 * Free the contents of a krb5_data structure and zero the data field. | |
4770 * | |
4771 * @param [in] context Library context | |
4772 * @param [in] val Data structure to free contents of | |
4773 * | |
4774 * This function frees the contents of @a val, but not the structure itself. | |
4775 * It sets the structure's data pointer to null and (beginning in release 1.19) | |
4776 * sets its length to zero. | |
4777 */ | |
4778 void KRB5_CALLCONV | |
4779 krb5_free_data_contents(krb5_context context, krb5_data *val); | |
4780 | |
4781 /** | |
4782 * Free a string representation of a principal. | |
4783 * | |
4784 * @param [in] context Library context | |
4785 * @param [in] val Name string to be freed | |
4786 */ | |
4787 void KRB5_CALLCONV | |
4788 krb5_free_unparsed_name(krb5_context context, char *val); | |
4789 | |
4790 /** | |
4791 * Free a string allocated by a krb5 function. | |
4792 * | |
4793 * @param [in] context Library context | |
4794 * @param [in] val String to be freed | |
4795 * | |
4796 * @version New in 1.10 | |
4797 */ | |
4798 void KRB5_CALLCONV | |
4799 krb5_free_string(krb5_context context, char *val); | |
4800 | |
4801 /** | |
4802 * Free an array of encryption types. | |
4803 * | |
4804 * @param [in] context Library context | |
4805 * @param [in] val Array of enctypes to be freed | |
4806 * | |
4807 * @version New in 1.12 | |
4808 */ | |
4809 void KRB5_CALLCONV | |
4810 krb5_free_enctypes(krb5_context context, krb5_enctype *val); | |
4811 | |
4812 /** | |
4813 * Free an array of checksum types. | |
4814 * | |
4815 * @param [in] context Library context | |
4816 * @param [in] val Array of checksum types to be freed | |
4817 */ | |
4818 void KRB5_CALLCONV | |
4819 krb5_free_cksumtypes(krb5_context context, krb5_cksumtype *val); | |
4820 | |
4821 /* From krb5/os, but needed by the outside world */ | |
4822 /** | |
4823 * Retrieve the system time of day, in sec and ms, since the epoch. | |
4824 * | |
4825 * @param [in] context Library context | |
4826 * @param [out] seconds System timeofday, seconds portion | |
4827 * @param [out] microseconds System timeofday, microseconds portion | |
4828 * | |
4829 * This function retrieves the system time of day with the context | |
4830 * specific time offset adjustment. | |
4831 * | |
4832 * @sa krb5_crypto_us_timeofday() | |
4833 * | |
4834 * @retval | |
4835 * 0 Success | |
4836 * @return | |
4837 * Kerberos error codes | |
4838 */ | |
4839 krb5_error_code KRB5_CALLCONV | |
4840 krb5_us_timeofday(krb5_context context, | |
4841 krb5_timestamp *seconds, krb5_int32 *microseconds); | |
4842 | |
4843 /** | |
4844 * Retrieve the current time with context specific time offset adjustment. | |
4845 * | |
4846 * @param [in] context Library context | |
4847 * @param [out] timeret Timestamp to fill in | |
4848 * | |
4849 * This function retrieves the system time of day with the context specific | |
4850 * time offset adjustment. | |
4851 * | |
4852 * @retval | |
4853 * 0 Success | |
4854 * @return | |
4855 * Kerberos error codes | |
4856 */ | |
4857 krb5_error_code KRB5_CALLCONV | |
4858 krb5_timeofday(krb5_context context, krb5_timestamp *timeret); | |
4859 | |
4860 /** | |
4861 * Check if a timestamp is within the allowed clock skew of the current time. | |
4862 * | |
4863 * @param [in] context Library context | |
4864 * @param [in] date Timestamp to check | |
4865 * | |
4866 * This function checks if @a date is close enough to the current time | |
4867 * according to the configured allowable clock skew. | |
4868 * | |
4869 * @version New in 1.10 | |
4870 * | |
4871 * @retval 0 Success | |
4872 * @retval KRB5KRB_AP_ERR_SKEW @a date is not within allowable clock skew | |
4873 */ | |
4874 krb5_error_code KRB5_CALLCONV | |
4875 krb5_check_clockskew(krb5_context context, krb5_timestamp date); | |
4876 | |
4877 /** | |
4878 * Return all interface addresses for this host. | |
4879 * | |
4880 * @param [in] context Library context | |
4881 * @param [out] addr Array of krb5_address pointers, ending with | |
4882 * NULL | |
4883 * | |
4884 * Use krb5_free_addresses() to free @a addr when it is no longer needed. | |
4885 * | |
4886 * @retval 0 Success; otherwise - Kerberos error codes | |
4887 */ | |
4888 krb5_error_code KRB5_CALLCONV | |
4889 krb5_os_localaddr(krb5_context context, krb5_address ***addr); | |
4890 | |
4891 /** | |
4892 * Retrieve the default realm. | |
4893 * | |
4894 * @param [in] context Library context | |
4895 * @param [out] lrealm Default realm name | |
4896 * | |
4897 * Retrieves the default realm to be used if no user-specified realm is | |
4898 * available. | |
4899 * | |
4900 * Use krb5_free_default_realm() to free @a lrealm when it is no longer needed. | |
4901 * | |
4902 * @retval | |
4903 * 0 Success | |
4904 * @return | |
4905 * Kerberos error codes | |
4906 */ | |
4907 krb5_error_code KRB5_CALLCONV | |
4908 krb5_get_default_realm(krb5_context context, char **lrealm); | |
4909 | |
4910 /** | |
4911 * Override the default realm for the specified context. | |
4912 * | |
4913 * @param [in] context Library context | |
4914 * @param [in] lrealm Realm name for the default realm | |
4915 * | |
4916 * If @a lrealm is NULL, clear the default realm setting. | |
4917 * | |
4918 * @retval | |
4919 * 0 Success | |
4920 * @return | |
4921 * Kerberos error codes | |
4922 */ | |
4923 krb5_error_code KRB5_CALLCONV | |
4924 krb5_set_default_realm(krb5_context context, const char *lrealm); | |
4925 | |
4926 /** | |
4927 * Free a default realm string returned by krb5_get_default_realm(). | |
4928 * | |
4929 * @param [in] context Library context | |
4930 * @param [in] lrealm Realm to be freed | |
4931 */ | |
4932 void KRB5_CALLCONV | |
4933 krb5_free_default_realm(krb5_context context, char *lrealm); | |
4934 | |
4935 /** | |
4936 * Canonicalize a hostname, possibly using name service. | |
4937 * | |
4938 * @param [in] context Library context | |
4939 * @param [in] host Input hostname | |
4940 * @param [out] canonhost_out Canonicalized hostname | |
4941 * | |
4942 * This function canonicalizes orig_hostname, possibly using name service | |
4943 * lookups if configuration permits. Use krb5_free_string() to free @a | |
4944 * canonhost_out when it is no longer needed. | |
4945 * | |
4946 * @version New in 1.15 | |
4947 */ | |
4948 krb5_error_code KRB5_CALLCONV | |
4949 krb5_expand_hostname(krb5_context context, const char *host, | |
4950 char **canonhost_out); | |
4951 | |
4952 /** | |
4953 * Generate a full principal name from a service name. | |
4954 * | |
4955 * @param [in] context Library context | |
4956 * @param [in] hostname Host name, or NULL to use local host | |
4957 * @param [in] sname Service name, or NULL to use @c "host" | |
4958 * @param [in] type Principal type | |
4959 * @param [out] ret_princ Generated principal | |
4960 * | |
4961 * This function converts a @a hostname and @a sname into @a krb5_principal | |
4962 * structure @a ret_princ. The returned principal will be of the form @a | |
4963 * sname\/hostname\@REALM where REALM is determined by krb5_get_host_realm(). | |
4964 * In some cases this may be the referral (empty) realm. | |
4965 * | |
4966 * The @a type can be one of the following: | |
4967 * | |
4968 * @li #KRB5_NT_SRV_HST canonicalizes the host name before looking up the | |
4969 * realm and generating the principal. | |
4970 * | |
4971 * @li #KRB5_NT_UNKNOWN accepts the hostname as given, and does not | |
4972 * canonicalize it. | |
4973 * | |
4974 * Use krb5_free_principal to free @a ret_princ when it is no longer needed. | |
4975 * | |
4976 * @retval | |
4977 * 0 Success | |
4978 * @return | |
4979 * Kerberos error codes | |
4980 */ | |
4981 krb5_error_code KRB5_CALLCONV | |
4982 krb5_sname_to_principal(krb5_context context, const char *hostname, const char *sname, | |
4983 krb5_int32 type, krb5_principal *ret_princ); | |
4984 | |
4985 /** | |
4986 * Test whether a principal matches a matching principal. | |
4987 * | |
4988 * @param [in] context Library context | |
4989 * @param [in] matching Matching principal | |
4990 * @param [in] princ Principal to test | |
4991 * | |
4992 * @note A matching principal is a host-based principal with an empty realm | |
4993 * and/or second data component (hostname). Profile configuration may cause | |
4994 * the hostname to be ignored even if it is present. A principal matches a | |
4995 * matching principal if the former has the same non-empty (and non-ignored) | |
4996 * components of the latter. | |
4997 * | |
4998 * If @a matching is NULL, return TRUE. If @a matching is not a matching | |
4999 * principal, return the value of krb5_principal_compare(context, matching, | |
5000 * princ). | |
5001 * | |
5002 * @return | |
5003 * TRUE if @a princ matches @a matching, FALSE otherwise. | |
5004 */ | |
5005 krb5_boolean KRB5_CALLCONV | |
5006 krb5_sname_match(krb5_context context, krb5_const_principal matching, | |
5007 krb5_const_principal princ); | |
5008 | |
5009 /** | |
5010 * Change a password for an existing Kerberos account. | |
5011 * | |
5012 * @param [in] context Library context | |
5013 * @param [in] creds Credentials for kadmin/changepw service | |
5014 * @param [in] newpw New password | |
5015 * @param [out] result_code Numeric error code from server | |
5016 * @param [out] result_code_string String equivalent to @a result_code | |
5017 * @param [out] result_string Change password response from the KDC | |
5018 * | |
5019 * Change the password for the existing principal identified by @a creds. | |
5020 * | |
5021 * The possible values of the output @a result_code are: | |
5022 * | |
5023 * @li #KRB5_KPASSWD_SUCCESS (0) - success | |
5024 * @li #KRB5_KPASSWD_MALFORMED (1) - Malformed request error | |
5025 * @li #KRB5_KPASSWD_HARDERROR (2) - Server error | |
5026 * @li #KRB5_KPASSWD_AUTHERROR (3) - Authentication error | |
5027 * @li #KRB5_KPASSWD_SOFTERROR (4) - Password change rejected | |
5028 * | |
5029 * @retval 0 Success; otherwise - Kerberos error codes | |
5030 */ | |
5031 krb5_error_code KRB5_CALLCONV | |
5032 krb5_change_password(krb5_context context, krb5_creds *creds, | |
5033 const char *newpw, int *result_code, | |
5034 krb5_data *result_code_string, krb5_data *result_string); | |
5035 | |
5036 /** | |
5037 * Set a password for a principal using specified credentials. | |
5038 * | |
5039 * @param [in] context Library context | |
5040 * @param [in] creds Credentials for kadmin/changepw service | |
5041 * @param [in] newpw New password | |
5042 * @param [in] change_password_for Change the password for this principal | |
5043 * @param [out] result_code Numeric error code from server | |
5044 * @param [out] result_code_string String equivalent to @a result_code | |
5045 * @param [out] result_string Data returned from the remote system | |
5046 * | |
5047 * This function uses the credentials @a creds to set the password @a newpw for | |
5048 * the principal @a change_password_for. It implements the set password | |
5049 * operation of RFC 3244, for interoperability with Microsoft Windows | |
5050 * implementations. | |
5051 * | |
5052 * @note If @a change_password_for is NULL, the change is performed on the | |
5053 * current principal. If @a change_password_for is non-null, the change is | |
5054 * performed on the principal name passed in @a change_password_for. | |
5055 * | |
5056 * The error code and strings are returned in @a result_code, | |
5057 * @a result_code_string and @a result_string. | |
5058 * | |
5059 * @sa krb5_set_password_using_ccache() | |
5060 * | |
5061 * @retval | |
5062 * 0 Success and result_code is set to #KRB5_KPASSWD_SUCCESS. | |
5063 * @return | |
5064 * Kerberos error codes. | |
5065 */ | |
5066 krb5_error_code KRB5_CALLCONV | |
5067 krb5_set_password(krb5_context context, krb5_creds *creds, const char *newpw, | |
5068 krb5_principal change_password_for, int *result_code, | |
5069 krb5_data *result_code_string, krb5_data *result_string); | |
5070 | |
5071 /** | |
5072 * Set a password for a principal using cached credentials. | |
5073 * | |
5074 * @param [in] context Library context | |
5075 * @param [in] ccache Credential cache | |
5076 * @param [in] newpw New password | |
5077 * @param [in] change_password_for Change the password for this principal | |
5078 * @param [out] result_code Numeric error code from server | |
5079 * @param [out] result_code_string String equivalent to @a result_code | |
5080 * @param [out] result_string Data returned from the remote system | |
5081 * | |
5082 * This function uses the cached credentials from @a ccache to set the password | |
5083 * @a newpw for the principal @a change_password_for. It implements RFC 3244 | |
5084 * set password operation (interoperable with MS Windows implementations) using | |
5085 * the credential cache. | |
5086 * | |
5087 * The error code and strings are returned in @a result_code, | |
5088 * @a result_code_string and @a result_string. | |
5089 * | |
5090 * @note If @a change_password_for is set to NULL, the change is performed on | |
5091 * the default principal in @a ccache. If @a change_password_for is non null, | |
5092 * the change is performed on the specified principal. | |
5093 * | |
5094 * @sa krb5_set_password() | |
5095 * | |
5096 * @retval | |
5097 * 0 Success | |
5098 * @return | |
5099 * Kerberos error codes | |
5100 */ | |
5101 krb5_error_code KRB5_CALLCONV | |
5102 krb5_set_password_using_ccache(krb5_context context, krb5_ccache ccache, | |
5103 const char *newpw, | |
5104 krb5_principal change_password_for, | |
5105 int *result_code, krb5_data *result_code_string, | |
5106 krb5_data *result_string); | |
5107 | |
5108 /** | |
5109 * Get a result message for changing or setting a password. | |
5110 * | |
5111 * @param [in] context Library context | |
5112 * @param [in] server_string Data returned from the remote system | |
5113 * @param [out] message_out A message displayable to the user | |
5114 * | |
5115 * This function processes the @a server_string returned in the @a | |
5116 * result_string parameter of krb5_change_password(), krb5_set_password(), and | |
5117 * related functions, and returns a displayable string. If @a server_string | |
5118 * contains Active Directory structured policy information, it will be | |
5119 * converted into human-readable text. | |
5120 * | |
5121 * Use krb5_free_string() to free @a message_out when it is no longer needed. | |
5122 * | |
5123 * @retval | |
5124 * 0 Success | |
5125 * @return | |
5126 * Kerberos error codes | |
5127 * | |
5128 * @version New in 1.11 | |
5129 */ | |
5130 krb5_error_code KRB5_CALLCONV | |
5131 krb5_chpw_message(krb5_context context, const krb5_data *server_string, | |
5132 char **message_out); | |
5133 | |
5134 /** | |
5135 * Retrieve configuration profile from the context. | |
5136 * | |
5137 * @param [in] context Library context | |
5138 * @param [out] profile Pointer to data read from a configuration file | |
5139 * | |
5140 * This function creates a new @a profile object that reflects profile | |
5141 * in the supplied @a context. | |
5142 * | |
5143 * The @a profile object may be freed with profile_release() function. | |
5144 * See profile.h and profile API for more details. | |
5145 * | |
5146 * @retval | |
5147 * 0 Success | |
5148 * @return | |
5149 * Kerberos error codes | |
5150 */ | |
5151 krb5_error_code KRB5_CALLCONV | |
5152 krb5_get_profile(krb5_context context, struct _profile_t ** profile); | |
5153 | |
5154 #if KRB5_DEPRECATED | |
5155 /** @deprecated Replaced by krb5_get_init_creds_password().*/ | |
5156 KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV | |
5157 krb5_get_in_tkt_with_password(krb5_context context, krb5_flags options, | |
5158 krb5_address *const *addrs, krb5_enctype *ktypes, | |
5159 krb5_preauthtype *pre_auth_types, | |
5160 const char *password, krb5_ccache ccache, | |
5161 krb5_creds *creds, krb5_kdc_rep **ret_as_reply); | |
5162 | |
5163 /** @deprecated Replaced by krb5_get_init_creds(). */ | |
5164 KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV | |
5165 krb5_get_in_tkt_with_skey(krb5_context context, krb5_flags options, | |
5166 krb5_address *const *addrs, krb5_enctype *ktypes, | |
5167 krb5_preauthtype *pre_auth_types, | |
5168 const krb5_keyblock *key, krb5_ccache ccache, | |
5169 krb5_creds *creds, krb5_kdc_rep **ret_as_reply); | |
5170 | |
5171 /** @deprecated Replaced by krb5_get_init_creds_keytab(). */ | |
5172 KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV | |
5173 krb5_get_in_tkt_with_keytab(krb5_context context, krb5_flags options, | |
5174 krb5_address *const *addrs, krb5_enctype *ktypes, | |
5175 krb5_preauthtype *pre_auth_types, | |
5176 krb5_keytab arg_keytab, krb5_ccache ccache, | |
5177 krb5_creds *creds, krb5_kdc_rep **ret_as_reply); | |
5178 | |
5179 #endif /* KRB5_DEPRECATED */ | |
5180 | |
5181 /** | |
5182 * Parse and decrypt a @c KRB_AP_REQ message. | |
5183 * | |
5184 * @param [in] context Library context | |
5185 * @param [in,out] auth_context Pre-existing or newly created auth context | |
5186 * @param [in] inbuf AP-REQ message to be parsed | |
5187 * @param [in] server Matching principal for server, or NULL to | |
5188 * allow any principal in keytab | |
5189 * @param [in] keytab Key table, or NULL to use the default | |
5190 * @param [out] ap_req_options If non-null, the AP-REQ flags on output | |
5191 * @param [out] ticket If non-null, ticket from the AP-REQ message | |
5192 * | |
5193 * This function parses, decrypts and verifies a AP-REQ message from @a inbuf | |
5194 * and stores the authenticator in @a auth_context. | |
5195 * | |
5196 * If a keyblock was specified in @a auth_context using | |
5197 * krb5_auth_con_setuseruserkey(), that key is used to decrypt the ticket in | |
5198 * AP-REQ message and @a keytab is ignored. In this case, @a server should be | |
5199 * specified as a complete principal name to allow for proper transited-path | |
5200 * checking and replay cache selection. | |
5201 * | |
5202 * Otherwise, the decryption key is obtained from @a keytab, or from the | |
5203 * default keytab if it is NULL. In this case, @a server may be a complete | |
5204 * principal name, a matching principal (see krb5_sname_match()), or NULL to | |
5205 * match any principal name. The keys tried against the encrypted part of the | |
5206 * ticket are determined as follows: | |
5207 * | |
5208 * - If @a server is a complete principal name, then its entry in @a keytab is | |
5209 * tried. | |
5210 * - Otherwise, if @a keytab is iterable, then all entries in @a keytab which | |
5211 * match @a server are tried. | |
5212 * - Otherwise, the server principal in the ticket must match @a server, and | |
5213 * its entry in @a keytab is tried. | |
5214 * | |
5215 * The client specified in the decrypted authenticator must match the client | |
5216 * specified in the decrypted ticket. | |
5217 * | |
5218 * If the @a remote_addr field of @a auth_context is set, the request must come | |
5219 * from that address. | |
5220 * | |
5221 * If a replay cache handle is provided in the @a auth_context, the | |
5222 * authenticator and ticket are verified against it. If no conflict is found, | |
5223 * the new authenticator is then stored in the replay cache of @a auth_context. | |
5224 * | |
5225 * Various other checks are performed on the decoded data, including | |
5226 * cross-realm policy, clockskew, and ticket validation times. | |
5227 * | |
5228 * On success the authenticator, subkey, and remote sequence number of the | |
5229 * request are stored in @a auth_context. If the #AP_OPTS_MUTUAL_REQUIRED | |
5230 * bit is set, the local sequence number is XORed with the remote sequence | |
5231 * number in the request. | |
5232 * | |
5233 * Use krb5_free_ticket() to free @a ticket when it is no longer needed. | |
5234 * | |
5235 * @retval 0 Success; otherwise - Kerberos error codes | |
5236 */ | |
5237 krb5_error_code KRB5_CALLCONV | |
5238 krb5_rd_req(krb5_context context, krb5_auth_context *auth_context, | |
5239 const krb5_data *inbuf, krb5_const_principal server, | |
5240 krb5_keytab keytab, krb5_flags *ap_req_options, | |
5241 krb5_ticket **ticket); | |
5242 | |
5243 /** | |
5244 * Retrieve a service key from a key table. | |
5245 * | |
5246 * @param [in] context Library context | |
5247 * @param [in] keyprocarg Name of a key table (NULL to use default name) | |
5248 * @param [in] principal Service principal | |
5249 * @param [in] vno Key version number (0 for highest available) | |
5250 * @param [in] enctype Encryption type (0 for any type) | |
5251 * @param [out] key Service key from key table | |
5252 * | |
5253 * Open and search the specified key table for the entry identified by @a | |
5254 * principal, @a enctype, and @a vno. If no key is found, return an error code. | |
5255 * | |
5256 * The default key table is used, unless @a keyprocarg is non-null. | |
5257 * @a keyprocarg designates a specific key table. | |
5258 * | |
5259 * Use krb5_free_keyblock() to free @a key when it is no longer needed. | |
5260 * | |
5261 * @retval | |
5262 * 0 Success | |
5263 * @return Kerberos error code if not found or @a keyprocarg is invalid. | |
5264 */ | |
5265 krb5_error_code KRB5_CALLCONV | |
5266 krb5_kt_read_service_key(krb5_context context, krb5_pointer keyprocarg, | |
5267 krb5_principal principal, krb5_kvno vno, | |
5268 krb5_enctype enctype, krb5_keyblock **key); | |
5269 | |
5270 /** | |
5271 * Format a @c KRB-SAFE message. | |
5272 * | |
5273 * @param [in] context Library context | |
5274 * @param [in] auth_context Authentication context | |
5275 * @param [in] userdata User data in the message | |
5276 * @param [out] der_out Formatted @c KRB-SAFE buffer | |
5277 * @param [out] rdata_out Replay data. Specify NULL if not needed | |
5278 * | |
5279 * This function creates an integrity protected @c KRB-SAFE message | |
5280 * using data supplied by the application. | |
5281 * | |
5282 * Fields in @a auth_context specify the checksum type, the keyblock that | |
5283 * can be used to seed the checksum, full addresses (host and port) for | |
5284 * the sender and receiver, and @ref KRB5_AUTH_CONTEXT flags. | |
5285 * | |
5286 * The local address in @a auth_context must be set, and is used to form the | |
5287 * sender address used in the KRB-SAFE message. The remote address is | |
5288 * optional; if specified, it will be used to form the receiver address used in | |
5289 * the message. | |
5290 * | |
5291 * @note The @a rdata_out argument is required if the | |
5292 * #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set | |
5293 * in @a auth_context. | |
5294 * | |
5295 * If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, a | |
5296 * timestamp is included in the KRB-SAFE message, and an entry for the message | |
5297 * is entered in an in-memory replay cache to detect if the message is | |
5298 * reflected by an attacker. If #KRB5_AUTH_CONTEXT_DO_TIME is not set, no | |
5299 * replay cache is used. If #KRB5_AUTH_CONTEXT_RET_TIME is set in @a | |
5300 * auth_context, a timestamp is included in the KRB-SAFE message and is stored | |
5301 * in @a rdata_out. | |
5302 * | |
5303 * If either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or #KRB5_AUTH_CONTEXT_RET_SEQUENCE | |
5304 * is set, the @a auth_context local sequence number is included in the | |
5305 * KRB-SAFE message and then incremented. If #KRB5_AUTH_CONTEXT_RET_SEQUENCE | |
5306 * is set, the sequence number used is stored in @a rdata_out. | |
5307 * | |
5308 * Use krb5_free_data_contents() to free @a der_out when it is no longer | |
5309 * needed. | |
5310 * | |
5311 * @retval 0 Success; otherwise - Kerberos error codes | |
5312 */ | |
5313 krb5_error_code KRB5_CALLCONV | |
5314 krb5_mk_safe(krb5_context context, krb5_auth_context auth_context, | |
5315 const krb5_data *userdata, krb5_data *der_out, | |
5316 krb5_replay_data *rdata_out); | |
5317 | |
5318 /** | |
5319 * Format a @c KRB-PRIV message. | |
5320 * | |
5321 * @param [in] context Library context | |
5322 * @param [in] auth_context Authentication context | |
5323 * @param [in] userdata User data for @c KRB-PRIV message | |
5324 * @param [out] der_out Formatted @c KRB-PRIV message | |
5325 * @param [out] rdata_out Replay data (NULL if not needed) | |
5326 * | |
5327 * This function is similar to krb5_mk_safe(), but the message is encrypted and | |
5328 * integrity-protected, not just integrity-protected. | |
5329 * | |
5330 * The local address in @a auth_context must be set, and is used to form the | |
5331 * sender address used in the KRB-PRIV message. The remote address is | |
5332 * optional; if specified, it will be used to form the receiver address used in | |
5333 * the message. | |
5334 * | |
5335 * @note The @a rdata_out argument is required if the | |
5336 * #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set | |
5337 * in @a auth_context. | |
5338 * | |
5339 * If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, a | |
5340 * timestamp is included in the KRB-PRIV message, and an entry for the message | |
5341 * is entered in an in-memory replay cache to detect if the message is | |
5342 * reflected by an attacker. If #KRB5_AUTH_CONTEXT_DO_TIME is not set, no | |
5343 * replay cache is used. If #KRB5_AUTH_CONTEXT_RET_TIME is set in @a | |
5344 * auth_context, a timestamp is included in the KRB-PRIV message and is stored | |
5345 * in @a rdata_out. | |
5346 * | |
5347 * If either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or #KRB5_AUTH_CONTEXT_RET_SEQUENCE | |
5348 * is set, the @a auth_context local sequence number is included in the | |
5349 * KRB-PRIV message and then incremented. If #KRB5_AUTH_CONTEXT_RET_SEQUENCE | |
5350 * is set, the sequence number used is stored in @a rdata_out. | |
5351 * | |
5352 * Use krb5_free_data_contents() to free @a der_out when it is no longer | |
5353 * needed. | |
5354 * | |
5355 * @retval 0 Success; otherwise - Kerberos error codes | |
5356 */ | |
5357 krb5_error_code KRB5_CALLCONV | |
5358 krb5_mk_priv(krb5_context context, krb5_auth_context auth_context, | |
5359 const krb5_data *userdata, krb5_data *der_out, | |
5360 krb5_replay_data *rdata_out); | |
5361 | |
5362 /** | |
5363 * Client function for @c sendauth protocol. | |
5364 * | |
5365 * @param [in] context Library context | |
5366 * @param [in,out] auth_context Pre-existing or newly created auth context | |
5367 * @param [in] fd File descriptor that describes network socket | |
5368 * @param [in] appl_version Application protocol version to be matched | |
5369 * with the receiver's application version | |
5370 * @param [in] client Client principal | |
5371 * @param [in] server Server principal | |
5372 * @param [in] ap_req_options @ref AP_OPTS options | |
5373 * @param [in] in_data Data to be sent to the server | |
5374 * @param [in] in_creds Input credentials, or NULL to use @a ccache | |
5375 * @param [in] ccache Credential cache | |
5376 * @param [out] error If non-null, contains KRB_ERROR message | |
5377 * returned from server | |
5378 * @param [out] rep_result If non-null and @a ap_req_options is | |
5379 * #AP_OPTS_MUTUAL_REQUIRED, contains the result | |
5380 * of mutual authentication exchange | |
5381 * @param [out] out_creds If non-null, the retrieved credentials | |
5382 * | |
5383 * This function performs the client side of a sendauth/recvauth exchange by | |
5384 * sending and receiving messages over @a fd. | |
5385 * | |
5386 * Credentials may be specified in three ways: | |
5387 * | |
5388 * @li If @a in_creds is NULL, credentials are obtained with | |
5389 * krb5_get_credentials() using the principals @a client and @a server. @a | |
5390 * server must be non-null; @a client may NULL to use the default principal of | |
5391 * @a ccache. | |
5392 * | |
5393 * @li If @a in_creds is non-null, but does not contain a ticket, credentials | |
5394 * for the exchange are obtained with krb5_get_credentials() using @a in_creds. | |
5395 * In this case, the values of @a client and @a server are unused. | |
5396 * | |
5397 * @li If @a in_creds is a complete credentials structure, it used directly. | |
5398 * In this case, the values of @a client, @a server, and @a ccache are unused. | |
5399 * | |
5400 * If the server is using a different application protocol than that specified | |
5401 * in @a appl_version, an error will be returned. | |
5402 * | |
5403 * Use krb5_free_creds() to free @a out_creds, krb5_free_ap_rep_enc_part() to | |
5404 * free @a rep_result, and krb5_free_error() to free @a error when they are no | |
5405 * longer needed. | |
5406 * | |
5407 * @sa krb5_recvauth() | |
5408 * | |
5409 * @retval 0 Success; otherwise - Kerberos error codes | |
5410 */ | |
5411 krb5_error_code KRB5_CALLCONV | |
5412 krb5_sendauth(krb5_context context, krb5_auth_context *auth_context, | |
5413 krb5_pointer fd, char *appl_version, krb5_principal client, | |
5414 krb5_principal server, krb5_flags ap_req_options, | |
5415 krb5_data *in_data, krb5_creds *in_creds, krb5_ccache ccache, | |
5416 krb5_error **error, krb5_ap_rep_enc_part **rep_result, | |
5417 krb5_creds **out_creds); | |
5418 | |
5419 /** | |
5420 * Server function for @a sendauth protocol. | |
5421 * | |
5422 * @param [in] context Library context | |
5423 * @param [in,out] auth_context Pre-existing or newly created auth context | |
5424 * @param [in] fd File descriptor | |
5425 * @param [in] appl_version Application protocol version to be matched | |
5426 * against the client's application version | |
5427 * @param [in] server Server principal (NULL for any in @a keytab) | |
5428 * @param [in] flags Additional specifications | |
5429 * @param [in] keytab Key table containing service keys | |
5430 * @param [out] ticket Ticket (NULL if not needed) | |
5431 * | |
5432 * This function performs the server side of a sendauth/recvauth exchange by | |
5433 * sending and receiving messages over @a fd. | |
5434 * | |
5435 * Use krb5_free_ticket() to free @a ticket when it is no longer needed. | |
5436 * | |
5437 * @sa krb5_sendauth() | |
5438 * | |
5439 * @retval 0 Success; otherwise - Kerberos error codes | |
5440 */ | |
5441 krb5_error_code KRB5_CALLCONV | |
5442 krb5_recvauth(krb5_context context, krb5_auth_context *auth_context, | |
5443 krb5_pointer fd, char *appl_version, krb5_principal server, | |
5444 krb5_int32 flags, krb5_keytab keytab, krb5_ticket **ticket); | |
5445 | |
5446 /** | |
5447 * Server function for @a sendauth protocol with version parameter. | |
5448 * | |
5449 * @param [in] context Library context | |
5450 * @param [in,out] auth_context Pre-existing or newly created auth context | |
5451 * @param [in] fd File descriptor | |
5452 * @param [in] server Server principal (NULL for any in @a keytab) | |
5453 * @param [in] flags Additional specifications | |
5454 * @param [in] keytab Decryption key | |
5455 * @param [out] ticket Ticket (NULL if not needed) | |
5456 * @param [out] version sendauth protocol version (NULL if not needed) | |
5457 * | |
5458 * This function is similar to krb5_recvauth() with the additional output | |
5459 * information place into @a version. | |
5460 * | |
5461 * @retval 0 Success; otherwise - Kerberos error codes | |
5462 */ | |
5463 krb5_error_code KRB5_CALLCONV | |
5464 krb5_recvauth_version(krb5_context context, | |
5465 krb5_auth_context *auth_context, | |
5466 krb5_pointer fd, | |
5467 krb5_principal server, | |
5468 krb5_int32 flags, | |
5469 krb5_keytab keytab, | |
5470 krb5_ticket **ticket, | |
5471 krb5_data *version); | |
5472 | |
5473 /** | |
5474 * Format a @c KRB-CRED message for an array of credentials. | |
5475 * | |
5476 * @param [in] context Library context | |
5477 * @param [in] auth_context Authentication context | |
5478 * @param [in] creds Null-terminated array of credentials | |
5479 * @param [out] der_out Encoded credentials | |
5480 * @param [out] rdata_out Replay cache information (NULL if not needed) | |
5481 * | |
5482 * This function takes an array of credentials @a creds and formats | |
5483 * a @c KRB-CRED message @a der_out to pass to krb5_rd_cred(). | |
5484 * | |
5485 * The local and remote addresses in @a auth_context are optional; if either is | |
5486 * specified, they are used to form the sender and receiver addresses in the | |
5487 * KRB-CRED message. | |
5488 * | |
5489 * @note The @a rdata_out argument is required if the | |
5490 * #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set | |
5491 * in @a auth_context. | |
5492 * | |
5493 * If the #KRB5_AUTH_CONTEXT_DO_TIME flag is set in @a auth_context, an entry | |
5494 * for the message is entered in an in-memory replay cache to detect if the | |
5495 * message is reflected by an attacker. If #KRB5_AUTH_CONTEXT_DO_TIME is not | |
5496 * set, no replay cache is used. If #KRB5_AUTH_CONTEXT_RET_TIME is set in @a | |
5497 * auth_context, the timestamp used for the KRB-CRED message is stored in @a | |
5498 * rdata_out. | |
5499 * | |
5500 * If either #KRB5_AUTH_CONTEXT_DO_SEQUENCE or #KRB5_AUTH_CONTEXT_RET_SEQUENCE | |
5501 * is set, the @a auth_context local sequence number is included in the | |
5502 * KRB-CRED message and then incremented. If #KRB5_AUTH_CONTEXT_RET_SEQUENCE | |
5503 * is set, the sequence number used is stored in @a rdata_out. | |
5504 * | |
5505 * Use krb5_free_data_contents() to free @a der_out when it is no longer | |
5506 * needed. | |
5507 * | |
5508 * The message will be encrypted using the send subkey of @a auth_context if it | |
5509 * is present, or the session key otherwise. If neither key is present, the | |
5510 * credentials will not be encrypted, and the message should only be sent over | |
5511 * a secure channel. No replay cache entry is used in this case. | |
5512 * | |
5513 * @retval | |
5514 * 0 Success | |
5515 * @retval | |
5516 * ENOMEM Insufficient memory | |
5517 * @retval | |
5518 * KRB5_RC_REQUIRED Message replay detection requires @a rcache parameter | |
5519 * @return | |
5520 * Kerberos error codes | |
5521 */ | |
5522 krb5_error_code KRB5_CALLCONV | |
5523 krb5_mk_ncred(krb5_context context, krb5_auth_context auth_context, | |
5524 krb5_creds **creds, krb5_data **der_out, | |
5525 krb5_replay_data *rdata_out); | |
5526 | |
5527 /** | |
5528 * Format a @c KRB-CRED message for a single set of credentials. | |
5529 * | |
5530 * @param [in] context Library context | |
5531 * @param [in] auth_context Authentication context | |
5532 * @param [in] creds Pointer to credentials | |
5533 * @param [out] der_out Encoded credentials | |
5534 * @param [out] rdata_out Replay cache data (NULL if not needed) | |
5535 * | |
5536 * This is a convenience function that calls krb5_mk_ncred() with a single set | |
5537 * of credentials. | |
5538 * | |
5539 * @retval | |
5540 * 0 Success | |
5541 * @retval | |
5542 * ENOMEM Insufficient memory | |
5543 * @retval | |
5544 * KRB5_RC_REQUIRED Message replay detection requires @a rcache parameter | |
5545 * @return | |
5546 * Kerberos error codes | |
5547 */ | |
5548 krb5_error_code KRB5_CALLCONV | |
5549 krb5_mk_1cred(krb5_context context, krb5_auth_context auth_context, | |
5550 krb5_creds *creds, krb5_data **der_out, | |
5551 krb5_replay_data *rdata_out); | |
5552 | |
5553 /** | |
5554 * Read and validate a @c KRB-CRED message. | |
5555 * | |
5556 * @param [in] context Library context | |
5557 * @param [in] auth_context Authentication context | |
5558 * @param [in] creddata @c KRB-CRED message | |
5559 * @param [out] creds_out Null-terminated array of forwarded credentials | |
5560 * @param [out] rdata_out Replay data (NULL if not needed) | |
5561 * | |
5562 * @note The @a rdata_out argument is required if the | |
5563 * #KRB5_AUTH_CONTEXT_RET_TIME or #KRB5_AUTH_CONTEXT_RET_SEQUENCE flag is set | |
5564 * in @a auth_context.` | |
5565 * | |
5566 * @a creddata will be decrypted using the receiving subkey if it is present in | |
5567 * @a auth_context, or the session key if the receiving subkey is not present | |
5568 * or fails to decrypt the message. | |
5569 * | |
5570 * Use krb5_free_tgt_creds() to free @a creds_out when it is no longer needed. | |
5571 * | |
5572 * @retval 0 Success; otherwise - Kerberos error codes | |
5573 */ | |
5574 krb5_error_code KRB5_CALLCONV | |
5575 krb5_rd_cred(krb5_context context, krb5_auth_context auth_context, | |
5576 krb5_data *creddata, krb5_creds ***creds_out, | |
5577 krb5_replay_data *rdata_out); | |
5578 | |
5579 /** | |
5580 * Get a forwarded TGT and format a @c KRB-CRED message. | |
5581 * | |
5582 * @param [in] context Library context | |
5583 * @param [in] auth_context Authentication context | |
5584 * @param [in] rhost Remote host | |
5585 * @param [in] client Client principal of TGT | |
5586 * @param [in] server Principal of server to receive TGT | |
5587 * @param [in] cc Credential cache handle (NULL to use default) | |
5588 * @param [in] forwardable Whether TGT should be forwardable | |
5589 * @param [out] outbuf KRB-CRED message | |
5590 * | |
5591 * Get a TGT for use at the remote host @a rhost and format it into a KRB-CRED | |
5592 * message. If @a rhost is NULL and @a server is of type #KRB5_NT_SRV_HST, | |
5593 * the second component of @a server will be used. | |
5594 * | |
5595 * @retval | |
5596 * 0 Success | |
5597 * @retval | |
5598 * ENOMEM Insufficient memory | |
5599 * @retval | |
5600 * KRB5_PRINC_NOMATCH Requested principal and ticket do not match | |
5601 * @retval | |
5602 * KRB5_NO_TKT_SUPPLIED Request did not supply a ticket | |
5603 * @retval | |
5604 * KRB5_CC_BADNAME Credential cache name or principal name malformed | |
5605 * @return | |
5606 * Kerberos error codes | |
5607 */ | |
5608 krb5_error_code KRB5_CALLCONV | |
5609 krb5_fwd_tgt_creds(krb5_context context, krb5_auth_context auth_context, | |
5610 const char *rhost, krb5_principal client, | |
5611 krb5_principal server, krb5_ccache cc, int forwardable, | |
5612 krb5_data *outbuf); | |
5613 | |
5614 /** | |
5615 * Create and initialize an authentication context. | |
5616 * | |
5617 * @param [in] context Library context | |
5618 * @param [out] auth_context Authentication context | |
5619 * | |
5620 * This function creates an authentication context to hold configuration and | |
5621 * state relevant to krb5 functions for authenticating principals and | |
5622 * protecting messages once authentication has occurred. | |
5623 * | |
5624 * By default, flags for the context are set to enable the use of the replay | |
5625 * cache (#KRB5_AUTH_CONTEXT_DO_TIME), but not sequence numbers. Use | |
5626 * krb5_auth_con_setflags() to change the flags. | |
5627 * | |
5628 * The allocated @a auth_context must be freed with krb5_auth_con_free() when | |
5629 * it is no longer needed. | |
5630 * | |
5631 * @retval 0 Success; otherwise - Kerberos error codes | |
5632 */ | |
5633 krb5_error_code KRB5_CALLCONV | |
5634 krb5_auth_con_init(krb5_context context, krb5_auth_context *auth_context); | |
5635 | |
5636 /** | |
5637 * Free a krb5_auth_context structure. | |
5638 * | |
5639 * @param [in] context Library context | |
5640 * @param [in] auth_context Authentication context to be freed | |
5641 * | |
5642 * This function frees an auth context allocated by krb5_auth_con_init(). | |
5643 * | |
5644 * @retval 0 (always) | |
5645 */ | |
5646 krb5_error_code KRB5_CALLCONV | |
5647 krb5_auth_con_free(krb5_context context, krb5_auth_context auth_context); | |
5648 | |
5649 /** | |
5650 * Set a flags field in a krb5_auth_context structure. | |
5651 * | |
5652 * @param [in] context Library context | |
5653 * @param [in] auth_context Authentication context | |
5654 * @param [in] flags Flags bit mask | |
5655 * | |
5656 * Valid values for @a flags are: | |
5657 * @li #KRB5_AUTH_CONTEXT_DO_TIME Use timestamps | |
5658 * @li #KRB5_AUTH_CONTEXT_RET_TIME Save timestamps | |
5659 * @li #KRB5_AUTH_CONTEXT_DO_SEQUENCE Use sequence numbers | |
5660 * @li #KRB5_AUTH_CONTEXT_RET_SEQUENCE Save sequence numbers | |
5661 * | |
5662 * @retval 0 (always) | |
5663 */ | |
5664 krb5_error_code KRB5_CALLCONV | |
5665 krb5_auth_con_setflags(krb5_context context, krb5_auth_context auth_context, krb5_int32 flags); | |
5666 | |
5667 /** | |
5668 * Retrieve flags from a krb5_auth_context structure. | |
5669 * | |
5670 * @param [in] context Library context | |
5671 * @param [in] auth_context Authentication context | |
5672 * @param [out] flags Flags bit mask | |
5673 * | |
5674 * Valid values for @a flags are: | |
5675 * @li #KRB5_AUTH_CONTEXT_DO_TIME Use timestamps | |
5676 * @li #KRB5_AUTH_CONTEXT_RET_TIME Save timestamps | |
5677 * @li #KRB5_AUTH_CONTEXT_DO_SEQUENCE Use sequence numbers | |
5678 * @li #KRB5_AUTH_CONTEXT_RET_SEQUENCE Save sequence numbers | |
5679 * | |
5680 * @retval 0 (always) | |
5681 */ | |
5682 krb5_error_code KRB5_CALLCONV | |
5683 krb5_auth_con_getflags(krb5_context context, krb5_auth_context auth_context, | |
5684 krb5_int32 *flags); | |
5685 | |
5686 /** | |
5687 * Set a checksum callback in an auth context. | |
5688 * | |
5689 * @param [in] context Library context | |
5690 * @param [in] auth_context Authentication context | |
5691 * @param [in] func Checksum callback | |
5692 * @param [in] data Callback argument | |
5693 * | |
5694 * Set a callback to obtain checksum data in krb5_mk_req(). The callback will | |
5695 * be invoked after the subkey and local sequence number are stored in @a | |
5696 * auth_context. | |
5697 * | |
5698 * @retval 0 (always) | |
5699 */ | |
5700 krb5_error_code KRB5_CALLCONV | |
5701 krb5_auth_con_set_checksum_func( krb5_context context, | |
5702 krb5_auth_context auth_context, | |
5703 krb5_mk_req_checksum_func func, | |
5704 void *data); | |
5705 | |
5706 /** | |
5707 * Get the checksum callback from an auth context. | |
5708 * | |
5709 * @param [in] context Library context | |
5710 * @param [in] auth_context Authentication context | |
5711 * @param [out] func Checksum callback | |
5712 * @param [out] data Callback argument | |
5713 * | |
5714 * @retval 0 (always) | |
5715 */ | |
5716 krb5_error_code KRB5_CALLCONV | |
5717 krb5_auth_con_get_checksum_func( krb5_context context, | |
5718 krb5_auth_context auth_context, | |
5719 krb5_mk_req_checksum_func *func, | |
5720 void **data); | |
5721 | |
5722 /** | |
5723 * Set the local and remote addresses in an auth context. | |
5724 * | |
5725 * @param [in] context Library context | |
5726 * @param [in] auth_context Authentication context | |
5727 * @param [in] local_addr Local address | |
5728 * @param [in] remote_addr Remote address | |
5729 * | |
5730 * This function releases the storage assigned to the contents of the local and | |
5731 * remote addresses of @a auth_context and then sets them to @a local_addr and | |
5732 * @a remote_addr respectively. | |
5733 * | |
5734 * @sa krb5_auth_con_genaddrs() | |
5735 * | |
5736 * @retval 0 Success; otherwise - Kerberos error codes | |
5737 */ | |
5738 krb5_error_code KRB5_CALLCONV_WRONG | |
5739 krb5_auth_con_setaddrs(krb5_context context, krb5_auth_context auth_context, | |
5740 krb5_address *local_addr, krb5_address *remote_addr); | |
5741 | |
5742 /** | |
5743 * Retrieve address fields from an auth context. | |
5744 * | |
5745 * @param [in] context Library context | |
5746 * @param [in] auth_context Authentication context | |
5747 * @param [out] local_addr Local address (NULL if not needed) | |
5748 * @param [out] remote_addr Remote address (NULL if not needed) | |
5749 * | |
5750 * @retval 0 Success; otherwise - Kerberos error codes | |
5751 */ | |
5752 krb5_error_code KRB5_CALLCONV | |
5753 krb5_auth_con_getaddrs(krb5_context context, krb5_auth_context auth_context, | |
5754 krb5_address **local_addr, krb5_address **remote_addr); | |
5755 | |
5756 /** | |
5757 * Set local and remote port fields in an auth context. | |
5758 * | |
5759 * @param [in] context Library context | |
5760 * @param [in] auth_context Authentication context | |
5761 * @param [in] local_port Local port | |
5762 * @param [in] remote_port Remote port | |
5763 * | |
5764 * This function releases the storage assigned to the contents of the local and | |
5765 * remote ports of @a auth_context and then sets them to @a local_port and @a | |
5766 * remote_port respectively. | |
5767 * | |
5768 * @sa krb5_auth_con_genaddrs() | |
5769 * | |
5770 * @retval 0 Success; otherwise - Kerberos error codes | |
5771 */ | |
5772 krb5_error_code KRB5_CALLCONV | |
5773 krb5_auth_con_setports(krb5_context context, krb5_auth_context auth_context, | |
5774 krb5_address *local_port, krb5_address *remote_port); | |
5775 | |
5776 /** | |
5777 * Set the session key in an auth context. | |
5778 * | |
5779 * @param [in] context Library context | |
5780 * @param [in] auth_context Authentication context | |
5781 * @param [in] keyblock User key | |
5782 * | |
5783 * @retval 0 Success; otherwise - Kerberos error codes | |
5784 */ | |
5785 krb5_error_code KRB5_CALLCONV | |
5786 krb5_auth_con_setuseruserkey(krb5_context context, krb5_auth_context auth_context, | |
5787 krb5_keyblock *keyblock); | |
5788 | |
5789 /** | |
5790 * Retrieve the session key from an auth context as a keyblock. | |
5791 * | |
5792 * @param [in] context Library context | |
5793 * @param [in] auth_context Authentication context | |
5794 * @param [out] keyblock Session key | |
5795 * | |
5796 * This function creates a keyblock containing the session key from @a | |
5797 * auth_context. Use krb5_free_keyblock() to free @a keyblock when it is no | |
5798 * longer needed | |
5799 * | |
5800 * @retval 0 Success. Otherwise - Kerberos error codes | |
5801 */ | |
5802 krb5_error_code KRB5_CALLCONV | |
5803 krb5_auth_con_getkey(krb5_context context, krb5_auth_context auth_context, | |
5804 krb5_keyblock **keyblock); | |
5805 | |
5806 /** | |
5807 * Retrieve the session key from an auth context. | |
5808 * | |
5809 * @param [in] context Library context | |
5810 * @param [in] auth_context Authentication context | |
5811 * @param [out] key Session key | |
5812 * | |
5813 * This function sets @a key to the session key from @a auth_context. Use | |
5814 * krb5_k_free_key() to release @a key when it is no longer needed. | |
5815 * | |
5816 * @retval 0 (always) | |
5817 */ | |
5818 krb5_error_code KRB5_CALLCONV | |
5819 krb5_auth_con_getkey_k(krb5_context context, krb5_auth_context auth_context, | |
5820 krb5_key *key); | |
5821 | |
5822 /** | |
5823 * Retrieve the send subkey from an auth context as a keyblock. | |
5824 * | |
5825 * @param [in] ctx Library context | |
5826 * @param [in] ac Authentication context | |
5827 * @param [out] keyblock Send subkey | |
5828 * | |
5829 * This function creates a keyblock containing the send subkey from @a | |
5830 * auth_context. Use krb5_free_keyblock() to free @a keyblock when it is no | |
5831 * longer needed. | |
5832 * | |
5833 * @retval 0 Success; otherwise - Kerberos error codes | |
5834 */ | |
5835 krb5_error_code KRB5_CALLCONV | |
5836 krb5_auth_con_getsendsubkey(krb5_context ctx, krb5_auth_context ac, krb5_keyblock **keyblock); | |
5837 | |
5838 /** | |
5839 * Retrieve the send subkey from an auth context. | |
5840 * | |
5841 * @param [in] ctx Library context | |
5842 * @param [in] ac Authentication context | |
5843 * @param [out] key Send subkey | |
5844 * | |
5845 * This function sets @a key to the send subkey from @a auth_context. Use | |
5846 * krb5_k_free_key() to release @a key when it is no longer needed. | |
5847 * | |
5848 * @retval 0 Success; otherwise - Kerberos error codes | |
5849 */ | |
5850 krb5_error_code KRB5_CALLCONV | |
5851 krb5_auth_con_getsendsubkey_k(krb5_context ctx, krb5_auth_context ac, | |
5852 krb5_key *key); | |
5853 | |
5854 /** | |
5855 * Retrieve the receiving subkey from an auth context as a keyblock. | |
5856 * | |
5857 * @param [in] ctx Library context | |
5858 * @param [in] ac Authentication context | |
5859 * @param [out] keyblock Receiving subkey | |
5860 * | |
5861 * This function creates a keyblock containing the receiving subkey from @a | |
5862 * auth_context. Use krb5_free_keyblock() to free @a keyblock when it is no | |
5863 * longer needed. | |
5864 * | |
5865 * @retval 0 Success; otherwise - Kerberos error codes | |
5866 */ | |
5867 krb5_error_code KRB5_CALLCONV | |
5868 krb5_auth_con_getrecvsubkey(krb5_context ctx, krb5_auth_context ac, krb5_keyblock **keyblock); | |
5869 | |
5870 /** | |
5871 * Retrieve the receiving subkey from an auth context as a keyblock. | |
5872 * | |
5873 * @param [in] ctx Library context | |
5874 * @param [in] ac Authentication context | |
5875 * @param [out] key Receiving subkey | |
5876 * | |
5877 * This function sets @a key to the receiving subkey from @a auth_context. Use | |
5878 * krb5_k_free_key() to release @a key when it is no longer needed. | |
5879 * | |
5880 * @retval 0 Success; otherwise - Kerberos error codes | |
5881 */ | |
5882 krb5_error_code KRB5_CALLCONV | |
5883 krb5_auth_con_getrecvsubkey_k(krb5_context ctx, krb5_auth_context ac, krb5_key *key); | |
5884 | |
5885 /** | |
5886 * Set the send subkey in an auth context with a keyblock. | |
5887 * | |
5888 * @param [in] ctx Library context | |
5889 * @param [in] ac Authentication context | |
5890 * @param [in] keyblock Send subkey | |
5891 * | |
5892 * This function sets the send subkey in @a ac to a copy of @a keyblock. | |
5893 * | |
5894 * @retval 0 Success. Otherwise - Kerberos error codes | |
5895 */ | |
5896 krb5_error_code KRB5_CALLCONV | |
5897 krb5_auth_con_setsendsubkey(krb5_context ctx, krb5_auth_context ac, | |
5898 krb5_keyblock *keyblock); | |
5899 | |
5900 /** | |
5901 * Set the send subkey in an auth context. | |
5902 * | |
5903 * @param [in] ctx Library context | |
5904 * @param [in] ac Authentication context | |
5905 * @param [out] key Send subkey | |
5906 * | |
5907 * This function sets the send subkey in @a ac to @a key, incrementing its | |
5908 * reference count. | |
5909 * | |
5910 * @version New in 1.9 | |
5911 * | |
5912 * @retval 0 Success; otherwise - Kerberos error codes | |
5913 */ | |
5914 krb5_error_code KRB5_CALLCONV | |
5915 krb5_auth_con_setsendsubkey_k(krb5_context ctx, krb5_auth_context ac, krb5_key key); | |
5916 | |
5917 /** | |
5918 * Set the receiving subkey in an auth context with a keyblock. | |
5919 * | |
5920 * @param [in] ctx Library context | |
5921 * @param [in] ac Authentication context | |
5922 * @param [in] keyblock Receiving subkey | |
5923 * | |
5924 * This function sets the receiving subkey in @a ac to a copy of @a keyblock. | |
5925 * | |
5926 * @retval 0 Success; otherwise - Kerberos error codes | |
5927 */ | |
5928 krb5_error_code KRB5_CALLCONV | |
5929 krb5_auth_con_setrecvsubkey(krb5_context ctx, krb5_auth_context ac, | |
5930 krb5_keyblock *keyblock); | |
5931 | |
5932 /** | |
5933 * Set the receiving subkey in an auth context. | |
5934 * | |
5935 * @param [in] ctx Library context | |
5936 * @param [in] ac Authentication context | |
5937 * @param [in] key Receiving subkey | |
5938 * | |
5939 * This function sets the receiving subkey in @a ac to @a key, incrementing its | |
5940 * reference count. | |
5941 * | |
5942 * @version New in 1.9 | |
5943 * | |
5944 * @retval 0 Success; otherwise - Kerberos error codes | |
5945 */ | |
5946 krb5_error_code KRB5_CALLCONV | |
5947 krb5_auth_con_setrecvsubkey_k(krb5_context ctx, krb5_auth_context ac, | |
5948 krb5_key key); | |
5949 | |
5950 #if KRB5_DEPRECATED | |
5951 /** @deprecated Replaced by krb5_auth_con_getsendsubkey(). */ | |
5952 KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV | |
5953 krb5_auth_con_getlocalsubkey(krb5_context context, krb5_auth_context auth_context, | |
5954 krb5_keyblock **keyblock); | |
5955 | |
5956 /** @deprecated Replaced by krb5_auth_con_getrecvsubkey(). */ | |
5957 KRB5_ATTR_DEPRECATED krb5_error_code KRB5_CALLCONV | |
5958 krb5_auth_con_getremotesubkey(krb5_context context, krb5_auth_context auth_context, | |
5959 krb5_keyblock **keyblock); | |
5960 #endif | |
5961 | |
5962 /** | |
5963 * Retrieve the local sequence number from an auth context. | |
5964 * | |
5965 * @param [in] context Library context | |
5966 * @param [in] auth_context Authentication context | |
5967 * @param [out] seqnumber Local sequence number | |
5968 * | |
5969 * Retrieve the local sequence number from @a auth_context and return it in @a | |
5970 * seqnumber. The #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag must be set in @a | |
5971 * auth_context for this function to be useful. | |
5972 * | |
5973 * @retval 0 Success; otherwise - Kerberos error codes | |
5974 */ | |
5975 krb5_error_code KRB5_CALLCONV | |
5976 krb5_auth_con_getlocalseqnumber(krb5_context context, krb5_auth_context auth_context, | |
5977 krb5_int32 *seqnumber); | |
5978 | |
5979 /** | |
5980 * Retrieve the remote sequence number from an auth context. | |
5981 * | |
5982 * @param [in] context Library context | |
5983 * @param [in] auth_context Authentication context | |
5984 * @param [out] seqnumber Remote sequence number | |
5985 * | |
5986 * Retrieve the remote sequence number from @a auth_context and return it in @a | |
5987 * seqnumber. The #KRB5_AUTH_CONTEXT_DO_SEQUENCE flag must be set in @a | |
5988 * auth_context for this function to be useful. | |
5989 * | |
5990 * @retval 0 Success; otherwise - Kerberos error codes | |
5991 */ | |
5992 krb5_error_code KRB5_CALLCONV | |
5993 krb5_auth_con_getremoteseqnumber(krb5_context context, krb5_auth_context auth_context, | |
5994 krb5_int32 *seqnumber); | |
5995 | |
5996 /** | |
5997 * Cause an auth context to use cipher state. | |
5998 * | |
5999 * @param [in] context Library context | |
6000 * @param [in] auth_context Authentication context | |
6001 * | |
6002 * Prepare @a auth_context to use cipher state when krb5_mk_priv() or | |
6003 * krb5_rd_priv() encrypt or decrypt data. | |
6004 * | |
6005 * @retval 0 Success; otherwise - Kerberos error codes | |
6006 */ | |
6007 krb5_error_code KRB5_CALLCONV | |
6008 krb5_auth_con_initivector(krb5_context context, krb5_auth_context auth_context); | |
6009 | |
6010 /** | |
6011 * Set the replay cache in an auth context. | |
6012 * | |
6013 * @param [in] context Library context | |
6014 * @param [in] auth_context Authentication context | |
6015 * @param [in] rcache Replay cache haddle | |
6016 * | |
6017 * This function sets the replay cache in @a auth_context to @a rcache. @a | |
6018 * rcache will be closed when @a auth_context is freed, so the caller should | |
6019 * relinquish that responsibility. | |
6020 * | |
6021 * @retval 0 Success; otherwise - Kerberos error codes | |
6022 */ | |
6023 krb5_error_code KRB5_CALLCONV | |
6024 krb5_auth_con_setrcache(krb5_context context, krb5_auth_context auth_context, | |
6025 krb5_rcache rcache); | |
6026 | |
6027 /** | |
6028 * Retrieve the replay cache from an auth context. | |
6029 * | |
6030 * @param [in] context Library context | |
6031 * @param [in] auth_context Authentication context | |
6032 * @param [out] rcache Replay cache handle | |
6033 * | |
6034 * This function fetches the replay cache from @a auth_context. The caller | |
6035 * should not close @a rcache. | |
6036 * | |
6037 * @retval 0 (always) | |
6038 */ | |
6039 krb5_error_code KRB5_CALLCONV_WRONG | |
6040 krb5_auth_con_getrcache(krb5_context context, krb5_auth_context auth_context, | |
6041 krb5_rcache *rcache); | |
6042 | |
6043 /** | |
6044 * Retrieve the authenticator from an auth context. | |
6045 * | |
6046 * @param [in] context Library context | |
6047 * @param [in] auth_context Authentication context | |
6048 * @param [out] authenticator Authenticator | |
6049 * | |
6050 * Use krb5_free_authenticator() to free @a authenticator when it is no longer | |
6051 * needed. | |
6052 * | |
6053 * @retval 0 Success. Otherwise - Kerberos error codes | |
6054 */ | |
6055 krb5_error_code KRB5_CALLCONV | |
6056 krb5_auth_con_getauthenticator(krb5_context context, krb5_auth_context auth_context, | |
6057 krb5_authenticator **authenticator); | |
6058 | |
6059 /** | |
6060 * Set checksum type in an an auth context. | |
6061 * | |
6062 * @param [in] context Library context | |
6063 * @param [in] auth_context Authentication context | |
6064 * @param [in] cksumtype Checksum type | |
6065 * | |
6066 * This function sets the checksum type in @a auth_context to be used by | |
6067 * krb5_mk_req() for the authenticator checksum. | |
6068 * | |
6069 * @retval 0 Success. Otherwise - Kerberos error codes | |
6070 */ | |
6071 krb5_error_code KRB5_CALLCONV | |
6072 krb5_auth_con_set_req_cksumtype(krb5_context context, krb5_auth_context auth_context, | |
6073 krb5_cksumtype cksumtype); | |
6074 | |
6075 #define KRB5_REALM_BRANCH_CHAR '.' | |
6076 | |
6077 /* | |
6078 * end "func-proto.h" | |
6079 */ | |
6080 | |
6081 /* | |
6082 * begin stuff from libos.h | |
6083 */ | |
6084 | |
6085 /** | |
6086 * @brief Read a password from keyboard input. | |
6087 * | |
6088 * @param [in] context Library context | |
6089 * @param [in] prompt First user prompt when reading password | |
6090 * @param [in] prompt2 Second user prompt (NULL to prompt only once) | |
6091 * @param [out] return_pwd Returned password | |
6092 * @param [in,out] size_return On input, maximum size of password; on output, | |
6093 * size of password read | |
6094 * | |
6095 * This function reads a password from keyboard input and stores it in @a | |
6096 * return_pwd. @a size_return should be set by the caller to the amount of | |
6097 * storage space available in @a return_pwd; on successful return, it will be | |
6098 * set to the length of the password read. | |
6099 * | |
6100 * @a prompt is printed to the terminal, followed by ": ", and then a password | |
6101 * is read from the keyboard. | |
6102 * | |
6103 * If @a prompt2 is NULL, the password is read only once. Otherwise, @a | |
6104 * prompt2 is printed to the terminal and a second password is read. If the | |
6105 * two passwords entered are not identical, KRB5_LIBOS_BADPWDMATCH is returned. | |
6106 * | |
6107 * Echoing is turned off when the password is read. | |
6108 * | |
6109 * @retval | |
6110 * 0 Success | |
6111 * @return | |
6112 * Error in reading or verifying the password | |
6113 * @return | |
6114 * Kerberos error codes | |
6115 */ | |
6116 krb5_error_code KRB5_CALLCONV | |
6117 krb5_read_password(krb5_context context, | |
6118 const char *prompt, const char *prompt2, | |
6119 char *return_pwd, unsigned int *size_return); | |
6120 | |
6121 /** | |
6122 * Convert a principal name to a local name. | |
6123 * | |
6124 * @param [in] context Library context | |
6125 * @param [in] aname Principal name | |
6126 * @param [in] lnsize_in Space available in @a lname | |
6127 * @param [out] lname Local name buffer to be filled in | |
6128 * | |
6129 * If @a aname does not correspond to any local account, KRB5_LNAME_NOTRANS is | |
6130 * returned. If @a lnsize_in is too small for the local name, | |
6131 * KRB5_CONFIG_NOTENUFSPACE is returned. | |
6132 * | |
6133 * Local names, rather than principal names, can be used by programs that | |
6134 * translate to an environment-specific name (for example, a user account | |
6135 * name). | |
6136 * | |
6137 * @retval | |
6138 * 0 Success | |
6139 * @retval | |
6140 * System errors | |
6141 * @return | |
6142 * Kerberos error codes | |
6143 */ | |
6144 krb5_error_code KRB5_CALLCONV | |
6145 krb5_aname_to_localname(krb5_context context, krb5_const_principal aname, | |
6146 int lnsize_in, char *lname); | |
6147 | |
6148 /** | |
6149 * Get the Kerberos realm names for a host. | |
6150 * | |
6151 * @param [in] context Library context | |
6152 * @param [in] host Host name (or NULL) | |
6153 * @param [out] realmsp Null-terminated list of realm names | |
6154 * | |
6155 * Fill in @a realmsp with a pointer to a null-terminated list of realm names. | |
6156 * If there are no known realms for the host, a list containing the referral | |
6157 * (empty) realm is returned. | |
6158 * | |
6159 * If @a host is NULL, the local host's realms are determined. | |
6160 * | |
6161 * Use krb5_free_host_realm() to release @a realmsp when it is no longer | |
6162 * needed. | |
6163 * | |
6164 * @retval | |
6165 * 0 Success | |
6166 * @retval | |
6167 * ENOMEM Insufficient memory | |
6168 * @return | |
6169 * Kerberos error codes | |
6170 */ | |
6171 krb5_error_code KRB5_CALLCONV | |
6172 krb5_get_host_realm(krb5_context context, const char *host, char ***realmsp); | |
6173 | |
6174 /** | |
6175 * | |
6176 * @param [in] context Library context | |
6177 * @param [in] hdata Host name (or NULL) | |
6178 * @param [out] realmsp Null-terminated list of realm names | |
6179 * | |
6180 * Fill in @a realmsp with a pointer to a null-terminated list of realm names | |
6181 * obtained through heuristics or insecure resolution methods which have lower | |
6182 * priority than KDC referrals. | |
6183 * | |
6184 * If @a host is NULL, the local host's realms are determined. | |
6185 * | |
6186 * Use krb5_free_host_realm() to release @a realmsp when it is no longer | |
6187 * needed. | |
6188 */ | |
6189 krb5_error_code KRB5_CALLCONV | |
6190 krb5_get_fallback_host_realm(krb5_context context, | |
6191 krb5_data *hdata, char ***realmsp); | |
6192 | |
6193 /** | |
6194 * Free the memory allocated by krb5_get_host_realm(). | |
6195 * | |
6196 * @param [in] context Library context | |
6197 * @param [in] realmlist List of realm names to be released | |
6198 * | |
6199 * @retval | |
6200 * 0 Success | |
6201 * @return | |
6202 * Kerberos error codes | |
6203 */ | |
6204 krb5_error_code KRB5_CALLCONV | |
6205 krb5_free_host_realm(krb5_context context, char *const *realmlist); | |
6206 | |
6207 /** | |
6208 * Determine if a principal is authorized to log in as a local user. | |
6209 * | |
6210 * @param [in] context Library context | |
6211 * @param [in] principal Principal name | |
6212 * @param [in] luser Local username | |
6213 * | |
6214 * Determine whether @a principal is authorized to log in as a local user @a | |
6215 * luser. | |
6216 * | |
6217 * @retval | |
6218 * TRUE Principal is authorized to log in as user; FALSE otherwise. | |
6219 */ | |
6220 krb5_boolean KRB5_CALLCONV | |
6221 krb5_kuserok(krb5_context context, krb5_principal principal, const char *luser); | |
6222 | |
6223 /** | |
6224 * Generate auth context addresses from a connected socket. | |
6225 * | |
6226 * @param [in] context Library context | |
6227 * @param [in] auth_context Authentication context | |
6228 * @param [in] infd Connected socket descriptor | |
6229 * @param [in] flags Flags | |
6230 * | |
6231 * This function sets the local and/or remote addresses in @a auth_context | |
6232 * based on the local and remote endpoints of the socket @a infd. The | |
6233 * following flags determine the operations performed: | |
6234 * | |
6235 * @li #KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR Generate local address. | |
6236 * @li #KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR Generate remote address. | |
6237 * @li #KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR Generate local address and port. | |
6238 * @li #KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR Generate remote address and port. | |
6239 * | |
6240 * @retval 0 Success; otherwise - Kerberos error codes | |
6241 */ | |
6242 krb5_error_code KRB5_CALLCONV | |
6243 krb5_auth_con_genaddrs(krb5_context context, krb5_auth_context auth_context, | |
6244 int infd, int flags); | |
6245 | |
6246 /** | |
6247 * Set time offset field in a krb5_context structure. | |
6248 * | |
6249 * @param [in] context Library context | |
6250 * @param [in] seconds Real time, seconds portion | |
6251 * @param [in] microseconds Real time, microseconds portion | |
6252 * | |
6253 * This function sets the time offset in @a context to the difference between | |
6254 * the system time and the real time as determined by @a seconds and @a | |
6255 * microseconds. | |
6256 * | |
6257 * @retval 0 Success; otherwise - Kerberos error codes | |
6258 */ | |
6259 krb5_error_code KRB5_CALLCONV | |
6260 krb5_set_real_time(krb5_context context, krb5_timestamp seconds, | |
6261 krb5_int32 microseconds); | |
6262 | |
6263 /** | |
6264 * Return the time offsets from the os context. | |
6265 * | |
6266 * @param [in] context Library context | |
6267 * @param [out] seconds Time offset, seconds portion | |
6268 * @param [out] microseconds Time offset, microseconds portion | |
6269 * | |
6270 * This function returns the time offsets in @a context. | |
6271 * | |
6272 * @retval 0 Success; otherwise - Kerberos error codes | |
6273 */ | |
6274 krb5_error_code KRB5_CALLCONV | |
6275 krb5_get_time_offsets(krb5_context context, krb5_timestamp *seconds, krb5_int32 *microseconds); | |
6276 | |
6277 /* str_conv.c */ | |
6278 /** | |
6279 * Convert a string to an encryption type. | |
6280 * | |
6281 * @param [in] string String to convert to an encryption type | |
6282 * @param [out] enctypep Encryption type | |
6283 * | |
6284 * @retval 0 Success; otherwise - EINVAL | |
6285 */ | |
6286 krb5_error_code KRB5_CALLCONV | |
6287 krb5_string_to_enctype(char *string, krb5_enctype *enctypep); | |
6288 | |
6289 /** | |
6290 * Convert a string to a salt type. | |
6291 * | |
6292 * @param [in] string String to convert to an encryption type | |
6293 * @param [out] salttypep Salt type to be filled in | |
6294 * | |
6295 * @retval 0 Success; otherwise - EINVAL | |
6296 */ | |
6297 krb5_error_code KRB5_CALLCONV | |
6298 krb5_string_to_salttype(char *string, krb5_int32 *salttypep); | |
6299 | |
6300 /** | |
6301 * Convert a string to a checksum type. | |
6302 * | |
6303 * @param [in] string String to be converted | |
6304 * @param [out] cksumtypep Checksum type to be filled in | |
6305 * | |
6306 * @retval 0 Success; otherwise - EINVAL | |
6307 */ | |
6308 krb5_error_code KRB5_CALLCONV | |
6309 krb5_string_to_cksumtype(char *string, krb5_cksumtype *cksumtypep); | |
6310 | |
6311 /** | |
6312 * Convert a string to a timestamp. | |
6313 * | |
6314 * @param [in] string String to be converted | |
6315 * @param [out] timestampp Pointer to timestamp | |
6316 * | |
6317 * @retval 0 Success; otherwise - EINVAL | |
6318 */ | |
6319 krb5_error_code KRB5_CALLCONV | |
6320 krb5_string_to_timestamp(char *string, krb5_timestamp *timestampp); | |
6321 | |
6322 /** | |
6323 * Convert a string to a delta time value. | |
6324 * | |
6325 * @param [in] string String to be converted | |
6326 * @param [out] deltatp Delta time to be filled in | |
6327 * | |
6328 * @retval 0 Success; otherwise - KRB5_DELTAT_BADFORMAT | |
6329 */ | |
6330 krb5_error_code KRB5_CALLCONV | |
6331 krb5_string_to_deltat(char *string, krb5_deltat *deltatp); | |
6332 | |
6333 /** | |
6334 * Convert an encryption type to a string. | |
6335 * | |
6336 * @param [in] enctype Encryption type | |
6337 * @param [out] buffer Buffer to hold encryption type string | |
6338 * @param [in] buflen Storage available in @a buffer | |
6339 * | |
6340 * @retval 0 Success; otherwise - Kerberos error codes | |
6341 */ | |
6342 krb5_error_code KRB5_CALLCONV | |
6343 krb5_enctype_to_string(krb5_enctype enctype, char *buffer, size_t buflen); | |
6344 | |
6345 /** | |
6346 * Convert an encryption type to a name or alias. | |
6347 * | |
6348 * @param [in] enctype Encryption type | |
6349 * @param [in] shortest Flag | |
6350 * @param [out] buffer Buffer to hold encryption type string | |
6351 * @param [in] buflen Storage available in @a buffer | |
6352 * | |
6353 * If @a shortest is FALSE, this function returns the enctype's canonical name | |
6354 * (like "aes128-cts-hmac-sha1-96"). If @a shortest is TRUE, it return the | |
6355 * enctype's shortest alias (like "aes128-cts"). | |
6356 * | |
6357 * @version New in 1.9 | |
6358 * | |
6359 * @retval 0 Success; otherwise - Kerberos error codes | |
6360 */ | |
6361 krb5_error_code KRB5_CALLCONV | |
6362 krb5_enctype_to_name(krb5_enctype enctype, krb5_boolean shortest, | |
6363 char *buffer, size_t buflen); | |
6364 | |
6365 /** | |
6366 * Convert a salt type to a string. | |
6367 * | |
6368 * @param [in] salttype Salttype to convert | |
6369 * @param [out] buffer Buffer to receive the converted string | |
6370 * @param [in] buflen Storage available in @a buffer | |
6371 * | |
6372 * @retval 0 Success; otherwise - Kerberos error codes | |
6373 */ | |
6374 krb5_error_code KRB5_CALLCONV | |
6375 krb5_salttype_to_string(krb5_int32 salttype, char *buffer, size_t buflen); | |
6376 | |
6377 /** | |
6378 * Convert a checksum type to a string. | |
6379 * | |
6380 * @param [in] cksumtype Checksum type | |
6381 * @param [out] buffer Buffer to hold converted checksum type | |
6382 * @param [in] buflen Storage available in @a buffer | |
6383 * | |
6384 * @retval 0 Success; otherwise - Kerberos error codes | |
6385 */ | |
6386 krb5_error_code KRB5_CALLCONV | |
6387 krb5_cksumtype_to_string(krb5_cksumtype cksumtype, char *buffer, size_t buflen); | |
6388 | |
6389 /** | |
6390 * Convert a timestamp to a string. | |
6391 * | |
6392 * @param [in] timestamp Timestamp to convert | |
6393 * @param [out] buffer Buffer to hold converted timestamp | |
6394 * @param [in] buflen Storage available in @a buffer | |
6395 * | |
6396 * The string is returned in the locale's appropriate date and time | |
6397 * representation. | |
6398 * | |
6399 * @retval 0 Success; otherwise - Kerberos error codes | |
6400 */ | |
6401 krb5_error_code KRB5_CALLCONV | |
6402 krb5_timestamp_to_string(krb5_timestamp timestamp, char *buffer, size_t buflen); | |
6403 | |
6404 /** | |
6405 * Convert a timestamp to a string, with optional output padding | |
6406 * | |
6407 * @param [in] timestamp Timestamp to convert | |
6408 * @param [out] buffer Buffer to hold the converted timestamp | |
6409 * @param [in] buflen Length of buffer | |
6410 * @param [in] pad Optional value to pad @a buffer if converted | |
6411 * timestamp does not fill it | |
6412 * | |
6413 * If @a pad is not NULL, @a buffer is padded out to @a buflen - 1 characters | |
6414 * with the value of *@a pad. | |
6415 * | |
6416 * @retval 0 Success; otherwise - Kerberos error codes | |
6417 */ | |
6418 krb5_error_code KRB5_CALLCONV | |
6419 krb5_timestamp_to_sfstring(krb5_timestamp timestamp, char *buffer, | |
6420 size_t buflen, char *pad); | |
6421 | |
6422 /** | |
6423 * Convert a relative time value to a string. | |
6424 * | |
6425 * @param [in] deltat Relative time value to convert | |
6426 * @param [out] buffer Buffer to hold time string | |
6427 * @param [in] buflen Storage available in @a buffer | |
6428 * | |
6429 * @retval 0 Success; otherwise - Kerberos error codes | |
6430 */ | |
6431 krb5_error_code KRB5_CALLCONV | |
6432 krb5_deltat_to_string(krb5_deltat deltat, char *buffer, size_t buflen); | |
6433 | |
6434 /* The name of the Kerberos ticket granting service... and its size */ | |
6435 #define KRB5_TGS_NAME "krbtgt" | |
6436 #define KRB5_TGS_NAME_SIZE 6 | |
6437 | |
6438 /* flags for recvauth */ | |
6439 #define KRB5_RECVAUTH_SKIP_VERSION 0x0001 | |
6440 #define KRB5_RECVAUTH_BADAUTHVERS 0x0002 | |
6441 /* initial ticket api functions */ | |
6442 | |
6443 /** Text for prompt used in prompter callback function. */ | |
6444 typedef struct _krb5_prompt { | |
6445 char *prompt; /**< The prompt to show to the user */ | |
6446 int hidden; /**< Boolean; informative prompt or hidden (e.g. PIN) */ | |
6447 krb5_data *reply; /**< Must be allocated before call to prompt routine */ | |
6448 } krb5_prompt; | |
6449 | |
6450 /** Pointer to a prompter callback function. */ | |
6451 typedef krb5_error_code | |
6452 (KRB5_CALLCONV *krb5_prompter_fct)(krb5_context context, void *data, | |
6453 const char *name, const char *banner, | |
6454 int num_prompts, krb5_prompt prompts[]); | |
6455 | |
6456 /** | |
6457 * Prompt user for password. | |
6458 * | |
6459 * @param [in] context Library context | |
6460 * @param data Unused (callback argument) | |
6461 * @param [in] name Name to output during prompt | |
6462 * @param [in] banner Banner to output during prompt | |
6463 * @param [in] num_prompts Number of prompts in @a prompts | |
6464 * @param [in] prompts Array of prompts and replies | |
6465 * | |
6466 * This function is intended to be used as a prompter callback for | |
6467 * krb5_get_init_creds_password() or krb5_init_creds_init(). | |
6468 * | |
6469 * Writes @a name and @a banner to stdout, each followed by a newline, then | |
6470 * writes each prompt field in the @a prompts array, followed by ": ", and sets | |
6471 * the reply field of the entry to a line of input read from stdin. If the | |
6472 * hidden flag is set for a prompt, then terminal echoing is turned off when | |
6473 * input is read. | |
6474 * | |
6475 * @retval | |
6476 * 0 Success | |
6477 * @return | |
6478 * Kerberos error codes | |
6479 * | |
6480 */ | |
6481 krb5_error_code KRB5_CALLCONV | |
6482 krb5_prompter_posix(krb5_context context, void *data, const char *name, | |
6483 const char *banner, int num_prompts, | |
6484 krb5_prompt prompts[]); | |
6485 | |
6486 /** | |
6487 * Long-term password responder question | |
6488 * | |
6489 * This question is asked when the long-term password is needed. It has no | |
6490 * challenge and the response is simply the password string. | |
6491 * | |
6492 * @version New in 1.11 | |
6493 */ | |
6494 #define KRB5_RESPONDER_QUESTION_PASSWORD "password" | |
6495 | |
6496 /** | |
6497 * OTP responder question | |
6498 * | |
6499 * The OTP responder question is asked when the KDC indicates that an OTP | |
6500 * value is required in order to complete the authentication. The JSON format | |
6501 * of the challenge is: | |
6502 * | |
6503 * { | |
6504 * "service": <string (optional)>, | |
6505 * "tokenInfo": [ | |
6506 * { | |
6507 * "flags": <number>, | |
6508 * "vendor": <string (optional)>, | |
6509 * "challenge": <string (optional)>, | |
6510 * "length": <number (optional)>, | |
6511 * "format": <number (optional)>, | |
6512 * "tokenID": <string (optional)>, | |
6513 * "algID": <string (optional)>, | |
6514 * }, | |
6515 * ... | |
6516 * ] | |
6517 * } | |
6518 * | |
6519 * The answer to the question MUST be JSON formatted: | |
6520 * | |
6521 * { | |
6522 * "tokeninfo": <number>, | |
6523 * "value": <string (optional)>, | |
6524 * "pin": <string (optional)>, | |
6525 * } | |
6526 * | |
6527 * For more detail, please see RFC 6560. | |
6528 * | |
6529 * @version New in 1.11 | |
6530 */ | |
6531 #define KRB5_RESPONDER_QUESTION_OTP "otp" | |
6532 | |
6533 /** | |
6534 * These format constants identify the format of the token value. | |
6535 */ | |
6536 #define KRB5_RESPONDER_OTP_FORMAT_DECIMAL 0 | |
6537 #define KRB5_RESPONDER_OTP_FORMAT_HEXADECIMAL 1 | |
6538 #define KRB5_RESPONDER_OTP_FORMAT_ALPHANUMERIC 2 | |
6539 | |
6540 /** | |
6541 * This flag indicates that the token value MUST be collected. | |
6542 */ | |
6543 #define KRB5_RESPONDER_OTP_FLAGS_COLLECT_TOKEN 0x0001 | |
6544 | |
6545 /** | |
6546 * This flag indicates that the PIN value MUST be collected. | |
6547 */ | |
6548 #define KRB5_RESPONDER_OTP_FLAGS_COLLECT_PIN 0x0002 | |
6549 | |
6550 /** | |
6551 * This flag indicates that the token is now in re-synchronization mode with | |
6552 * the server. The user is expected to reply with the next code displayed on | |
6553 * the token. | |
6554 */ | |
6555 #define KRB5_RESPONDER_OTP_FLAGS_NEXTOTP 0x0004 | |
6556 | |
6557 /** | |
6558 * This flag indicates that the PIN MUST be returned as a separate item. This | |
6559 * flag only takes effect if KRB5_RESPONDER_OTP_FLAGS_COLLECT_PIN is set. If | |
6560 * this flag is not set, the responder may either concatenate PIN + token value | |
6561 * and store it as "value" in the answer or it may return them separately. If | |
6562 * they are returned separately, they will be concatenated internally. | |
6563 */ | |
6564 #define KRB5_RESPONDER_OTP_FLAGS_SEPARATE_PIN 0x0008 | |
6565 | |
6566 /** | |
6567 * PKINIT responder question | |
6568 * | |
6569 * The PKINIT responder question is asked when the client needs a password | |
6570 * that's being used to protect key information, and is formatted as a JSON | |
6571 * object. A specific identity's flags value, if not zero, is the bitwise-OR | |
6572 * of one or more of the KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_* flags defined | |
6573 * below, and possibly other flags to be added later. Any resemblance to | |
6574 * similarly-named CKF_* values in the PKCS#11 API should not be depended on. | |
6575 * | |
6576 * { | |
6577 * identity <string> : flags <number>, | |
6578 * ... | |
6579 * } | |
6580 * | |
6581 * The answer to the question MUST be JSON formatted: | |
6582 * | |
6583 * { | |
6584 * identity <string> : password <string>, | |
6585 * ... | |
6586 * } | |
6587 * | |
6588 * @version New in 1.12 | |
6589 */ | |
6590 #define KRB5_RESPONDER_QUESTION_PKINIT "pkinit" | |
6591 | |
6592 /** | |
6593 * This flag indicates that an incorrect PIN was supplied at least once since | |
6594 * the last time the correct PIN was supplied. | |
6595 */ | |
6596 #define KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_USER_PIN_COUNT_LOW (1 << 0) | |
6597 | |
6598 /** | |
6599 * This flag indicates that supplying an incorrect PIN will cause the token to | |
6600 * lock itself. | |
6601 */ | |
6602 #define KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_USER_PIN_FINAL_TRY (1 << 1) | |
6603 | |
6604 /** | |
6605 * This flag indicates that the user PIN is locked, and you can't log in to the | |
6606 * token with it. | |
6607 */ | |
6608 #define KRB5_RESPONDER_PKINIT_FLAGS_TOKEN_USER_PIN_LOCKED (1 << 2) | |
6609 | |
6610 /** | |
6611 * A container for a set of preauthentication questions and answers | |
6612 * | |
6613 * A responder context is supplied by the krb5 authentication system to a @ref | |
6614 * krb5_responder_fn callback. It contains a list of questions and can receive | |
6615 * answers. Questions contained in a responder context can be listed using | |
6616 * krb5_responder_list_questions(), retrieved using | |
6617 * krb5_responder_get_challenge(), or answered using | |
6618 * krb5_responder_set_answer(). The form of a question's challenge and | |
6619 * answer depend on the question name. | |
6620 * | |
6621 * @version New in 1.11 | |
6622 */ | |
6623 typedef struct krb5_responder_context_st *krb5_responder_context; | |
6624 | |
6625 /** | |
6626 * List the question names contained in the responder context. | |
6627 * | |
6628 * @param [in] ctx Library context | |
6629 * @param [in] rctx Responder context | |
6630 * | |
6631 * Return a pointer to a null-terminated list of question names which are | |
6632 * present in @a rctx. The pointer is an alias, valid only as long as the | |
6633 * lifetime of @a rctx, and should not be modified or freed by the caller. A | |
6634 * question's challenge can be retrieved using krb5_responder_get_challenge() | |
6635 * and answered using krb5_responder_set_answer(). | |
6636 * | |
6637 * @version New in 1.11 | |
6638 */ | |
6639 const char * const * KRB5_CALLCONV | |
6640 krb5_responder_list_questions(krb5_context ctx, krb5_responder_context rctx); | |
6641 | |
6642 /** | |
6643 * Retrieve the challenge data for a given question in the responder context. | |
6644 * | |
6645 * @param [in] ctx Library context | |
6646 * @param [in] rctx Responder context | |
6647 * @param [in] question Question name | |
6648 * | |
6649 * Return a pointer to a C string containing the challenge for @a question | |
6650 * within @a rctx, or NULL if the question is not present in @a rctx. The | |
6651 * structure of the question depends on the question name, but will always be | |
6652 * printable UTF-8 text. The returned pointer is an alias, valid only as long | |
6653 * as the lifetime of @a rctx, and should not be modified or freed by the | |
6654 * caller. | |
6655 * | |
6656 * @version New in 1.11 | |
6657 */ | |
6658 const char * KRB5_CALLCONV | |
6659 krb5_responder_get_challenge(krb5_context ctx, krb5_responder_context rctx, | |
6660 const char *question); | |
6661 | |
6662 /** | |
6663 * Answer a named question in the responder context. | |
6664 * | |
6665 * @param [in] ctx Library context | |
6666 * @param [in] rctx Responder context | |
6667 * @param [in] question Question name | |
6668 * @param [in] answer The string to set (MUST be printable UTF-8) | |
6669 * | |
6670 * This function supplies an answer to @a question within @a rctx. The | |
6671 * appropriate form of the answer depends on the question name. | |
6672 * | |
6673 * @retval EINVAL @a question is not present within @a rctx | |
6674 * | |
6675 * @version New in 1.11 | |
6676 */ | |
6677 krb5_error_code KRB5_CALLCONV | |
6678 krb5_responder_set_answer(krb5_context ctx, krb5_responder_context rctx, | |
6679 const char *question, const char *answer); | |
6680 | |
6681 /** | |
6682 * Responder function for an initial credential exchange. | |
6683 * | |
6684 * @param [in] ctx Library context | |
6685 * @param [in] data Callback data | |
6686 * @param [in] rctx Responder context | |
6687 * | |
6688 * A responder function is like a prompter function, but is used for handling | |
6689 * questions and answers as potentially complex data types. Client | |
6690 * preauthentication modules will insert a set of named "questions" into | |
6691 * the responder context. Each question may optionally contain a challenge. | |
6692 * This challenge is printable UTF-8, but may be an encoded value. The | |
6693 * precise encoding and contents of the challenge are specific to the question | |
6694 * asked. When the responder is called, it should answer all the questions it | |
6695 * understands. Like the challenge, the answer MUST be printable UTF-8, but | |
6696 * may contain structured/encoded data formatted to the expected answer format | |
6697 * of the question. | |
6698 * | |
6699 * If a required question is unanswered, the prompter may be called. | |
6700 */ | |
6701 typedef krb5_error_code | |
6702 (KRB5_CALLCONV *krb5_responder_fn)(krb5_context ctx, void *data, | |
6703 krb5_responder_context rctx); | |
6704 | |
6705 typedef struct _krb5_responder_otp_tokeninfo { | |
6706 krb5_flags flags; | |
6707 krb5_int32 format; /* -1 when not specified. */ | |
6708 krb5_int32 length; /* -1 when not specified. */ | |
6709 char *vendor; | |
6710 char *challenge; | |
6711 char *token_id; | |
6712 char *alg_id; | |
6713 } krb5_responder_otp_tokeninfo; | |
6714 | |
6715 typedef struct _krb5_responder_otp_challenge { | |
6716 char *service; | |
6717 krb5_responder_otp_tokeninfo **tokeninfo; | |
6718 } krb5_responder_otp_challenge; | |
6719 | |
6720 /** | |
6721 * Decode the KRB5_RESPONDER_QUESTION_OTP to a C struct. | |
6722 * | |
6723 * A convenience function which parses the KRB5_RESPONDER_QUESTION_OTP | |
6724 * question challenge data, making it available in native C. The main feature | |
6725 * of this function is the ability to interact with OTP tokens without parsing | |
6726 * the JSON. | |
6727 * | |
6728 * The returned value must be passed to krb5_responder_otp_challenge_free() to | |
6729 * be freed. | |
6730 * | |
6731 * @param [in] ctx Library context | |
6732 * @param [in] rctx Responder context | |
6733 * @param [out] chl Challenge structure | |
6734 * | |
6735 * @version New in 1.11 | |
6736 */ | |
6737 krb5_error_code KRB5_CALLCONV | |
6738 krb5_responder_otp_get_challenge(krb5_context ctx, | |
6739 krb5_responder_context rctx, | |
6740 krb5_responder_otp_challenge **chl); | |
6741 | |
6742 /** | |
6743 * Answer the KRB5_RESPONDER_QUESTION_OTP question. | |
6744 * | |
6745 * @param [in] ctx Library context | |
6746 * @param [in] rctx Responder context | |
6747 * @param [in] ti The index of the tokeninfo selected | |
6748 * @param [in] value The value to set, or NULL for none | |
6749 * @param [in] pin The pin to set, or NULL for none | |
6750 * | |
6751 * @version New in 1.11 | |
6752 */ | |
6753 krb5_error_code KRB5_CALLCONV | |
6754 krb5_responder_otp_set_answer(krb5_context ctx, krb5_responder_context rctx, | |
6755 size_t ti, const char *value, const char *pin); | |
6756 | |
6757 /** | |
6758 * Free the value returned by krb5_responder_otp_get_challenge(). | |
6759 * | |
6760 * @param [in] ctx Library context | |
6761 * @param [in] rctx Responder context | |
6762 * @param [in] chl The challenge to free | |
6763 * | |
6764 * @version New in 1.11 | |
6765 */ | |
6766 void KRB5_CALLCONV | |
6767 krb5_responder_otp_challenge_free(krb5_context ctx, | |
6768 krb5_responder_context rctx, | |
6769 krb5_responder_otp_challenge *chl); | |
6770 | |
6771 typedef struct _krb5_responder_pkinit_identity { | |
6772 char *identity; | |
6773 krb5_int32 token_flags; /* 0 when not specified or not applicable. */ | |
6774 } krb5_responder_pkinit_identity; | |
6775 | |
6776 typedef struct _krb5_responder_pkinit_challenge { | |
6777 krb5_responder_pkinit_identity **identities; | |
6778 } krb5_responder_pkinit_challenge; | |
6779 | |
6780 /** | |
6781 * Decode the KRB5_RESPONDER_QUESTION_PKINIT to a C struct. | |
6782 * | |
6783 * A convenience function which parses the KRB5_RESPONDER_QUESTION_PKINIT | |
6784 * question challenge data, making it available in native C. The main feature | |
6785 * of this function is the ability to read the challenge without parsing | |
6786 * the JSON. | |
6787 * | |
6788 * The returned value must be passed to krb5_responder_pkinit_challenge_free() | |
6789 * to be freed. | |
6790 * | |
6791 * @param [in] ctx Library context | |
6792 * @param [in] rctx Responder context | |
6793 * @param [out] chl_out Challenge structure | |
6794 * | |
6795 * @version New in 1.12 | |
6796 */ | |
6797 krb5_error_code KRB5_CALLCONV | |
6798 krb5_responder_pkinit_get_challenge(krb5_context ctx, | |
6799 krb5_responder_context rctx, | |
6800 krb5_responder_pkinit_challenge **chl_out); | |
6801 | |
6802 /** | |
6803 * Answer the KRB5_RESPONDER_QUESTION_PKINIT question for one identity. | |
6804 * | |
6805 * @param [in] ctx Library context | |
6806 * @param [in] rctx Responder context | |
6807 * @param [in] identity The identity for which a PIN is being supplied | |
6808 * @param [in] pin The provided PIN, or NULL for none | |
6809 * | |
6810 * @version New in 1.12 | |
6811 */ | |
6812 krb5_error_code KRB5_CALLCONV | |
6813 krb5_responder_pkinit_set_answer(krb5_context ctx, krb5_responder_context rctx, | |
6814 const char *identity, const char *pin); | |
6815 | |
6816 /** | |
6817 * Free the value returned by krb5_responder_pkinit_get_challenge(). | |
6818 * | |
6819 * @param [in] ctx Library context | |
6820 * @param [in] rctx Responder context | |
6821 * @param [in] chl The challenge to free | |
6822 * | |
6823 * @version New in 1.12 | |
6824 */ | |
6825 void KRB5_CALLCONV | |
6826 krb5_responder_pkinit_challenge_free(krb5_context ctx, | |
6827 krb5_responder_context rctx, | |
6828 krb5_responder_pkinit_challenge *chl); | |
6829 | |
6830 /** Store options for @c _krb5_get_init_creds */ | |
6831 typedef struct _krb5_get_init_creds_opt { | |
6832 krb5_flags flags; | |
6833 krb5_deltat tkt_life; | |
6834 krb5_deltat renew_life; | |
6835 int forwardable; | |
6836 int proxiable; | |
6837 krb5_enctype *etype_list; | |
6838 int etype_list_length; | |
6839 krb5_address **address_list; | |
6840 krb5_preauthtype *preauth_list; | |
6841 int preauth_list_length; | |
6842 krb5_data *salt; | |
6843 } krb5_get_init_creds_opt; | |
6844 | |
6845 #define KRB5_GET_INIT_CREDS_OPT_TKT_LIFE 0x0001 | |
6846 #define KRB5_GET_INIT_CREDS_OPT_RENEW_LIFE 0x0002 | |
6847 #define KRB5_GET_INIT_CREDS_OPT_FORWARDABLE 0x0004 | |
6848 #define KRB5_GET_INIT_CREDS_OPT_PROXIABLE 0x0008 | |
6849 #define KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST 0x0010 | |
6850 #define KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST 0x0020 | |
6851 #define KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST 0x0040 | |
6852 #define KRB5_GET_INIT_CREDS_OPT_SALT 0x0080 | |
6853 #define KRB5_GET_INIT_CREDS_OPT_CHG_PWD_PRMPT 0x0100 | |
6854 #define KRB5_GET_INIT_CREDS_OPT_CANONICALIZE 0x0200 | |
6855 #define KRB5_GET_INIT_CREDS_OPT_ANONYMOUS 0x0400 | |
6856 | |
6857 | |
6858 /** | |
6859 * Allocate a new initial credential options structure. | |
6860 * | |
6861 * @param [in] context Library context | |
6862 * @param [out] opt New options structure | |
6863 * | |
6864 * This function is the preferred way to create an options structure for | |
6865 * getting initial credentials, and is required to make use of certain options. | |
6866 * Use krb5_get_init_creds_opt_free() to free @a opt when it is no longer | |
6867 * needed. | |
6868 * | |
6869 * @retval 0 - Success; Kerberos errors otherwise. | |
6870 */ | |
6871 krb5_error_code KRB5_CALLCONV | |
6872 krb5_get_init_creds_opt_alloc(krb5_context context, | |
6873 krb5_get_init_creds_opt **opt); | |
6874 | |
6875 /** | |
6876 * Free initial credential options. | |
6877 * | |
6878 * @param [in] context Library context | |
6879 * @param [in] opt Options structure to free | |
6880 * | |
6881 * @sa krb5_get_init_creds_opt_alloc() | |
6882 */ | |
6883 void KRB5_CALLCONV | |
6884 krb5_get_init_creds_opt_free(krb5_context context, | |
6885 krb5_get_init_creds_opt *opt); | |
6886 | |
6887 /** @deprecated Use krb5_get_init_creds_opt_alloc() instead. */ | |
6888 void KRB5_CALLCONV | |
6889 krb5_get_init_creds_opt_init(krb5_get_init_creds_opt *opt); | |
6890 | |
6891 /** | |
6892 * Set the ticket lifetime in initial credential options. | |
6893 * | |
6894 * @param [in] opt Options structure | |
6895 * @param [in] tkt_life Ticket lifetime | |
6896 */ | |
6897 void KRB5_CALLCONV | |
6898 krb5_get_init_creds_opt_set_tkt_life(krb5_get_init_creds_opt *opt, | |
6899 krb5_deltat tkt_life); | |
6900 | |
6901 /** | |
6902 * Set the ticket renewal lifetime in initial credential options. | |
6903 * | |
6904 * @param [in] opt Pointer to @a options field | |
6905 * @param [in] renew_life Ticket renewal lifetime | |
6906 */ | |
6907 void KRB5_CALLCONV | |
6908 krb5_get_init_creds_opt_set_renew_life(krb5_get_init_creds_opt *opt, | |
6909 krb5_deltat renew_life); | |
6910 | |
6911 /** | |
6912 * Set or unset the forwardable flag in initial credential options. | |
6913 * | |
6914 * @param [in] opt Options structure | |
6915 * @param [in] forwardable Whether credentials should be forwardable | |
6916 */ | |
6917 void KRB5_CALLCONV | |
6918 krb5_get_init_creds_opt_set_forwardable(krb5_get_init_creds_opt *opt, | |
6919 int forwardable); | |
6920 | |
6921 /** | |
6922 * Set or unset the proxiable flag in initial credential options. | |
6923 * | |
6924 * @param [in] opt Options structure | |
6925 * @param [in] proxiable Whether credentials should be proxiable | |
6926 */ | |
6927 void KRB5_CALLCONV | |
6928 krb5_get_init_creds_opt_set_proxiable(krb5_get_init_creds_opt *opt, | |
6929 int proxiable); | |
6930 | |
6931 /** | |
6932 * Set or unset the canonicalize flag in initial credential options. | |
6933 * | |
6934 * @param [in] opt Options structure | |
6935 * @param [in] canonicalize Whether to canonicalize client principal | |
6936 */ | |
6937 void KRB5_CALLCONV | |
6938 krb5_get_init_creds_opt_set_canonicalize(krb5_get_init_creds_opt *opt, | |
6939 int canonicalize); | |
6940 | |
6941 /** | |
6942 * Set or unset the anonymous flag in initial credential options. | |
6943 * | |
6944 * @param [in] opt Options structure | |
6945 * @param [in] anonymous Whether to make an anonymous request | |
6946 * | |
6947 * This function may be used to request anonymous credentials from the KDC by | |
6948 * setting @a anonymous to non-zero. Note that anonymous credentials are only | |
6949 * a request; clients must verify that credentials are anonymous if that is a | |
6950 * requirement. | |
6951 */ | |
6952 void KRB5_CALLCONV | |
6953 krb5_get_init_creds_opt_set_anonymous(krb5_get_init_creds_opt *opt, | |
6954 int anonymous); | |
6955 | |
6956 /** | |
6957 * Set allowable encryption types in initial credential options. | |
6958 * | |
6959 * @param [in] opt Options structure | |
6960 * @param [in] etype_list Array of encryption types | |
6961 * @param [in] etype_list_length Length of @a etype_list | |
6962 */ | |
6963 void KRB5_CALLCONV | |
6964 krb5_get_init_creds_opt_set_etype_list(krb5_get_init_creds_opt *opt, | |
6965 krb5_enctype *etype_list, | |
6966 int etype_list_length); | |
6967 | |
6968 /** | |
6969 * Set address restrictions in initial credential options. | |
6970 * | |
6971 * @param [in] opt Options structure | |
6972 * @param [in] addresses Null-terminated array of addresses | |
6973 */ | |
6974 void KRB5_CALLCONV | |
6975 krb5_get_init_creds_opt_set_address_list(krb5_get_init_creds_opt *opt, | |
6976 krb5_address **addresses); | |
6977 | |
6978 /** | |
6979 * Set preauthentication types in initial credential options. | |
6980 * | |
6981 * @param [in] opt Options structure | |
6982 * @param [in] preauth_list Array of preauthentication types | |
6983 * @param [in] preauth_list_length Length of @a preauth_list | |
6984 * | |
6985 * This function can be used to perform optimistic preauthentication when | |
6986 * getting initial credentials, in combination with | |
6987 * krb5_get_init_creds_opt_set_salt() and krb5_get_init_creds_opt_set_pa(). | |
6988 */ | |
6989 void KRB5_CALLCONV | |
6990 krb5_get_init_creds_opt_set_preauth_list(krb5_get_init_creds_opt *opt, | |
6991 krb5_preauthtype *preauth_list, | |
6992 int preauth_list_length); | |
6993 | |
6994 /** | |
6995 * Set salt for optimistic preauthentication in initial credential options. | |
6996 * | |
6997 * @param [in] opt Options structure | |
6998 * @param [in] salt Salt data | |
6999 * | |
7000 * When getting initial credentials with a password, a salt string it used to | |
7001 * convert the password to a key. Normally this salt is obtained from the | |
7002 * first KDC reply, but when performing optimistic preauthentication, the | |
7003 * client may need to supply the salt string with this function. | |
7004 */ | |
7005 void KRB5_CALLCONV | |
7006 krb5_get_init_creds_opt_set_salt(krb5_get_init_creds_opt *opt, | |
7007 krb5_data *salt); | |
7008 | |
7009 /** | |
7010 * Set or unset change-password-prompt flag in initial credential options. | |
7011 * | |
7012 * @param [in] opt Options structure | |
7013 * @param [in] prompt Whether to prompt to change password | |
7014 * | |
7015 * This flag is on by default. It controls whether | |
7016 * krb5_get_init_creds_password() will react to an expired-password error by | |
7017 * prompting for a new password and attempting to change the old one. | |
7018 */ | |
7019 void KRB5_CALLCONV | |
7020 krb5_get_init_creds_opt_set_change_password_prompt(krb5_get_init_creds_opt *opt, | |
7021 int prompt); | |
7022 | |
7023 /** Generic preauth option attribute/value pairs */ | |
7024 typedef struct _krb5_gic_opt_pa_data { | |
7025 char *attr; | |
7026 char *value; | |
7027 } krb5_gic_opt_pa_data; | |
7028 | |
7029 /** | |
7030 * Supply options for preauthentication in initial credential options. | |
7031 * | |
7032 * @param [in] context Library context | |
7033 * @param [in] opt Options structure | |
7034 * @param [in] attr Preauthentication option name | |
7035 * @param [in] value Preauthentication option value | |
7036 * | |
7037 * This function allows the caller to supply options for preauthentication. | |
7038 * The values of @a attr and @a value are supplied to each preauthentication | |
7039 * module available within @a context. | |
7040 */ | |
7041 krb5_error_code KRB5_CALLCONV | |
7042 krb5_get_init_creds_opt_set_pa(krb5_context context, | |
7043 krb5_get_init_creds_opt *opt, const char *attr, | |
7044 const char *value); | |
7045 | |
7046 /** | |
7047 * Set location of FAST armor ccache in initial credential options. | |
7048 * | |
7049 * @param [in] context Library context | |
7050 * @param [in] opt Options | |
7051 * @param [in] fast_ccache_name Credential cache name | |
7052 * | |
7053 * Sets the location of a credential cache containing an armor ticket to | |
7054 * protect an initial credential exchange using the FAST protocol extension. | |
7055 * | |
7056 * In version 1.7, setting an armor ccache requires that FAST be used for the | |
7057 * exchange. In version 1.8 or later, setting the armor ccache causes FAST to | |
7058 * be used if the KDC supports it; krb5_get_init_creds_opt_set_fast_flags() | |
7059 * must be used to require that FAST be used. | |
7060 */ | |
7061 krb5_error_code KRB5_CALLCONV | |
7062 krb5_get_init_creds_opt_set_fast_ccache_name(krb5_context context, | |
7063 krb5_get_init_creds_opt *opt, | |
7064 const char *fast_ccache_name); | |
7065 | |
7066 /** | |
7067 * Set FAST armor cache in initial credential options. | |
7068 * | |
7069 * @param [in] context Library context | |
7070 * @param [in] opt Options | |
7071 * @param [in] ccache Credential cache handle | |
7072 * | |
7073 * This function is similar to krb5_get_init_creds_opt_set_fast_ccache_name(), | |
7074 * but uses a credential cache handle instead of a name. | |
7075 * | |
7076 * @version New in 1.9 | |
7077 */ | |
7078 krb5_error_code KRB5_CALLCONV | |
7079 krb5_get_init_creds_opt_set_fast_ccache(krb5_context context, | |
7080 krb5_get_init_creds_opt *opt, | |
7081 krb5_ccache ccache); | |
7082 | |
7083 /** | |
7084 * Set an input credential cache in initial credential options. | |
7085 * | |
7086 * @param [in] context Library context | |
7087 * @param [in] opt Options | |
7088 * @param [in] ccache Credential cache handle | |
7089 * | |
7090 * If an input credential cache is set, then the krb5_get_init_creds family of | |
7091 * APIs will read settings from it. Setting an input ccache is desirable when | |
7092 * the application wishes to perform authentication in the same way (using the | |
7093 * same preauthentication mechanisms, and making the same non-security- | |
7094 * sensitive choices) as the previous authentication attempt, which stored | |
7095 * information in the passed-in ccache. | |
7096 * | |
7097 * @version New in 1.11 | |
7098 */ | |
7099 krb5_error_code KRB5_CALLCONV | |
7100 krb5_get_init_creds_opt_set_in_ccache(krb5_context context, | |
7101 krb5_get_init_creds_opt *opt, | |
7102 krb5_ccache ccache); | |
7103 | |
7104 /** | |
7105 * Set an output credential cache in initial credential options. | |
7106 * | |
7107 * @param [in] context Library context | |
7108 * @param [in] opt Options | |
7109 * @param [in] ccache Credential cache handle | |
7110 * | |
7111 * If an output credential cache is set, then the krb5_get_init_creds family of | |
7112 * APIs will write credentials to it. Setting an output ccache is desirable | |
7113 * both because it simplifies calling code and because it permits the | |
7114 * krb5_get_init_creds APIs to write out configuration information about the | |
7115 * realm to the ccache. | |
7116 */ | |
7117 krb5_error_code KRB5_CALLCONV | |
7118 krb5_get_init_creds_opt_set_out_ccache(krb5_context context, | |
7119 krb5_get_init_creds_opt *opt, | |
7120 krb5_ccache ccache); | |
7121 | |
7122 /** | |
7123 * @brief Ask the KDC to include or not include a PAC in the ticket | |
7124 * | |
7125 * @param [in] context Library context | |
7126 * @param [in] opt Options structure | |
7127 * @param [in] req_pac Whether to request a PAC or not | |
7128 * | |
7129 * If this option is set, the AS request will include a PAC-REQUEST pa-data | |
7130 * item explicitly asking the KDC to either include or not include a privilege | |
7131 * attribute certificate in the ticket authorization data. By default, no | |
7132 * request is made; typically the KDC will default to including a PAC if it | |
7133 * supports them. | |
7134 * | |
7135 * @version New in 1.15 | |
7136 */ | |
7137 krb5_error_code KRB5_CALLCONV | |
7138 krb5_get_init_creds_opt_set_pac_request(krb5_context context, | |
7139 krb5_get_init_creds_opt *opt, | |
7140 krb5_boolean req_pac); | |
7141 | |
7142 /** | |
7143 * Set FAST flags in initial credential options. | |
7144 * | |
7145 * @param [in] context Library context | |
7146 * @param [in] opt Options | |
7147 * @param [in] flags FAST flags | |
7148 * | |
7149 * The following flag values are valid: | |
7150 * @li #KRB5_FAST_REQUIRED - Require FAST to be used | |
7151 * | |
7152 * @retval | |
7153 * 0 - Success; Kerberos errors otherwise. | |
7154 */ | |
7155 krb5_error_code KRB5_CALLCONV | |
7156 krb5_get_init_creds_opt_set_fast_flags(krb5_context context, | |
7157 krb5_get_init_creds_opt *opt, | |
7158 krb5_flags flags); | |
7159 | |
7160 /** | |
7161 * Retrieve FAST flags from initial credential options. | |
7162 * | |
7163 * @param [in] context Library context | |
7164 * @param [in] opt Options | |
7165 * @param [out] out_flags FAST flags | |
7166 * | |
7167 * @retval | |
7168 * 0 - Success; Kerberos errors otherwise. | |
7169 */ | |
7170 krb5_error_code KRB5_CALLCONV | |
7171 krb5_get_init_creds_opt_get_fast_flags(krb5_context context, | |
7172 krb5_get_init_creds_opt *opt, | |
7173 krb5_flags *out_flags); | |
7174 | |
7175 /* Fast flags*/ | |
7176 #define KRB5_FAST_REQUIRED 0x0001 /**< Require KDC to support FAST*/ | |
7177 | |
7178 typedef void | |
7179 (KRB5_CALLCONV *krb5_expire_callback_func)(krb5_context context, void *data, | |
7180 krb5_timestamp password_expiration, | |
7181 krb5_timestamp account_expiration, | |
7182 krb5_boolean is_last_req); | |
7183 | |
7184 /** | |
7185 * Set an expiration callback in initial credential options. | |
7186 * | |
7187 * @param [in] context Library context | |
7188 * @param [in] opt Options structure | |
7189 * @param [in] cb Callback function | |
7190 * @param [in] data Callback argument | |
7191 * | |
7192 * Set a callback to receive password and account expiration times. | |
7193 * | |
7194 * @a cb will be invoked if and only if credentials are successfully acquired. | |
7195 * The callback will receive the @a context from the calling function and the | |
7196 * @a data argument supplied with this API. The remaining arguments should be | |
7197 * interpreted as follows: | |
7198 * | |
7199 * If @a is_last_req is true, then the KDC reply contained last-req entries | |
7200 * which unambiguously indicated the password expiration, account expiration, | |
7201 * or both. (If either value was not present, the corresponding argument will | |
7202 * be 0.) Furthermore, a non-zero @a password_expiration should be taken as a | |
7203 * suggestion from the KDC that a warning be displayed. | |
7204 * | |
7205 * If @a is_last_req is false, then @a account_expiration will be 0 and @a | |
7206 * password_expiration will contain the expiration time of either the password | |
7207 * or account, or 0 if no expiration time was indicated in the KDC reply. The | |
7208 * callback should independently decide whether to display a password | |
7209 * expiration warning. | |
7210 * | |
7211 * Note that @a cb may be invoked even if credentials are being acquired for | |
7212 * the kadmin/changepw service in order to change the password. It is the | |
7213 * caller's responsibility to avoid displaying a password expiry warning in | |
7214 * this case. | |
7215 * | |
7216 * @warning Setting an expire callback with this API will cause | |
7217 * krb5_get_init_creds_password() not to send password expiry warnings to the | |
7218 * prompter, as it ordinarily may. | |
7219 * | |
7220 * @version New in 1.9 | |
7221 */ | |
7222 krb5_error_code KRB5_CALLCONV | |
7223 krb5_get_init_creds_opt_set_expire_callback(krb5_context context, | |
7224 krb5_get_init_creds_opt *opt, | |
7225 krb5_expire_callback_func cb, | |
7226 void *data); | |
7227 | |
7228 /** | |
7229 * Set the responder function in initial credential options. | |
7230 * | |
7231 * @param [in] context Library context | |
7232 * @param [in] opt Options structure | |
7233 * @param [in] responder Responder function | |
7234 * @param [in] data Responder data argument | |
7235 * | |
7236 * @version New in 1.11 | |
7237 */ | |
7238 krb5_error_code KRB5_CALLCONV | |
7239 krb5_get_init_creds_opt_set_responder(krb5_context context, | |
7240 krb5_get_init_creds_opt *opt, | |
7241 krb5_responder_fn responder, void *data); | |
7242 | |
7243 /** | |
7244 * Get initial credentials using a password. | |
7245 * | |
7246 * @param [in] context Library context | |
7247 * @param [out] creds New credentials | |
7248 * @param [in] client Client principal | |
7249 * @param [in] password Password (or NULL) | |
7250 * @param [in] prompter Prompter function | |
7251 * @param [in] data Prompter callback data | |
7252 * @param [in] start_time Time when ticket becomes valid (0 for now) | |
7253 * @param [in] in_tkt_service Service name of initial credentials (or NULL) | |
7254 * @param [in] k5_gic_options Initial credential options | |
7255 * | |
7256 * This function requests KDC for an initial credentials for @a client using @a | |
7257 * password. If @a password is NULL, a password will be prompted for using @a | |
7258 * prompter if necessary. If @a in_tkt_service is specified, it is parsed as a | |
7259 * principal name (with the realm ignored) and used as the service principal | |
7260 * for the request; otherwise the ticket-granting service is used. | |
7261 * | |
7262 * @sa krb5_verify_init_creds() | |
7263 * | |
7264 * @retval | |
7265 * 0 Success | |
7266 * @retval | |
7267 * EINVAL Invalid argument | |
7268 * @retval | |
7269 * KRB5_KDC_UNREACH Cannot contact any KDC for requested realm | |
7270 * @retval | |
7271 * KRB5_PREAUTH_FAILED Generic Pre-athentication failure | |
7272 * @retval | |
7273 * KRB5_LIBOS_PWDINTR Password read interrupted | |
7274 * @retval | |
7275 * KRB5_REALM_CANT_RESOLVE Cannot resolve network address for KDC in requested realm | |
7276 * @retval | |
7277 * KRB5KDC_ERR_KEY_EXP Password has expired | |
7278 * @retval | |
7279 * KRB5_LIBOS_BADPWDMATCH Password mismatch | |
7280 * @retval | |
7281 * KRB5_CHPW_PWDNULL New password cannot be zero length | |
7282 * @retval | |
7283 * KRB5_CHPW_FAIL Password change failed | |
7284 * @return | |
7285 * Kerberos error codes | |
7286 */ | |
7287 krb5_error_code KRB5_CALLCONV | |
7288 krb5_get_init_creds_password(krb5_context context, krb5_creds *creds, | |
7289 krb5_principal client, const char *password, | |
7290 krb5_prompter_fct prompter, void *data, | |
7291 krb5_deltat start_time, | |
7292 const char *in_tkt_service, | |
7293 krb5_get_init_creds_opt *k5_gic_options); | |
7294 | |
7295 /** | |
7296 * Retrieve enctype, salt and s2kparams from KDC | |
7297 * | |
7298 * @param [in] context Library context | |
7299 * @param [in] principal Principal whose information is requested | |
7300 * @param [in] opt Initial credential options | |
7301 * @param [out] enctype_out The enctype chosen by KDC | |
7302 * @param [out] salt_out Salt returned from KDC | |
7303 * @param [out] s2kparams_out String-to-key parameters returned from KDC | |
7304 * | |
7305 * Send an initial ticket request for @a principal and extract the encryption | |
7306 * type, salt type, and string-to-key parameters from the KDC response. If the | |
7307 * KDC provides no etype-info, set @a enctype_out to @c ENCTYPE_NULL and set @a | |
7308 * salt_out and @a s2kparams_out to empty. If the KDC etype-info provides no | |
7309 * salt, compute the default salt and place it in @a salt_out. If the KDC | |
7310 * etype-info provides no string-to-key parameters, set @a s2kparams_out to | |
7311 * empty. | |
7312 * | |
7313 * @a opt may be used to specify options which affect the initial request, such | |
7314 * as request encryption types or a FAST armor cache (see | |
7315 * krb5_get_init_creds_opt_set_etype_list() and | |
7316 * krb5_get_init_creds_opt_set_fast_ccache_name()). | |
7317 * | |
7318 * Use krb5_free_data_contents() to free @a salt_out and @a s2kparams_out when | |
7319 * they are no longer needed. | |
7320 * | |
7321 * @version New in 1.17 | |
7322 * | |
7323 * @retval 0 Success | |
7324 * @return A Kerberos error code | |
7325 */ | |
7326 krb5_error_code KRB5_CALLCONV | |
7327 krb5_get_etype_info(krb5_context context, krb5_principal principal, | |
7328 krb5_get_init_creds_opt *opt, krb5_enctype *enctype_out, | |
7329 krb5_data *salt_out, krb5_data *s2kparams_out); | |
7330 | |
7331 struct _krb5_init_creds_context; | |
7332 typedef struct _krb5_init_creds_context *krb5_init_creds_context; | |
7333 | |
7334 #define KRB5_INIT_CREDS_STEP_FLAG_CONTINUE 0x1 /**< More responses needed */ | |
7335 | |
7336 /** | |
7337 * Free an initial credentials context. | |
7338 * | |
7339 * @param [in] context Library context | |
7340 * @param [in] ctx Initial credentials context | |
7341 * | |
7342 * @a context must be the same as the one passed to krb5_init_creds_init() for | |
7343 * this initial credentials context. | |
7344 */ | |
7345 void KRB5_CALLCONV | |
7346 krb5_init_creds_free(krb5_context context, krb5_init_creds_context ctx); | |
7347 | |
7348 /** | |
7349 * Acquire credentials using an initial credentials context. | |
7350 * | |
7351 * @param [in] context Library context | |
7352 * @param [in] ctx Initial credentials context | |
7353 * | |
7354 * This function synchronously obtains credentials using a context created by | |
7355 * krb5_init_creds_init(). On successful return, the credentials can be | |
7356 * retrieved with krb5_init_creds_get_creds(). | |
7357 * | |
7358 * @a context must be the same as the one passed to krb5_init_creds_init() for | |
7359 * this initial credentials context. | |
7360 * | |
7361 * @retval 0 Success; otherwise - Kerberos error codes | |
7362 */ | |
7363 krb5_error_code KRB5_CALLCONV | |
7364 krb5_init_creds_get(krb5_context context, krb5_init_creds_context ctx); | |
7365 | |
7366 /** | |
7367 * Retrieve acquired credentials from an initial credentials context. | |
7368 * | |
7369 * @param [in] context Library context | |
7370 * @param [in] ctx Initial credentials context | |
7371 * @param [out] creds Acquired credentials | |
7372 * | |
7373 * This function copies the acquired initial credentials from @a ctx into @a | |
7374 * creds, after the successful completion of krb5_init_creds_get() or | |
7375 * krb5_init_creds_step(). Use krb5_free_cred_contents() to free @a creds when | |
7376 * it is no longer needed. | |
7377 * | |
7378 * @retval 0 Success; otherwise - Kerberos error codes | |
7379 */ | |
7380 krb5_error_code KRB5_CALLCONV | |
7381 krb5_init_creds_get_creds(krb5_context context, krb5_init_creds_context ctx, | |
7382 krb5_creds *creds); | |
7383 | |
7384 /** | |
7385 * Get the last error from KDC from an initial credentials context. | |
7386 * | |
7387 * @param [in] context Library context | |
7388 * @param [in] ctx Initial credentials context | |
7389 * @param [out] error Error from KDC, or NULL if none was received | |
7390 * | |
7391 * @retval 0 Success; otherwise - Kerberos error codes | |
7392 */ | |
7393 krb5_error_code KRB5_CALLCONV | |
7394 krb5_init_creds_get_error(krb5_context context, krb5_init_creds_context ctx, | |
7395 krb5_error **error); | |
7396 | |
7397 /** | |
7398 * Create a context for acquiring initial credentials. | |
7399 * | |
7400 * @param [in] context Library context | |
7401 * @param [in] client Client principal to get initial creds for | |
7402 * @param [in] prompter Prompter callback | |
7403 * @param [in] data Prompter callback argument | |
7404 * @param [in] start_time Time when credentials become valid (0 for now) | |
7405 * @param [in] options Options structure (NULL for default) | |
7406 * @param [out] ctx New initial credentials context | |
7407 * | |
7408 * This function creates a new context for acquiring initial credentials. Use | |
7409 * krb5_init_creds_free() to free @a ctx when it is no longer needed. | |
7410 * | |
7411 * Any subsequent calls to krb5_init_creds_step(), krb5_init_creds_get(), or | |
7412 * krb5_init_creds_free() for this initial credentials context must use the | |
7413 * same @a context argument as the one passed to this function. | |
7414 * | |
7415 * @retval 0 Success; otherwise - Kerberos error codes | |
7416 */ | |
7417 krb5_error_code KRB5_CALLCONV | |
7418 krb5_init_creds_init(krb5_context context, krb5_principal client, | |
7419 krb5_prompter_fct prompter, void *data, | |
7420 krb5_deltat start_time, krb5_get_init_creds_opt *options, | |
7421 krb5_init_creds_context *ctx); | |
7422 | |
7423 /** | |
7424 * Specify a keytab to use for acquiring initial credentials. | |
7425 * | |
7426 * @param [in] context Library context | |
7427 * @param [in] ctx Initial credentials context | |
7428 * @param [in] keytab Key table handle | |
7429 * | |
7430 * This function supplies a keytab containing the client key for an initial | |
7431 * credentials request. | |
7432 * | |
7433 * @retval 0 Success; otherwise - Kerberos error codes | |
7434 */ | |
7435 krb5_error_code KRB5_CALLCONV | |
7436 krb5_init_creds_set_keytab(krb5_context context, krb5_init_creds_context ctx, | |
7437 krb5_keytab keytab); | |
7438 | |
7439 /** | |
7440 * Get the next KDC request for acquiring initial credentials. | |
7441 * | |
7442 * @param [in] context Library context | |
7443 * @param [in] ctx Initial credentials context | |
7444 * @param [in] in KDC response (empty on the first call) | |
7445 * @param [out] out Next KDC request | |
7446 * @param [out] realm Realm for next KDC request | |
7447 * @param [out] flags Output flags | |
7448 * | |
7449 * This function constructs the next KDC request in an initial credential | |
7450 * exchange, allowing the caller to control the transport of KDC requests and | |
7451 * replies. On the first call, @a in should be set to an empty buffer; on | |
7452 * subsequent calls, it should be set to the KDC's reply to the previous | |
7453 * request. | |
7454 * | |
7455 * If more requests are needed, @a flags will be set to | |
7456 * #KRB5_INIT_CREDS_STEP_FLAG_CONTINUE and the next request will be placed in | |
7457 * @a out. If no more requests are needed, @a flags will not contain | |
7458 * #KRB5_INIT_CREDS_STEP_FLAG_CONTINUE and @a out will be empty. | |
7459 * | |
7460 * If this function returns @c KRB5KRB_ERR_RESPONSE_TOO_BIG, the caller should | |
7461 * transmit the next request using TCP rather than UDP. If this function | |
7462 * returns any other error, the initial credential exchange has failed. | |
7463 * | |
7464 * @a context must be the same as the one passed to krb5_init_creds_init() for | |
7465 * this initial credentials context. | |
7466 * | |
7467 * @retval 0 Success; otherwise - Kerberos error codes | |
7468 */ | |
7469 krb5_error_code KRB5_CALLCONV | |
7470 krb5_init_creds_step(krb5_context context, krb5_init_creds_context ctx, | |
7471 krb5_data *in, krb5_data *out, krb5_data *realm, | |
7472 unsigned int *flags); | |
7473 | |
7474 /** | |
7475 * Set a password for acquiring initial credentials. | |
7476 * | |
7477 * @param [in] context Library context | |
7478 * @param [in] ctx Initial credentials context | |
7479 * @param [in] password Password | |
7480 * | |
7481 * This function supplies a password to be used to construct the client key for | |
7482 * an initial credentials request. | |
7483 * | |
7484 * @retval 0 Success; otherwise - Kerberos error codes | |
7485 */ | |
7486 krb5_error_code KRB5_CALLCONV | |
7487 krb5_init_creds_set_password(krb5_context context, krb5_init_creds_context ctx, | |
7488 const char *password); | |
7489 | |
7490 /** | |
7491 * Specify a service principal for acquiring initial credentials. | |
7492 * | |
7493 * @param [in] context Library context | |
7494 * @param [in] ctx Initial credentials context | |
7495 * @param [in] service Service principal string | |
7496 * | |
7497 * This function supplies a service principal string to acquire initial | |
7498 * credentials for instead of the default krbtgt service. @a service is parsed | |
7499 * as a principal name; any realm part is ignored. | |
7500 * | |
7501 * @retval 0 Success; otherwise - Kerberos error codes | |
7502 */ | |
7503 krb5_error_code KRB5_CALLCONV | |
7504 krb5_init_creds_set_service(krb5_context context, krb5_init_creds_context ctx, | |
7505 const char *service); | |
7506 | |
7507 /** | |
7508 * Retrieve ticket times from an initial credentials context. | |
7509 * | |
7510 * @param [in] context Library context | |
7511 * @param [in] ctx Initial credentials context | |
7512 * @param [out] times Ticket times for acquired credentials | |
7513 * | |
7514 * The initial credentials context must have completed obtaining credentials | |
7515 * via either krb5_init_creds_get() or krb5_init_creds_step(). | |
7516 * | |
7517 * @retval 0 Success; otherwise - Kerberos error codes | |
7518 */ | |
7519 krb5_error_code KRB5_CALLCONV | |
7520 krb5_init_creds_get_times(krb5_context context, krb5_init_creds_context ctx, | |
7521 krb5_ticket_times *times); | |
7522 | |
7523 struct _krb5_tkt_creds_context; | |
7524 typedef struct _krb5_tkt_creds_context *krb5_tkt_creds_context; | |
7525 | |
7526 /** | |
7527 * Create a context to get credentials from a KDC's Ticket Granting Service. | |
7528 * | |
7529 * @param[in] context Library context | |
7530 * @param[in] ccache Credential cache handle | |
7531 * @param[in] creds Input credentials | |
7532 * @param[in] options @ref KRB5_GC options for this request. | |
7533 * @param[out] ctx New TGS request context | |
7534 * | |
7535 * This function prepares to obtain credentials matching @a creds, either by | |
7536 * retrieving them from @a ccache or by making requests to ticket-granting | |
7537 * services beginning with a ticket-granting ticket for the client principal's | |
7538 * realm. | |
7539 * | |
7540 * The resulting TGS acquisition context can be used asynchronously with | |
7541 * krb5_tkt_creds_step() or synchronously with krb5_tkt_creds_get(). See also | |
7542 * krb5_get_credentials() for synchronous use. | |
7543 * | |
7544 * Use krb5_tkt_creds_free() to free @a ctx when it is no longer needed. | |
7545 * | |
7546 * @version New in 1.9 | |
7547 * | |
7548 * @retval 0 Success; otherwise - Kerberos error codes | |
7549 */ | |
7550 krb5_error_code KRB5_CALLCONV | |
7551 krb5_tkt_creds_init(krb5_context context, krb5_ccache ccache, | |
7552 krb5_creds *creds, krb5_flags options, | |
7553 krb5_tkt_creds_context *ctx); | |
7554 | |
7555 /** | |
7556 * Synchronously obtain credentials using a TGS request context. | |
7557 * | |
7558 * @param[in] context Library context | |
7559 * @param[in] ctx TGS request context | |
7560 * | |
7561 * This function synchronously obtains credentials using a context created by | |
7562 * krb5_tkt_creds_init(). On successful return, the credentials can be | |
7563 * retrieved with krb5_tkt_creds_get_creds(). | |
7564 * | |
7565 * @version New in 1.9 | |
7566 * | |
7567 * @retval 0 Success; otherwise - Kerberos error codes | |
7568 */ | |
7569 krb5_error_code KRB5_CALLCONV | |
7570 krb5_tkt_creds_get(krb5_context context, krb5_tkt_creds_context ctx); | |
7571 | |
7572 /** | |
7573 * Retrieve acquired credentials from a TGS request context. | |
7574 * | |
7575 * @param[in] context Library context | |
7576 * @param[in] ctx TGS request context | |
7577 * @param[out] creds Acquired credentials | |
7578 * | |
7579 * This function copies the acquired initial credentials from @a ctx into @a | |
7580 * creds, after the successful completion of krb5_tkt_creds_get() or | |
7581 * krb5_tkt_creds_step(). Use krb5_free_cred_contents() to free @a creds when | |
7582 * it is no longer needed. | |
7583 * | |
7584 * @version New in 1.9 | |
7585 * | |
7586 * @retval 0 Success; otherwise - Kerberos error codes | |
7587 */ | |
7588 krb5_error_code KRB5_CALLCONV | |
7589 krb5_tkt_creds_get_creds(krb5_context context, krb5_tkt_creds_context ctx, | |
7590 krb5_creds *creds); | |
7591 | |
7592 /** | |
7593 * Free a TGS request context. | |
7594 * | |
7595 * @param[in] context Library context | |
7596 * @param[in] ctx TGS request context | |
7597 * | |
7598 * @version New in 1.9 | |
7599 */ | |
7600 void KRB5_CALLCONV | |
7601 krb5_tkt_creds_free(krb5_context context, krb5_tkt_creds_context ctx); | |
7602 | |
7603 #define KRB5_TKT_CREDS_STEP_FLAG_CONTINUE 0x1 /**< More responses needed */ | |
7604 | |
7605 /** | |
7606 * Get the next KDC request in a TGS exchange. | |
7607 * | |
7608 * @param[in] context Library context | |
7609 * @param[in] ctx TGS request context | |
7610 * @param[in] in KDC response (empty on the first call) | |
7611 * @param[out] out Next KDC request | |
7612 * @param[out] realm Realm for next KDC request | |
7613 * @param[out] flags Output flags | |
7614 * | |
7615 * This function constructs the next KDC request for a TGS exchange, allowing | |
7616 * the caller to control the transport of KDC requests and replies. On the | |
7617 * first call, @a in should be set to an empty buffer; on subsequent calls, it | |
7618 * should be set to the KDC's reply to the previous request. | |
7619 * | |
7620 * If more requests are needed, @a flags will be set to | |
7621 * #KRB5_TKT_CREDS_STEP_FLAG_CONTINUE and the next request will be placed in @a | |
7622 * out. If no more requests are needed, @a flags will not contain | |
7623 * #KRB5_TKT_CREDS_STEP_FLAG_CONTINUE and @a out will be empty. | |
7624 * | |
7625 * If this function returns @c KRB5KRB_ERR_RESPONSE_TOO_BIG, the caller should | |
7626 * transmit the next request using TCP rather than UDP. If this function | |
7627 * returns any other error, the TGS exchange has failed. | |
7628 * | |
7629 * @version New in 1.9 | |
7630 * | |
7631 * @retval 0 Success; otherwise - Kerberos error codes | |
7632 */ | |
7633 krb5_error_code KRB5_CALLCONV | |
7634 krb5_tkt_creds_step(krb5_context context, krb5_tkt_creds_context ctx, | |
7635 krb5_data *in, krb5_data *out, krb5_data *realm, | |
7636 unsigned int *flags); | |
7637 | |
7638 /** | |
7639 * Retrieve ticket times from a TGS request context. | |
7640 * | |
7641 * @param[in] context Library context | |
7642 * @param[in] ctx TGS request context | |
7643 * @param[out] times Ticket times for acquired credentials | |
7644 * | |
7645 * The TGS request context must have completed obtaining credentials via either | |
7646 * krb5_tkt_creds_get() or krb5_tkt_creds_step(). | |
7647 * | |
7648 * @version New in 1.9 | |
7649 * | |
7650 * @retval 0 Success; otherwise - Kerberos error codes | |
7651 */ | |
7652 krb5_error_code KRB5_CALLCONV | |
7653 krb5_tkt_creds_get_times(krb5_context context, krb5_tkt_creds_context ctx, | |
7654 krb5_ticket_times *times); | |
7655 | |
7656 /** | |
7657 * Get initial credentials using a key table. | |
7658 * | |
7659 * @param [in] context Library context | |
7660 * @param [out] creds New credentials | |
7661 * @param [in] client Client principal | |
7662 * @param [in] arg_keytab Key table handle | |
7663 * @param [in] start_time Time when ticket becomes valid (0 for now) | |
7664 * @param [in] in_tkt_service Service name of initial credentials (or NULL) | |
7665 * @param [in] k5_gic_options Initial credential options | |
7666 * | |
7667 * This function requests KDC for an initial credentials for @a client using a | |
7668 * client key stored in @a arg_keytab. If @a in_tkt_service is specified, it | |
7669 * is parsed as a principal name (with the realm ignored) and used as the | |
7670 * service principal for the request; otherwise the ticket-granting service is | |
7671 * used. | |
7672 * | |
7673 * @sa krb5_verify_init_creds() | |
7674 * | |
7675 * @retval | |
7676 * 0 Success | |
7677 * @return | |
7678 * Kerberos error codes | |
7679 */ | |
7680 krb5_error_code KRB5_CALLCONV | |
7681 krb5_get_init_creds_keytab(krb5_context context, krb5_creds *creds, | |
7682 krb5_principal client, krb5_keytab arg_keytab, | |
7683 krb5_deltat start_time, const char *in_tkt_service, | |
7684 krb5_get_init_creds_opt *k5_gic_options); | |
7685 | |
7686 typedef struct _krb5_verify_init_creds_opt { | |
7687 krb5_flags flags; | |
7688 int ap_req_nofail; /**< boolean */ | |
7689 } krb5_verify_init_creds_opt; | |
7690 | |
7691 #define KRB5_VERIFY_INIT_CREDS_OPT_AP_REQ_NOFAIL 0x0001 | |
7692 | |
7693 /** | |
7694 * Initialize a credential verification options structure. | |
7695 * | |
7696 * @param [in] k5_vic_options Verification options structure | |
7697 */ | |
7698 void KRB5_CALLCONV | |
7699 krb5_verify_init_creds_opt_init(krb5_verify_init_creds_opt *k5_vic_options); | |
7700 | |
7701 /** | |
7702 * Set whether credential verification is required. | |
7703 * | |
7704 * @param [in] k5_vic_options Verification options structure | |
7705 * @param [in] ap_req_nofail Whether to require successful verification | |
7706 * | |
7707 * This function determines how krb5_verify_init_creds() behaves if no keytab | |
7708 * information is available. If @a ap_req_nofail is @c FALSE, verification | |
7709 * will be skipped in this case and krb5_verify_init_creds() will return | |
7710 * successfully. If @a ap_req_nofail is @c TRUE, krb5_verify_init_creds() will | |
7711 * not return successfully unless verification can be performed. | |
7712 * | |
7713 * If this function is not used, the behavior of krb5_verify_init_creds() is | |
7714 * determined through configuration. | |
7715 */ | |
7716 void KRB5_CALLCONV | |
7717 krb5_verify_init_creds_opt_set_ap_req_nofail(krb5_verify_init_creds_opt * k5_vic_options, | |
7718 int ap_req_nofail); | |
7719 | |
7720 /** | |
7721 * Verify initial credentials against a keytab. | |
7722 * | |
7723 * @param [in] context Library context | |
7724 * @param [in] creds Initial credentials to be verified | |
7725 * @param [in] server Server principal (or NULL) | |
7726 * @param [in] keytab Key table (NULL to use default keytab) | |
7727 * @param [in] ccache Credential cache for fetched creds (or NULL) | |
7728 * @param [in] options Verification options (NULL for default options) | |
7729 * | |
7730 * This function attempts to verify that @a creds were obtained from a KDC with | |
7731 * knowledge of a key in @a keytab, or the default keytab if @a keytab is NULL. | |
7732 * If @a server is provided, the highest-kvno key entry for that principal name | |
7733 * is used to verify the credentials; otherwise, all unique "host" service | |
7734 * principals in the keytab are tried. | |
7735 * | |
7736 * If the specified keytab does not exist, or is empty, or cannot be read, or | |
7737 * does not contain an entry for @a server, then credential verification may be | |
7738 * skipped unless configuration demands that it succeed. The caller can | |
7739 * control this behavior by providing a verification options structure; see | |
7740 * krb5_verify_init_creds_opt_init() and | |
7741 * krb5_verify_init_creds_opt_set_ap_req_nofail(). | |
7742 * | |
7743 * If @a ccache is NULL, any additional credentials fetched during the | |
7744 * verification process will be destroyed. If @a ccache points to NULL, a | |
7745 * memory ccache will be created for the additional credentials and returned in | |
7746 * @a ccache. If @a ccache points to a valid credential cache handle, the | |
7747 * additional credentials will be stored in that cache. | |
7748 * | |
7749 * @retval 0 Success; otherwise - Kerberos error codes | |
7750 */ | |
7751 krb5_error_code KRB5_CALLCONV | |
7752 krb5_verify_init_creds(krb5_context context, krb5_creds *creds, | |
7753 krb5_principal server, krb5_keytab keytab, | |
7754 krb5_ccache *ccache, | |
7755 krb5_verify_init_creds_opt *options); | |
7756 | |
7757 /** | |
7758 * Get validated credentials from the KDC. | |
7759 * | |
7760 * @param [in] context Library context | |
7761 * @param [out] creds Validated credentials | |
7762 * @param [in] client Client principal name | |
7763 * @param [in] ccache Credential cache | |
7764 * @param [in] in_tkt_service Server principal string (or NULL) | |
7765 * | |
7766 * This function gets a validated credential using a postdated credential from | |
7767 * @a ccache. If @a in_tkt_service is specified, it is parsed (with the realm | |
7768 * part ignored) and used as the server principal of the credential; | |
7769 * otherwise, the ticket-granting service is used. | |
7770 * | |
7771 * If successful, the validated credential is placed in @a creds. | |
7772 * | |
7773 * @sa krb5_get_renewed_creds() | |
7774 * | |
7775 * @retval | |
7776 * 0 Success | |
7777 * @retval | |
7778 * KRB5_NO_2ND_TKT Request missing second ticket | |
7779 * @retval | |
7780 * KRB5_NO_TKT_SUPPLIED Request did not supply a ticket | |
7781 * @retval | |
7782 * KRB5_PRINC_NOMATCH Requested principal and ticket do not match | |
7783 * @retval | |
7784 * KRB5_KDCREP_MODIFIED KDC reply did not match expectations | |
7785 * @retval | |
7786 * KRB5_KDCREP_SKEW Clock skew too great in KDC reply | |
7787 * @return | |
7788 * Kerberos error codes | |
7789 */ | |
7790 krb5_error_code KRB5_CALLCONV | |
7791 krb5_get_validated_creds(krb5_context context, krb5_creds *creds, | |
7792 krb5_principal client, krb5_ccache ccache, | |
7793 const char *in_tkt_service); | |
7794 | |
7795 /** | |
7796 * Get renewed credential from KDC using an existing credential. | |
7797 * | |
7798 * @param [in] context Library context | |
7799 * @param [out] creds Renewed credentials | |
7800 * @param [in] client Client principal name | |
7801 * @param [in] ccache Credential cache | |
7802 * @param [in] in_tkt_service Server principal string (or NULL) | |
7803 * | |
7804 * This function gets a renewed credential using an existing one from @a | |
7805 * ccache. If @a in_tkt_service is specified, it is parsed (with the realm | |
7806 * part ignored) and used as the server principal of the credential; otherwise, | |
7807 * the ticket-granting service is used. | |
7808 * | |
7809 * If successful, the renewed credential is placed in @a creds. | |
7810 * | |
7811 * @retval | |
7812 * 0 Success | |
7813 * @return | |
7814 * Kerberos error codes | |
7815 */ | |
7816 krb5_error_code KRB5_CALLCONV | |
7817 krb5_get_renewed_creds(krb5_context context, krb5_creds *creds, | |
7818 krb5_principal client, krb5_ccache ccache, | |
7819 const char *in_tkt_service); | |
7820 | |
7821 /** | |
7822 * Decode an ASN.1-formatted ticket. | |
7823 * | |
7824 * @param [in] code ASN.1-formatted ticket | |
7825 * @param [out] rep Decoded ticket information | |
7826 * | |
7827 * @retval 0 Success; otherwise - Kerberos error codes | |
7828 */ | |
7829 krb5_error_code KRB5_CALLCONV | |
7830 krb5_decode_ticket(const krb5_data *code, krb5_ticket **rep); | |
7831 | |
7832 /** | |
7833 * Retrieve a string value from the appdefaults section of krb5.conf. | |
7834 * | |
7835 * @param [in] context Library context | |
7836 * @param [in] appname Application name | |
7837 * @param [in] realm Realm name | |
7838 * @param [in] option Option to be checked | |
7839 * @param [in] default_value Default value to return if no match is found | |
7840 * @param [out] ret_value String value of @a option | |
7841 * | |
7842 * This function gets the application defaults for @a option based on the given | |
7843 * @a appname and/or @a realm. | |
7844 * | |
7845 * @sa krb5_appdefault_boolean() | |
7846 */ | |
7847 void KRB5_CALLCONV | |
7848 krb5_appdefault_string(krb5_context context, const char *appname, | |
7849 const krb5_data *realm, const char *option, | |
7850 const char *default_value, char ** ret_value); | |
7851 | |
7852 /** | |
7853 * Retrieve a boolean value from the appdefaults section of krb5.conf. | |
7854 * | |
7855 * @param [in] context Library context | |
7856 * @param [in] appname Application name | |
7857 * @param [in] realm Realm name | |
7858 * @param [in] option Option to be checked | |
7859 * @param [in] default_value Default value to return if no match is found | |
7860 * @param [out] ret_value Boolean value of @a option | |
7861 * | |
7862 * This function gets the application defaults for @a option based on the given | |
7863 * @a appname and/or @a realm. | |
7864 * | |
7865 * @sa krb5_appdefault_string() | |
7866 */ | |
7867 void KRB5_CALLCONV | |
7868 krb5_appdefault_boolean(krb5_context context, const char *appname, | |
7869 const krb5_data *realm, const char *option, | |
7870 int default_value, int *ret_value); | |
7871 | |
7872 /* | |
7873 * Prompter enhancements | |
7874 */ | |
7875 /** Prompt for password */ | |
7876 #define KRB5_PROMPT_TYPE_PASSWORD 0x1 | |
7877 /** Prompt for new password (during password change) */ | |
7878 #define KRB5_PROMPT_TYPE_NEW_PASSWORD 0x2 | |
7879 /** Prompt for new password again */ | |
7880 #define KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN 0x3 | |
7881 /** Prompt for preauthentication data (such as an OTP value) */ | |
7882 #define KRB5_PROMPT_TYPE_PREAUTH 0x4 | |
7883 | |
7884 typedef krb5_int32 krb5_prompt_type; | |
7885 | |
7886 /** | |
7887 * Get prompt types array from a context. | |
7888 * | |
7889 * @param [in] context Library context | |
7890 * | |
7891 * @return | |
7892 * Pointer to an array of prompt types corresponding to the prompter's @a | |
7893 * prompts arguments. Each type has one of the following values: | |
7894 * @li #KRB5_PROMPT_TYPE_PASSWORD | |
7895 * @li #KRB5_PROMPT_TYPE_NEW_PASSWORD | |
7896 * @li #KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN | |
7897 * @li #KRB5_PROMPT_TYPE_PREAUTH | |
7898 */ | |
7899 krb5_prompt_type* KRB5_CALLCONV | |
7900 krb5_get_prompt_types(krb5_context context); | |
7901 | |
7902 /* Error reporting */ | |
7903 /** | |
7904 * Set an extended error message for an error code. | |
7905 * | |
7906 * @param [in] ctx Library context | |
7907 * @param [in] code Error code | |
7908 * @param [in] fmt Error string for the error code | |
7909 * @param [in] ... printf(3) style parameters | |
7910 */ | |
7911 void KRB5_CALLCONV_C | |
7912 krb5_set_error_message(krb5_context ctx, krb5_error_code code, const char *fmt, ...) | |
7913 #if !defined(__cplusplus) && (__GNUC__ > 2) | |
7914 __attribute__((__format__(__printf__, 3, 4))) | |
7915 #endif | |
7916 ; | |
7917 | |
7918 /** | |
7919 * Set an extended error message for an error code using a va_list. | |
7920 * | |
7921 * @param [in] ctx Library context | |
7922 * @param [in] code Error code | |
7923 * @param [in] fmt Error string for the error code | |
7924 * @param [in] args List of vprintf(3) style arguments | |
7925 */ | |
7926 void KRB5_CALLCONV | |
7927 krb5_vset_error_message(krb5_context ctx, krb5_error_code code, | |
7928 const char *fmt, va_list args) | |
7929 #if !defined(__cplusplus) && (__GNUC__ > 2) | |
7930 __attribute__((__format__(__printf__, 3, 0))) | |
7931 #endif | |
7932 ; | |
7933 | |
7934 /** | |
7935 * Add a prefix to the message for an error code. | |
7936 * | |
7937 * @param [in] ctx Library context | |
7938 * @param [in] code Error code | |
7939 * @param [in] fmt Format string for error message prefix | |
7940 * @param [in] ... printf(3) style parameters | |
7941 * | |
7942 * Format a message and prepend it to the current message for @a code. The | |
7943 * prefix will be separated from the old message with a colon and space. | |
7944 */ | |
7945 void KRB5_CALLCONV_C | |
7946 krb5_prepend_error_message(krb5_context ctx, krb5_error_code code, | |
7947 const char *fmt, ...) | |
7948 #if !defined(__cplusplus) && (__GNUC__ > 2) | |
7949 __attribute__((__format__(__printf__, 3, 4))) | |
7950 #endif | |
7951 ; | |
7952 | |
7953 /** | |
7954 * Add a prefix to the message for an error code using a va_list. | |
7955 * | |
7956 * @param [in] ctx Library context | |
7957 * @param [in] code Error code | |
7958 * @param [in] fmt Format string for error message prefix | |
7959 * @param [in] args List of vprintf(3) style arguments | |
7960 * | |
7961 * This function is similar to krb5_prepend_error_message(), but uses a | |
7962 * va_list instead of variadic arguments. | |
7963 */ | |
7964 void KRB5_CALLCONV | |
7965 krb5_vprepend_error_message(krb5_context ctx, krb5_error_code code, | |
7966 const char *fmt, va_list args) | |
7967 #if !defined(__cplusplus) && (__GNUC__ > 2) | |
7968 __attribute__((__format__(__printf__, 3, 0))) | |
7969 #endif | |
7970 ; | |
7971 | |
7972 /** | |
7973 * Add a prefix to a different error code's message. | |
7974 * | |
7975 * @param [in] ctx Library context | |
7976 * @param [in] old_code Previous error code | |
7977 * @param [in] code Error code | |
7978 * @param [in] fmt Format string for error message prefix | |
7979 * @param [in] ... printf(3) style parameters | |
7980 * | |
7981 * Format a message and prepend it to the message for @a old_code. The prefix | |
7982 * will be separated from the old message with a colon and space. Set the | |
7983 * resulting message as the extended error message for @a code. | |
7984 */ | |
7985 void KRB5_CALLCONV_C | |
7986 krb5_wrap_error_message(krb5_context ctx, krb5_error_code old_code, | |
7987 krb5_error_code code, const char *fmt, ...) | |
7988 #if !defined(__cplusplus) && (__GNUC__ > 2) | |
7989 __attribute__((__format__(__printf__, 4, 5))) | |
7990 #endif | |
7991 ; | |
7992 | |
7993 /** | |
7994 * Add a prefix to a different error code's message using a va_list. | |
7995 * | |
7996 * @param [in] ctx Library context | |
7997 * @param [in] old_code Previous error code | |
7998 * @param [in] code Error code | |
7999 * @param [in] fmt Format string for error message prefix | |
8000 * @param [in] args List of vprintf(3) style arguments | |
8001 * | |
8002 * This function is similar to krb5_wrap_error_message(), but uses a | |
8003 * va_list instead of variadic arguments. | |
8004 */ | |
8005 void KRB5_CALLCONV | |
8006 krb5_vwrap_error_message(krb5_context ctx, krb5_error_code old_code, | |
8007 krb5_error_code code, const char *fmt, va_list args) | |
8008 #if !defined(__cplusplus) && (__GNUC__ > 2) | |
8009 __attribute__((__format__(__printf__, 4, 0))) | |
8010 #endif | |
8011 ; | |
8012 | |
8013 /** | |
8014 * Copy the most recent extended error message from one context to another. | |
8015 * | |
8016 * @param [in] dest_ctx Library context to copy message to | |
8017 * @param [in] src_ctx Library context with current message | |
8018 */ | |
8019 void KRB5_CALLCONV | |
8020 krb5_copy_error_message(krb5_context dest_ctx, krb5_context src_ctx); | |
8021 | |
8022 /** | |
8023 * Get the (possibly extended) error message for a code. | |
8024 * | |
8025 * @param [in] ctx Library context | |
8026 * @param [in] code Error code | |
8027 * | |
8028 * The behavior of krb5_get_error_message() is only defined the first time it | |
8029 * is called after a failed call to a krb5 function using the same context, and | |
8030 * only when the error code passed in is the same as that returned by the krb5 | |
8031 * function. | |
8032 * | |
8033 * This function never returns NULL, so its result may be used unconditionally | |
8034 * as a C string. | |
8035 * | |
8036 * The string returned by this function must be freed using | |
8037 * krb5_free_error_message() | |
8038 * | |
8039 * @note Future versions may return the same string for the second | |
8040 * and following calls. | |
8041 */ | |
8042 const char * KRB5_CALLCONV | |
8043 krb5_get_error_message(krb5_context ctx, krb5_error_code code); | |
8044 | |
8045 /** | |
8046 * Free an error message generated by krb5_get_error_message(). | |
8047 * | |
8048 * @param [in] ctx Library context | |
8049 * @param [in] msg Pointer to error message | |
8050 */ | |
8051 void KRB5_CALLCONV | |
8052 krb5_free_error_message(krb5_context ctx, const char *msg); | |
8053 | |
8054 /** | |
8055 * Clear the extended error message in a context. | |
8056 * | |
8057 * @param [in] ctx Library context | |
8058 * | |
8059 * This function unsets the extended error message in a context, to ensure that | |
8060 * it is not mistakenly applied to another occurrence of the same error code. | |
8061 */ | |
8062 void KRB5_CALLCONV | |
8063 krb5_clear_error_message(krb5_context ctx); | |
8064 | |
8065 /** | |
8066 * Unwrap authorization data. | |
8067 * | |
8068 * @param [in] context Library context | |
8069 * @param [in] type @ref KRB5_AUTHDATA type of @a container | |
8070 * @param [in] container Authorization data to be decoded | |
8071 * @param [out] authdata List of decoded authorization data | |
8072 * | |
8073 * @sa krb5_encode_authdata_container() | |
8074 * | |
8075 * @retval 0 Success; otherwise - Kerberos error codes | |
8076 */ | |
8077 krb5_error_code KRB5_CALLCONV | |
8078 krb5_decode_authdata_container(krb5_context context, | |
8079 krb5_authdatatype type, | |
8080 const krb5_authdata *container, | |
8081 krb5_authdata ***authdata); | |
8082 /** | |
8083 * Wrap authorization data in a container. | |
8084 * | |
8085 * @param [in] context Library context | |
8086 * @param [in] type @ref KRB5_AUTHDATA type of @a container | |
8087 * @param [in] authdata List of authorization data to be encoded | |
8088 * @param [out] container List of encoded authorization data | |
8089 * | |
8090 * The result is returned in @a container as a single-element list. | |
8091 * | |
8092 * @sa krb5_decode_authdata_container() | |
8093 * | |
8094 * @retval 0 Success; otherwise - Kerberos error codes | |
8095 */ | |
8096 krb5_error_code KRB5_CALLCONV | |
8097 krb5_encode_authdata_container(krb5_context context, | |
8098 krb5_authdatatype type, | |
8099 krb5_authdata * const*authdata, | |
8100 krb5_authdata ***container); | |
8101 | |
8102 /* | |
8103 * AD-KDCIssued | |
8104 */ | |
8105 /** | |
8106 * Encode and sign AD-KDCIssued authorization data. | |
8107 * | |
8108 * @param [in] context Library context | |
8109 * @param [in] key Session key | |
8110 * @param [in] issuer The name of the issuing principal | |
8111 * @param [in] authdata List of authorization data to be signed | |
8112 * @param [out] ad_kdcissued List containing AD-KDCIssued authdata | |
8113 * | |
8114 * This function wraps a list of authorization data entries @a authdata in an | |
8115 * AD-KDCIssued container (see RFC 4120 section 5.2.6.2) signed with @a key. | |
8116 * The result is returned in @a ad_kdcissued as a single-element list. | |
8117 */ | |
8118 krb5_error_code KRB5_CALLCONV | |
8119 krb5_make_authdata_kdc_issued(krb5_context context, | |
8120 const krb5_keyblock *key, | |
8121 krb5_const_principal issuer, | |
8122 krb5_authdata *const *authdata, | |
8123 krb5_authdata ***ad_kdcissued); | |
8124 | |
8125 /** | |
8126 * Unwrap and verify AD-KDCIssued authorization data. | |
8127 * | |
8128 * @param [in] context Library context | |
8129 * @param [in] key Session key | |
8130 * @param [in] ad_kdcissued AD-KDCIssued authorization data to be unwrapped | |
8131 * @param [out] issuer Name of issuing principal (or NULL) | |
8132 * @param [out] authdata Unwrapped list of authorization data | |
8133 * | |
8134 * This function unwraps an AD-KDCIssued authdatum (see RFC 4120 section | |
8135 * 5.2.6.2) and verifies its signature against @a key. The issuer field of the | |
8136 * authdatum element is returned in @a issuer, and the unwrapped list of | |
8137 * authdata is returned in @a authdata. | |
8138 */ | |
8139 krb5_error_code KRB5_CALLCONV | |
8140 krb5_verify_authdata_kdc_issued(krb5_context context, | |
8141 const krb5_keyblock *key, | |
8142 const krb5_authdata *ad_kdcissued, | |
8143 krb5_principal *issuer, | |
8144 krb5_authdata ***authdata); | |
8145 | |
8146 /* | |
8147 * Windows PAC | |
8148 */ | |
8149 | |
8150 /* Microsoft defined types of data */ | |
8151 #define KRB5_PAC_LOGON_INFO 1 /**< Logon information */ | |
8152 #define KRB5_PAC_CREDENTIALS_INFO 2 /**< Credentials information */ | |
8153 #define KRB5_PAC_SERVER_CHECKSUM 6 /**< Server checksum */ | |
8154 #define KRB5_PAC_PRIVSVR_CHECKSUM 7 /**< KDC checksum */ | |
8155 #define KRB5_PAC_CLIENT_INFO 10 /**< Client name and ticket info */ | |
8156 #define KRB5_PAC_DELEGATION_INFO 11 /**< Constrained delegation info */ | |
8157 #define KRB5_PAC_UPN_DNS_INFO 12 /**< User principal name and DNS info */ | |
8158 #define KRB5_PAC_CLIENT_CLAIMS 13 /**< Client claims information */ | |
8159 #define KRB5_PAC_DEVICE_INFO 14 /**< Device information */ | |
8160 #define KRB5_PAC_DEVICE_CLAIMS 15 /**< Device claims information */ | |
8161 #define KRB5_PAC_TICKET_CHECKSUM 16 /**< Ticket checksum */ | |
8162 #define KRB5_PAC_ATTRIBUTES_INFO 17 /**< PAC attributes */ | |
8163 #define KRB5_PAC_REQUESTOR 18 /**< PAC requestor SID */ | |
8164 | |
8165 struct krb5_pac_data; | |
8166 /** PAC data structure to convey authorization information */ | |
8167 typedef struct krb5_pac_data *krb5_pac; | |
8168 | |
8169 /** | |
8170 * Add a buffer to a PAC handle. | |
8171 * | |
8172 * @param [in] context Library context | |
8173 * @param [in] pac PAC handle | |
8174 * @param [in] type Buffer type | |
8175 * @param [in] data contents | |
8176 * | |
8177 * This function adds a buffer of type @a type and contents @a data to @a pac | |
8178 * if there isn't already a buffer of this type present. | |
8179 * | |
8180 * The valid values of @a type is one of the following: | |
8181 * @li #KRB5_PAC_LOGON_INFO - Logon information | |
8182 * @li #KRB5_PAC_CREDENTIALS_INFO - Credentials information | |
8183 * @li #KRB5_PAC_SERVER_CHECKSUM - Server checksum | |
8184 * @li #KRB5_PAC_PRIVSVR_CHECKSUM - KDC checksum | |
8185 * @li #KRB5_PAC_CLIENT_INFO - Client name and ticket information | |
8186 * @li #KRB5_PAC_DELEGATION_INFO - Constrained delegation information | |
8187 * @li #KRB5_PAC_UPN_DNS_INFO - User principal name and DNS information | |
8188 * | |
8189 * @retval 0 Success; otherwise - Kerberos error codes | |
8190 */ | |
8191 krb5_error_code KRB5_CALLCONV | |
8192 krb5_pac_add_buffer(krb5_context context, krb5_pac pac, krb5_ui_4 type, | |
8193 const krb5_data *data); | |
8194 | |
8195 /** | |
8196 * Free a PAC handle. | |
8197 * | |
8198 * @param [in] context Library context | |
8199 * @param [in] pac PAC to be freed | |
8200 * | |
8201 * This function frees the contents of @a pac and the structure itself. | |
8202 */ | |
8203 void KRB5_CALLCONV | |
8204 krb5_pac_free(krb5_context context, krb5_pac pac); | |
8205 | |
8206 /** | |
8207 * Retrieve a buffer value from a PAC. | |
8208 * | |
8209 * @param [in] context Library context | |
8210 * @param [in] pac PAC handle | |
8211 * @param [in] type Type of buffer to retrieve | |
8212 * @param [out] data Buffer value | |
8213 * | |
8214 * Use krb5_free_data_contents() to free @a data when it is no longer needed. | |
8215 * | |
8216 * @retval 0 Success; otherwise - Kerberos error codes | |
8217 */ | |
8218 krb5_error_code KRB5_CALLCONV | |
8219 krb5_pac_get_buffer(krb5_context context, krb5_pac pac, krb5_ui_4 type, | |
8220 krb5_data *data); | |
8221 | |
8222 /** | |
8223 * Return an array of buffer types in a PAC handle. | |
8224 * | |
8225 * @param [in] context Library context | |
8226 * @param [in] pac PAC handle | |
8227 * @param [out] len Number of entries in @a types | |
8228 * @param [out] types Array of buffer types | |
8229 * | |
8230 * @retval 0 Success; otherwise - Kerberos error codes | |
8231 */ | |
8232 krb5_error_code KRB5_CALLCONV | |
8233 krb5_pac_get_types(krb5_context context, krb5_pac pac, size_t *len, | |
8234 krb5_ui_4 **types); | |
8235 | |
8236 /** | |
8237 * Create an empty Privilege Attribute Certificate (PAC) handle. | |
8238 * | |
8239 * @param [in] context Library context | |
8240 * @param [out] pac New PAC handle | |
8241 * | |
8242 * Use krb5_pac_free() to free @a pac when it is no longer needed. | |
8243 * | |
8244 * @retval 0 Success; otherwise - Kerberos error codes | |
8245 */ | |
8246 krb5_error_code KRB5_CALLCONV | |
8247 krb5_pac_init(krb5_context context, krb5_pac *pac); | |
8248 | |
8249 /** | |
8250 * Unparse an encoded PAC into a new handle. | |
8251 * | |
8252 * @param [in] context Library context | |
8253 * @param [in] ptr PAC buffer | |
8254 * @param [in] len Length of @a ptr | |
8255 * @param [out] pac PAC handle | |
8256 * | |
8257 * Use krb5_pac_free() to free @a pac when it is no longer needed. | |
8258 * | |
8259 * @retval 0 Success; otherwise - Kerberos error codes | |
8260 */ | |
8261 krb5_error_code KRB5_CALLCONV | |
8262 krb5_pac_parse(krb5_context context, const void *ptr, size_t len, | |
8263 krb5_pac *pac); | |
8264 | |
8265 /** | |
8266 * Verify a PAC. | |
8267 * | |
8268 * @param [in] context Library context | |
8269 * @param [in] pac PAC handle | |
8270 * @param [in] authtime Expected timestamp | |
8271 * @param [in] principal Expected principal name (or NULL) | |
8272 * @param [in] server Key to validate server checksum (or NULL) | |
8273 * @param [in] privsvr Key to validate KDC checksum (or NULL) | |
8274 * | |
8275 * This function validates @a pac against the supplied @a server, @a privsvr, | |
8276 * @a principal and @a authtime. If @a principal is NULL, the principal and | |
8277 * authtime are not verified. If @a server or @a privsvr is NULL, the | |
8278 * corresponding checksum is not verified. | |
8279 * | |
8280 * If successful, @a pac is marked as verified. | |
8281 * | |
8282 * @note A checksum mismatch can occur if the PAC was copied from a cross-realm | |
8283 * TGT by an ignorant KDC; also macOS Server Open Directory (as of 10.6) | |
8284 * generates PACs with no server checksum at all. One should consider not | |
8285 * failing the whole authentication because of this reason, but, instead, | |
8286 * treating the ticket as if it did not contain a PAC or marking the PAC | |
8287 * information as non-verified. | |
8288 * | |
8289 * @retval 0 Success; otherwise - Kerberos error codes | |
8290 */ | |
8291 krb5_error_code KRB5_CALLCONV | |
8292 krb5_pac_verify(krb5_context context, const krb5_pac pac, | |
8293 krb5_timestamp authtime, krb5_const_principal principal, | |
8294 const krb5_keyblock *server, const krb5_keyblock *privsvr); | |
8295 | |
8296 /** | |
8297 * Verify a PAC, possibly from a specified realm. | |
8298 * | |
8299 * @param [in] context Library context | |
8300 * @param [in] pac PAC handle | |
8301 * @param [in] authtime Expected timestamp | |
8302 * @param [in] principal Expected principal name (or NULL) | |
8303 * @param [in] server Key to validate server checksum (or NULL) | |
8304 * @param [in] privsvr Key to validate KDC checksum (or NULL) | |
8305 * @param [in] with_realm If true, expect the realm of @a principal | |
8306 * | |
8307 * This function is similar to krb5_pac_verify(), but adds a parameter | |
8308 * @a with_realm. If @a with_realm is true, the PAC_CLIENT_INFO field is | |
8309 * expected to include the realm of @a principal as well as the name. This | |
8310 * flag is necessary to verify PACs in cross-realm S4U2Self referral TGTs. | |
8311 * | |
8312 * @version New in 1.17 | |
8313 */ | |
8314 krb5_error_code KRB5_CALLCONV | |
8315 krb5_pac_verify_ext(krb5_context context, const krb5_pac pac, | |
8316 krb5_timestamp authtime, krb5_const_principal principal, | |
8317 const krb5_keyblock *server, const krb5_keyblock *privsvr, | |
8318 krb5_boolean with_realm); | |
8319 | |
8320 /** | |
8321 * Verify a PAC, possibly including ticket signature | |
8322 * | |
8323 * @param [in] context Library context | |
8324 * @param [in] enc_tkt Ticket enc-part, possibly containing a PAC | |
8325 * @param [in] server_princ Canonicalized name of ticket server | |
8326 * @param [in] server Key to validate server checksum (or NULL) | |
8327 * @param [in] privsvr Key to validate KDC checksum (or NULL) | |
8328 * @param [out] pac_out Verified PAC (NULL if no PAC included) | |
8329 * | |
8330 * If a PAC is present in @a enc_tkt, verify its signatures. If @a privsvr is | |
8331 * not NULL and @a server_princ is not a krbtgt or kadmin/changepw service, | |
8332 * require a ticket signature over @a enc_tkt in addition to the KDC signature. | |
8333 * Place the verified PAC in @a pac_out. If an invalid PAC signature is found, | |
8334 * return an error matching the Windows KDC protocol code for that condition as | |
8335 * closely as possible. | |
8336 * | |
8337 * If no PAC is present in @a enc_tkt, set @a pac_out to NULL and return | |
8338 * successfully. | |
8339 * | |
8340 * @note This function does not validate the PAC_CLIENT_INFO buffer. If a | |
8341 * specific value is expected, the caller can make a separate call to | |
8342 * krb5_pac_verify_ext() with a principal but no keys. | |
8343 * | |
8344 * @retval 0 Success; otherwise - Kerberos error codes | |
8345 * | |
8346 * @version New in 1.20 | |
8347 */ | |
8348 krb5_error_code KRB5_CALLCONV | |
8349 krb5_kdc_verify_ticket(krb5_context context, const krb5_enc_tkt_part *enc_tkt, | |
8350 krb5_const_principal server_princ, | |
8351 const krb5_keyblock *server, | |
8352 const krb5_keyblock *privsvr, krb5_pac *pac_out); | |
8353 | |
8354 /** @deprecated Use krb5_kdc_sign_ticket() instead. */ | |
8355 krb5_error_code KRB5_CALLCONV | |
8356 krb5_pac_sign(krb5_context context, krb5_pac pac, krb5_timestamp authtime, | |
8357 krb5_const_principal principal, const krb5_keyblock *server_key, | |
8358 const krb5_keyblock *privsvr_key, krb5_data *data); | |
8359 | |
8360 /** @deprecated Use krb5_kdc_sign_ticket() instead. */ | |
8361 krb5_error_code KRB5_CALLCONV | |
8362 krb5_pac_sign_ext(krb5_context context, krb5_pac pac, krb5_timestamp authtime, | |
8363 krb5_const_principal principal, | |
8364 const krb5_keyblock *server_key, | |
8365 const krb5_keyblock *privsvr_key, krb5_boolean with_realm, | |
8366 krb5_data *data); | |
8367 | |
8368 /** | |
8369 * Sign a PAC, possibly including a ticket signature | |
8370 * | |
8371 * @param [in] context Library context | |
8372 * @param [in] enc_tkt The ticket for the signature | |
8373 * @param [in] pac PAC handle | |
8374 * @param [in] server_princ Canonical ticket server name | |
8375 * @param [in] client_princ PAC_CLIENT_INFO principal (or NULL) | |
8376 * @param [in] server Key for server checksum | |
8377 * @param [in] privsvr Key for KDC and ticket checksum | |
8378 * @param [in] with_realm If true, include the realm of @a principal | |
8379 * | |
8380 * Sign @a pac using the keys @a server and @a privsvr. Include a ticket | |
8381 * signature over @a enc_tkt if @a server_princ is not a TGS or kadmin/changepw | |
8382 * principal name. Add the signed PAC's encoding to the authorization data of | |
8383 * @a enc_tkt in the first slot, wrapped in an AD-IF-RELEVANT container. If @a | |
8384 * client_princ is non-null, add a PAC_CLIENT_INFO buffer, including the realm | |
8385 * if @a with_realm is true. | |
8386 * | |
8387 * @retval 0 on success, otherwise - Kerberos error codes | |
8388 * | |
8389 * @version New in 1.20 | |
8390 */ | |
8391 krb5_error_code KRB5_CALLCONV | |
8392 krb5_kdc_sign_ticket(krb5_context context, krb5_enc_tkt_part *enc_tkt, | |
8393 const krb5_pac pac, krb5_const_principal server_princ, | |
8394 krb5_const_principal client_princ, | |
8395 const krb5_keyblock *server, const krb5_keyblock *privsvr, | |
8396 krb5_boolean with_realm); | |
8397 | |
8398 /** | |
8399 * Read client information from a PAC. | |
8400 * | |
8401 * @param [in] context Library context | |
8402 * @param [in] pac PAC handle | |
8403 * @param [out] authtime_out Authentication timestamp (NULL if not needed) | |
8404 * @param [out] princname_out Client account name | |
8405 * | |
8406 * Read the PAC_CLIENT_INFO buffer in @a pac. Place the client account name as | |
8407 * a string in @a princname_out. If @a authtime_out is not NULL, place the | |
8408 * initial authentication timestamp in @a authtime_out. | |
8409 * | |
8410 * @retval 0 on success, ENOENT if no PAC_CLIENT_INFO buffer is present in @a | |
8411 * pac, ERANGE if the buffer contains invalid lengths. | |
8412 * | |
8413 * @version New in 1.18 | |
8414 */ | |
8415 krb5_error_code KRB5_CALLCONV | |
8416 krb5_pac_get_client_info(krb5_context context, const krb5_pac pac, | |
8417 krb5_timestamp *authtime_out, char **princname_out); | |
8418 | |
8419 /** | |
8420 * Allow the application to override the profile's allow_weak_crypto setting. | |
8421 * | |
8422 * @param [in] context Library context | |
8423 * @param [in] enable Boolean flag | |
8424 * | |
8425 * This function allows an application to override the allow_weak_crypto | |
8426 * setting. It is primarily for use by aklog. | |
8427 * | |
8428 * @retval 0 (always) | |
8429 */ | |
8430 krb5_error_code KRB5_CALLCONV | |
8431 krb5_allow_weak_crypto(krb5_context context, krb5_boolean enable); | |
8432 | |
8433 /** | |
8434 * A wrapper for passing information to a @c krb5_trace_callback. | |
8435 * | |
8436 * Currently, it only contains the formatted message as determined | |
8437 * the the format string and arguments of the tracing macro, but it | |
8438 * may be extended to contain more fields in the future. | |
8439 */ | |
8440 typedef struct _krb5_trace_info { | |
8441 const char *message; | |
8442 } krb5_trace_info; | |
8443 | |
8444 typedef void | |
8445 (KRB5_CALLCONV *krb5_trace_callback)(krb5_context context, | |
8446 const krb5_trace_info *info, | |
8447 void *cb_data); | |
8448 | |
8449 /** | |
8450 * Specify a callback function for trace events. | |
8451 * | |
8452 * @param [in] context Library context | |
8453 * @param [in] fn Callback function | |
8454 * @param [in] cb_data Callback data | |
8455 * | |
8456 * Specify a callback for trace events occurring in krb5 operations performed | |
8457 * within @a context. @a fn will be invoked with @a context as the first | |
8458 * argument, @a cb_data as the last argument, and a pointer to a | |
8459 * krb5_trace_info as the second argument. If the trace callback is reset via | |
8460 * this function or @a context is destroyed, @a fn will be invoked with a NULL | |
8461 * second argument so it can clean up @a cb_data. Supply a NULL value for @a | |
8462 * fn to disable trace callbacks within @a context. | |
8463 * | |
8464 * @note This function overrides the information passed through the | |
8465 * @a KRB5_TRACE environment variable. | |
8466 * | |
8467 * @version New in 1.9 | |
8468 * | |
8469 * @return Returns KRB5_TRACE_NOSUPP if tracing is not supported in the library | |
8470 * (unless @a fn is NULL). | |
8471 */ | |
8472 krb5_error_code KRB5_CALLCONV | |
8473 krb5_set_trace_callback(krb5_context context, krb5_trace_callback fn, | |
8474 void *cb_data); | |
8475 | |
8476 /** | |
8477 * Specify a file name for directing trace events. | |
8478 * | |
8479 * @param [in] context Library context | |
8480 * @param [in] filename File name | |
8481 * | |
8482 * Open @a filename for appending (creating it, if necessary) and set up a | |
8483 * callback to write trace events to it. | |
8484 * | |
8485 * @note This function overrides the information passed through the | |
8486 * @a KRB5_TRACE environment variable. | |
8487 * | |
8488 * @version New in 1.9 | |
8489 * | |
8490 * @retval KRB5_TRACE_NOSUPP Tracing is not supported in the library. | |
8491 */ | |
8492 krb5_error_code KRB5_CALLCONV | |
8493 krb5_set_trace_filename(krb5_context context, const char *filename); | |
8494 | |
8495 | |
8496 /** | |
8497 * Hook function for inspecting or modifying messages sent to KDCs. | |
8498 * | |
8499 * @param [in] context Library context | |
8500 * @param [in] data Callback data | |
8501 * @param [in] realm The realm the message will be sent to | |
8502 * @param [in] message The original message to be sent to the KDC | |
8503 * @param [out] new_message_out Optional replacement message to be sent | |
8504 * @param [out] new_reply_out Optional synthetic reply | |
8505 * | |
8506 * If the hook function returns an error code, the KDC communication will be | |
8507 * aborted and the error code will be returned to the library operation which | |
8508 * initiated the communication. | |
8509 * | |
8510 * If the hook function sets @a new_reply_out, @a message will not be sent to | |
8511 * the KDC, and the given reply will used instead. | |
8512 * | |
8513 * If the hook function sets @a new_message_out, the given message will be sent | |
8514 * to the KDC in place of @a message. | |
8515 * | |
8516 * If the hook function returns successfully without setting either output, | |
8517 * @a message will be sent to the KDC normally. | |
8518 * | |
8519 * The hook function should use krb5_copy_data() to construct the value for | |
8520 * @a new_message_out or @a reply_out, to ensure that it can be freed correctly | |
8521 * by the library. | |
8522 * | |
8523 * @version New in 1.15 | |
8524 * | |
8525 * @retval 0 Success | |
8526 * @return A Kerberos error code | |
8527 */ | |
8528 typedef krb5_error_code | |
8529 (KRB5_CALLCONV *krb5_pre_send_fn)(krb5_context context, void *data, | |
8530 const krb5_data *realm, | |
8531 const krb5_data *message, | |
8532 krb5_data **new_message_out, | |
8533 krb5_data **new_reply_out); | |
8534 | |
8535 /** | |
8536 * Hook function for inspecting or overriding KDC replies. | |
8537 * | |
8538 * @param [in] context Library context | |
8539 * @param [in] data Callback data | |
8540 * @param [in] code Status of KDC communication | |
8541 * @param [in] realm The realm the reply was received from | |
8542 * @param [in] message The message sent to the realm's KDC | |
8543 * @param [in] reply The reply received from the KDC | |
8544 * @param [out] new_reply_out Optional replacement reply | |
8545 * | |
8546 * If @a code is zero, @a reply contains the reply received from the KDC. The | |
8547 * hook function may return an error code to simulate an error, may synthesize | |
8548 * a different reply by setting @a new_reply_out, or may simply return | |
8549 * successfully to do nothing. | |
8550 * | |
8551 * If @a code is non-zero, KDC communication failed and @a reply should be | |
8552 * ignored. The hook function may return @a code or a different error code, or | |
8553 * may synthesize a reply by setting @a new_reply_out and return successfully. | |
8554 * | |
8555 * The hook function should use krb5_copy_data() to construct the value for | |
8556 * @a new_reply_out, to ensure that it can be freed correctly by the library. | |
8557 * | |
8558 * @version New in 1.15 | |
8559 * | |
8560 * @retval 0 Success | |
8561 * @return A Kerberos error code | |
8562 */ | |
8563 typedef krb5_error_code | |
8564 (KRB5_CALLCONV *krb5_post_recv_fn)(krb5_context context, void *data, | |
8565 krb5_error_code code, | |
8566 const krb5_data *realm, | |
8567 const krb5_data *message, | |
8568 const krb5_data *reply, | |
8569 krb5_data **new_reply_out); | |
8570 | |
8571 /** | |
8572 * Set a KDC pre-send hook function. | |
8573 * | |
8574 * @param [in] context Library context | |
8575 * @param [in] send_hook Hook function (or NULL to disable the hook) | |
8576 * @param [in] data Callback data to be passed to @a send_hook | |
8577 * | |
8578 * @a send_hook will be called before messages are sent to KDCs by library | |
8579 * functions such as krb5_get_credentials(). The hook function may inspect, | |
8580 * override, or synthesize its own reply to the message. | |
8581 * | |
8582 * @version New in 1.15 | |
8583 */ | |
8584 void KRB5_CALLCONV | |
8585 krb5_set_kdc_send_hook(krb5_context context, krb5_pre_send_fn send_hook, | |
8586 void *data); | |
8587 | |
8588 /** | |
8589 * Set a KDC post-receive hook function. | |
8590 * | |
8591 * @param [in] context The library context. | |
8592 * @param [in] recv_hook Hook function (or NULL to disable the hook) | |
8593 * @param [in] data Callback data to be passed to @a recv_hook | |
8594 * | |
8595 * @a recv_hook will be called after a reply is received from a KDC during a | |
8596 * call to a library function such as krb5_get_credentials(). The hook | |
8597 * function may inspect or override the reply. This hook will not be executed | |
8598 * if the pre-send hook returns a synthetic reply. | |
8599 * | |
8600 * @version New in 1.15 | |
8601 */ | |
8602 void KRB5_CALLCONV | |
8603 krb5_set_kdc_recv_hook(krb5_context context, krb5_post_recv_fn recv_hook, | |
8604 void *data); | |
8605 | |
8606 #if defined(__APPLE__) && (defined(__ppc__) || defined(__ppc64__) || defined(__i386__) || defined(__x86_64__)) | |
8607 #pragma pack(pop) | |
8608 #endif | |
8609 | |
8610 KRB5INT_END_DECLS | |
8611 | |
8612 /* Don't use this! We're going to phase it out. It's just here to keep | |
8613 applications from breaking right away. */ | |
8614 #define krb5_const const | |
8615 | |
8616 #undef KRB5_ATTR_DEPRECATED | |
8617 | |
8618 /** @} */ /* end of KRB5_H group */ | |
8619 | |
8620 #endif /* KRB5_GENERAL__ */ | |
8621 /* | |
8622 * et-h-krb5_err.h: | |
8623 * This file is automatically generated; please do not edit it. | |
8624 */ | |
8625 | |
8626 #include <com_err.h> | |
8627 | |
8628 #define KRB5KDC_ERR_NONE (-1765328384L) | |
8629 #define KRB5KDC_ERR_NAME_EXP (-1765328383L) | |
8630 #define KRB5KDC_ERR_SERVICE_EXP (-1765328382L) | |
8631 #define KRB5KDC_ERR_BAD_PVNO (-1765328381L) | |
8632 #define KRB5KDC_ERR_C_OLD_MAST_KVNO (-1765328380L) | |
8633 #define KRB5KDC_ERR_S_OLD_MAST_KVNO (-1765328379L) | |
8634 #define KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN (-1765328378L) | |
8635 #define KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN (-1765328377L) | |
8636 #define KRB5KDC_ERR_PRINCIPAL_NOT_UNIQUE (-1765328376L) | |
8637 #define KRB5KDC_ERR_NULL_KEY (-1765328375L) | |
8638 #define KRB5KDC_ERR_CANNOT_POSTDATE (-1765328374L) | |
8639 #define KRB5KDC_ERR_NEVER_VALID (-1765328373L) | |
8640 #define KRB5KDC_ERR_POLICY (-1765328372L) | |
8641 #define KRB5KDC_ERR_BADOPTION (-1765328371L) | |
8642 #define KRB5KDC_ERR_ETYPE_NOSUPP (-1765328370L) | |
8643 #define KRB5KDC_ERR_SUMTYPE_NOSUPP (-1765328369L) | |
8644 #define KRB5KDC_ERR_PADATA_TYPE_NOSUPP (-1765328368L) | |
8645 #define KRB5KDC_ERR_TRTYPE_NOSUPP (-1765328367L) | |
8646 #define KRB5KDC_ERR_CLIENT_REVOKED (-1765328366L) | |
8647 #define KRB5KDC_ERR_SERVICE_REVOKED (-1765328365L) | |
8648 #define KRB5KDC_ERR_TGT_REVOKED (-1765328364L) | |
8649 #define KRB5KDC_ERR_CLIENT_NOTYET (-1765328363L) | |
8650 #define KRB5KDC_ERR_SERVICE_NOTYET (-1765328362L) | |
8651 #define KRB5KDC_ERR_KEY_EXP (-1765328361L) | |
8652 #define KRB5KDC_ERR_PREAUTH_FAILED (-1765328360L) | |
8653 #define KRB5KDC_ERR_PREAUTH_REQUIRED (-1765328359L) | |
8654 #define KRB5KDC_ERR_SERVER_NOMATCH (-1765328358L) | |
8655 #define KRB5KDC_ERR_MUST_USE_USER2USER (-1765328357L) | |
8656 #define KRB5KDC_ERR_PATH_NOT_ACCEPTED (-1765328356L) | |
8657 #define KRB5KDC_ERR_SVC_UNAVAILABLE (-1765328355L) | |
8658 #define KRB5PLACEHOLD_30 (-1765328354L) | |
8659 #define KRB5KRB_AP_ERR_BAD_INTEGRITY (-1765328353L) | |
8660 #define KRB5KRB_AP_ERR_TKT_EXPIRED (-1765328352L) | |
8661 #define KRB5KRB_AP_ERR_TKT_NYV (-1765328351L) | |
8662 #define KRB5KRB_AP_ERR_REPEAT (-1765328350L) | |
8663 #define KRB5KRB_AP_ERR_NOT_US (-1765328349L) | |
8664 #define KRB5KRB_AP_ERR_BADMATCH (-1765328348L) | |
8665 #define KRB5KRB_AP_ERR_SKEW (-1765328347L) | |
8666 #define KRB5KRB_AP_ERR_BADADDR (-1765328346L) | |
8667 #define KRB5KRB_AP_ERR_BADVERSION (-1765328345L) | |
8668 #define KRB5KRB_AP_ERR_MSG_TYPE (-1765328344L) | |
8669 #define KRB5KRB_AP_ERR_MODIFIED (-1765328343L) | |
8670 #define KRB5KRB_AP_ERR_BADORDER (-1765328342L) | |
8671 #define KRB5KRB_AP_ERR_ILL_CR_TKT (-1765328341L) | |
8672 #define KRB5KRB_AP_ERR_BADKEYVER (-1765328340L) | |
8673 #define KRB5KRB_AP_ERR_NOKEY (-1765328339L) | |
8674 #define KRB5KRB_AP_ERR_MUT_FAIL (-1765328338L) | |
8675 #define KRB5KRB_AP_ERR_BADDIRECTION (-1765328337L) | |
8676 #define KRB5KRB_AP_ERR_METHOD (-1765328336L) | |
8677 #define KRB5KRB_AP_ERR_BADSEQ (-1765328335L) | |
8678 #define KRB5KRB_AP_ERR_INAPP_CKSUM (-1765328334L) | |
8679 #define KRB5KRB_AP_PATH_NOT_ACCEPTED (-1765328333L) | |
8680 #define KRB5KRB_ERR_RESPONSE_TOO_BIG (-1765328332L) | |
8681 #define KRB5PLACEHOLD_53 (-1765328331L) | |
8682 #define KRB5PLACEHOLD_54 (-1765328330L) | |
8683 #define KRB5PLACEHOLD_55 (-1765328329L) | |
8684 #define KRB5PLACEHOLD_56 (-1765328328L) | |
8685 #define KRB5PLACEHOLD_57 (-1765328327L) | |
8686 #define KRB5PLACEHOLD_58 (-1765328326L) | |
8687 #define KRB5PLACEHOLD_59 (-1765328325L) | |
8688 #define KRB5KRB_ERR_GENERIC (-1765328324L) | |
8689 #define KRB5KRB_ERR_FIELD_TOOLONG (-1765328323L) | |
8690 #define KRB5KDC_ERR_CLIENT_NOT_TRUSTED (-1765328322L) | |
8691 #define KRB5KDC_ERR_KDC_NOT_TRUSTED (-1765328321L) | |
8692 #define KRB5KDC_ERR_INVALID_SIG (-1765328320L) | |
8693 #define KRB5KDC_ERR_DH_KEY_PARAMETERS_NOT_ACCEPTED (-1765328319L) | |
8694 #define KRB5KDC_ERR_CERTIFICATE_MISMATCH (-1765328318L) | |
8695 #define KRB5KRB_AP_ERR_NO_TGT (-1765328317L) | |
8696 #define KRB5KDC_ERR_WRONG_REALM (-1765328316L) | |
8697 #define KRB5KRB_AP_ERR_USER_TO_USER_REQUIRED (-1765328315L) | |
8698 #define KRB5KDC_ERR_CANT_VERIFY_CERTIFICATE (-1765328314L) | |
8699 #define KRB5KDC_ERR_INVALID_CERTIFICATE (-1765328313L) | |
8700 #define KRB5KDC_ERR_REVOKED_CERTIFICATE (-1765328312L) | |
8701 #define KRB5KDC_ERR_REVOCATION_STATUS_UNKNOWN (-1765328311L) | |
8702 #define KRB5KDC_ERR_REVOCATION_STATUS_UNAVAILABLE (-1765328310L) | |
8703 #define KRB5KDC_ERR_CLIENT_NAME_MISMATCH (-1765328309L) | |
8704 #define KRB5KDC_ERR_KDC_NAME_MISMATCH (-1765328308L) | |
8705 #define KRB5KDC_ERR_INCONSISTENT_KEY_PURPOSE (-1765328307L) | |
8706 #define KRB5KDC_ERR_DIGEST_IN_CERT_NOT_ACCEPTED (-1765328306L) | |
8707 #define KRB5KDC_ERR_PA_CHECKSUM_MUST_BE_INCLUDED (-1765328305L) | |
8708 #define KRB5KDC_ERR_DIGEST_IN_SIGNED_DATA_NOT_ACCEPTED (-1765328304L) | |
8709 #define KRB5KDC_ERR_PUBLIC_KEY_ENCRYPTION_NOT_SUPPORTED (-1765328303L) | |
8710 #define KRB5PLACEHOLD_82 (-1765328302L) | |
8711 #define KRB5PLACEHOLD_83 (-1765328301L) | |
8712 #define KRB5PLACEHOLD_84 (-1765328300L) | |
8713 #define KRB5KRB_AP_ERR_IAKERB_KDC_NOT_FOUND (-1765328299L) | |
8714 #define KRB5KRB_AP_ERR_IAKERB_KDC_NO_RESPONSE (-1765328298L) | |
8715 #define KRB5PLACEHOLD_87 (-1765328297L) | |
8716 #define KRB5PLACEHOLD_88 (-1765328296L) | |
8717 #define KRB5PLACEHOLD_89 (-1765328295L) | |
8718 #define KRB5KDC_ERR_PREAUTH_EXPIRED (-1765328294L) | |
8719 #define KRB5KDC_ERR_MORE_PREAUTH_DATA_REQUIRED (-1765328293L) | |
8720 #define KRB5PLACEHOLD_92 (-1765328292L) | |
8721 #define KRB5KDC_ERR_UNKNOWN_CRITICAL_FAST_OPTION (-1765328291L) | |
8722 #define KRB5PLACEHOLD_94 (-1765328290L) | |
8723 #define KRB5PLACEHOLD_95 (-1765328289L) | |
8724 #define KRB5PLACEHOLD_96 (-1765328288L) | |
8725 #define KRB5PLACEHOLD_97 (-1765328287L) | |
8726 #define KRB5PLACEHOLD_98 (-1765328286L) | |
8727 #define KRB5PLACEHOLD_99 (-1765328285L) | |
8728 #define KRB5KDC_ERR_NO_ACCEPTABLE_KDF (-1765328284L) | |
8729 #define KRB5PLACEHOLD_101 (-1765328283L) | |
8730 #define KRB5PLACEHOLD_102 (-1765328282L) | |
8731 #define KRB5PLACEHOLD_103 (-1765328281L) | |
8732 #define KRB5PLACEHOLD_104 (-1765328280L) | |
8733 #define KRB5PLACEHOLD_105 (-1765328279L) | |
8734 #define KRB5PLACEHOLD_106 (-1765328278L) | |
8735 #define KRB5PLACEHOLD_107 (-1765328277L) | |
8736 #define KRB5PLACEHOLD_108 (-1765328276L) | |
8737 #define KRB5PLACEHOLD_109 (-1765328275L) | |
8738 #define KRB5PLACEHOLD_110 (-1765328274L) | |
8739 #define KRB5PLACEHOLD_111 (-1765328273L) | |
8740 #define KRB5PLACEHOLD_112 (-1765328272L) | |
8741 #define KRB5PLACEHOLD_113 (-1765328271L) | |
8742 #define KRB5PLACEHOLD_114 (-1765328270L) | |
8743 #define KRB5PLACEHOLD_115 (-1765328269L) | |
8744 #define KRB5PLACEHOLD_116 (-1765328268L) | |
8745 #define KRB5PLACEHOLD_117 (-1765328267L) | |
8746 #define KRB5PLACEHOLD_118 (-1765328266L) | |
8747 #define KRB5PLACEHOLD_119 (-1765328265L) | |
8748 #define KRB5PLACEHOLD_120 (-1765328264L) | |
8749 #define KRB5PLACEHOLD_121 (-1765328263L) | |
8750 #define KRB5PLACEHOLD_122 (-1765328262L) | |
8751 #define KRB5PLACEHOLD_123 (-1765328261L) | |
8752 #define KRB5PLACEHOLD_124 (-1765328260L) | |
8753 #define KRB5PLACEHOLD_125 (-1765328259L) | |
8754 #define KRB5PLACEHOLD_126 (-1765328258L) | |
8755 #define KRB5PLACEHOLD_127 (-1765328257L) | |
8756 #define KRB5_ERR_RCSID (-1765328256L) | |
8757 #define KRB5_LIBOS_BADLOCKFLAG (-1765328255L) | |
8758 #define KRB5_LIBOS_CANTREADPWD (-1765328254L) | |
8759 #define KRB5_LIBOS_BADPWDMATCH (-1765328253L) | |
8760 #define KRB5_LIBOS_PWDINTR (-1765328252L) | |
8761 #define KRB5_PARSE_ILLCHAR (-1765328251L) | |
8762 #define KRB5_PARSE_MALFORMED (-1765328250L) | |
8763 #define KRB5_CONFIG_CANTOPEN (-1765328249L) | |
8764 #define KRB5_CONFIG_BADFORMAT (-1765328248L) | |
8765 #define KRB5_CONFIG_NOTENUFSPACE (-1765328247L) | |
8766 #define KRB5_BADMSGTYPE (-1765328246L) | |
8767 #define KRB5_CC_BADNAME (-1765328245L) | |
8768 #define KRB5_CC_UNKNOWN_TYPE (-1765328244L) | |
8769 #define KRB5_CC_NOTFOUND (-1765328243L) | |
8770 #define KRB5_CC_END (-1765328242L) | |
8771 #define KRB5_NO_TKT_SUPPLIED (-1765328241L) | |
8772 #define KRB5KRB_AP_WRONG_PRINC (-1765328240L) | |
8773 #define KRB5KRB_AP_ERR_TKT_INVALID (-1765328239L) | |
8774 #define KRB5_PRINC_NOMATCH (-1765328238L) | |
8775 #define KRB5_KDCREP_MODIFIED (-1765328237L) | |
8776 #define KRB5_KDCREP_SKEW (-1765328236L) | |
8777 #define KRB5_IN_TKT_REALM_MISMATCH (-1765328235L) | |
8778 #define KRB5_PROG_ETYPE_NOSUPP (-1765328234L) | |
8779 #define KRB5_PROG_KEYTYPE_NOSUPP (-1765328233L) | |
8780 #define KRB5_WRONG_ETYPE (-1765328232L) | |
8781 #define KRB5_PROG_SUMTYPE_NOSUPP (-1765328231L) | |
8782 #define KRB5_REALM_UNKNOWN (-1765328230L) | |
8783 #define KRB5_SERVICE_UNKNOWN (-1765328229L) | |
8784 #define KRB5_KDC_UNREACH (-1765328228L) | |
8785 #define KRB5_NO_LOCALNAME (-1765328227L) | |
8786 #define KRB5_MUTUAL_FAILED (-1765328226L) | |
8787 #define KRB5_RC_TYPE_EXISTS (-1765328225L) | |
8788 #define KRB5_RC_MALLOC (-1765328224L) | |
8789 #define KRB5_RC_TYPE_NOTFOUND (-1765328223L) | |
8790 #define KRB5_RC_UNKNOWN (-1765328222L) | |
8791 #define KRB5_RC_REPLAY (-1765328221L) | |
8792 #define KRB5_RC_IO (-1765328220L) | |
8793 #define KRB5_RC_NOIO (-1765328219L) | |
8794 #define KRB5_RC_PARSE (-1765328218L) | |
8795 #define KRB5_RC_IO_EOF (-1765328217L) | |
8796 #define KRB5_RC_IO_MALLOC (-1765328216L) | |
8797 #define KRB5_RC_IO_PERM (-1765328215L) | |
8798 #define KRB5_RC_IO_IO (-1765328214L) | |
8799 #define KRB5_RC_IO_UNKNOWN (-1765328213L) | |
8800 #define KRB5_RC_IO_SPACE (-1765328212L) | |
8801 #define KRB5_TRANS_CANTOPEN (-1765328211L) | |
8802 #define KRB5_TRANS_BADFORMAT (-1765328210L) | |
8803 #define KRB5_LNAME_CANTOPEN (-1765328209L) | |
8804 #define KRB5_LNAME_NOTRANS (-1765328208L) | |
8805 #define KRB5_LNAME_BADFORMAT (-1765328207L) | |
8806 #define KRB5_CRYPTO_INTERNAL (-1765328206L) | |
8807 #define KRB5_KT_BADNAME (-1765328205L) | |
8808 #define KRB5_KT_UNKNOWN_TYPE (-1765328204L) | |
8809 #define KRB5_KT_NOTFOUND (-1765328203L) | |
8810 #define KRB5_KT_END (-1765328202L) | |
8811 #define KRB5_KT_NOWRITE (-1765328201L) | |
8812 #define KRB5_KT_IOERR (-1765328200L) | |
8813 #define KRB5_NO_TKT_IN_RLM (-1765328199L) | |
8814 #define KRB5DES_BAD_KEYPAR (-1765328198L) | |
8815 #define KRB5DES_WEAK_KEY (-1765328197L) | |
8816 #define KRB5_BAD_ENCTYPE (-1765328196L) | |
8817 #define KRB5_BAD_KEYSIZE (-1765328195L) | |
8818 #define KRB5_BAD_MSIZE (-1765328194L) | |
8819 #define KRB5_CC_TYPE_EXISTS (-1765328193L) | |
8820 #define KRB5_KT_TYPE_EXISTS (-1765328192L) | |
8821 #define KRB5_CC_IO (-1765328191L) | |
8822 #define KRB5_FCC_PERM (-1765328190L) | |
8823 #define KRB5_FCC_NOFILE (-1765328189L) | |
8824 #define KRB5_FCC_INTERNAL (-1765328188L) | |
8825 #define KRB5_CC_WRITE (-1765328187L) | |
8826 #define KRB5_CC_NOMEM (-1765328186L) | |
8827 #define KRB5_CC_FORMAT (-1765328185L) | |
8828 #define KRB5_CC_NOT_KTYPE (-1765328184L) | |
8829 #define KRB5_INVALID_FLAGS (-1765328183L) | |
8830 #define KRB5_NO_2ND_TKT (-1765328182L) | |
8831 #define KRB5_NOCREDS_SUPPLIED (-1765328181L) | |
8832 #define KRB5_SENDAUTH_BADAUTHVERS (-1765328180L) | |
8833 #define KRB5_SENDAUTH_BADAPPLVERS (-1765328179L) | |
8834 #define KRB5_SENDAUTH_BADRESPONSE (-1765328178L) | |
8835 #define KRB5_SENDAUTH_REJECTED (-1765328177L) | |
8836 #define KRB5_PREAUTH_BAD_TYPE (-1765328176L) | |
8837 #define KRB5_PREAUTH_NO_KEY (-1765328175L) | |
8838 #define KRB5_PREAUTH_FAILED (-1765328174L) | |
8839 #define KRB5_RCACHE_BADVNO (-1765328173L) | |
8840 #define KRB5_CCACHE_BADVNO (-1765328172L) | |
8841 #define KRB5_KEYTAB_BADVNO (-1765328171L) | |
8842 #define KRB5_PROG_ATYPE_NOSUPP (-1765328170L) | |
8843 #define KRB5_RC_REQUIRED (-1765328169L) | |
8844 #define KRB5_ERR_BAD_HOSTNAME (-1765328168L) | |
8845 #define KRB5_ERR_HOST_REALM_UNKNOWN (-1765328167L) | |
8846 #define KRB5_SNAME_UNSUPP_NAMETYPE (-1765328166L) | |
8847 #define KRB5KRB_AP_ERR_V4_REPLY (-1765328165L) | |
8848 #define KRB5_REALM_CANT_RESOLVE (-1765328164L) | |
8849 #define KRB5_TKT_NOT_FORWARDABLE (-1765328163L) | |
8850 #define KRB5_FWD_BAD_PRINCIPAL (-1765328162L) | |
8851 #define KRB5_GET_IN_TKT_LOOP (-1765328161L) | |
8852 #define KRB5_CONFIG_NODEFREALM (-1765328160L) | |
8853 #define KRB5_SAM_UNSUPPORTED (-1765328159L) | |
8854 #define KRB5_SAM_INVALID_ETYPE (-1765328158L) | |
8855 #define KRB5_SAM_NO_CHECKSUM (-1765328157L) | |
8856 #define KRB5_SAM_BAD_CHECKSUM (-1765328156L) | |
8857 #define KRB5_KT_NAME_TOOLONG (-1765328155L) | |
8858 #define KRB5_KT_KVNONOTFOUND (-1765328154L) | |
8859 #define KRB5_APPL_EXPIRED (-1765328153L) | |
8860 #define KRB5_LIB_EXPIRED (-1765328152L) | |
8861 #define KRB5_CHPW_PWDNULL (-1765328151L) | |
8862 #define KRB5_CHPW_FAIL (-1765328150L) | |
8863 #define KRB5_KT_FORMAT (-1765328149L) | |
8864 #define KRB5_NOPERM_ETYPE (-1765328148L) | |
8865 #define KRB5_CONFIG_ETYPE_NOSUPP (-1765328147L) | |
8866 #define KRB5_OBSOLETE_FN (-1765328146L) | |
8867 #define KRB5_EAI_FAIL (-1765328145L) | |
8868 #define KRB5_EAI_NODATA (-1765328144L) | |
8869 #define KRB5_EAI_NONAME (-1765328143L) | |
8870 #define KRB5_EAI_SERVICE (-1765328142L) | |
8871 #define KRB5_ERR_NUMERIC_REALM (-1765328141L) | |
8872 #define KRB5_ERR_BAD_S2K_PARAMS (-1765328140L) | |
8873 #define KRB5_ERR_NO_SERVICE (-1765328139L) | |
8874 #define KRB5_CC_READONLY (-1765328138L) | |
8875 #define KRB5_CC_NOSUPP (-1765328137L) | |
8876 #define KRB5_DELTAT_BADFORMAT (-1765328136L) | |
8877 #define KRB5_PLUGIN_NO_HANDLE (-1765328135L) | |
8878 #define KRB5_PLUGIN_OP_NOTSUPP (-1765328134L) | |
8879 #define KRB5_ERR_INVALID_UTF8 (-1765328133L) | |
8880 #define KRB5_ERR_FAST_REQUIRED (-1765328132L) | |
8881 #define KRB5_LOCAL_ADDR_REQUIRED (-1765328131L) | |
8882 #define KRB5_REMOTE_ADDR_REQUIRED (-1765328130L) | |
8883 #define KRB5_TRACE_NOSUPP (-1765328129L) | |
8884 #define ERROR_TABLE_BASE_krb5 (-1765328384L) | |
8885 | |
8886 extern const struct error_table et_krb5_error_table; | |
8887 | |
8888 #if !defined(_WIN32) | |
8889 /* for compatibility with older versions... */ | |
8890 extern void initialize_krb5_error_table (void) /*@modifies internalState@*/; | |
8891 #else | |
8892 #define initialize_krb5_error_table() | |
8893 #endif | |
8894 | |
8895 #if !defined(_WIN32) | |
8896 #define init_krb5_err_tbl initialize_krb5_error_table | |
8897 #define krb5_err_base ERROR_TABLE_BASE_krb5 | |
8898 #endif | |
8899 /* | |
8900 * et-h-k5e1_err.h: | |
8901 * This file is automatically generated; please do not edit it. | |
8902 */ | |
8903 | |
8904 #include <com_err.h> | |
8905 | |
8906 #define KRB5_PLUGIN_VER_NOTSUPP (-1750600192L) | |
8907 #define KRB5_PLUGIN_BAD_MODULE_SPEC (-1750600191L) | |
8908 #define KRB5_PLUGIN_NAME_NOTFOUND (-1750600190L) | |
8909 #define KRB5KDC_ERR_DISCARD (-1750600189L) | |
8910 #define KRB5_DCC_CANNOT_CREATE (-1750600188L) | |
8911 #define KRB5_KCC_INVALID_ANCHOR (-1750600187L) | |
8912 #define KRB5_KCC_UNKNOWN_VERSION (-1750600186L) | |
8913 #define KRB5_KCC_INVALID_UID (-1750600185L) | |
8914 #define KRB5_KCM_MALFORMED_REPLY (-1750600184L) | |
8915 #define KRB5_KCM_RPC_ERROR (-1750600183L) | |
8916 #define KRB5_KCM_REPLY_TOO_BIG (-1750600182L) | |
8917 #define KRB5_KCM_NO_SERVER (-1750600181L) | |
8918 #define KRB5_CERTAUTH_HWAUTH (-1750600180L) | |
8919 #define KRB5_CERTAUTH_HWAUTH_PASS (-1750600179L) | |
8920 #define ERROR_TABLE_BASE_k5e1 (-1750600192L) | |
8921 | |
8922 extern const struct error_table et_k5e1_error_table; | |
8923 | |
8924 #if !defined(_WIN32) | |
8925 /* for compatibility with older versions... */ | |
8926 extern void initialize_k5e1_error_table (void) /*@modifies internalState@*/; | |
8927 #else | |
8928 #define initialize_k5e1_error_table() | |
8929 #endif | |
8930 | |
8931 #if !defined(_WIN32) | |
8932 #define init_k5e1_err_tbl initialize_k5e1_error_table | |
8933 #define k5e1_err_base ERROR_TABLE_BASE_k5e1 | |
8934 #endif | |
8935 /* | |
8936 * et-h-kdb5_err.h: | |
8937 * This file is automatically generated; please do not edit it. | |
8938 */ | |
8939 | |
8940 #include <com_err.h> | |
8941 | |
8942 #define KRB5_KDB_RCSID (-1780008448L) | |
8943 #define KRB5_KDB_INUSE (-1780008447L) | |
8944 #define KRB5_KDB_UK_SERROR (-1780008446L) | |
8945 #define KRB5_KDB_UK_RERROR (-1780008445L) | |
8946 #define KRB5_KDB_UNAUTH (-1780008444L) | |
8947 #define KRB5_KDB_NOENTRY (-1780008443L) | |
8948 #define KRB5_KDB_ILL_WILDCARD (-1780008442L) | |
8949 #define KRB5_KDB_DB_INUSE (-1780008441L) | |
8950 #define KRB5_KDB_DB_CHANGED (-1780008440L) | |
8951 #define KRB5_KDB_TRUNCATED_RECORD (-1780008439L) | |
8952 #define KRB5_KDB_RECURSIVELOCK (-1780008438L) | |
8953 #define KRB5_KDB_NOTLOCKED (-1780008437L) | |
8954 #define KRB5_KDB_BADLOCKMODE (-1780008436L) | |
8955 #define KRB5_KDB_DBNOTINITED (-1780008435L) | |
8956 #define KRB5_KDB_DBINITED (-1780008434L) | |
8957 #define KRB5_KDB_ILLDIRECTION (-1780008433L) | |
8958 #define KRB5_KDB_NOMASTERKEY (-1780008432L) | |
8959 #define KRB5_KDB_BADMASTERKEY (-1780008431L) | |
8960 #define KRB5_KDB_INVALIDKEYSIZE (-1780008430L) | |
8961 #define KRB5_KDB_CANTREAD_STORED (-1780008429L) | |
8962 #define KRB5_KDB_BADSTORED_MKEY (-1780008428L) | |
8963 #define KRB5_KDB_NOACTMASTERKEY (-1780008427L) | |
8964 #define KRB5_KDB_KVNONOMATCH (-1780008426L) | |
8965 #define KRB5_KDB_STORED_MKEY_NOTCURRENT (-1780008425L) | |
8966 #define KRB5_KDB_CANTLOCK_DB (-1780008424L) | |
8967 #define KRB5_KDB_DB_CORRUPT (-1780008423L) | |
8968 #define KRB5_KDB_BAD_VERSION (-1780008422L) | |
8969 #define KRB5_KDB_BAD_SALTTYPE (-1780008421L) | |
8970 #define KRB5_KDB_BAD_ENCTYPE (-1780008420L) | |
8971 #define KRB5_KDB_BAD_CREATEFLAGS (-1780008419L) | |
8972 #define KRB5_KDB_NO_PERMITTED_KEY (-1780008418L) | |
8973 #define KRB5_KDB_NO_MATCHING_KEY (-1780008417L) | |
8974 #define KRB5_KDB_DBTYPE_NOTFOUND (-1780008416L) | |
8975 #define KRB5_KDB_DBTYPE_NOSUP (-1780008415L) | |
8976 #define KRB5_KDB_DBTYPE_INIT (-1780008414L) | |
8977 #define KRB5_KDB_SERVER_INTERNAL_ERR (-1780008413L) | |
8978 #define KRB5_KDB_ACCESS_ERROR (-1780008412L) | |
8979 #define KRB5_KDB_INTERNAL_ERROR (-1780008411L) | |
8980 #define KRB5_KDB_CONSTRAINT_VIOLATION (-1780008410L) | |
8981 #define KRB5_LOG_CONV (-1780008409L) | |
8982 #define KRB5_LOG_UNSTABLE (-1780008408L) | |
8983 #define KRB5_LOG_CORRUPT (-1780008407L) | |
8984 #define KRB5_LOG_ERROR (-1780008406L) | |
8985 #define KRB5_KDB_DBTYPE_MISMATCH (-1780008405L) | |
8986 #define KRB5_KDB_POLICY_REF (-1780008404L) | |
8987 #define KRB5_KDB_STRINGS_TOOLONG (-1780008403L) | |
8988 #define ERROR_TABLE_BASE_kdb5 (-1780008448L) | |
8989 | |
8990 extern const struct error_table et_kdb5_error_table; | |
8991 | |
8992 #if !defined(_WIN32) | |
8993 /* for compatibility with older versions... */ | |
8994 extern void initialize_kdb5_error_table (void) /*@modifies internalState@*/; | |
8995 #else | |
8996 #define initialize_kdb5_error_table() | |
8997 #endif | |
8998 | |
8999 #if !defined(_WIN32) | |
9000 #define init_kdb5_err_tbl initialize_kdb5_error_table | |
9001 #define kdb5_err_base ERROR_TABLE_BASE_kdb5 | |
9002 #endif | |
9003 /* | |
9004 * et-h-kv5m_err.h: | |
9005 * This file is automatically generated; please do not edit it. | |
9006 */ | |
9007 | |
9008 #include <com_err.h> | |
9009 | |
9010 #define KV5M_NONE (-1760647424L) | |
9011 #define KV5M_PRINCIPAL (-1760647423L) | |
9012 #define KV5M_DATA (-1760647422L) | |
9013 #define KV5M_KEYBLOCK (-1760647421L) | |
9014 #define KV5M_CHECKSUM (-1760647420L) | |
9015 #define KV5M_ENCRYPT_BLOCK (-1760647419L) | |
9016 #define KV5M_ENC_DATA (-1760647418L) | |
9017 #define KV5M_CRYPTOSYSTEM_ENTRY (-1760647417L) | |
9018 #define KV5M_CS_TABLE_ENTRY (-1760647416L) | |
9019 #define KV5M_CHECKSUM_ENTRY (-1760647415L) | |
9020 #define KV5M_AUTHDATA (-1760647414L) | |
9021 #define KV5M_TRANSITED (-1760647413L) | |
9022 #define KV5M_ENC_TKT_PART (-1760647412L) | |
9023 #define KV5M_TICKET (-1760647411L) | |
9024 #define KV5M_AUTHENTICATOR (-1760647410L) | |
9025 #define KV5M_TKT_AUTHENT (-1760647409L) | |
9026 #define KV5M_CREDS (-1760647408L) | |
9027 #define KV5M_LAST_REQ_ENTRY (-1760647407L) | |
9028 #define KV5M_PA_DATA (-1760647406L) | |
9029 #define KV5M_KDC_REQ (-1760647405L) | |
9030 #define KV5M_ENC_KDC_REP_PART (-1760647404L) | |
9031 #define KV5M_KDC_REP (-1760647403L) | |
9032 #define KV5M_ERROR (-1760647402L) | |
9033 #define KV5M_AP_REQ (-1760647401L) | |
9034 #define KV5M_AP_REP (-1760647400L) | |
9035 #define KV5M_AP_REP_ENC_PART (-1760647399L) | |
9036 #define KV5M_RESPONSE (-1760647398L) | |
9037 #define KV5M_SAFE (-1760647397L) | |
9038 #define KV5M_PRIV (-1760647396L) | |
9039 #define KV5M_PRIV_ENC_PART (-1760647395L) | |
9040 #define KV5M_CRED (-1760647394L) | |
9041 #define KV5M_CRED_INFO (-1760647393L) | |
9042 #define KV5M_CRED_ENC_PART (-1760647392L) | |
9043 #define KV5M_PWD_DATA (-1760647391L) | |
9044 #define KV5M_ADDRESS (-1760647390L) | |
9045 #define KV5M_KEYTAB_ENTRY (-1760647389L) | |
9046 #define KV5M_CONTEXT (-1760647388L) | |
9047 #define KV5M_OS_CONTEXT (-1760647387L) | |
9048 #define KV5M_ALT_METHOD (-1760647386L) | |
9049 #define KV5M_ETYPE_INFO_ENTRY (-1760647385L) | |
9050 #define KV5M_DB_CONTEXT (-1760647384L) | |
9051 #define KV5M_AUTH_CONTEXT (-1760647383L) | |
9052 #define KV5M_KEYTAB (-1760647382L) | |
9053 #define KV5M_RCACHE (-1760647381L) | |
9054 #define KV5M_CCACHE (-1760647380L) | |
9055 #define KV5M_PREAUTH_OPS (-1760647379L) | |
9056 #define KV5M_SAM_CHALLENGE (-1760647378L) | |
9057 #define KV5M_SAM_CHALLENGE_2 (-1760647377L) | |
9058 #define KV5M_SAM_KEY (-1760647376L) | |
9059 #define KV5M_ENC_SAM_RESPONSE_ENC (-1760647375L) | |
9060 #define KV5M_ENC_SAM_RESPONSE_ENC_2 (-1760647374L) | |
9061 #define KV5M_SAM_RESPONSE (-1760647373L) | |
9062 #define KV5M_SAM_RESPONSE_2 (-1760647372L) | |
9063 #define KV5M_PREDICTED_SAM_RESPONSE (-1760647371L) | |
9064 #define KV5M_PASSWD_PHRASE_ELEMENT (-1760647370L) | |
9065 #define KV5M_GSS_OID (-1760647369L) | |
9066 #define KV5M_GSS_QUEUE (-1760647368L) | |
9067 #define KV5M_FAST_ARMORED_REQ (-1760647367L) | |
9068 #define KV5M_FAST_REQ (-1760647366L) | |
9069 #define KV5M_FAST_RESPONSE (-1760647365L) | |
9070 #define KV5M_AUTHDATA_CONTEXT (-1760647364L) | |
9071 #define ERROR_TABLE_BASE_kv5m (-1760647424L) | |
9072 | |
9073 extern const struct error_table et_kv5m_error_table; | |
9074 | |
9075 #if !defined(_WIN32) | |
9076 /* for compatibility with older versions... */ | |
9077 extern void initialize_kv5m_error_table (void) /*@modifies internalState@*/; | |
9078 #else | |
9079 #define initialize_kv5m_error_table() | |
9080 #endif | |
9081 | |
9082 #if !defined(_WIN32) | |
9083 #define init_kv5m_err_tbl initialize_kv5m_error_table | |
9084 #define kv5m_err_base ERROR_TABLE_BASE_kv5m | |
9085 #endif | |
9086 /* | |
9087 * et-h-krb524_err.h: | |
9088 * This file is automatically generated; please do not edit it. | |
9089 */ | |
9090 | |
9091 #include <com_err.h> | |
9092 | |
9093 #define KRB524_BADKEY (-1750206208L) | |
9094 #define KRB524_BADADDR (-1750206207L) | |
9095 #define KRB524_BADPRINC (-1750206206L) | |
9096 #define KRB524_BADREALM (-1750206205L) | |
9097 #define KRB524_V4ERR (-1750206204L) | |
9098 #define KRB524_ENCFULL (-1750206203L) | |
9099 #define KRB524_DECEMPTY (-1750206202L) | |
9100 #define KRB524_NOTRESP (-1750206201L) | |
9101 #define KRB524_KRB4_DISABLED (-1750206200L) | |
9102 #define ERROR_TABLE_BASE_k524 (-1750206208L) | |
9103 | |
9104 extern const struct error_table et_k524_error_table; | |
9105 | |
9106 #if !defined(_WIN32) | |
9107 /* for compatibility with older versions... */ | |
9108 extern void initialize_k524_error_table (void) /*@modifies internalState@*/; | |
9109 #else | |
9110 #define initialize_k524_error_table() | |
9111 #endif | |
9112 | |
9113 #if !defined(_WIN32) | |
9114 #define init_k524_err_tbl initialize_k524_error_table | |
9115 #define k524_err_base ERROR_TABLE_BASE_k524 | |
9116 #endif | |
9117 /* | |
9118 * et-h-asn1_err.h: | |
9119 * This file is automatically generated; please do not edit it. | |
9120 */ | |
9121 | |
9122 #include <com_err.h> | |
9123 | |
9124 #define ASN1_BAD_TIMEFORMAT (1859794432L) | |
9125 #define ASN1_MISSING_FIELD (1859794433L) | |
9126 #define ASN1_MISPLACED_FIELD (1859794434L) | |
9127 #define ASN1_TYPE_MISMATCH (1859794435L) | |
9128 #define ASN1_OVERFLOW (1859794436L) | |
9129 #define ASN1_OVERRUN (1859794437L) | |
9130 #define ASN1_BAD_ID (1859794438L) | |
9131 #define ASN1_BAD_LENGTH (1859794439L) | |
9132 #define ASN1_BAD_FORMAT (1859794440L) | |
9133 #define ASN1_PARSE_ERROR (1859794441L) | |
9134 #define ASN1_BAD_GMTIME (1859794442L) | |
9135 #define ASN1_INDEF (1859794443L) | |
9136 #define ASN1_MISSING_EOC (1859794444L) | |
9137 #define ASN1_OMITTED (1859794445L) | |
9138 #define ERROR_TABLE_BASE_asn1 (1859794432L) | |
9139 | |
9140 extern const struct error_table et_asn1_error_table; | |
9141 | |
9142 #if !defined(_WIN32) | |
9143 /* for compatibility with older versions... */ | |
9144 extern void initialize_asn1_error_table (void) /*@modifies internalState@*/; | |
9145 #else | |
9146 #define initialize_asn1_error_table() | |
9147 #endif | |
9148 | |
9149 #if !defined(_WIN32) | |
9150 #define init_asn1_err_tbl initialize_asn1_error_table | |
9151 #define asn1_err_base ERROR_TABLE_BASE_asn1 | |
9152 #endif | |
9153 #endif /* KRB5_KRB5_H_INCLUDED */ |