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