xref: /freebsd/crypto/heimdal/lib/krb5/krb5.h (revision 5521ff5a4d1929056e7ffc982fac3341ca54df7c)
1 /*
2  * Copyright (c) 1997 - 2001 Kungliga Tekniska H�gskolan
3  * (Royal Institute of Technology, Stockholm, Sweden).
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the Institute nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33 
34 /* $Id: krb5.h,v 1.190 2001/05/16 22:23:56 assar Exp $ */
35 
36 #ifndef __KRB5_H__
37 #define __KRB5_H__
38 
39 #include <time.h>
40 #include <krb5-types.h>
41 
42 #include <asn1_err.h>
43 #include <krb5_err.h>
44 #include <heim_err.h>
45 
46 #include <krb5_asn1.h>
47 
48 /* simple constants */
49 
50 #ifndef TRUE
51 #define TRUE  1
52 #define FALSE 0
53 #endif
54 
55 typedef int krb5_boolean;
56 
57 typedef int32_t krb5_error_code;
58 
59 typedef int krb5_kvno;
60 
61 typedef u_int32_t krb5_flags;
62 
63 typedef void *krb5_pointer;
64 typedef const void *krb5_const_pointer;
65 
66 typedef octet_string krb5_data;
67 
68 struct krb5_crypto_data;
69 typedef struct krb5_crypto_data *krb5_crypto;
70 
71 typedef CKSUMTYPE krb5_cksumtype;
72 
73 typedef Checksum krb5_checksum;
74 
75 typedef ENCTYPE krb5_enctype;
76 
77 /* alternative names */
78 enum {
79     ENCTYPE_NULL		= ETYPE_NULL,
80     ENCTYPE_DES_CBC_CRC		= ETYPE_DES_CBC_CRC,
81     ENCTYPE_DES_CBC_MD4		= ETYPE_DES_CBC_MD4,
82     ENCTYPE_DES_CBC_MD5		= ETYPE_DES_CBC_MD5,
83     ENCTYPE_DES3_CBC_MD5	= ETYPE_DES3_CBC_MD5,
84     ENCTYPE_OLD_DES3_CBC_SHA1	= ETYPE_OLD_DES3_CBC_SHA1,
85     ENCTYPE_SIGN_DSA_GENERATE	= ETYPE_SIGN_DSA_GENERATE,
86     ENCTYPE_ENCRYPT_RSA_PRIV	= ETYPE_ENCRYPT_RSA_PRIV,
87     ENCTYPE_ENCRYPT_RSA_PUB	= ETYPE_ENCRYPT_RSA_PUB,
88     ENCTYPE_DES3_CBC_SHA1	= ETYPE_DES3_CBC_SHA1,
89     ENCTYPE_ARCFOUR_HMAC_MD5	= ETYPE_ARCFOUR_HMAC_MD5,
90     ENCTYPE_ARCFOUR_HMAC_MD5_56	= ETYPE_ARCFOUR_HMAC_MD5_56,
91     ENCTYPE_ENCTYPE_PK_CROSS	= ETYPE_ENCTYPE_PK_CROSS,
92     ENCTYPE_DES_CBC_NONE	= ETYPE_DES_CBC_NONE,
93     ENCTYPE_DES3_CBC_NONE	= ETYPE_DES3_CBC_NONE,
94     ENCTYPE_DES_CFB64_NONE	= ETYPE_DES_CFB64_NONE,
95     ENCTYPE_DES_PCBC_NONE	= ETYPE_DES_PCBC_NONE,
96     ENCTYPE_DES3_CBC_NONE_IVEC	= ETYPE_DES3_CBC_NONE_IVEC
97 };
98 
99 typedef PADATA_TYPE krb5_preauthtype;
100 
101 typedef enum krb5_key_usage {
102     KRB5_KU_PA_ENC_TIMESTAMP = 1,
103     /* AS-REQ PA-ENC-TIMESTAMP padata timestamp, encrypted with the
104        client key (section 5.4.1) */
105     KRB5_KU_TICKET = 2,
106     /* AS-REP Ticket and TGS-REP Ticket (includes tgs session key or
107        application session key), encrypted with the service key
108        (section 5.4.2) */
109     KRB5_KU_AS_REP_ENC_PART = 3,
110     /* AS-REP encrypted part (includes tgs session key or application
111        session key), encrypted with the client key (section 5.4.2) */
112     KRB5_KU_TGS_REQ_AUTH_DAT_SESSION = 4,
113     /* TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the tgs
114        session key (section 5.4.1) */
115     KRB5_KU_TGS_REQ_AUTH_DAT_SUBKEY = 5,
116     /* TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the tgs
117           authenticator subkey (section 5.4.1) */
118     KRB5_KU_TGS_REQ_AUTH_CKSUM = 6,
119     /* TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator cksum, keyed
120        with the tgs session key (sections 5.3.2, 5.4.1) */
121     KRB5_KU_TGS_REQ_AUTH = 7,
122     /* TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator (includes tgs
123        authenticator subkey), encrypted with the tgs session key
124        (section 5.3.2) */
125     KRB5_KU_TGS_REP_ENC_PART_SESSION = 8,
126     /* TGS-REP encrypted part (includes application session key),
127        encrypted with the tgs session key (section 5.4.2) */
128     KRB5_KU_TGS_REP_ENC_PART_SUB_KEY = 9,
129     /* TGS-REP encrypted part (includes application session key),
130        encrypted with the tgs authenticator subkey (section 5.4.2) */
131     KRB5_KU_AP_REQ_AUTH_CKSUM = 10,
132     /* AP-REQ Authenticator cksum, keyed with the application session
133        key (section 5.3.2) */
134     KRB5_KU_AP_REQ_AUTH = 11,
135     /* AP-REQ Authenticator (includes application authenticator
136        subkey), encrypted with the application session key (section
137        5.3.2) */
138     KRB5_KU_AP_REQ_ENC_PART = 12,
139     /* AP-REP encrypted part (includes application session subkey),
140        encrypted with the application session key (section 5.5.2) */
141     KRB5_KU_KRB_PRIV = 13,
142     /* KRB-PRIV encrypted part, encrypted with a key chosen by the
143        application (section 5.7.1) */
144     KRB5_KU_KRB_CRED = 14,
145     /* KRB-CRED encrypted part, encrypted with a key chosen by the
146        application (section 5.8.1) */
147     KRB5_KU_KRB_SAFE_CKSUM = 15,
148     /* KRB-SAFE cksum, keyed with a key chosen by the application
149        (section 5.6.1) */
150     KRB5_KU_OTHER_ENCRYPTED = 16,
151     /* Data which is defined in some specification outside of
152        Kerberos to be encrypted using an RFC1510 encryption type. */
153     KRB5_KU_OTHER_CKSUM = 17,
154     /* Data which is defined in some specification outside of
155        Kerberos to be checksummed using an RFC1510 checksum type. */
156     KRB5_KU_KRB_ERROR = 18,
157     /* Krb-error checksum */
158     KRB5_KU_AD_KDC_ISSUED = 19,
159     /* AD-KDCIssued checksum */
160     KRB5_KU_MANDATORY_TICKET_EXTENSION = 20,
161     /* Checksum for Mandatory Ticket Extensions */
162     KRB5_KU_AUTH_DATA_TICKET_EXTENSION = 21,
163     /* Checksum in Authorization Data in Ticket Extensions */
164     KRB5_KU_USAGE_SEAL = 22,
165     /* seal in GSSAPI krb5 mechanism */
166     KRB5_KU_USAGE_SIGN = 23,
167     /* sign in GSSAPI krb5 mechanism */
168     KRB5_KU_USAGE_SEQ = 24
169     /* SEQ in GSSAPI krb5 mechanism */
170 } krb5_key_usage;
171 
172 typedef krb5_key_usage krb5_keyusage;
173 
174 typedef enum krb5_salttype {
175     KRB5_PW_SALT = KRB5_PADATA_PW_SALT,
176     KRB5_AFS3_SALT = KRB5_PADATA_AFS3_SALT
177 }krb5_salttype;
178 
179 typedef struct krb5_salt {
180     krb5_salttype salttype;
181     krb5_data saltvalue;
182 } krb5_salt;
183 
184 typedef ETYPE_INFO krb5_preauthinfo;
185 
186 typedef struct {
187     krb5_preauthtype type;
188     krb5_preauthinfo info; /* list of preauthinfo for this type */
189 } krb5_preauthdata_entry;
190 
191 typedef struct krb5_preauthdata {
192     unsigned len;
193     krb5_preauthdata_entry *val;
194 }krb5_preauthdata;
195 
196 typedef enum krb5_address_type {
197     KRB5_ADDRESS_INET     =   2,
198     KRB5_ADDRESS_INET6    =  24,
199     KRB5_ADDRESS_ADDRPORT = 256,
200     KRB5_ADDRESS_IPPORT   = 257
201 } krb5_address_type;
202 
203 enum {
204   AP_OPTS_USE_SESSION_KEY = 1,
205   AP_OPTS_MUTUAL_REQUIRED = 2
206 };
207 
208 typedef HostAddress krb5_address;
209 
210 typedef HostAddresses krb5_addresses;
211 
212 typedef enum krb5_keytype {
213     KEYTYPE_NULL	= 0,
214     KEYTYPE_DES		= 1,
215     KEYTYPE_DES3	= 7,
216     KEYTYPE_ARCFOUR	= 23
217 } krb5_keytype;
218 
219 typedef EncryptionKey krb5_keyblock;
220 
221 typedef AP_REQ krb5_ap_req;
222 
223 struct krb5_cc_ops;
224 
225 #define KRB5_DEFAULT_CCFILE_ROOT "/tmp/krb5cc_"
226 
227 #define KRB5_DEFAULT_CCROOT "FILE:" KRB5_DEFAULT_CCFILE_ROOT
228 
229 #define KRB5_ACCEPT_NULL_ADDRESSES(C) 					 \
230     krb5_config_get_bool_default((C), NULL, TRUE, 			 \
231 				 "libdefaults", "accept_null_addresses", \
232 				 NULL)
233 
234 typedef void *krb5_cc_cursor;
235 
236 typedef struct krb5_ccache_data {
237     const struct krb5_cc_ops *ops;
238     krb5_data data;
239 }krb5_ccache_data;
240 
241 typedef struct krb5_ccache_data *krb5_ccache;
242 
243 typedef struct krb5_context_data *krb5_context;
244 
245 typedef Realm krb5_realm;
246 typedef const char *krb5_const_realm; /* stupid language */
247 
248 #define krb5_realm_length(r) strlen(r)
249 #define krb5_realm_data(r) (r)
250 
251 typedef Principal krb5_principal_data;
252 typedef struct Principal *krb5_principal;
253 typedef const struct Principal *krb5_const_principal;
254 
255 typedef time_t krb5_deltat;
256 typedef time_t krb5_timestamp;
257 
258 typedef struct krb5_times {
259   krb5_timestamp authtime;
260   krb5_timestamp starttime;
261   krb5_timestamp endtime;
262   krb5_timestamp renew_till;
263 } krb5_times;
264 
265 typedef union {
266     TicketFlags b;
267     krb5_flags i;
268 } krb5_ticket_flags;
269 
270 /* options for krb5_get_in_tkt() */
271 #define KDC_OPT_FORWARDABLE		(1 << 1)
272 #define KDC_OPT_FORWARDED		(1 << 2)
273 #define KDC_OPT_PROXIABLE		(1 << 3)
274 #define KDC_OPT_PROXY			(1 << 4)
275 #define KDC_OPT_ALLOW_POSTDATE		(1 << 5)
276 #define KDC_OPT_POSTDATED		(1 << 6)
277 #define KDC_OPT_RENEWABLE		(1 << 8)
278 #define KDC_OPT_REQUEST_ANONYMOUS	(1 << 14)
279 #define KDC_OPT_DISABLE_TRANSITED_CHECK	(1 << 26)
280 #define KDC_OPT_RENEWABLE_OK		(1 << 27)
281 #define KDC_OPT_ENC_TKT_IN_SKEY		(1 << 28)
282 #define KDC_OPT_RENEW			(1 << 30)
283 #define KDC_OPT_VALIDATE		(1 << 31)
284 
285 typedef union {
286     KDCOptions b;
287     krb5_flags i;
288 } krb5_kdc_flags;
289 
290 /* flags for krb5_verify_ap_req */
291 
292 #define KRB5_VERIFY_AP_REQ_IGNORE_INVALID	(1 << 0)
293 
294 #define KRB5_GC_CACHED		1
295 #define KRB5_GC_USER_USER	2
296 
297 /* constants for compare_creds (and cc_retrieve_cred) */
298 #define KRB5_TC_DONT_MATCH_REALM	(1U << 31)
299 #define KRB5_TC_MATCH_KEYTYPE		(1U << 30)
300 
301 typedef AuthorizationData krb5_authdata;
302 
303 typedef KRB_ERROR krb5_error;
304 
305 typedef struct krb5_creds {
306     krb5_principal client;
307     krb5_principal server;
308     krb5_keyblock session;
309     krb5_times times;
310     krb5_data ticket;
311     krb5_data second_ticket;
312     krb5_authdata authdata;
313     krb5_addresses addresses;
314     krb5_ticket_flags flags;
315 } krb5_creds;
316 
317 typedef struct krb5_cc_ops {
318     char *prefix;
319     char* (*get_name)(krb5_context, krb5_ccache);
320     krb5_error_code (*resolve)(krb5_context, krb5_ccache *, const char *);
321     krb5_error_code (*gen_new)(krb5_context, krb5_ccache *);
322     krb5_error_code (*init)(krb5_context, krb5_ccache, krb5_principal);
323     krb5_error_code (*destroy)(krb5_context, krb5_ccache);
324     krb5_error_code (*close)(krb5_context, krb5_ccache);
325     krb5_error_code (*store)(krb5_context, krb5_ccache, krb5_creds*);
326     krb5_error_code (*retrieve)(krb5_context, krb5_ccache,
327 				krb5_flags, krb5_creds*, krb5_creds);
328     krb5_error_code (*get_princ)(krb5_context, krb5_ccache, krb5_principal*);
329     krb5_error_code (*get_first)(krb5_context, krb5_ccache, krb5_cc_cursor *);
330     krb5_error_code (*get_next)(krb5_context, krb5_ccache,
331 				krb5_cc_cursor*, krb5_creds*);
332     krb5_error_code (*end_get)(krb5_context, krb5_ccache, krb5_cc_cursor*);
333     krb5_error_code (*remove_cred)(krb5_context, krb5_ccache,
334 				   krb5_flags, krb5_creds*);
335     krb5_error_code (*set_flags)(krb5_context, krb5_ccache, krb5_flags);
336     int (*get_version)(krb5_context, krb5_ccache);
337 } krb5_cc_ops;
338 
339 struct krb5_log_facility;
340 
341 struct krb5_config_binding {
342     enum { krb5_config_string, krb5_config_list } type;
343     char *name;
344     struct krb5_config_binding *next;
345     union {
346 	char *string;
347 	struct krb5_config_binding *list;
348 	void *generic;
349     } u;
350 };
351 
352 typedef struct krb5_config_binding krb5_config_binding;
353 
354 typedef krb5_config_binding krb5_config_section;
355 
356 typedef struct krb5_context_data {
357     krb5_enctype *etypes;
358     krb5_enctype *etypes_des;
359     char **default_realms;
360     time_t max_skew;
361     time_t kdc_timeout;
362     unsigned max_retries;
363     int32_t kdc_sec_offset;
364     int32_t kdc_usec_offset;
365     krb5_config_section *cf;
366     struct et_list *et_list;
367     struct krb5_log_facility *warn_dest;
368     krb5_cc_ops *cc_ops;
369     int num_cc_ops;
370     const char *http_proxy;
371     const char *time_fmt;
372     krb5_boolean log_utc;
373     const char *default_keytab;
374     const char *default_keytab_modify;
375     krb5_boolean use_admin_kdc;
376     krb5_addresses *extra_addresses;
377     krb5_boolean scan_interfaces;	/* `ifconfig -a' */
378     krb5_boolean srv_lookup;		/* do SRV lookups */
379     krb5_boolean srv_try_txt;		/* try TXT records also */
380     krb5_boolean srv_try_rfc2052;	/* try RFC2052 compatible records */
381     int32_t fcache_vno;			/* create cache files w/ this
382                                            version */
383     int num_kt_types;			/* # of registered keytab types */
384     struct krb5_keytab_data *kt_types;  /* registered keytab types */
385     const char *date_fmt;
386     char *error_string;
387     char error_buf[256];
388 } krb5_context_data;
389 
390 typedef struct krb5_ticket {
391     EncTicketPart ticket;
392     krb5_principal client;
393     krb5_principal server;
394 } krb5_ticket;
395 
396 typedef Authenticator krb5_authenticator_data;
397 
398 typedef krb5_authenticator_data *krb5_authenticator;
399 
400 struct krb5_rcache_data;
401 typedef struct krb5_rcache_data *krb5_rcache;
402 typedef Authenticator krb5_donot_replay;
403 
404 #define KRB5_STORAGE_HOST_BYTEORDER			0x01 /* old */
405 #define KRB5_STORAGE_PRINCIPAL_WRONG_NUM_COMPONENTS	0x02
406 #define KRB5_STORAGE_PRINCIPAL_NO_NAME_TYPE		0x04
407 #define KRB5_STORAGE_KEYBLOCK_KEYTYPE_TWICE		0x08
408 #define KRB5_STORAGE_BYTEORDER_MASK			0x60
409 #define KRB5_STORAGE_BYTEORDER_BE			0x00 /* default */
410 #define KRB5_STORAGE_BYTEORDER_LE			0x20
411 #define KRB5_STORAGE_BYTEORDER_HOST			0x40
412 
413 typedef struct krb5_storage {
414     void *data;
415     ssize_t (*fetch)(struct krb5_storage*, void*, size_t);
416     ssize_t (*store)(struct krb5_storage*, const void*, size_t);
417     off_t (*seek)(struct krb5_storage*, off_t, int);
418     void (*free)(struct krb5_storage*);
419     krb5_flags flags;
420 } krb5_storage;
421 
422 typedef struct krb5_keytab_entry {
423     krb5_principal principal;
424     krb5_kvno vno;
425     krb5_keyblock keyblock;
426     u_int32_t timestamp;
427 } krb5_keytab_entry;
428 
429 typedef struct krb5_kt_cursor {
430     int fd;
431     krb5_storage *sp;
432     void *data;
433 } krb5_kt_cursor;
434 
435 struct krb5_keytab_data;
436 
437 typedef struct krb5_keytab_data *krb5_keytab;
438 
439 struct krb5_keytab_data {
440     char *prefix;
441     krb5_error_code (*resolve)(krb5_context, const char*, krb5_keytab);
442     krb5_error_code (*get_name)(krb5_context, krb5_keytab, char*, size_t);
443     krb5_error_code (*close)(krb5_context, krb5_keytab);
444     krb5_error_code (*get)(krb5_context, krb5_keytab, krb5_const_principal,
445 			   krb5_kvno, krb5_enctype, krb5_keytab_entry*);
446     krb5_error_code (*start_seq_get)(krb5_context, krb5_keytab, krb5_kt_cursor*);
447     krb5_error_code (*next_entry)(krb5_context, krb5_keytab,
448 				  krb5_keytab_entry*, krb5_kt_cursor*);
449     krb5_error_code (*end_seq_get)(krb5_context, krb5_keytab, krb5_kt_cursor*);
450     krb5_error_code (*add)(krb5_context, krb5_keytab, krb5_keytab_entry*);
451     krb5_error_code (*remove)(krb5_context, krb5_keytab, krb5_keytab_entry*);
452     void *data;
453     int32_t version;
454 };
455 
456 typedef struct krb5_keytab_data krb5_kt_ops;
457 
458 struct krb5_keytab_key_proc_args {
459     krb5_keytab keytab;
460     krb5_principal principal;
461 };
462 
463 typedef struct krb5_keytab_key_proc_args krb5_keytab_key_proc_args;
464 
465 typedef struct krb5_replay_data {
466     krb5_timestamp timestamp;
467     u_int32_t usec;
468     u_int32_t seq;
469 } krb5_replay_data;
470 
471 /* flags for krb5_auth_con_setflags */
472 enum {
473     KRB5_AUTH_CONTEXT_DO_TIME      = 1,
474     KRB5_AUTH_CONTEXT_RET_TIME     = 2,
475     KRB5_AUTH_CONTEXT_DO_SEQUENCE  = 4,
476     KRB5_AUTH_CONTEXT_RET_SEQUENCE = 8,
477     KRB5_AUTH_CONTEXT_PERMIT_ALL   = 16
478 };
479 
480 /* flags for krb5_auth_con_genaddrs */
481 enum {
482     KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR       = 1,
483     KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR  = 3,
484     KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR      = 4,
485     KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR = 12
486 };
487 
488 typedef struct krb5_auth_context_data {
489     unsigned int flags;
490 
491     krb5_address *local_address;
492     krb5_address *remote_address;
493     int16_t local_port;
494     int16_t remote_port;
495     krb5_keyblock *keyblock;
496     krb5_keyblock *local_subkey;
497     krb5_keyblock *remote_subkey;
498 
499     u_int32_t local_seqnumber;
500     u_int32_t remote_seqnumber;
501 
502     krb5_authenticator authenticator;
503 
504     krb5_pointer i_vector;
505 
506     krb5_rcache rcache;
507 
508     krb5_keytype keytype;	/* �requested key type ? */
509     krb5_cksumtype cksumtype;	/* �requested checksum type! */
510 
511 }krb5_auth_context_data, *krb5_auth_context;
512 
513 typedef struct {
514     KDC_REP kdc_rep;
515     EncKDCRepPart enc_part;
516     KRB_ERROR error;
517 } krb5_kdc_rep;
518 
519 extern const char *heimdal_version, *heimdal_long_version;
520 
521 typedef void (*krb5_log_log_func_t)(const char*, const char*, void*);
522 typedef void (*krb5_log_close_func_t)(void*);
523 
524 typedef struct krb5_log_facility {
525     const char *program;
526     int len;
527     struct facility *val;
528 } krb5_log_facility;
529 
530 typedef EncAPRepPart krb5_ap_rep_enc_part;
531 
532 #define KRB5_RECVAUTH_IGNORE_VERSION 1
533 
534 #define KRB5_SENDAUTH_VERSION "KRB5_SENDAUTH_V1.0"
535 
536 #define KRB5_TGS_NAME_SIZE (6)
537 #define KRB5_TGS_NAME ("krbtgt")
538 
539 /* variables */
540 
541 extern const char krb5_config_file[];
542 extern const char krb5_defkeyname[];
543 
544 typedef enum {
545     KRB5_PROMPT_TYPE_PASSWORD		= 0x1,
546     KRB5_PROMPT_TYPE_NEW_PASSWORD	= 0x2,
547     KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN = 0x3,
548     KRB5_PROMPT_TYPE_PREAUTH		= 0x4
549 } krb5_prompt_type;
550 
551 typedef struct _krb5_prompt {
552     char *prompt;
553     int hidden;
554     krb5_data *reply;
555     krb5_prompt_type type;
556 } krb5_prompt;
557 
558 typedef int (*krb5_prompter_fct)(krb5_context context,
559 				 void *data,
560 				 const char *name,
561 				 const char *banner,
562 				 int num_prompts,
563 				 krb5_prompt prompts[]);
564 
565 typedef krb5_error_code (*krb5_key_proc)(krb5_context context,
566 					 krb5_enctype type,
567 					 krb5_salt salt,
568 					 krb5_const_pointer keyseed,
569 					 krb5_keyblock **key);
570 typedef krb5_error_code (*krb5_decrypt_proc)(krb5_context context,
571 					     krb5_keyblock *key,
572 					     krb5_key_usage usage,
573 					     krb5_const_pointer decrypt_arg,
574 					     krb5_kdc_rep *dec_rep);
575 
576 
577 typedef struct _krb5_get_init_creds_opt {
578     krb5_flags flags;
579     krb5_deltat tkt_life;
580     krb5_deltat renew_life;
581     int forwardable;
582     int proxiable;
583     int anonymous;
584     krb5_enctype *etype_list;
585     int etype_list_length;
586     krb5_addresses *address_list;
587 #if 0 /* this is the MIT-way */
588     krb5_address **address_list;
589 #endif
590     /* XXX the next three should not be used, as they may be
591        removed later */
592     krb5_preauthtype *preauth_list;
593     int preauth_list_length;
594     krb5_data *salt;
595 } krb5_get_init_creds_opt;
596 
597 #define KRB5_GET_INIT_CREDS_OPT_TKT_LIFE	0x0001
598 #define KRB5_GET_INIT_CREDS_OPT_RENEW_LIFE	0x0002
599 #define KRB5_GET_INIT_CREDS_OPT_FORWARDABLE	0x0004
600 #define KRB5_GET_INIT_CREDS_OPT_PROXIABLE	0x0008
601 #define KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST	0x0010
602 #define KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST	0x0020
603 #define KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST	0x0040
604 #define KRB5_GET_INIT_CREDS_OPT_SALT		0x0080
605 #define KRB5_GET_INIT_CREDS_OPT_ANONYMOUS	0x0100
606 
607 typedef struct _krb5_verify_init_creds_opt {
608     krb5_flags flags;
609     int ap_req_nofail;
610 } krb5_verify_init_creds_opt;
611 
612 #define KRB5_VERIFY_INIT_CREDS_OPT_AP_REQ_NOFAIL	0x0001
613 
614 typedef struct krb5_verify_opt {
615     unsigned int flags;
616     krb5_ccache ccache;
617     krb5_keytab keytab;
618     krb5_boolean secure;
619     const char *service;
620 } krb5_verify_opt;
621 
622 #define KRB5_VERIFY_LREALMS 1
623 
624 extern const krb5_cc_ops krb5_fcc_ops;
625 extern const krb5_cc_ops krb5_mcc_ops;
626 
627 extern const krb5_kt_ops krb5_fkt_ops;
628 extern const krb5_kt_ops krb5_mkt_ops;
629 extern const krb5_kt_ops krb5_akf_ops;
630 extern const krb5_kt_ops krb4_fkt_ops;
631 extern const krb5_kt_ops krb5_srvtab_fkt_ops;
632 extern const krb5_kt_ops krb5_any_ops;
633 
634 #define KRB5_KPASSWD_SUCCESS	0
635 #define KRB5_KPASSWD_MALFORMED	0
636 #define KRB5_KPASSWD_HARDERROR	0
637 #define KRB5_KPASSWD_AUTHERROR	0
638 #define KRB5_KPASSWD_SOFTERROR	0
639 
640 #define KPASSWD_PORT 464
641 
642 struct credentials; /* this is to keep the compiler happy */
643 struct getargs;
644 
645 struct sockaddr;
646 
647 #include <krb5-protos.h>
648 
649 #endif /* __KRB5_H__ */
650 
651