File indexing completed on 2026-09-09 09:29:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 #ifndef KRB5_KDB5__
0066 #define KRB5_KDB5__
0067
0068 #include <time.h>
0069 #include <krb5.h>
0070
0071
0072
0073 #define KRB5_KDB_API_VERSION 10
0074
0075
0076 #define KRB5_KDB_SALTTYPE_NORMAL 0
0077
0078 #define KRB5_KDB_SALTTYPE_NOREALM 2
0079 #define KRB5_KDB_SALTTYPE_ONLYREALM 3
0080 #define KRB5_KDB_SALTTYPE_SPECIAL 4
0081
0082 #define KRB5_KDB_SALTTYPE_CERTHASH 6
0083
0084
0085 #define KRB5_KDB_DISALLOW_POSTDATED 0x00000001
0086 #define KRB5_KDB_DISALLOW_FORWARDABLE 0x00000002
0087 #define KRB5_KDB_DISALLOW_TGT_BASED 0x00000004
0088 #define KRB5_KDB_DISALLOW_RENEWABLE 0x00000008
0089 #define KRB5_KDB_DISALLOW_PROXIABLE 0x00000010
0090 #define KRB5_KDB_DISALLOW_DUP_SKEY 0x00000020
0091 #define KRB5_KDB_DISALLOW_ALL_TIX 0x00000040
0092 #define KRB5_KDB_REQUIRES_PRE_AUTH 0x00000080
0093 #define KRB5_KDB_REQUIRES_HW_AUTH 0x00000100
0094 #define KRB5_KDB_REQUIRES_PWCHANGE 0x00000200
0095 #define KRB5_KDB_DISALLOW_SVR 0x00001000
0096 #define KRB5_KDB_PWCHANGE_SERVICE 0x00002000
0097 #define KRB5_KDB_SUPPORT_DESMD5 0x00004000
0098 #define KRB5_KDB_NEW_PRINC 0x00008000
0099 #define KRB5_KDB_OK_AS_DELEGATE 0x00100000
0100 #define KRB5_KDB_OK_TO_AUTH_AS_DELEGATE 0x00200000
0101 #define KRB5_KDB_NO_AUTH_DATA_REQUIRED 0x00400000
0102 #define KRB5_KDB_LOCKDOWN_KEYS 0x00800000
0103
0104
0105 #define KRB5_KDB_CREATE_BTREE 0x00000001
0106 #define KRB5_KDB_CREATE_HASH 0x00000002
0107
0108
0109
0110 #define KRB5_KDB_FLAG_REFERRAL_OK 0x00000010
0111
0112 #define KRB5_KDB_FLAG_CLIENT 0x00000040
0113
0114 #define KRB5_KDB_FLAG_MAP_PRINCIPALS 0x00000080
0115
0116 #define KRB5_KDB_FLAG_PROTOCOL_TRANSITION 0x00000100
0117
0118 #define KRB5_KDB_FLAG_CONSTRAINED_DELEGATION 0x00000200
0119
0120 #define KRB5_KDB_FLAG_USER_TO_USER 0x00000800
0121
0122 #define KRB5_KDB_FLAG_CROSS_REALM 0x00001000
0123
0124 #define KRB5_KDB_FLAG_ISSUING_REFERRAL 0x00004000
0125
0126
0127 #define KRB5_KDB_FLAGS_S4U ( KRB5_KDB_FLAG_PROTOCOL_TRANSITION | \
0128 KRB5_KDB_FLAG_CONSTRAINED_DELEGATION )
0129
0130
0131 #define KRB5_DB_ITER_WRITE 0x00000001
0132 #define KRB5_DB_ITER_REV 0x00000002
0133 #define KRB5_DB_ITER_RECURSE 0x00000004
0134
0135
0136 #define KRB5_KDB_SK_PAC_PRIVSVR_ENCTYPE "pac_privsvr_enctype"
0137 #define KRB5_KDB_SK_SESSION_ENCTYPES "session_enctypes"
0138 #define KRB5_KDB_SK_REQUIRE_AUTH "require_auth"
0139
0140 #if !defined(_WIN32)
0141
0142
0143
0144
0145
0146
0147 typedef struct _krb5_tl_data {
0148 struct _krb5_tl_data* tl_data_next;
0149 krb5_int16 tl_data_type;
0150 krb5_ui_2 tl_data_length;
0151 krb5_octet * tl_data_contents;
0152 } krb5_tl_data;
0153
0154
0155
0156 typedef struct krb5_string_attr_st {
0157 char *key;
0158 char *value;
0159 } krb5_string_attr;
0160
0161
0162
0163
0164
0165
0166
0167 typedef struct _krb5_key_data {
0168 krb5_int16 key_data_ver;
0169 krb5_ui_2 key_data_kvno;
0170 krb5_int16 key_data_type[2];
0171 krb5_ui_2 key_data_length[2];
0172 krb5_octet * key_data_contents[2];
0173 } krb5_key_data;
0174
0175 #define KRB5_KDB_V1_KEY_DATA_ARRAY 2
0176
0177 typedef struct _krb5_keysalt {
0178 krb5_int16 type;
0179 krb5_data data;
0180 } krb5_keysalt;
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191 typedef struct _krb5_db_entry_new {
0192 krb5_magic magic;
0193 krb5_ui_2 len;
0194 krb5_ui_4 mask;
0195 krb5_flags attributes;
0196 krb5_deltat max_life;
0197 krb5_deltat max_renewable_life;
0198 krb5_timestamp expiration;
0199 krb5_timestamp pw_expiration;
0200 krb5_timestamp last_success;
0201 krb5_timestamp last_failed;
0202 krb5_kvno fail_auth_count;
0203 krb5_int16 n_tl_data;
0204 krb5_int16 n_key_data;
0205 krb5_ui_2 e_length;
0206 krb5_octet * e_data;
0207
0208 krb5_principal princ;
0209 krb5_tl_data * tl_data;
0210
0211
0212 krb5_key_data * key_data;
0213 } krb5_db_entry;
0214
0215 typedef struct _osa_policy_ent_t {
0216 int version;
0217 char *name;
0218 krb5_ui_4 pw_min_life;
0219 krb5_ui_4 pw_max_life;
0220 krb5_ui_4 pw_min_length;
0221 krb5_ui_4 pw_min_classes;
0222 krb5_ui_4 pw_history_num;
0223 krb5_ui_4 policy_refcnt;
0224
0225 krb5_ui_4 pw_max_fail;
0226 krb5_ui_4 pw_failcnt_interval;
0227 krb5_ui_4 pw_lockout_duration;
0228
0229 krb5_ui_4 attributes;
0230 krb5_ui_4 max_life;
0231 krb5_ui_4 max_renewable_life;
0232 char * allowed_keysalts;
0233 krb5_int16 n_tl_data;
0234 krb5_tl_data * tl_data;
0235 } osa_policy_ent_rec, *osa_policy_ent_t;
0236
0237 typedef void (*osa_adb_iter_policy_func) (void *, osa_policy_ent_t);
0238
0239 typedef struct __krb5_key_salt_tuple {
0240 krb5_enctype ks_enctype;
0241 krb5_int32 ks_salttype;
0242 } krb5_key_salt_tuple;
0243
0244 #define KRB5_KDB_MAGIC_NUMBER 0xdbdbdbdb
0245 #define KRB5_KDB_V1_BASE_LENGTH 38
0246
0247 #define KRB5_KDB_MAX_ALLOWED_KS_LEN 512
0248
0249 #define KRB5_TL_LAST_PWD_CHANGE 0x0001
0250 #define KRB5_TL_MOD_PRINC 0x0002
0251 #define KRB5_TL_KADM_DATA 0x0003
0252 #define KRB5_TL_KADM5_E_DATA 0x0004
0253 #define KRB5_TL_RB1_CHALLENGE 0x0005
0254 #ifdef SECURID
0255 #define KRB5_TL_SECURID_STATE 0x0006
0256 #endif
0257 #define KRB5_TL_USER_CERTIFICATE 0x0007
0258 #define KRB5_TL_MKVNO 0x0008
0259 #define KRB5_TL_ACTKVNO 0x0009
0260 #define KRB5_TL_MKEY_AUX 0x000a
0261
0262
0263
0264 #define KRB5_TL_STRING_ATTRS 0x000b
0265
0266 #define KRB5_TL_ALIAS_TARGET 0x000c
0267
0268 #define KRB5_TL_PAC_LOGON_INFO 0x0100
0269 #define KRB5_TL_SERVER_REFERRAL 0x0200
0270 #define KRB5_TL_SVR_REFERRAL_DATA 0x0300
0271 #define KRB5_TL_CONSTRAINED_DELEGATION_ACL 0x0400
0272 #define KRB5_TL_LM_KEY 0x0500
0273 #define KRB5_TL_X509_SUBJECT_ISSUER_NAME 0x0600
0274 #define KRB5_TL_LAST_ADMIN_UNLOCK 0x0700
0275
0276 #define KRB5_TL_DB_ARGS 0x7fff
0277
0278
0279 #define KRB5_TL_ACTKVNO_VER 1
0280
0281
0282 #define KRB5_TL_MKEY_AUX_VER 1
0283
0284 typedef struct _krb5_actkvno_node {
0285 struct _krb5_actkvno_node *next;
0286 krb5_kvno act_kvno;
0287 krb5_timestamp act_time;
0288 } krb5_actkvno_node;
0289
0290 typedef struct _krb5_mkey_aux_node {
0291 struct _krb5_mkey_aux_node *next;
0292 krb5_kvno mkey_kvno;
0293 krb5_key_data latest_mkey;
0294 } krb5_mkey_aux_node;
0295
0296 typedef struct _krb5_keylist_node {
0297 krb5_keyblock keyblock;
0298 krb5_kvno kvno;
0299 struct _krb5_keylist_node *next;
0300 } krb5_keylist_node;
0301
0302
0303
0304
0305
0306 #define KRB5_MAX_FAIL_COUNT 5
0307
0308
0309 #define KRB5_KDB_M_NAME "K/M"
0310
0311
0312 #define KRB5_KDC_MKEY_1 "Enter KDC database master key"
0313 #define KRB5_KDC_MKEY_2 "Re-enter KDC database master key to verify"
0314
0315
0316 extern char *krb5_mkey_pwd_prompt1;
0317 extern char *krb5_mkey_pwd_prompt2;
0318
0319
0320
0321
0322
0323
0324 #ifdef _KRB5_INT_H
0325 #include "k5-platform.h"
0326 #define krb5_kdb_decode_int16(cp, i16) \
0327 *((krb5_int16 *) &(i16)) = load_16_le(cp)
0328 #define krb5_kdb_decode_int32(cp, i32) \
0329 *((krb5_int32 *) &(i32)) = load_32_le(cp)
0330 #define krb5_kdb_encode_int16(i16, cp) store_16_le(i16, cp)
0331 #define krb5_kdb_encode_int32(i32, cp) store_32_le(i32, cp)
0332 #endif
0333
0334 #define KRB5_KDB_OPEN_RW 0
0335 #define KRB5_KDB_OPEN_RO 1
0336
0337 #ifndef KRB5_KDB_SRV_TYPE_KDC
0338 #define KRB5_KDB_SRV_TYPE_KDC 0x0100
0339 #endif
0340
0341 #ifndef KRB5_KDB_SRV_TYPE_ADMIN
0342 #define KRB5_KDB_SRV_TYPE_ADMIN 0x0200
0343 #endif
0344
0345
0346
0347 #ifndef KRB5_KDB_SRV_TYPE_OTHER
0348 #define KRB5_KDB_SRV_TYPE_OTHER 0x0400
0349 #endif
0350
0351 #define KRB5_KDB_OPT_SET_DB_NAME 0
0352 #define KRB5_KDB_OPT_SET_LOCK_MODE 1
0353
0354 #define KRB5_DB_LOCKMODE_SHARED 0x0001
0355 #define KRB5_DB_LOCKMODE_EXCLUSIVE 0x0002
0356 #define KRB5_DB_LOCKMODE_PERMANENT 0x0008
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367 krb5_error_code krb5_db_load_module(krb5_context kcontext, const char *name);
0368
0369 krb5_error_code krb5_db_setup_lib_handle(krb5_context kcontext);
0370 krb5_error_code krb5_db_open( krb5_context kcontext, char **db_args, int mode );
0371 krb5_error_code krb5_db_init ( krb5_context kcontext );
0372 krb5_error_code krb5_db_create ( krb5_context kcontext, char **db_args );
0373 krb5_error_code krb5_db_inited ( krb5_context kcontext );
0374 krb5_error_code kdb5_db_create ( krb5_context kcontext, char **db_args );
0375 krb5_error_code krb5_db_fini ( krb5_context kcontext );
0376 const char * krb5_db_errcode2string ( krb5_context kcontext, long err_code );
0377 krb5_error_code krb5_db_destroy ( krb5_context kcontext, char **db_args );
0378 krb5_error_code krb5_db_promote ( krb5_context kcontext, char **db_args );
0379 krb5_error_code krb5_db_get_age ( krb5_context kcontext, char *db_name, time_t *t );
0380 krb5_error_code krb5_db_lock ( krb5_context kcontext, int lock_mode );
0381 krb5_error_code krb5_db_unlock ( krb5_context kcontext );
0382 krb5_error_code krb5_db_get_principal ( krb5_context kcontext,
0383 krb5_const_principal search_for,
0384 unsigned int flags,
0385 krb5_db_entry **entry );
0386 void krb5_db_free_principal ( krb5_context kcontext, krb5_db_entry *entry );
0387 krb5_error_code krb5_db_put_principal ( krb5_context kcontext,
0388 krb5_db_entry *entry );
0389 krb5_error_code krb5_db_delete_principal ( krb5_context kcontext,
0390 krb5_principal search_for );
0391 krb5_error_code krb5_db_rename_principal ( krb5_context kcontext,
0392 krb5_principal source,
0393 krb5_principal target );
0394
0395
0396
0397
0398
0399
0400 krb5_error_code krb5_db_iterate ( krb5_context kcontext,
0401 char *match_entry,
0402 int (*func) (krb5_pointer, krb5_db_entry *),
0403 krb5_pointer func_arg, krb5_flags iterflags );
0404
0405
0406 krb5_error_code krb5_db_store_master_key ( krb5_context kcontext,
0407 char *keyfile,
0408 krb5_principal mname,
0409 krb5_kvno kvno,
0410 krb5_keyblock *key,
0411 char *master_pwd);
0412 krb5_error_code krb5_db_store_master_key_list ( krb5_context kcontext,
0413 char *keyfile,
0414 krb5_principal mname,
0415 char *master_pwd);
0416 krb5_error_code krb5_db_fetch_mkey ( krb5_context context,
0417 krb5_principal mname,
0418 krb5_enctype etype,
0419 krb5_boolean fromkeyboard,
0420 krb5_boolean twice,
0421 char *db_args,
0422 krb5_kvno *kvno,
0423 krb5_data *salt,
0424 krb5_keyblock *key);
0425 krb5_error_code
0426 krb5_db_fetch_mkey_list( krb5_context context,
0427 krb5_principal mname,
0428 const krb5_keyblock * mkey );
0429
0430 krb5_error_code
0431 krb5_dbe_find_enctype( krb5_context kcontext,
0432 krb5_db_entry *dbentp,
0433 krb5_int32 ktype,
0434 krb5_int32 stype,
0435 krb5_int32 kvno,
0436 krb5_key_data **kdatap);
0437
0438
0439 krb5_error_code krb5_dbe_search_enctype ( krb5_context kcontext,
0440 krb5_db_entry *dbentp,
0441 krb5_int32 *start,
0442 krb5_int32 ktype,
0443 krb5_int32 stype,
0444 krb5_int32 kvno,
0445 krb5_key_data **kdatap);
0446
0447 krb5_error_code
0448 krb5_db_setup_mkey_name ( krb5_context context,
0449 const char *keyname,
0450 const char *realm,
0451 char **fullname,
0452 krb5_principal *principal);
0453
0454
0455
0456
0457
0458 krb5_error_code
0459 krb5_dbe_decrypt_key_data( krb5_context context,
0460 const krb5_keyblock * mkey,
0461 const krb5_key_data * key_data,
0462 krb5_keyblock * dbkey,
0463 krb5_keysalt * keysalt);
0464
0465 krb5_error_code
0466 krb5_dbe_encrypt_key_data( krb5_context context,
0467 const krb5_keyblock * mkey,
0468 const krb5_keyblock * dbkey,
0469 const krb5_keysalt * keysalt,
0470 int keyver,
0471 krb5_key_data * key_data);
0472
0473 krb5_error_code
0474 krb5_dbe_fetch_act_key_list(krb5_context context,
0475 krb5_principal princ,
0476 krb5_actkvno_node **act_key_list);
0477
0478 krb5_error_code
0479 krb5_dbe_find_act_mkey( krb5_context context,
0480 krb5_actkvno_node * act_mkey_list,
0481 krb5_kvno * act_kvno,
0482 krb5_keyblock ** act_mkey);
0483
0484 krb5_error_code
0485 krb5_dbe_find_mkey( krb5_context context,
0486 krb5_db_entry * entry,
0487 krb5_keyblock ** mkey);
0488
0489
0490 krb5_error_code
0491 krb5_dbe_lookup_mkvno( krb5_context context,
0492 krb5_db_entry * entry,
0493 krb5_kvno * mkvno);
0494
0495 krb5_keylist_node *
0496 krb5_db_mkey_list_alias( krb5_context kcontext );
0497
0498
0499 krb5_error_code
0500 krb5_dbe_get_mkvno( krb5_context context,
0501 krb5_db_entry * entry,
0502 krb5_kvno * mkvno);
0503
0504 krb5_error_code
0505 krb5_dbe_lookup_mod_princ_data( krb5_context context,
0506 krb5_db_entry * entry,
0507 krb5_timestamp * mod_time,
0508 krb5_principal * mod_princ);
0509
0510 krb5_error_code
0511 krb5_dbe_lookup_mkey_aux( krb5_context context,
0512 krb5_db_entry * entry,
0513 krb5_mkey_aux_node ** mkey_aux_data_list);
0514 krb5_error_code
0515 krb5_dbe_update_mkvno( krb5_context context,
0516 krb5_db_entry * entry,
0517 krb5_kvno mkvno);
0518
0519 krb5_error_code
0520 krb5_dbe_lookup_actkvno( krb5_context context,
0521 krb5_db_entry * entry,
0522 krb5_actkvno_node ** actkvno_list);
0523
0524 krb5_error_code
0525 krb5_dbe_update_mkey_aux( krb5_context context,
0526 krb5_db_entry * entry,
0527 krb5_mkey_aux_node * mkey_aux_data_list);
0528
0529 krb5_error_code
0530 krb5_dbe_update_actkvno(krb5_context context,
0531 krb5_db_entry * entry,
0532 const krb5_actkvno_node *actkvno_list);
0533
0534 krb5_error_code
0535 krb5_dbe_update_last_pwd_change( krb5_context context,
0536 krb5_db_entry * entry,
0537 krb5_timestamp stamp);
0538
0539 krb5_error_code
0540 krb5_dbe_update_last_admin_unlock( krb5_context context,
0541 krb5_db_entry * entry,
0542 krb5_timestamp stamp);
0543
0544 krb5_error_code
0545 krb5_dbe_lookup_tl_data( krb5_context context,
0546 krb5_db_entry * entry,
0547 krb5_tl_data * ret_tl_data);
0548
0549 krb5_error_code
0550 krb5_dbe_create_key_data( krb5_context context,
0551 krb5_db_entry * entry);
0552
0553
0554 krb5_error_code
0555 krb5_dbe_update_mod_princ_data( krb5_context context,
0556 krb5_db_entry * entry,
0557 krb5_timestamp mod_date,
0558 krb5_const_principal mod_princ);
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569 void *krb5_db_alloc( krb5_context kcontext,
0570 void *ptr,
0571 size_t size );
0572 void krb5_db_free( krb5_context kcontext,
0573 void *ptr);
0574
0575
0576 krb5_error_code
0577 krb5_dbe_lookup_last_pwd_change( krb5_context context,
0578 krb5_db_entry * entry,
0579 krb5_timestamp * stamp);
0580
0581 krb5_error_code
0582 krb5_dbe_lookup_last_admin_unlock( krb5_context context,
0583 krb5_db_entry * entry,
0584 krb5_timestamp * stamp);
0585
0586
0587
0588 krb5_error_code
0589 krb5_dbe_get_strings(krb5_context context, krb5_db_entry *entry,
0590 krb5_string_attr **strings_out, int *count_out);
0591
0592
0593
0594 krb5_error_code
0595 krb5_dbe_get_string(krb5_context context, krb5_db_entry *entry,
0596 const char *key, char **value_out);
0597
0598
0599 krb5_error_code
0600 krb5_dbe_set_string(krb5_context context, krb5_db_entry *entry,
0601 const char *key, const char *value);
0602
0603 krb5_error_code
0604 krb5_dbe_delete_tl_data( krb5_context context,
0605 krb5_db_entry * entry,
0606 krb5_int16 tl_data_type);
0607
0608 krb5_error_code
0609 krb5_db_update_tl_data(krb5_context context,
0610 krb5_int16 * n_tl_datap,
0611 krb5_tl_data **tl_datap,
0612 krb5_tl_data * new_tl_data);
0613
0614 krb5_error_code
0615 krb5_dbe_update_tl_data( krb5_context context,
0616 krb5_db_entry * entry,
0617 krb5_tl_data * new_tl_data);
0618
0619
0620 krb5_error_code
0621 krb5_dbe_compute_salt(krb5_context context, const krb5_key_data *key,
0622 krb5_const_principal princ, krb5_int16 *salttype_out,
0623 krb5_data **salt_out);
0624
0625
0626
0627
0628
0629 krb5_error_code
0630 krb5_dbe_specialize_salt(krb5_context context, krb5_db_entry *entry);
0631
0632 krb5_error_code
0633 krb5_dbe_cpw( krb5_context kcontext,
0634 krb5_keyblock * master_key,
0635 krb5_key_salt_tuple * ks_tuple,
0636 int ks_tuple_count,
0637 char * passwd,
0638 int new_kvno,
0639 unsigned int keepold,
0640 krb5_db_entry * db_entry);
0641
0642
0643 krb5_error_code
0644 krb5_dbe_ark( krb5_context context,
0645 krb5_keyblock * master_key,
0646 krb5_key_salt_tuple * ks_tuple,
0647 int ks_tuple_count,
0648 krb5_db_entry * db_entry);
0649
0650 krb5_error_code
0651 krb5_dbe_crk( krb5_context context,
0652 krb5_keyblock * master_key,
0653 krb5_key_salt_tuple * ks_tuple,
0654 int ks_tuple_count,
0655 unsigned int keepold,
0656 krb5_db_entry * db_entry);
0657
0658 krb5_error_code
0659 krb5_dbe_apw( krb5_context context,
0660 krb5_keyblock * master_key,
0661 krb5_key_salt_tuple * ks_tuple,
0662 int ks_tuple_count,
0663 char * passwd,
0664 krb5_db_entry * db_entry);
0665
0666 int
0667 krb5_db_get_key_data_kvno( krb5_context context,
0668 int count,
0669 krb5_key_data * data);
0670
0671 krb5_error_code krb5_db_check_transited_realms(krb5_context kcontext,
0672 const krb5_data *tr_contents,
0673 const krb5_data *client_realm,
0674 const krb5_data *server_realm);
0675
0676 krb5_error_code krb5_db_check_policy_as(krb5_context kcontext,
0677 krb5_kdc_req *request,
0678 krb5_db_entry *client,
0679 krb5_db_entry *server,
0680 krb5_timestamp kdc_time,
0681 const char **status,
0682 krb5_pa_data ***e_data);
0683
0684 krb5_error_code krb5_db_check_policy_tgs(krb5_context kcontext,
0685 krb5_kdc_req *request,
0686 krb5_db_entry *server,
0687 krb5_ticket *ticket,
0688 const char **status,
0689 krb5_pa_data ***e_data);
0690
0691 void krb5_db_audit_as_req(krb5_context kcontext, krb5_kdc_req *request,
0692 const krb5_address *local_addr,
0693 const krb5_address *remote_addr,
0694 krb5_db_entry *client, krb5_db_entry *server,
0695 krb5_timestamp authtime, krb5_error_code error_code);
0696
0697 void krb5_db_refresh_config(krb5_context kcontext);
0698
0699 krb5_error_code krb5_db_check_allowed_to_delegate(krb5_context kcontext,
0700 krb5_const_principal client,
0701 const krb5_db_entry *server,
0702 krb5_const_principal proxy);
0703
0704 krb5_error_code krb5_db_get_s4u_x509_principal(krb5_context kcontext,
0705 const krb5_data *client_cert,
0706 krb5_const_principal in_princ,
0707 unsigned int flags,
0708 krb5_db_entry **entry);
0709
0710 krb5_error_code krb5_db_allowed_to_delegate_from(krb5_context context,
0711 krb5_const_principal client,
0712 krb5_const_principal server,
0713 krb5_pac server_pac,
0714 const krb5_db_entry *proxy);
0715
0716
0717
0718
0719
0720
0721
0722
0723
0724
0725
0726 void
0727 krb5_dbe_sort_key_data(krb5_key_data *key_data, size_t key_data_length);
0728
0729 krb5_error_code
0730 krb5_db_issue_pac(krb5_context context, unsigned int flags,
0731 krb5_db_entry *client, krb5_keyblock *replaced_reply_key,
0732 krb5_db_entry *server, krb5_db_entry *krbtgt,
0733 krb5_timestamp authtime, krb5_pac old_pac, krb5_pac new_pac,
0734 krb5_data ***auth_indicators);
0735
0736
0737
0738
0739
0740
0741 krb5_error_code
0742 krb5_dbe_def_search_enctype( krb5_context kcontext,
0743 krb5_db_entry *dbentp,
0744 krb5_int32 *start,
0745 krb5_int32 ktype,
0746 krb5_int32 stype,
0747 krb5_int32 kvno,
0748 krb5_key_data **kdatap);
0749
0750 krb5_error_code
0751 krb5_def_store_mkey_list( krb5_context context,
0752 char *keyfile,
0753 krb5_principal mname,
0754 krb5_keylist_node *keylist,
0755 char *master_pwd);
0756
0757 krb5_error_code
0758 krb5_db_def_fetch_mkey( krb5_context context,
0759 krb5_principal mname,
0760 krb5_keyblock *key,
0761 krb5_kvno *kvno,
0762 char *db_args);
0763
0764 krb5_error_code
0765 krb5_def_fetch_mkey_list( krb5_context context,
0766 krb5_principal mprinc,
0767 const krb5_keyblock *mkey,
0768 krb5_keylist_node **mkeys_list);
0769
0770 krb5_error_code
0771 krb5_dbe_def_cpw( krb5_context context,
0772 krb5_keyblock * master_key,
0773 krb5_key_salt_tuple * ks_tuple,
0774 int ks_tuple_count,
0775 char * passwd,
0776 int new_kvno,
0777 unsigned int keepold,
0778 krb5_db_entry * db_entry);
0779
0780 krb5_error_code
0781 krb5_dbe_def_decrypt_key_data( krb5_context context,
0782 const krb5_keyblock * mkey,
0783 const krb5_key_data * key_data,
0784 krb5_keyblock * dbkey,
0785 krb5_keysalt * keysalt);
0786
0787 krb5_error_code
0788 krb5_dbe_def_encrypt_key_data( krb5_context context,
0789 const krb5_keyblock * mkey,
0790 const krb5_keyblock * dbkey,
0791 const krb5_keysalt * keysalt,
0792 int keyver,
0793 krb5_key_data * key_data);
0794
0795 krb5_error_code
0796 krb5_db_def_rename_principal( krb5_context kcontext,
0797 krb5_const_principal source,
0798 krb5_const_principal target);
0799
0800 krb5_error_code
0801 krb5_db_create_policy( krb5_context kcontext,
0802 osa_policy_ent_t policy);
0803
0804 krb5_error_code
0805 krb5_db_get_policy ( krb5_context kcontext,
0806 char *name,
0807 osa_policy_ent_t *policy );
0808
0809 krb5_error_code
0810 krb5_db_put_policy( krb5_context kcontext,
0811 osa_policy_ent_t policy);
0812
0813 krb5_error_code
0814 krb5_db_iter_policy( krb5_context kcontext,
0815 char *match_entry,
0816 osa_adb_iter_policy_func func,
0817 void *data);
0818
0819 krb5_error_code
0820 krb5_db_delete_policy( krb5_context kcontext,
0821 char *policy);
0822
0823 void
0824 krb5_db_free_policy( krb5_context kcontext,
0825 osa_policy_ent_t policy);
0826
0827
0828 krb5_error_code
0829 krb5_db_set_context(krb5_context, void *db_context);
0830
0831 krb5_error_code
0832 krb5_db_get_context(krb5_context, void **db_context);
0833
0834 void
0835 krb5_dbe_free_key_data_contents(krb5_context, krb5_key_data *);
0836
0837 void
0838 krb5_dbe_free_key_list(krb5_context, krb5_keylist_node *);
0839
0840 void
0841 krb5_dbe_free_actkvno_list(krb5_context, krb5_actkvno_node *);
0842
0843 void
0844 krb5_dbe_free_mkey_aux_list(krb5_context, krb5_mkey_aux_node *);
0845
0846 void
0847 krb5_dbe_free_tl_data(krb5_context, krb5_tl_data *);
0848
0849 void
0850 krb5_dbe_free_strings(krb5_context, krb5_string_attr *, int count);
0851
0852 void
0853 krb5_dbe_free_string(krb5_context, char *);
0854
0855
0856 krb5_error_code
0857 krb5_dbe_make_alias_entry(krb5_context context, krb5_const_principal alias,
0858 krb5_const_principal target, krb5_db_entry **out);
0859
0860
0861
0862 krb5_error_code
0863 krb5_dbe_read_alias(krb5_context context, krb5_db_entry *entry,
0864 krb5_principal *target_out);
0865
0866
0867
0868
0869
0870
0871 krb5_error_code krb5_db_register_keytab(krb5_context context);
0872
0873 #define KRB5_KDB_DEF_FLAGS 0
0874
0875 #define KDB_MAX_DB_NAME 128
0876 #define KDB_REALM_SECTION "realms"
0877 #define KDB_MODULE_POINTER "database_module"
0878 #define KDB_MODULE_DEF_SECTION "dbdefaults"
0879 #define KDB_MODULE_SECTION "dbmodules"
0880 #define KDB_LIB_POINTER "db_library"
0881 #define KDB_DATABASE_CONF_FILE DEFAULT_SECURE_PROFILE_PATH
0882 #define KDB_DATABASE_ENV_PROF KDC_PROFILE_ENV
0883
0884 #define KRB5_KDB_OPEN_RW 0
0885 #define KRB5_KDB_OPEN_RO 1
0886
0887 #define KRB5_KDB_OPT_SET_DB_NAME 0
0888 #define KRB5_KDB_OPT_SET_LOCK_MODE 1
0889
0890
0891
0892
0893
0894 #define KRB5_KDB_DAL_MAJOR_VERSION 9
0895
0896
0897
0898
0899
0900
0901
0902
0903
0904
0905
0906
0907
0908
0909
0910
0911
0912
0913
0914
0915
0916
0917
0918
0919
0920
0921
0922
0923
0924
0925
0926
0927
0928
0929
0930
0931
0932
0933
0934
0935
0936
0937
0938
0939
0940
0941
0942
0943
0944
0945
0946
0947
0948 typedef struct _kdb_vftabl {
0949 short int maj_ver;
0950 short int min_ver;
0951
0952
0953
0954
0955
0956 krb5_error_code (*init_library)(void);
0957
0958
0959
0960
0961
0962 krb5_error_code (*fini_library)(void);
0963
0964
0965
0966
0967
0968
0969
0970
0971 krb5_error_code (*init_module)(krb5_context kcontext, char *conf_section,
0972 char **db_args, int mode);
0973
0974
0975
0976
0977
0978 krb5_error_code (*fini_module)(krb5_context kcontext);
0979
0980
0981
0982
0983
0984
0985
0986
0987
0988
0989
0990
0991
0992
0993 krb5_error_code (*create)(krb5_context kcontext, char *conf_section,
0994 char **db_args);
0995
0996
0997
0998
0999
1000
1001
1002 krb5_error_code (*destroy)(krb5_context kcontext, char *conf_section,
1003 char **db_args);
1004
1005
1006
1007
1008
1009 krb5_error_code (*get_age)(krb5_context kcontext, char *db_name,
1010 time_t *age);
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025 krb5_error_code (*lock)(krb5_context kcontext, int mode);
1026
1027
1028 krb5_error_code (*unlock)(krb5_context kcontext);
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081 krb5_error_code (*get_principal)(krb5_context kcontext,
1082 krb5_const_principal search_for,
1083 unsigned int flags,
1084 krb5_db_entry **entry);
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101 krb5_error_code (*put_principal)(krb5_context kcontext,
1102 krb5_db_entry *entry, char **db_args);
1103
1104
1105
1106
1107
1108
1109 krb5_error_code (*delete_principal)(krb5_context kcontext,
1110 krb5_const_principal search_for);
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121 krb5_error_code (*rename_principal)(krb5_context kcontext,
1122 krb5_const_principal source,
1123 krb5_const_principal target);
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135 krb5_error_code (*iterate)(krb5_context kcontext,
1136 char *match_entry,
1137 int (*func)(krb5_pointer, krb5_db_entry *),
1138 krb5_pointer func_arg, krb5_flags iterflags);
1139
1140
1141
1142
1143
1144 krb5_error_code (*create_policy)(krb5_context kcontext,
1145 osa_policy_ent_t policy);
1146
1147
1148
1149
1150
1151 krb5_error_code (*get_policy)(krb5_context kcontext, char *name,
1152 osa_policy_ent_t *policy);
1153
1154
1155
1156
1157
1158 krb5_error_code (*put_policy)(krb5_context kcontext,
1159 osa_policy_ent_t policy);
1160
1161
1162
1163
1164
1165
1166
1167 krb5_error_code (*iter_policy)(krb5_context kcontext, char *match_entry,
1168 osa_adb_iter_policy_func func,
1169 void *data);
1170
1171
1172
1173
1174
1175 krb5_error_code (*delete_policy)(krb5_context kcontext, char *policy);
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185 krb5_error_code (*fetch_master_key)(krb5_context kcontext,
1186 krb5_principal mname,
1187 krb5_keyblock *key, krb5_kvno *kvno,
1188 char *db_args);
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204 krb5_error_code (*fetch_master_key_list)(krb5_context kcontext,
1205 krb5_principal mname,
1206 const krb5_keyblock *key,
1207 krb5_keylist_node **mkeys_list);
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218 krb5_error_code (*store_master_key_list)(krb5_context kcontext,
1219 char *db_arg,
1220 krb5_principal mname,
1221 krb5_keylist_node *keylist,
1222 char *master_pwd);
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233 krb5_error_code (*dbe_search_enctype)(krb5_context kcontext,
1234 krb5_db_entry *dbentp,
1235 krb5_int32 *start, krb5_int32 ktype,
1236 krb5_int32 stype, krb5_int32 kvno,
1237 krb5_key_data **kdatap);
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249 krb5_error_code (*change_pwd)(krb5_context context,
1250 krb5_keyblock *master_key,
1251 krb5_key_salt_tuple *ks_tuple,
1252 int ks_tuple_count, char *passwd,
1253 int new_kvno, unsigned int keepold,
1254 krb5_db_entry *db_entry);
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265 krb5_error_code (*promote_db)(krb5_context context, char *conf_section,
1266 char **db_args);
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280 krb5_error_code (*decrypt_key_data)(krb5_context kcontext,
1281 const krb5_keyblock *mkey,
1282 const krb5_key_data *key_data,
1283 krb5_keyblock *dbkey,
1284 krb5_keysalt *keysalt);
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296 krb5_error_code (*encrypt_key_data)(krb5_context kcontext,
1297 const krb5_keyblock *mkey,
1298 const krb5_keyblock *dbkey,
1299 const krb5_keysalt *keysalt,
1300 int keyver, krb5_key_data *key_data);
1301
1302
1303
1304
1305
1306
1307
1308 krb5_error_code (*check_transited_realms)(krb5_context kcontext,
1309 const krb5_data *tr_contents,
1310 const krb5_data *client_realm,
1311 const krb5_data *server_realm);
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322 krb5_error_code (*check_policy_as)(krb5_context kcontext,
1323 krb5_kdc_req *request,
1324 krb5_db_entry *client,
1325 krb5_db_entry *server,
1326 krb5_timestamp kdc_time,
1327 const char **status,
1328 krb5_pa_data ***e_data);
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340 krb5_error_code (*check_policy_tgs)(krb5_context kcontext,
1341 krb5_kdc_req *request,
1342 krb5_db_entry *server,
1343 krb5_ticket *ticket,
1344 const char **status,
1345 krb5_pa_data ***e_data);
1346
1347
1348
1349
1350
1351 void (*audit_as_req)(krb5_context kcontext, krb5_kdc_req *request,
1352 const krb5_address *local_addr,
1353 const krb5_address *remote_addr,
1354 krb5_db_entry *client, krb5_db_entry *server,
1355 krb5_timestamp authtime, krb5_error_code error_code);
1356
1357
1358
1359
1360
1361
1362
1363 void (*refresh_config)(krb5_context kcontext);
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378 krb5_error_code (*check_allowed_to_delegate)(krb5_context context,
1379 krb5_const_principal client,
1380 const krb5_db_entry *server,
1381 krb5_const_principal proxy);
1382
1383
1384
1385
1386
1387
1388 void (*free_principal_e_data)(krb5_context kcontext, krb5_octet *e_data);
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403 krb5_error_code (*get_s4u_x509_principal)(krb5_context kcontext,
1404 const krb5_data *client_cert,
1405 krb5_const_principal princ,
1406 unsigned int flags,
1407 krb5_db_entry **entry_out);
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425 krb5_error_code (*allowed_to_delegate_from)(krb5_context context,
1426 krb5_const_principal client,
1427 krb5_const_principal server,
1428 krb5_pac server_pac,
1429 const krb5_db_entry *proxy);
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475 krb5_error_code (*issue_pac)(krb5_context context, unsigned int flags,
1476 krb5_db_entry *client,
1477 krb5_keyblock *replaced_reply_key,
1478 krb5_db_entry *server,
1479 krb5_db_entry *signing_krbtgt,
1480 krb5_timestamp authtime, krb5_pac old_pac,
1481 krb5_pac new_pac,
1482 krb5_data ***auth_indicators);
1483
1484
1485 } kdb_vftabl;
1486
1487 #endif
1488
1489 #endif