From 323fa3f74a84ee28115c4df7c7c0ea9b5b231a76 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Fri, 2 Jul 2010 17:58:41 +0000 Subject: [PATCH] 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 --- src/include/kdb.h | 115 ++++++------ src/lib/kdb/kdb5.c | 109 ++++++----- src/plugins/kdb/db2/db2_exp.c | 74 ++++---- src/plugins/kdb/db2/kdb_db2.c | 170 ++++++++---------- src/plugins/kdb/db2/kdb_db2.h | 64 ++++--- src/plugins/kdb/db2/lockout.c | 2 +- src/plugins/kdb/ldap/ldap_exp.c | 42 ++--- src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c | 2 +- src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h | 2 +- .../kdb/ldap/libkdb_ldap/libkdb_ldap.exports | 2 +- 10 files changed, 279 insertions(+), 303 deletions(-) diff --git a/src/include/kdb.h b/src/include/kdb.h index b65130d72..a2c496967 100644 --- a/src/include/kdb.h +++ b/src/include/kdb.h @@ -902,8 +902,8 @@ typedef struct _kdb_vftabl { * init_module. This function may return an error if the database already * exists. Used by kdb5_util create. */ - krb5_error_code (*db_create)(krb5_context kcontext, char *conf_section, - char **db_args); + krb5_error_code (*create)(krb5_context kcontext, char *conf_section, + char **db_args); /* * Optional: Destroy a database. conf_section and db_args have the same @@ -911,8 +911,8 @@ typedef struct _kdb_vftabl { * usage, the database is destroyed while open, so the module should handle * that. */ - krb5_error_code (*db_destroy)(krb5_context kcontext, char *conf_section, - char **db_args); + krb5_error_code (*destroy)(krb5_context kcontext, char *conf_section, + char **db_args); /* * Optional: Set *age to the last modification time of the database. Used @@ -923,8 +923,8 @@ typedef struct _kdb_vftabl { * effectively expire immediately. Another option is to supply the current * time, which will cause lookaside cache entries to last for one second. */ - krb5_error_code (*db_get_age)(krb5_context kcontext, char *db_name, - time_t *age); + krb5_error_code (*get_age)(krb5_context kcontext, char *db_name, + time_t *age); /* * Optional: Lock the database, with semantics depending on the mode @@ -941,10 +941,10 @@ typedef struct _kdb_vftabl { * KRB5_PLUGIN_OP_NOTSUPP; note that this is *not* the usual "operation * not supported" error code. */ - krb5_error_code (*db_lock)(krb5_context kcontext, int mode); + krb5_error_code (*lock)(krb5_context kcontext, int mode); /* Optional: Release a lock created with db_lock. */ - krb5_error_code (*db_unlock)(krb5_context kcontext); + krb5_error_code (*unlock)(krb5_context kcontext); /* * Mandatory: Fill in *entries with the entry for the principal search_for. @@ -1008,11 +1008,11 @@ typedef struct _kdb_vftabl { * the module should return the entry for the cross-realm TGS of the * referred-to realm. */ - krb5_error_code (*db_get_principal)(krb5_context kcontext, - krb5_const_principal search_for, - unsigned int flags, - krb5_db_entry *entries, int *nentries, - krb5_boolean *more); + krb5_error_code (*get_principal)(krb5_context kcontext, + krb5_const_principal search_for, + unsigned int flags, + krb5_db_entry *entries, int *nentries, + krb5_boolean *more); /* * Mandatory: Free the memory associated with principal entries. Do not @@ -1021,8 +1021,8 @@ typedef struct _kdb_vftabl { * allocate associated memory); thus, a plugin must allocate each field * of a principal entry separately. */ - krb5_error_code (*db_free_principal)(krb5_context kcontext, - krb5_db_entry *entry, int count); + krb5_error_code (*free_principal)(krb5_context kcontext, + krb5_db_entry *entry, int count); /* * Optional: Create or modify one or more principal entries. All callers @@ -1036,18 +1036,18 @@ typedef struct _kdb_vftabl { * they are specified in the mask, so it is acceptable for a module to * ignore the mask and update the entire entry. */ - krb5_error_code (*db_put_principal)(krb5_context kcontext, - krb5_db_entry *entries, int *nentries, - char **db_args); + krb5_error_code (*put_principal)(krb5_context kcontext, + krb5_db_entry *entries, int *nentries, + char **db_args); /* * Optional: Delete the entry for the principal search_for. If the * principal does not exist, set *nentries to 0 and return success; if it * did exist, set *nentries to 1. */ - krb5_error_code (*db_delete_principal)(krb5_context kcontext, - krb5_const_principal search_for, - int *nentries); + krb5_error_code (*delete_principal)(krb5_context kcontext, + krb5_const_principal search_for, + int *nentries); /* * Optional: For each principal entry in the database, invoke func with the @@ -1055,17 +1055,17 @@ typedef struct _kdb_vftabl { * module may narrow the iteration to principal names matching that regular * expression; a module may alternatively ignore match_entry. */ - krb5_error_code (*db_iterate)(krb5_context kcontext, - char *match_entry, - int (*func)(krb5_pointer, krb5_db_entry *), - krb5_pointer func_arg); + krb5_error_code (*iterate)(krb5_context kcontext, + char *match_entry, + int (*func)(krb5_pointer, krb5_db_entry *), + krb5_pointer func_arg); /* * Optional: Create a password policy entry. Return an error if the policy * already exists. */ - krb5_error_code (*db_create_policy)(krb5_context kcontext, - osa_policy_ent_t policy); + krb5_error_code (*create_policy)(krb5_context kcontext, + osa_policy_ent_t policy); /* * Optional: If a password policy entry exists with the name name, allocate @@ -1074,15 +1074,15 @@ typedef struct _kdb_vftabl { * success, or return an error (existing module implementations are not * consistent). */ - krb5_error_code (*db_get_policy)(krb5_context kcontext, char *name, - osa_policy_ent_t *policy, int *cnt); + krb5_error_code (*get_policy)(krb5_context kcontext, char *name, + osa_policy_ent_t *policy, int *cnt); /* * Optional: Modify an existing password policy entry to match the values * in policy. Return an error if the policy does not already exist. */ - krb5_error_code (*db_put_policy)(krb5_context kcontext, - osa_policy_ent_t policy); + krb5_error_code (*put_policy)(krb5_context kcontext, + osa_policy_ent_t policy); /* * Optional: For each password policy entry in the database, invoke func @@ -1090,32 +1090,32 @@ typedef struct _kdb_vftabl { * the module may narrow the iteration to policy names matching that * regular expression; a module may alternatively ignore match_entry. */ - krb5_error_code (*db_iter_policy)(krb5_context kcontext, char *match_entry, - osa_adb_iter_policy_func func, - void *data); + krb5_error_code (*iter_policy)(krb5_context kcontext, char *match_entry, + osa_adb_iter_policy_func func, + void *data); /* * Optional: Delete the password policy entry with the name policy. Return * an error if the entry does not exist. */ - krb5_error_code (*db_delete_policy)(krb5_context kcontext, char *policy); + krb5_error_code (*delete_policy)(krb5_context kcontext, char *policy); /* Optional: Free a policy entry returned by db_get_policy. */ - void (*db_free_policy)(krb5_context kcontext, osa_policy_ent_t val); + void (*free_policy)(krb5_context kcontext, osa_policy_ent_t val); /* * Mandatory: Has the semantics of realloc(ptr, size). Callers use this to * allocate memory for new or changed principal entries, so the module * should expect to potentially see this memory in db_free_principal. */ - void *(*db_alloc)(krb5_context kcontext, void *ptr, size_t size); + void *(*alloc)(krb5_context kcontext, void *ptr, size_t size); /* * Mandatory: Has the semantics of free(ptr). Callers use this to free * fields from a principal entry (such as key data) before changing it in * place, and in some cases to free data they allocated with db_alloc. */ - void (*db_free)(krb5_context kcontext, void *ptr); + void (*free)(krb5_context kcontext, void *ptr); /* * Optional with default: Inform the module of the master key. The module @@ -1230,14 +1230,14 @@ typedef struct _kdb_vftabl { * set. * * The default implementation uses the keyblock master_key to encrypt each - * new key, via the function dbekd_encrypt_key_data. + * new key, via the function encrypt_key_data. */ - krb5_error_code (*db_change_pwd)(krb5_context context, - krb5_keyblock *master_key, - krb5_key_salt_tuple *ks_tuple, - int ks_tuple_count, char *passwd, - int new_kvno, krb5_boolean keepold, - krb5_db_entry *db_entry); + krb5_error_code (*change_pwd)(krb5_context context, + krb5_keyblock *master_key, + krb5_key_salt_tuple *ks_tuple, + int ks_tuple_count, char *passwd, + int new_kvno, krb5_boolean keepold, + krb5_db_entry *db_entry); /* * Optional with default: Promote a temporary database to be the live one. @@ -1264,11 +1264,11 @@ typedef struct _kdb_vftabl { * stored, unencrypted, in key_data_contents[1], with length given by * key_data_length[1]. */ - krb5_error_code (*dbekd_decrypt_key_data)(krb5_context kcontext, - const krb5_keyblock *mkey, - const krb5_key_data *key_data, - krb5_keyblock *dbkey, - krb5_keysalt *keysalt); + krb5_error_code (*decrypt_key_data)(krb5_context kcontext, + const krb5_keyblock *mkey, + const krb5_key_data *key_data, + krb5_keyblock *dbkey, + krb5_keysalt *keysalt); /* * Optional with default: Encrypt dbkey with master keyblock mkey, placing @@ -1280,12 +1280,11 @@ typedef struct _kdb_vftabl { * in key_data_contents[1] and its length in key_data_length[1]. If * keysalt is not specified, key_data_ver is set to 1. */ - krb5_error_code (*dbekd_encrypt_key_data)(krb5_context kcontext, - const krb5_keyblock *mkey, - const krb5_keyblock *dbkey, - const krb5_keysalt *keysalt, - int keyver, - krb5_key_data *key_data); + krb5_error_code (*encrypt_key_data)(krb5_context kcontext, + const krb5_keyblock *mkey, + const krb5_keyblock *dbkey, + const krb5_keysalt *keysalt, + int keyver, krb5_key_data *key_data); /* * Optional: Perform an operation on input data req with output stored in @@ -1344,8 +1343,8 @@ typedef struct _kdb_vftabl { * not. If this method is not implemented, all S4U2Proxy delegation * requests will be rejected. Do not place any data in rep. */ - krb5_error_code (*db_invoke)(krb5_context context, unsigned int method, - const krb5_data *req, krb5_data *rep); + krb5_error_code (*invoke)(krb5_context context, unsigned int method, + const krb5_data *req, krb5_data *rep); } kdb_vftabl; #endif /* !defined(_WIN32) */ diff --git a/src/lib/kdb/kdb5.c b/src/lib/kdb/kdb5.c index 11be6dfd4..f1bd58119 100644 --- a/src/lib/kdb/kdb5.c +++ b/src/lib/kdb/kdb5.c @@ -260,16 +260,16 @@ kdb_setup_opt_functions(db_library lib) lib->vftabl.store_master_key_list = krb5_def_store_mkey_list; if (lib->vftabl.dbe_search_enctype == NULL) lib->vftabl.dbe_search_enctype = krb5_dbe_def_search_enctype; - if (lib->vftabl.db_change_pwd == NULL) - lib->vftabl.db_change_pwd = krb5_dbe_def_cpw; + if (lib->vftabl.change_pwd == NULL) + lib->vftabl.change_pwd = krb5_dbe_def_cpw; if (lib->vftabl.store_master_key == NULL) lib->vftabl.store_master_key = krb5_def_store_mkey; if (lib->vftabl.promote_db == NULL) lib->vftabl.promote_db = krb5_def_promote_db; - if (lib->vftabl.dbekd_decrypt_key_data == NULL) - lib->vftabl.dbekd_decrypt_key_data = krb5_dbe_def_decrypt_key_data; - if (lib->vftabl.dbekd_encrypt_key_data == NULL) - lib->vftabl.dbekd_encrypt_key_data = krb5_dbe_def_encrypt_key_data; + if (lib->vftabl.decrypt_key_data == NULL) + lib->vftabl.decrypt_key_data = krb5_dbe_def_decrypt_key_data; + if (lib->vftabl.encrypt_key_data == NULL) + lib->vftabl.encrypt_key_data = krb5_dbe_def_encrypt_key_data; } #ifdef STATIC_PLUGINS @@ -637,11 +637,11 @@ krb5_db_create(krb5_context kcontext, char **db_args) status = get_vftabl(kcontext, &v); if (status) goto clean_n_exit; - if (v->db_create == NULL) { + if (v->create == NULL) { status = KRB5_KDB_DBTYPE_NOSUP; goto clean_n_exit; } - status = v->db_create(kcontext, section, db_args); + status = v->create(kcontext, section, db_args); clean_n_exit: if (section) @@ -688,11 +688,11 @@ krb5_db_destroy(krb5_context kcontext, char **db_args) status = get_vftabl(kcontext, &v); if (status) goto clean_n_exit; - if (v->db_destroy == NULL) { + if (v->destroy == NULL) { status = KRB5_KDB_DBTYPE_NOSUP; goto clean_n_exit; } - status = v->db_destroy(kcontext, section, db_args); + status = v->destroy(kcontext, section, db_args); clean_n_exit: if (section) @@ -709,9 +709,9 @@ krb5_db_get_age(krb5_context kcontext, char *db_name, time_t * t) status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_get_age == NULL) + if (v->get_age == NULL) return KRB5_KDB_DBTYPE_NOSUP; - return v->db_get_age(kcontext, db_name, t); + return v->get_age(kcontext, db_name, t); } krb5_error_code @@ -723,9 +723,9 @@ krb5_db_lock(krb5_context kcontext, int lock_mode) status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_lock == NULL) + if (v->lock == NULL) return KRB5_KDB_DBTYPE_NOSUP; - return v->db_lock(kcontext, lock_mode); + return v->lock(kcontext, lock_mode); } krb5_error_code @@ -737,9 +737,9 @@ krb5_db_unlock(krb5_context kcontext) status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_unlock == NULL) + if (v->unlock == NULL) return KRB5_KDB_DBTYPE_NOSUP; - return v->db_unlock(kcontext); + return v->unlock(kcontext); } krb5_error_code @@ -754,10 +754,9 @@ krb5_db_get_principal(krb5_context kcontext, status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_get_principal == NULL) + if (v->get_principal == NULL) return KRB5_KDB_DBTYPE_NOSUP; - return v->db_get_principal(kcontext, search_for, 0, entries, nentries, - more); + return v->get_principal(kcontext, search_for, 0, entries, nentries, more); } krb5_error_code @@ -773,10 +772,10 @@ krb5_db_get_principal_ext(krb5_context kcontext, status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_get_principal == NULL) + if (v->get_principal == NULL) return KRB5_KDB_DBTYPE_NOSUP; - return v->db_get_principal(kcontext, search_for, flags, entries, nentries, - more); + return v->get_principal(kcontext, search_for, flags, entries, nentries, + more); } krb5_error_code @@ -788,9 +787,9 @@ krb5_db_free_principal(krb5_context kcontext, krb5_db_entry * entry, int count) status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_free_principal == NULL) + if (v->free_principal == NULL) return KRB5_KDB_DBTYPE_NOSUP; - return v->db_free_principal(kcontext, entry, count); + return v->free_principal(kcontext, entry, count); } static void @@ -884,14 +883,14 @@ krb5int_put_principal_no_log(krb5_context kcontext, status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_put_principal == NULL) + if (v->put_principal == NULL) return KRB5_KDB_DBTYPE_NOSUP; status = extract_db_args_from_tl_data(kcontext, &entries->tl_data, &entries->n_tl_data, &db_args); if (status) return status; - status = v->db_put_principal(kcontext, entries, nentries, db_args); + status = v->put_principal(kcontext, entries, nentries, db_args); free_db_args(kcontext, db_args); return status; } @@ -955,12 +954,12 @@ krb5_db_put_principal(krb5_context kcontext, } } - if (v->db_put_principal == NULL) { + if (v->put_principal == NULL) { status = KRB5_KDB_DBTYPE_NOSUP; goto err_lock; } - status = v->db_put_principal(kcontext, entries, nentries, db_args); + status = v->put_principal(kcontext, entries, nentries, db_args); if (status == 0 && fupd) { upd = fupd; for (i = 0; i < *nentries; i++) { @@ -992,9 +991,9 @@ krb5int_delete_principal_no_log(krb5_context kcontext, status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_delete_principal == NULL) + if (v->delete_principal == NULL) return KRB5_KDB_DBTYPE_NOSUP; - return v->db_delete_principal(kcontext, search_for, nentries); + return v->delete_principal(kcontext, search_for, nentries); } krb5_error_code @@ -1039,10 +1038,10 @@ krb5_db_delete_principal(krb5_context kcontext, free(princ_name); } - if (v->db_delete_principal == NULL) + if (v->delete_principal == NULL) return KRB5_KDB_DBTYPE_NOSUP; - status = v->db_delete_principal(kcontext, search_for, nentries); + status = v->delete_principal(kcontext, search_for, nentries); /* * We need to commit our update upon success @@ -1068,9 +1067,9 @@ krb5_db_iterate(krb5_context kcontext, status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_iterate == NULL) + if (v->iterate == NULL) return 0; - return v->db_iterate(kcontext, match_entry, func, func_arg); + return v->iterate(kcontext, match_entry, func, func_arg); } krb5_error_code @@ -1473,7 +1472,7 @@ krb5_db_alloc(krb5_context kcontext, void *ptr, size_t size) status = get_vftabl(kcontext, &v); if (status) return NULL; - return v->db_alloc(kcontext, ptr, size); + return v->alloc(kcontext, ptr, size); } void @@ -1485,7 +1484,7 @@ krb5_db_free(krb5_context kcontext, void *ptr) status = get_vftabl(kcontext, &v); if (status) return; - v->db_free(kcontext, ptr); + v->free(kcontext, ptr); } /* has to be modified */ @@ -2192,8 +2191,8 @@ krb5_dbe_cpw(krb5_context kcontext, status = get_vftabl(kcontext, &v); if (status) return status; - return v->db_change_pwd(kcontext, master_key, ks_tuple, ks_tuple_count, - passwd, new_kvno, keepold, db_entry); + return v->change_pwd(kcontext, master_key, ks_tuple, ks_tuple_count, + passwd, new_kvno, keepold, db_entry); } /* policy management functions */ @@ -2206,9 +2205,9 @@ krb5_db_create_policy(krb5_context kcontext, osa_policy_ent_t policy) status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_create_policy == NULL) + if (v->create_policy == NULL) return KRB5_KDB_DBTYPE_NOSUP; - return v->db_create_policy(kcontext, policy); + return v->create_policy(kcontext, policy); } krb5_error_code @@ -2221,9 +2220,9 @@ krb5_db_get_policy(krb5_context kcontext, char *name, status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_get_policy == NULL) + if (v->get_policy == NULL) return KRB5_KDB_DBTYPE_NOSUP; - return v->db_get_policy(kcontext, name, policy, cnt); + return v->get_policy(kcontext, name, policy, cnt); } krb5_error_code @@ -2235,9 +2234,9 @@ krb5_db_put_policy(krb5_context kcontext, osa_policy_ent_t policy) status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_put_policy == NULL) + if (v->put_policy == NULL) return KRB5_KDB_DBTYPE_NOSUP; - return v->db_put_policy(kcontext, policy); + return v->put_policy(kcontext, policy); } krb5_error_code @@ -2250,9 +2249,9 @@ krb5_db_iter_policy(krb5_context kcontext, char *match_entry, status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_iter_policy == NULL) + if (v->iter_policy == NULL) return 0; - return v->db_iter_policy(kcontext, match_entry, func, data); + return v->iter_policy(kcontext, match_entry, func, data); } krb5_error_code @@ -2264,9 +2263,9 @@ krb5_db_delete_policy(krb5_context kcontext, char *policy) status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_delete_policy == NULL) + if (v->delete_policy == NULL) return KRB5_KDB_DBTYPE_NOSUP; - return v->db_delete_policy(kcontext, policy); + return v->delete_policy(kcontext, policy); } void @@ -2276,9 +2275,9 @@ krb5_db_free_policy(krb5_context kcontext, osa_policy_ent_t policy) kdb_vftabl *v; status = get_vftabl(kcontext, &v); - if (status || v->db_free_policy == NULL) + if (status || v->free_policy == NULL) return; - v->db_free_policy(kcontext, policy); + v->free_policy(kcontext, policy); } krb5_error_code @@ -2320,7 +2319,7 @@ krb5_dbe_decrypt_key_data( krb5_context kcontext, status = get_vftabl(kcontext, &v); if (status) return status; - return v->dbekd_decrypt_key_data(kcontext, mkey, key_data, dbkey, keysalt); + return v->decrypt_key_data(kcontext, mkey, key_data, dbkey, keysalt); } krb5_error_code @@ -2337,8 +2336,8 @@ krb5_dbe_encrypt_key_data( krb5_context kcontext, status = get_vftabl(kcontext, &v); if (status) return status; - return v->dbekd_encrypt_key_data(kcontext, mkey, dbkey, keysalt, keyver, - key_data); + return v->encrypt_key_data(kcontext, mkey, dbkey, keysalt, keyver, + key_data); } krb5_error_code @@ -2370,7 +2369,7 @@ krb5_db_invoke(krb5_context kcontext, status = get_vftabl(kcontext, &v); if (status) return status; - if (v->db_invoke == NULL) + if (v->invoke == NULL) return KRB5_KDB_DBTYPE_NOSUP; - return v->db_invoke(kcontext, method, req, rep); + return v->invoke(kcontext, method, req, rep); } diff --git a/src/plugins/kdb/db2/db2_exp.c b/src/plugins/kdb/db2/db2_exp.c index 384d2eeda..87a3bf0f9 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 684fcd99c..3e32a9437 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 2c954487a..f31017d10 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 ec22dce73..1e9cc11d9 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; } diff --git a/src/plugins/kdb/ldap/ldap_exp.c b/src/plugins/kdb/ldap/ldap_exp.c index 2b0fc62ef..4d071dc49 100644 --- a/src/plugins/kdb/ldap/ldap_exp.c +++ b/src/plugins/kdb/ldap/ldap_exp.c @@ -53,24 +53,24 @@ kdb_vftabl PLUGIN_SYMBOL_NAME(krb5_ldap, kdb_function_table) = { /* fini_library */ krb5_ldap_lib_cleanup, /* init_module */ krb5_ldap_open, /* fini_module */ krb5_ldap_close, - /* db_create */ krb5_ldap_create, - /* db_destroy */ krb5_ldap_delete_realm_1, - /* db_get_age */ krb5_ldap_db_get_age, - /* db_lock */ krb5_ldap_lock, - /* db_unlock */ krb5_ldap_unlock, - /* db_get_principal */ krb5_ldap_get_principal, - /* db_free_principal */ krb5_ldap_free_principal, - /* db_put_principal */ krb5_ldap_put_principal, - /* db_delete_principal */ krb5_ldap_delete_principal, - /* db_iterate */ krb5_ldap_iterate, - /* db_create_policy */ krb5_ldap_create_password_policy, - /* db_get_policy */ krb5_ldap_get_password_policy, - /* db_put_policy */ krb5_ldap_put_password_policy, - /* db_iter_policy */ krb5_ldap_iterate_password_policy, - /* db_delete_policy */ krb5_ldap_delete_password_policy, - /* db_free_policy */ krb5_ldap_free_password_policy, - /* db_alloc */ krb5_ldap_alloc, - /* db_free */ krb5_ldap_free, + /* create */ krb5_ldap_create, + /* destroy */ krb5_ldap_delete_realm_1, + /* get_age */ krb5_ldap_get_age, + /* lock */ krb5_ldap_lock, + /* unlock */ krb5_ldap_unlock, + /* get_principal */ krb5_ldap_get_principal, + /* free_principal */ krb5_ldap_free_principal, + /* put_principal */ krb5_ldap_put_principal, + /* delete_principal */ krb5_ldap_delete_principal, + /* iterate */ krb5_ldap_iterate, + /* create_policy */ krb5_ldap_create_password_policy, + /* get_policy */ krb5_ldap_get_password_policy, + /* put_policy */ krb5_ldap_put_password_policy, + /* iter_policy */ krb5_ldap_iterate_password_policy, + /* delete_policy */ krb5_ldap_delete_password_policy, + /* free_policy */ krb5_ldap_free_password_policy, + /* alloc */ krb5_ldap_alloc, + /* free */ krb5_ldap_free, /* optional functions */ /* set_master_key_list */ krb5_ldap_set_mkey_list, /* get_master_key_list */ krb5_ldap_get_mkey_list, @@ -82,8 +82,8 @@ kdb_vftabl PLUGIN_SYMBOL_NAME(krb5_ldap, kdb_function_table) = { /* Search enc type */ NULL, /* Change pwd */ NULL, /* promote_db */ NULL, - /* dbekd_decrypt_key_data */ NULL, - /* dbekd_encrypt_key_data */ NULL, - /* db_invoke */ krb5_ldap_invoke, + /* decrypt_key_data */ NULL, + /* encrypt_key_data */ NULL, + /* invoke */ krb5_ldap_invoke, }; diff --git a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c index 1966aa970..633de85d2 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c +++ b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c @@ -87,7 +87,7 @@ krb5_ldap_get_db_opt(char *input, char **opt, char **val) * ldap get age */ krb5_error_code -krb5_ldap_db_get_age(context, db_name, age) +krb5_ldap_get_age(context, db_name, age) krb5_context context; char *db_name; time_t *age; diff --git a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h index 72e254587..35dd12e02 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h +++ b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h @@ -251,7 +251,7 @@ krb5_error_code krb5_ldap_rebind(krb5_ldap_context *, krb5_ldap_server_handle **); krb5_error_code -krb5_ldap_db_get_age(krb5_context, char *, time_t *); +krb5_ldap_get_age(krb5_context, char *, time_t *); krb5_error_code krb5_ldap_lib_init(int dal_version); diff --git a/src/plugins/kdb/ldap/libkdb_ldap/libkdb_ldap.exports b/src/plugins/kdb/ldap/libkdb_ldap/libkdb_ldap.exports index 0e8c08150..7f285ce94 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/libkdb_ldap.exports +++ b/src/plugins/kdb/ldap/libkdb_ldap/libkdb_ldap.exports @@ -4,7 +4,7 @@ krb5_ldap_close krb5_ldap_db_init krb5_ldap_lib_init krb5_ldap_lib_cleanup -krb5_ldap_db_get_age +krb5_ldap_get_age krb5_ldap_read_server_params krb5_ldap_put_principal krb5_ldap_get_principal -- 2.26.2