diff options
author | Greg Hudson <ghudson@mit.edu> | 2010-07-02 17:58:41 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2010-07-02 17:58:41 +0000 |
commit | 323fa3f74a84ee28115c4df7c7c0ea9b5b231a76 (patch) | |
tree | 592fa921ea9e228daf990ddbaf4c9bbbbf6fcf6f /src/plugins/kdb/db2 | |
parent | 6dc8b18192b302b3208d13d8bda9cc3380d5fbec (diff) | |
download | krb5-323fa3f74a84ee28115c4df7c7c0ea9b5b231a76.zip krb5-323fa3f74a84ee28115c4df7c7c0ea9b5b231a76.tar.gz krb5-323fa3f74a84ee28115c4df7c7c0ea9b5b231a76.tar.bz2 |
Remove db_ and similar prefixes from DAL function names, for
consistency. Follow suit inside the DB2 and LDAP modules. (No change
to the caller-facing libkdb5 APIs.)
ticket: 6749
status: open
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24165 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/plugins/kdb/db2')
-rw-r--r-- | src/plugins/kdb/db2/db2_exp.c | 74 | ||||
-rw-r--r-- | src/plugins/kdb/db2/kdb_db2.c | 170 | ||||
-rw-r--r-- | src/plugins/kdb/db2/kdb_db2.h | 64 | ||||
-rw-r--r-- | src/plugins/kdb/db2/lockout.c | 2 |
4 files changed, 144 insertions, 166 deletions
diff --git a/src/plugins/kdb/db2/db2_exp.c b/src/plugins/kdb/db2/db2_exp.c index 384d2ee..87a3bf0 100644 --- a/src/plugins/kdb/db2/db2_exp.c +++ b/src/plugins/kdb/db2/db2_exp.c @@ -98,26 +98,26 @@ WRAP_K (krb5_db2_open, char **db_args, int mode ), (kcontext, conf_section, db_args, mode)); -WRAP_K (krb5_db2_db_fini, (krb5_context ctx), (ctx)); +WRAP_K (krb5_db2_fini, (krb5_context ctx), (ctx)); WRAP_K (krb5_db2_create, ( krb5_context kcontext, char *conf_section, char **db_args ), (kcontext, conf_section, db_args)); WRAP_K (krb5_db2_destroy, ( krb5_context kcontext, char *conf_section, char **db_args ), (kcontext, conf_section, db_args)); -WRAP_K (krb5_db2_db_get_age, +WRAP_K (krb5_db2_get_age, (krb5_context ctx, char *s, time_t *t), (ctx, s, t)); -WRAP_K (krb5_db2_db_lock, +WRAP_K (krb5_db2_lock, ( krb5_context context, int in_mode), (context, in_mode)); -WRAP_K (krb5_db2_db_unlock, (krb5_context ctx), (ctx)); +WRAP_K (krb5_db2_unlock, (krb5_context ctx), (ctx)); -WRAP_K (krb5_db2_db_get_principal, +WRAP_K (krb5_db2_get_principal, (krb5_context ctx, krb5_const_principal p, unsigned int flags, @@ -125,24 +125,24 @@ WRAP_K (krb5_db2_db_get_principal, int * i, krb5_boolean *b), (ctx, p, d, i, b)); -WRAP_K (krb5_db2_db_free_principal, +WRAP_K (krb5_db2_free_principal, (krb5_context ctx, krb5_db_entry *d, int i), (ctx, d, i)); -WRAP_K (krb5_db2_db_put_principal, +WRAP_K (krb5_db2_put_principal, (krb5_context ctx, krb5_db_entry *d, int *i, char **db_args), (ctx, d, i, db_args)); -WRAP_K (krb5_db2_db_delete_principal, +WRAP_K (krb5_db2_delete_principal, (krb5_context context, krb5_const_principal searchfor, int *nentries), (context, searchfor, nentries)); -WRAP_K (krb5_db2_db_iterate, +WRAP_K (krb5_db2_iterate, (krb5_context ctx, char *s, krb5_error_code (*f) (krb5_pointer, krb5_db_entry *), @@ -174,11 +174,11 @@ WRAP_VOID (krb5_db2_free_policy, ( krb5_context kcontext, osa_policy_ent_t entry ), (kcontext, entry)); -WRAP_K (krb5_db2_db_set_mkey_list, +WRAP_K (krb5_db2_set_mkey_list, ( krb5_context kcontext, krb5_keylist_node *keylist), (kcontext, keylist)); -WRAP_K (krb5_db2_db_get_mkey_list, +WRAP_K (krb5_db2_get_mkey_list, ( krb5_context context, krb5_keylist_node **keylist), (context, keylist)); @@ -222,32 +222,32 @@ hack_cleanup (void) kdb_vftabl PLUGIN_SYMBOL_NAME(krb5_db2, kdb_function_table) = { 1, /* major version number 1 */ 0, /* minor version number 0 */ - /* init_library */ hack_init, - /* fini_library */ hack_cleanup, - /* init_module */ wrap_krb5_db2_open, - /* fini_module */ wrap_krb5_db2_db_fini, - /* db_create */ wrap_krb5_db2_create, - /* db_destroy */ wrap_krb5_db2_destroy, - /* db_get_age */ wrap_krb5_db2_db_get_age, - /* db_lock */ wrap_krb5_db2_db_lock, - /* db_unlock */ wrap_krb5_db2_db_unlock, - /* db_get_principal */ wrap_krb5_db2_db_get_principal, - /* db_free_principal */ wrap_krb5_db2_db_free_principal, - /* db_put_principal */ wrap_krb5_db2_db_put_principal, - /* db_delete_principal */ wrap_krb5_db2_db_delete_principal, - /* db_iterate */ wrap_krb5_db2_db_iterate, - /* db_create_policy */ wrap_krb5_db2_create_policy, - /* db_get_policy */ wrap_krb5_db2_get_policy, - /* db_put_policy */ wrap_krb5_db2_put_policy, - /* db_iter_policy */ wrap_krb5_db2_iter_policy, - /* db_delete_policy */ wrap_krb5_db2_delete_policy, - /* db_free_policy */ wrap_krb5_db2_free_policy, - /* db_alloc */ krb5_db2_alloc, - /* db_free */ krb5_db2_free, - /* set_master_key_list */ wrap_krb5_db2_db_set_mkey_list, - /* get_master_key_list */ wrap_krb5_db2_db_get_mkey_list, + /* init_library */ hack_init, + /* fini_library */ hack_cleanup, + /* init_module */ wrap_krb5_db2_open, + /* fini_module */ wrap_krb5_db2_fini, + /* create */ wrap_krb5_db2_create, + /* destroy */ wrap_krb5_db2_destroy, + /* get_age */ wrap_krb5_db2_get_age, + /* lock */ wrap_krb5_db2_lock, + /* unlock */ wrap_krb5_db2_unlock, + /* get_principal */ wrap_krb5_db2_get_principal, + /* free_principal */ wrap_krb5_db2_free_principal, + /* put_principal */ wrap_krb5_db2_put_principal, + /* delete_principal */ wrap_krb5_db2_delete_principal, + /* iterate */ wrap_krb5_db2_iterate, + /* create_policy */ wrap_krb5_db2_create_policy, + /* get_policy */ wrap_krb5_db2_get_policy, + /* put_policy */ wrap_krb5_db2_put_policy, + /* iter_policy */ wrap_krb5_db2_iter_policy, + /* delete_policy */ wrap_krb5_db2_delete_policy, + /* free_policy */ wrap_krb5_db2_free_policy, + /* alloc */ krb5_db2_alloc, + /* free */ krb5_db2_free, + /* set_master_key_list */ wrap_krb5_db2_set_mkey_list, + /* get_master_key_list */ wrap_krb5_db2_get_mkey_list, /* blah blah blah */ 0,0,0,0,0,0,0, - /* promote_db */ wrap_krb5_db2_promote_db, + /* promote_db */ wrap_krb5_db2_promote_db, 0, 0, - /* invoke */ wrap_krb5_db2_invoke + /* invoke */ wrap_krb5_db2_invoke }; diff --git a/src/plugins/kdb/db2/kdb_db2.c b/src/plugins/kdb/db2/kdb_db2.c index 684fcd9..3e32a94 100644 --- a/src/plugins/kdb/db2/kdb_db2.c +++ b/src/plugins/kdb/db2/kdb_db2.c @@ -69,10 +69,8 @@ #define KDB_DB2_DATABASE_NAME "database_name" -static krb5_error_code krb5_db2_db_start_update(krb5_context); -static krb5_error_code krb5_db2_db_end_update(krb5_context); - -krb5_error_code krb5_db2_db_lock(krb5_context, int); +static krb5_error_code krb5_db2_start_update(krb5_context); +static krb5_error_code krb5_db2_end_update(krb5_context); /* * Locking: @@ -350,7 +348,7 @@ k5db2_dbopen(krb5_db2_context *dbc, char *fname, int flags, int mode, int tempdb */ krb5_error_code -krb5_db2_db_init(krb5_context context) +krb5_db2_init(krb5_context context) { char *filename = NULL; krb5_db2_context *db_ctx; @@ -385,7 +383,7 @@ krb5_db2_db_init(krb5_context context) set_cloexec_fd(db_ctx->db_lf_file); db_ctx->db_inited++; - if ((retval = krb5_db2_db_get_age(context, NULL, &db_ctx->db_lf_time))) + if ((retval = krb5_db2_get_age(context, NULL, &db_ctx->db_lf_time))) goto err_out; snprintf(policy_db_name, sizeof(policy_db_name), "%s%s.kadm5", @@ -408,10 +406,10 @@ err_out: /* * gracefully shut down database--must be called by ANY program that does - * a krb5_db2_db_init + * a krb5_db2_init */ krb5_error_code -krb5_db2_db_fini(krb5_context context) +krb5_db2_fini(krb5_context context) { krb5_error_code retval = 0; krb5_db2_context *db_ctx; @@ -439,7 +437,7 @@ krb5_db2_db_fini(krb5_context context) } krb5_error_code -krb5_db2_db_set_mkey_list(krb5_context context, krb5_keylist_node *key_list) +krb5_db2_set_mkey_list(krb5_context context, krb5_keylist_node *key_list) { krb5_db2_context *db_ctx; @@ -452,7 +450,7 @@ krb5_db2_db_set_mkey_list(krb5_context context, krb5_keylist_node *key_list) } krb5_error_code -krb5_db2_db_get_mkey_list(krb5_context context, krb5_keylist_node **key_list) +krb5_db2_get_mkey_list(krb5_context context, krb5_keylist_node **key_list) { krb5_db2_context *db_ctx; @@ -487,7 +485,7 @@ check_openable(krb5_context context) */ krb5_error_code -krb5_db2_db_get_age(krb5_context context, char *db_name, time_t *age) +krb5_db2_get_age(krb5_context context, char *db_name, time_t *age) { krb5_db2_context *db_ctx; struct stat st; @@ -512,13 +510,13 @@ krb5_db2_db_get_age(krb5_context context, char *db_name, time_t *age) */ static krb5_error_code -krb5_db2_db_start_update(krb5_context context) +krb5_db2_start_update(krb5_context context) { return 0; } static krb5_error_code -krb5_db2_db_end_update(krb5_context context) +krb5_db2_end_update(krb5_context context) { krb5_error_code retval; krb5_db2_context *db_ctx; @@ -556,7 +554,7 @@ krb5_db2_db_end_update(krb5_context context) #define MAX_LOCK_TRIES 5 krb5_error_code -krb5_db2_db_lock(krb5_context context, int in_mode) +krb5_db2_lock(krb5_context context, int in_mode) { krb5_db2_context *db_ctx; int krb5_lock_mode; @@ -612,7 +610,7 @@ krb5_db2_db_lock(krb5_context context, int in_mode) else if (retval != 0) return retval; - if ((retval = krb5_db2_db_get_age(context, NULL, &mod_time))) + if ((retval = krb5_db2_get_age(context, NULL, &mod_time))) goto lock_error; db = k5db2_dbopen(db_ctx, db_ctx->db_name, @@ -631,19 +629,19 @@ krb5_db2_db_lock(krb5_context context, int in_mode) policy_lock: if ((retval = osa_adb_get_lock(db_ctx->policy_db, in_mode))) { - krb5_db2_db_unlock(context); + krb5_db2_unlock(context); } return retval; lock_error:; db_ctx->db_lock_mode = 0; db_ctx->db_locks_held = 0; - krb5_db2_db_unlock(context); + krb5_db2_unlock(context); return retval; } krb5_error_code -krb5_db2_db_unlock(krb5_context context) +krb5_db2_unlock(krb5_context context) { krb5_db2_context *db_ctx; DB *db; @@ -859,11 +857,11 @@ destroy_db(krb5_context context, char *dbname) */ krb5_error_code -krb5_db2_db_get_principal(krb5_context context, - krb5_const_principal searchfor, - krb5_db_entry *entries, /* filled in */ - int *nentries, /* how much room/how many found */ - krb5_boolean *more) /* are there more? */ +krb5_db2_get_principal(krb5_context context, + krb5_const_principal searchfor, + krb5_db_entry *entries, /* filled in */ + int *nentries, /* how much room/how many found */ + krb5_boolean *more) /* are there more? */ { krb5_db2_context *db_ctx; krb5_error_code retval; @@ -881,7 +879,7 @@ krb5_db2_db_get_principal(krb5_context context, db_ctx = context->dal_handle->db_context; for (trynum = 0; trynum < KRB5_DB2_MAX_RETRY; trynum++) { - if ((retval = krb5_db2_db_lock(context, KRB5_LOCKMODE_SHARED))) { + if ((retval = krb5_db2_lock(context, KRB5_LOCKMODE_SHARED))) { if (db_ctx->db_nb_locks) return (retval); sleep(1); @@ -920,16 +918,16 @@ krb5_db2_db_get_principal(krb5_context context, } cleanup: - (void) krb5_db2_db_unlock(context); /* unlock read lock */ + (void) krb5_db2_unlock(context); /* unlock read lock */ return retval; } /* - Free stuff returned by krb5_db2_db_get_principal. + Free stuff returned by krb5_db2_get_principal. */ krb5_error_code -krb5_db2_db_free_principal(krb5_context context, krb5_db_entry *entries, - int nentries) +krb5_db2_free_principal(krb5_context context, krb5_db_entry *entries, + int nentries) { register int i; for (i = 0; i < nentries; i++) @@ -948,10 +946,9 @@ krb5_db2_db_free_principal(krb5_context context, krb5_db_entry *entries, */ krb5_error_code -krb5_db2_db_put_principal(krb5_context context, - krb5_db_entry *entries, - int *nentries, /* number of entry structs to update */ - char **db_args) +krb5_db2_put_principal(krb5_context context, krb5_db_entry *entries, + int *nentries, /* number of entry structs to update */ + char **db_args) { int i, n, dbret; DB *db; @@ -975,12 +972,12 @@ krb5_db2_db_put_principal(krb5_context context, return KRB5_KDB_DBNOTINITED; db_ctx = context->dal_handle->db_context; - if ((retval = krb5_db2_db_lock(context, KRB5_LOCKMODE_EXCLUSIVE))) + if ((retval = krb5_db2_lock(context, KRB5_LOCKMODE_EXCLUSIVE))) return retval; db = db_ctx->db; - if ((retval = krb5_db2_db_start_update(context))) { - (void) krb5_db2_db_unlock(context); + if ((retval = krb5_db2_start_update(context))) { + (void) krb5_db2_unlock(context); return retval; } @@ -1008,8 +1005,8 @@ krb5_db2_db_put_principal(krb5_context context, entries++; /* bump to next struct */ } - (void) krb5_db2_db_end_update(context); - (void) krb5_db2_db_unlock(context); /* unlock database */ + (void) krb5_db2_end_update(context); + (void) krb5_db2_unlock(context); /* unlock database */ *nentries = i; return (retval); } @@ -1020,9 +1017,8 @@ krb5_db2_db_put_principal(krb5_context context, */ krb5_error_code -krb5_db2_db_delete_principal(krb5_context context, - krb5_const_principal searchfor, - int *nentries) /* how many found & deleted */ +krb5_db2_delete_principal(krb5_context context, krb5_const_principal searchfor, + int *nentries) /* how many found & deleted */ { krb5_error_code retval; krb5_db_entry entry; @@ -1036,11 +1032,11 @@ krb5_db2_db_delete_principal(krb5_context context, return KRB5_KDB_DBNOTINITED; db_ctx = context->dal_handle->db_context; - if ((retval = krb5_db2_db_lock(context, KRB5_LOCKMODE_EXCLUSIVE))) + if ((retval = krb5_db2_lock(context, KRB5_LOCKMODE_EXCLUSIVE))) return (retval); - if ((retval = krb5_db2_db_start_update(context))) { - (void) krb5_db2_db_unlock(context); /* unlock write lock */ + if ((retval = krb5_db2_start_update(context))) { + (void) krb5_db2_unlock(context); /* unlock write lock */ return (retval); } @@ -1096,16 +1092,15 @@ cleankey: krb5_free_data_contents(context, &keydata); cleanup: - (void) krb5_db2_db_end_update(context); - (void) krb5_db2_db_unlock(context); /* unlock write lock */ + (void) krb5_db2_end_update(context); + (void) krb5_db2_unlock(context); /* unlock write lock */ return retval; } krb5_error_code -krb5_db2_db_iterate_ext(krb5_context context, - krb5_error_code(*func) (krb5_pointer, krb5_db_entry *), - krb5_pointer func_arg, - int backwards, int recursive) +krb5_db2_iterate_ext(krb5_context context, + krb5_error_code(*func) (krb5_pointer, krb5_db_entry *), + krb5_pointer func_arg, int backwards, int recursive) { krb5_db2_context *db_ctx; DB *db; @@ -1121,14 +1116,14 @@ krb5_db2_db_iterate_ext(krb5_context context, return KRB5_KDB_DBNOTINITED; db_ctx = context->dal_handle->db_context; - retval = krb5_db2_db_lock(context, KRB5_LOCKMODE_SHARED); + retval = krb5_db2_lock(context, KRB5_LOCKMODE_SHARED); if (retval) return retval; db = db_ctx->db; if (recursive && db->type != DB_BTREE) { - (void) krb5_db2_db_unlock(context); + (void) krb5_db2_unlock(context); return KRB5_KDB_UK_RERROR; /* Not optimal, but close enough. */ } @@ -1139,7 +1134,7 @@ krb5_db2_db_iterate_ext(krb5_context context, dbret = bt_rseq(db, &key, &contents, &cookie, backwards ? R_LAST : R_FIRST); #else - (void) krb5_db2_db_unlock(context); + (void) krb5_db2_unlock(context); return KRB5_KDB_UK_RERROR; /* Not optimal, but close enough. */ #endif } @@ -1174,7 +1169,7 @@ krb5_db2_db_iterate_ext(krb5_context context, dbret = bt_rseq(db, &key, &contents, &cookie, backwards ? R_PREV : R_NEXT); #else - (void) krb5_db2_db_unlock(context); + (void) krb5_db2_unlock(context); return KRB5_KDB_UK_RERROR; /* Not optimal, but close enough. */ #endif } @@ -1187,21 +1182,20 @@ krb5_db2_db_iterate_ext(krb5_context context, default: retval = errno; } - (void) krb5_db2_db_unlock(context); + (void) krb5_db2_unlock(context); return retval; } krb5_error_code -krb5_db2_db_iterate(krb5_context context, - char *match_expr, - krb5_error_code(*func) (krb5_pointer, krb5_db_entry *), - krb5_pointer func_arg) +krb5_db2_iterate(krb5_context context, char *match_expr, + krb5_error_code(*func) (krb5_pointer, krb5_db_entry *), + krb5_pointer func_arg) { - return krb5_db2_db_iterate_ext(context, func, func_arg, 0, 0); + return krb5_db2_iterate_ext(context, func, func_arg, 0, 0); } krb5_boolean -krb5_db2_db_set_lockmode(krb5_context context, krb5_boolean mode) +krb5_db2_set_lockmode(krb5_context context, krb5_boolean mode) { krb5_boolean old; krb5_db2_context *db_ctx; @@ -1249,7 +1243,7 @@ krb5_db2_open(krb5_context context, char *conf_section, char **db_args, if (status != 0) return status; - return krb5_db2_db_init(context); + return krb5_db2_init(context); } krb5_error_code @@ -1275,7 +1269,7 @@ krb5_db2_create(krb5_context context, char *conf_section, char **db_args) if (status != 0) return status; - return krb5_db2_db_init(context); + return krb5_db2_init(context); } krb5_error_code @@ -1285,7 +1279,7 @@ krb5_db2_destroy(krb5_context context, char *conf_section, char **db_args) krb5_db2_context *db_ctx; if (k5db2_inited(context)) { - status = krb5_db2_db_fini(context); + status = krb5_db2_fini(context); if (status != 0) return status; } @@ -1399,7 +1393,7 @@ krb5_db2_promote_db(krb5_context context, char *conf_section, char **db_args) } } - status = krb5_db2_db_rename (context, temp_db_name, db_name, merge_nra); + status = krb5_db2_rename(context, temp_db_name, db_name, merge_nra); if (status) goto clean_n_exit; @@ -1468,11 +1462,8 @@ krb5_db2_merge_nra_iterator(krb5_pointer ptr, krb5_db_entry *entry) dal_handle->db_context = nra->db_context; /* look up the new principal in the old DB */ - retval = krb5_db2_db_get_principal(nra->kcontext, - entry->princ, - &s_entry, - &n_entries, - &more); + retval = krb5_db2_get_principal(nra->kcontext, entry->princ, &s_entry, + &n_entries, &more); if (retval != 0 || n_entries == 0) { /* principal may be newly created, so ignore */ dal_handle->db_context = dst_db; @@ -1486,10 +1477,8 @@ krb5_db2_merge_nra_iterator(krb5_pointer ptr, krb5_db_entry *entry) /* if necessary, commit the modified new entry to the new DB */ if (changed) { - retval = krb5_db2_db_put_principal(nra->kcontext, - entry, - &n_entries, - NULL); + retval = krb5_db2_put_principal(nra->kcontext, entry, &n_entries, + NULL); } else { retval = 0; } @@ -1519,19 +1508,16 @@ krb5_db2_begin_nra_merge(krb5_context context, assert(dal_handle->db_context == dst_db); dal_handle->db_context = src_db; - retval = krb5_db2_db_lock(context, KRB5_LOCKMODE_EXCLUSIVE); + retval = krb5_db2_lock(context, KRB5_LOCKMODE_EXCLUSIVE); if (retval) { dal_handle->db_context = dst_db; return retval; } - retval = krb5_db2_db_iterate_ext(context, - krb5_db2_merge_nra_iterator, - &nra, - 0, - 0); + retval = krb5_db2_iterate_ext(context, krb5_db2_merge_nra_iterator, + &nra, 0, 0); if (retval != 0) - (void) krb5_db2_db_unlock(context); + (void) krb5_db2_unlock(context); dal_handle->db_context = dst_db; @@ -1551,7 +1537,7 @@ krb5_db2_end_nra_merge(krb5_context context, kdb5_dal_handle *dal_handle = context->dal_handle; dal_handle->db_context = src_db; - retval = krb5_db2_db_unlock(context); + retval = krb5_db2_unlock(context); dal_handle->db_context = dst_db; return retval; @@ -1569,11 +1555,7 @@ krb5_db2_end_nra_merge(krb5_context context, * have to go through the same stuff that we went through up in db_destroy. */ krb5_error_code -krb5_db2_db_rename(context, from, to, merge_nra) - krb5_context context; - char *from; - char *to; - int merge_nra; +krb5_db2_rename(krb5_context context, char *from, char *to, int merge_nra) { char *fromok; krb5_error_code retval; @@ -1588,7 +1570,7 @@ krb5_db2_db_rename(context, from, to, merge_nra) /* * Create the database if it does not already exist; the - * files must exist because krb5_db2_db_lock, called below, + * files must exist because krb5_db2_lock, called below, * will fail otherwise. */ retval = create_db(context, to); @@ -1609,7 +1591,7 @@ krb5_db2_db_rename(context, from, to, merge_nra) if (retval) goto errout; - retval = krb5_db2_db_init(context); + retval = krb5_db2_init(context); if (retval) goto errout; @@ -1627,7 +1609,7 @@ krb5_db2_db_rename(context, from, to, merge_nra) db_ctx->db_inited = 1; - retval = krb5_db2_db_get_age(context, NULL, &db_ctx->db_lf_time); + retval = krb5_db2_get_age(context, NULL, &db_ctx->db_lf_time); if (retval) goto errout; @@ -1637,10 +1619,10 @@ krb5_db2_db_rename(context, from, to, merge_nra) goto errout; } - if ((retval = krb5_db2_db_lock(context, KRB5_LOCKMODE_EXCLUSIVE))) + if ((retval = krb5_db2_lock(context, KRB5_LOCKMODE_EXCLUSIVE))) goto errfromok; - if ((retval = krb5_db2_db_start_update(context))) + if ((retval = krb5_db2_start_update(context))) goto errfromok; if (merge_nra) { @@ -1661,7 +1643,7 @@ krb5_db2_db_rename(context, from, to, merge_nra) krb5_db2_end_nra_merge(context, s_context, db_ctx); } - retval = krb5_db2_db_end_update(context); + retval = krb5_db2_end_update(context); if (retval) goto errfromok; @@ -1690,7 +1672,7 @@ errfromok: errout: if (dal_handle->db_context) { if (db_ctx->db_lf_file >= 0) { - krb5_db2_db_unlock(context); + krb5_db2_unlock(context); close(db_ctx->db_lf_file); } k5db2_clear_context((krb5_db2_context *) dal_handle->db_context); @@ -1698,7 +1680,7 @@ errout: } dal_handle->db_context = s_context; - (void) krb5_db2_db_unlock(context); /* unlock saved context db */ + (void) krb5_db2_unlock(context); /* unlock saved context db */ return retval; } diff --git a/src/plugins/kdb/db2/kdb_db2.h b/src/plugins/kdb/db2/kdb_db2.h index 2c95448..f31017d 100644 --- a/src/plugins/kdb/db2/kdb_db2.h +++ b/src/plugins/kdb/db2/kdb_db2.h @@ -55,56 +55,52 @@ typedef struct _krb5_db2_context { #define KDB2_LOCK_EXT ".ok" #define KDB2_TEMP_LOCK_EXT "~.ok" -krb5_error_code krb5_db2_db_init(krb5_context); -krb5_error_code krb5_db2_db_fini(krb5_context); -krb5_error_code krb5_db2_db_get_age(krb5_context, char *, time_t *); -krb5_error_code krb5_db2_db_rename(krb5_context, char *, char *, int ); -krb5_error_code krb5_db2_db_get_principal(krb5_context, krb5_const_principal, - krb5_db_entry *, int *, - krb5_boolean *); -krb5_error_code krb5_db2_db_free_principal(krb5_context, krb5_db_entry *, int); -krb5_error_code krb5_db2_db_put_principal(krb5_context, krb5_db_entry *, - int *, char **db_args); -krb5_error_code krb5_db2_db_iterate_ext(krb5_context, - krb5_error_code (*)(krb5_pointer, - krb5_db_entry *), - krb5_pointer, int, int); -krb5_error_code krb5_db2_db_iterate(krb5_context, char *, - krb5_error_code (*)(krb5_pointer, - krb5_db_entry *), - krb5_pointer); -krb5_error_code krb5_db2_db_set_nonblocking(krb5_context, krb5_boolean, - krb5_boolean *); -krb5_boolean krb5_db2_db_set_lockmode(krb5_context, krb5_boolean); -krb5_error_code krb5_db2_db_open_database(krb5_context); -krb5_error_code krb5_db2_db_close_database(krb5_context); +krb5_error_code krb5_db2_init(krb5_context); +krb5_error_code krb5_db2_fini(krb5_context); +krb5_error_code krb5_db2_get_age(krb5_context, char *, time_t *); +krb5_error_code krb5_db2_rename(krb5_context, char *, char *, int ); +krb5_error_code krb5_db2_get_principal(krb5_context, krb5_const_principal, + krb5_db_entry *, int *, krb5_boolean *); +krb5_error_code krb5_db2_free_principal(krb5_context, krb5_db_entry *, int); +krb5_error_code krb5_db2_put_principal(krb5_context, krb5_db_entry *, int *, + char **db_args); +krb5_error_code krb5_db2_iterate_ext(krb5_context, + krb5_error_code (*)(krb5_pointer, + krb5_db_entry *), + krb5_pointer, int, int); +krb5_error_code krb5_db2_iterate(krb5_context, char *, + krb5_error_code (*)(krb5_pointer, + krb5_db_entry *), + krb5_pointer); +krb5_error_code krb5_db2_set_nonblocking(krb5_context, krb5_boolean, + krb5_boolean *); +krb5_boolean krb5_db2_set_lockmode(krb5_context, krb5_boolean); +krb5_error_code krb5_db2_open_database(krb5_context); +krb5_error_code krb5_db2_close_database(krb5_context); krb5_error_code -krb5_db2_db_set_mkey_list(krb5_context context, krb5_keylist_node *keylist); +krb5_db2_set_mkey_list(krb5_context context, krb5_keylist_node *keylist); krb5_error_code -krb5_db2_db_get_mkey_list(krb5_context context, krb5_keylist_node **keylist); +krb5_db2_get_mkey_list(krb5_context context, krb5_keylist_node **keylist); krb5_error_code -krb5_db2_db_put_principal(krb5_context context, krb5_db_entry *entries, - register int *nentries, char **db_args); +krb5_db2_put_principal(krb5_context context, krb5_db_entry *entries, + register int *nentries, char **db_args); krb5_error_code -krb5_db2_db_delete_principal(krb5_context context, - krb5_const_principal searchfor, int *nentries); +krb5_db2_delete_principal(krb5_context context, krb5_const_principal searchfor, + int *nentries); krb5_error_code krb5_db2_lib_init(void); krb5_error_code krb5_db2_lib_cleanup(void); -krb5_error_code krb5_db2_db_unlock(krb5_context); +krb5_error_code krb5_db2_unlock(krb5_context); krb5_error_code krb5_db2_promote_db(krb5_context kcontext, char *conf_section, char **db_args); krb5_error_code -krb5_db2_db_set_option(krb5_context kcontext, int option, void *value ); - -krb5_error_code -krb5_db2_db_lock(krb5_context context, int in_mode); +krb5_db2_lock(krb5_context context, int in_mode); krb5_error_code krb5_db2_open(krb5_context kcontext, char *conf_section, char **db_args, diff --git a/src/plugins/kdb/db2/lockout.c b/src/plugins/kdb/db2/lockout.c index ec22dce..1e9cc11 100644 --- a/src/plugins/kdb/db2/lockout.c +++ b/src/plugins/kdb/db2/lockout.c @@ -198,7 +198,7 @@ krb5_db2_lockout_audit(krb5_context context, } if (need_update) { - code = krb5_db2_db_put_principal(context, entry, &nentries, NULL); + code = krb5_db2_put_principal(context, entry, &nentries, NULL); if (code != 0) return code; } |