diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/kdb/kdb5.c | 142 | ||||
-rw-r--r-- | src/lib/kdb/kdb5.h | 5 | ||||
-rw-r--r-- | src/lib/krb5/krb/init_ctx.c | 4 | ||||
-rw-r--r-- | src/lib/krb5/krb/ser_ctx.c | 12 |
4 files changed, 81 insertions, 82 deletions
diff --git a/src/lib/kdb/kdb5.c b/src/lib/kdb/kdb5.c index 168892974..bdade9904 100644 --- a/src/lib/kdb/kdb5.c +++ b/src/lib/kdb/kdb5.c @@ -542,7 +542,7 @@ kdb_setup_lib_handle(krb5_context kcontext) } dal_handle->lib_handle = lib; - kcontext->db_context = (void *) dal_handle; + kcontext->dal_handle = dal_handle; clean_n_exit: free(library); @@ -562,15 +562,13 @@ kdb_free_lib_handle(krb5_context kcontext) { krb5_error_code status = 0; - status = - kdb_free_library(((kdb5_dal_handle *) kcontext->db_context)-> - lib_handle); + status = kdb_free_library(kcontext->dal_handle->lib_handle); if (status) { goto clean_n_exit; } - free(kcontext->db_context); - kcontext->db_context = NULL; + free(kcontext->dal_handle); + kcontext->dal_handle = NULL; clean_n_exit: return status; @@ -585,8 +583,8 @@ get_errmsg (krb5_context kcontext, krb5_error_code err_code) return; assert(kcontext != NULL); /* Must be called with dal_handle->lib_handle locked! */ - assert(kcontext->db_context != NULL); - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + assert(kcontext->dal_handle != NULL); + dal_handle = kcontext->dal_handle; if (dal_handle->lib_handle->vftabl.errcode_2_string == NULL) return; e = dal_handle->lib_handle->vftabl.errcode_2_string(kcontext, err_code); @@ -615,14 +613,14 @@ krb5_db_open(krb5_context kcontext, char **db_args, int mode) goto clean_n_exit; } - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -644,8 +642,8 @@ krb5_db_open(krb5_context kcontext, char **db_args, int mode) krb5_error_code krb5_db_inited(krb5_context kcontext) { - return !(kcontext && kcontext->db_context && - ((kdb5_dal_handle *) kcontext->db_context)->db_context); + return !(kcontext && kcontext->dal_handle && + kcontext->dal_handle->db_context); } krb5_error_code @@ -664,14 +662,14 @@ krb5_db_create(krb5_context kcontext, char **db_args) goto clean_n_exit; } - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -695,12 +693,12 @@ krb5_db_fini(krb5_context kcontext) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { /* module not loaded. So nothing to be done */ goto clean_n_exit; } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -737,14 +735,14 @@ krb5_db_destroy(krb5_context kcontext, char **db_args) goto clean_n_exit; } - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -767,14 +765,14 @@ krb5_db_get_age(krb5_context kcontext, char *db_name, time_t * t) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -794,14 +792,14 @@ krb5_db_set_option(krb5_context kcontext, int option, void *value) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -822,14 +820,14 @@ krb5_db_lock(krb5_context kcontext, int lock_mode) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; /* acquire an exclusive lock, ensures no other thread uses this context */ status = kdb_lock_lib_lock(dal_handle->lib_handle, TRUE); if (status) { @@ -852,14 +850,14 @@ krb5_db_unlock(krb5_context kcontext) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; /* normal lock acquired and exclusive lock released */ status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { @@ -884,14 +882,14 @@ krb5_db_get_principal(krb5_context kcontext, krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -914,14 +912,14 @@ krb5_db_free_principal(krb5_context kcontext, krb5_db_entry * entry, int count) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -947,7 +945,7 @@ krb5_db_put_principal(krb5_context kcontext, krb5_tl_data *prev, *curr, *next; int db_args_size = 0; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; @@ -1002,7 +1000,7 @@ krb5_db_put_principal(krb5_context kcontext, } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1035,14 +1033,14 @@ krb5_db_delete_principal(krb5_context kcontext, krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1068,14 +1066,14 @@ krb5_db_iterate(krb5_context kcontext, krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1097,14 +1095,14 @@ krb5_supported_realms(krb5_context kcontext, char **realms) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1125,14 +1123,14 @@ krb5_free_supported_realms(krb5_context kcontext, char **realms) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1155,14 +1153,14 @@ krb5_db_set_master_key_ext(krb5_context kcontext, krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1189,14 +1187,14 @@ krb5_db_get_mkey(krb5_context kcontext, krb5_keyblock ** key) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1221,14 +1219,14 @@ krb5_db_store_master_key(krb5_context kcontext, krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1292,14 +1290,14 @@ krb5_db_fetch_mkey(krb5_context context, } else { kdb5_dal_handle *dal_handle; - if (context->db_context == NULL) { + if (context->dal_handle == NULL) { retval = kdb_setup_lib_handle(context); if (retval) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) context->db_context; + dal_handle = context->dal_handle; retval = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (retval) { goto clean_n_exit; @@ -1345,14 +1343,14 @@ krb5_db_verify_master_key(krb5_context kcontext, krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1374,14 +1372,14 @@ krb5_db_alloc(krb5_context kcontext, void *ptr, size_t size) kdb5_dal_handle *dal_handle; void *new_ptr = NULL; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; new_ptr = dal_handle->lib_handle->vftabl.db_alloc(kcontext, ptr, size); @@ -1395,14 +1393,14 @@ krb5_db_free(krb5_context kcontext, void *ptr) krb5_error_code status; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; dal_handle->lib_handle->vftabl.db_free(kcontext, ptr); @@ -1435,14 +1433,14 @@ krb5_dbe_search_enctype(krb5_context kcontext, krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1728,14 +1726,14 @@ krb5_dbe_cpw(krb5_context kcontext, krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1762,14 +1760,14 @@ krb5_db_create_policy(krb5_context kcontext, osa_policy_ent_t policy) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1790,14 +1788,14 @@ krb5_db_get_policy(krb5_context kcontext, char *name, krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1819,14 +1817,14 @@ krb5_db_put_policy(krb5_context kcontext, osa_policy_ent_t policy) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1847,14 +1845,14 @@ krb5_db_iter_policy(krb5_context kcontext, char *match_entry, krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1876,14 +1874,14 @@ krb5_db_delete_policy(krb5_context kcontext, char *policy) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1903,14 +1901,14 @@ krb5_db_free_policy(krb5_context kcontext, osa_policy_ent_t policy) krb5_error_code status = 0; kdb5_dal_handle *dal_handle; - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; @@ -1940,14 +1938,14 @@ krb5_db_promote(krb5_context kcontext, char **db_args) goto clean_n_exit; } - if (kcontext->db_context == NULL) { + if (kcontext->dal_handle == NULL) { status = kdb_setup_lib_handle(kcontext); if (status) { goto clean_n_exit; } } - dal_handle = (kdb5_dal_handle *) kcontext->db_context; + dal_handle = kcontext->dal_handle; status = kdb_lock_lib_lock(dal_handle->lib_handle, FALSE); if (status) { goto clean_n_exit; diff --git a/src/lib/kdb/kdb5.h b/src/lib/kdb/kdb5.h index f19b077e4..328ce2519 100644 --- a/src/lib/kdb/kdb5.h +++ b/src/lib/kdb/kdb5.h @@ -186,12 +186,13 @@ typedef struct _db_library { struct _db_library *next, *prev; } *db_library; -typedef struct _kdb5_dal_handle +struct _kdb5_dal_handle { /* Helps us to change db_library without affecting modules to some extent. */ void *db_context; db_library lib_handle; -} kdb5_dal_handle; +}; +/* typedef kdb5_dal_handle is in k5-int.h now */ #endif /* end of _KRB5_KDB5_H_ */ diff --git a/src/lib/krb5/krb/init_ctx.c b/src/lib/krb5/krb/init_ctx.c index 57f5b8fba..e29557066 100644 --- a/src/lib/krb5/krb/init_ctx.c +++ b/src/lib/krb5/krb/init_ctx.c @@ -1,7 +1,7 @@ /* * lib/krb5/krb/init_ctx.c * - * Copyright 1994,1999,2000, 2002, 2003, 2007 by the Massachusetts Institute of Technology. + * Copyright 1994,1999,2000, 2002, 2003, 2007, 2008 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -529,7 +529,7 @@ krb5_copy_context(krb5_context ctx, krb5_context *nctx_out) nctx->tgs_ktype_count = 0; nctx->default_realm = NULL; nctx->profile = NULL; - nctx->db_context = NULL; + nctx->dal_handle = NULL; nctx->ser_ctx_count = 0; nctx->ser_ctx = NULL; nctx->prompt_types = NULL; diff --git a/src/lib/krb5/krb/ser_ctx.c b/src/lib/krb5/krb/ser_ctx.c index 8a0088768..5854123ea 100644 --- a/src/lib/krb5/krb/ser_ctx.c +++ b/src/lib/krb5/krb/ser_ctx.c @@ -1,7 +1,7 @@ /* * lib/krb5/krb/ser_ctx.c * - * Copyright 1995, 2007 by the Massachusetts Institute of Technology. + * Copyright 1995, 2007, 2008 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -138,10 +138,10 @@ krb5_context_size(krb5_context kcontext, krb5_pointer arg, size_t *sizep) &required); /* Calculate size required by db_context, if appropriate */ - if (!kret && context->db_context) + if (!kret && context->dal_handle) kret = krb5_size_opaque(kcontext, KV5M_DB_CONTEXT, - (krb5_pointer) context->db_context, + (krb5_pointer) context->dal_handle, &required); /* Finally, calculate size required by profile, if appropriate */ @@ -288,9 +288,9 @@ krb5_context_externalize(krb5_context kcontext, krb5_pointer arg, krb5_octet **b return (kret); /* Now handle database context, if appropriate */ - if (context->db_context) { + if (context->dal_handle) { kret = krb5_externalize_opaque(kcontext, KV5M_DB_CONTEXT, - (krb5_pointer) context->db_context, + (krb5_pointer) context->dal_handle, &bp, &remain); if (kret) return (kret); @@ -465,7 +465,7 @@ krb5_context_internalize(krb5_context kcontext, krb5_pointer *argp, krb5_octet * /* Attempt to read in the db_context */ kret = krb5_internalize_opaque(kcontext, KV5M_DB_CONTEXT, - (krb5_pointer *) &context->db_context, + (krb5_pointer *) &context->dal_handle, &bp, &remain); if (kret && (kret != EINVAL) && (kret != ENOENT)) goto cleanup; |