diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/krb5/kadm5_hook_plugin.h | 35 | ||||
-rw-r--r-- | src/lib/kadm5/server_internal.h | 15 | ||||
-rw-r--r-- | src/lib/kadm5/srv/kadm5_hook.c | 57 |
3 files changed, 47 insertions, 60 deletions
diff --git a/src/include/krb5/kadm5_hook_plugin.h b/src/include/krb5/kadm5_hook_plugin.h index 7e23a249d9..9e81222836 100644 --- a/src/include/krb5/kadm5_hook_plugin.h +++ b/src/include/krb5/kadm5_hook_plugin.h @@ -56,7 +56,7 @@ /** * Whether the operation is being run before or after the database - * update + * update. */ enum kadm5_hook_stage { /** In this stage, any plugin failure prevents following plugins from @@ -66,31 +66,31 @@ enum kadm5_hook_stage { KADM5_HOOK_STAGE_POSTCOMMIT }; -/** Opaque module data pointer*/ +/** Opaque module data pointer. */ typedef struct kadm5_hook_modinfo_st kadm5_hook_modinfo; /** - * Interface for the v1 virtual table for the kadm5_hook plugin + * Interface for the v1 virtual table for the kadm5_hook plugin. * All entry points are optional. The name field must be provided. */ typedef struct kadm5_hook_vtable_1_st { - /** A text string identifying the plugin for logging messages*/ + /** A text string identifying the plugin for logging messages. */ char *name; - /** Initialize a plugin module + /** Initialize a plugin module. * @param modinfo returns newly allocated module info for future - * calls. Cleaned up by the fini() function. + * calls. Cleaned up by the fini() function. */ kadm5_ret_t (*init)(krb5_context, kadm5_hook_modinfo **modinfo); - /** Clean up a module and free @a modinfo*/ + /** Clean up a module and free @a modinfo. */ void (*fini)(krb5_context, kadm5_hook_modinfo *modinfo); /** Indicates that the password is being changed. * @param stage is an integer from #kadm5_hook_stage enumeration * @param keepold is true if existing keys are being kept. - * */ + */ kadm5_ret_t (*chpass)(krb5_context, kadm5_hook_modinfo *modinfo, int stage, @@ -99,7 +99,7 @@ typedef struct kadm5_hook_vtable_1_st { krb5_key_salt_tuple *ks_tuple, const char *newpass); - /** Indicate a principal is created*/ + /** Indicate a principal is created. */ kadm5_ret_t (*create)(krb5_context, kadm5_hook_modinfo *, int stage, @@ -107,20 +107,19 @@ typedef struct kadm5_hook_vtable_1_st { int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, const char *password); - /** Modify a principal*/ + + /** Modify a principal. */ kadm5_ret_t (*modify)(krb5_context, kadm5_hook_modinfo *, int stage, kadm5_principal_ent_t, long mask); + /** Indicate a principal is deleted. */ + kadm5_ret_t (*remove)(krb5_context, + kadm5_hook_modinfo *modinfo, + int stage, krb5_principal); - /** Indicate a principal is deleted*/ - kadm5_ret_t (* remove) (krb5_context, - kadm5_hook_modinfo *modinfo, - int stage, krb5_principal - ); - - /*End of minor version 1*/ -}kadm5_hook_vftable_1; + /* End of minor version 1. */ +} kadm5_hook_vftable_1; #endif /*H_KRB5_KADM5_HOOK_PLUGIN*/ diff --git a/src/lib/kadm5/server_internal.h b/src/lib/kadm5/server_internal.h index 59c7b0512d..42b11c85ee 100644 --- a/src/lib/kadm5/server_internal.h +++ b/src/lib/kadm5/server_internal.h @@ -205,16 +205,16 @@ pwqual_princ_initvt(krb5_context context, int maj_ver, int min_ver, * @name kadm5_hook plugin support */ -/**Load all kadm5_hook plugins*/ +/** Load all kadm5_hook plugins. */ krb5_error_code k5_kadm5_hook_load(krb5_context context, kadm5_hook_handle **handles_out); -/** Free handles allocated by k5_kadm5_hook_load()*/ +/** Free handles allocated by k5_kadm5_hook_load(). */ void k5_kadm5_hook_free_handles(krb5_context context, kadm5_hook_handle *handles); -/**Call the chpass entry point on every kadm5_hook in @a handles*/ +/** Call the chpass entry point on every kadm5_hook in @a handles. */ kadm5_ret_t k5_kadm5_hook_chpass (krb5_context context, kadm5_hook_handle *handles, @@ -224,7 +224,7 @@ k5_kadm5_hook_chpass (krb5_context context, krb5_key_salt_tuple *ks_tuple, const char *newpass); -/** Call the create entry point for kadm5_hook_plugins*/ +/** Call the create entry point for kadm5_hook_plugins. */ kadm5_ret_t k5_kadm5_hook_create (krb5_context context, kadm5_hook_handle *handles, @@ -234,14 +234,14 @@ k5_kadm5_hook_create (krb5_context context, krb5_key_salt_tuple *ks_tuple, const char *newpass); -/** Call modify kadm5_hook entry point*/ +/** Call modify kadm5_hook entry point. */ kadm5_ret_t k5_kadm5_hook_modify (krb5_context context, kadm5_hook_handle *handles, int stage, kadm5_principal_ent_t princ, long mask); -/** call remove kadm5_hook entry point*/ +/** Call remove kadm5_hook entry point. */ kadm5_ret_t k5_kadm5_hook_remove (krb5_context context, kadm5_hook_handle *handles, @@ -250,7 +250,4 @@ k5_kadm5_hook_remove (krb5_context context, /** @}*/ - - - #endif /* __KADM5_SERVER_INTERNAL_H__ */ diff --git a/src/lib/kadm5/srv/kadm5_hook.c b/src/lib/kadm5/srv/kadm5_hook.c index b86ab42973..386715d729 100644 --- a/src/lib/kadm5/srv/kadm5_hook.c +++ b/src/lib/kadm5/srv/kadm5_hook.c @@ -24,8 +24,7 @@ * this software for any purpose. It is provided "as is" without express * or implied warranty. */ -/* Consumer interface for kadm5_hook plugins*/ - +/* Consumer interface for kadm5_hook plugins. */ #include "k5-int.h" #include "server_internal.h" @@ -59,7 +58,8 @@ k5_kadm5_hook_load(krb5_context context, if (list == NULL) goto cleanup; - /* For each module, allocate a handle, initialize its vtable, and initialize the module*/ + /* For each module, allocate a handle, initialize its vtable, and + * initialize the module. */ count = 0; for (mod = modules; *mod != NULL; mod++) { handle = k5alloc(sizeof(*handle), &ret); @@ -73,8 +73,8 @@ k5_kadm5_hook_load(krb5_context context, } handle->data = NULL; if (handle->vt.init != NULL) { - ret = handle->vt.init(context, &handle->data); - if (ret != 0) /* Failed dictionary binding is fatal. */ + ret = handle->vt.init(context, &handle->data); + if (ret != 0) /* Failed initialization is fatal. */ goto cleanup; } list[count++] = handle; @@ -116,9 +116,11 @@ log_failure(krb5_context context, krb5_error_code ret) { const char *e = krb5_get_error_message(context, ret); - if (e) + + if (e) { krb5_klog_syslog(LOG_ERR, "kadm5_hook %s failed postcommit %s: %s", name, function, e); + } krb5_free_error_message(context, e); } @@ -132,19 +134,17 @@ log_failure(krb5_context context, if (ret) { \ if (stage == KADM5_HOOK_STAGE_PRECOMMIT) \ return ret; \ - else log_failure(context, h->vt.name, #operation, ret); \ + else \ + log_failure(context, h->vt.name, #operation, ret); \ } \ } kadm5_ret_t -k5_kadm5_hook_chpass (krb5_context context, - kadm5_hook_handle *handles, - int stage, krb5_principal princ, - krb5_boolean keepold, - int n_ks_tuple, - krb5_key_salt_tuple *ks_tuple, - const char *newpass) +k5_kadm5_hook_chpass(krb5_context context, kadm5_hook_handle *handles, + int stage, krb5_principal princ, krb5_boolean keepold, + int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, + const char *newpass) { ITERATE(chpass, (context, h->data, stage, princ, keepold, @@ -153,13 +153,10 @@ k5_kadm5_hook_chpass (krb5_context context, } kadm5_ret_t -k5_kadm5_hook_create (krb5_context context, - kadm5_hook_handle *handles, - int stage, - kadm5_principal_ent_t princ, long mask, - int n_ks_tuple, - krb5_key_salt_tuple *ks_tuple, - const char *newpass) +k5_kadm5_hook_create(krb5_context context, kadm5_hook_handle *handles, + int stage, kadm5_principal_ent_t princ, long mask, + int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, + const char *newpass) { ITERATE(create, (context, h->data, stage, princ, mask, n_ks_tuple, ks_tuple, newpass)); @@ -167,23 +164,17 @@ k5_kadm5_hook_create (krb5_context context, } kadm5_ret_t -k5_kadm5_hook_modify (krb5_context context, - kadm5_hook_handle *handles, - int stage, - kadm5_principal_ent_t princ, long mask) +k5_kadm5_hook_modify(krb5_context context, kadm5_hook_handle *handles, + int stage, kadm5_principal_ent_t princ, long mask) { - ITERATE(modify, (context, h->data, - stage, princ, mask)); + ITERATE(modify, (context, h->data, stage, princ, mask)); return 0; } kadm5_ret_t -k5_kadm5_hook_remove (krb5_context context, - kadm5_hook_handle *handles, - int stage, - krb5_principal princ) +k5_kadm5_hook_remove(krb5_context context, kadm5_hook_handle *handles, + int stage, krb5_principal princ) { - ITERATE(remove, (context, h->data, - stage, princ)); + ITERATE(remove, (context, h->data, stage, princ)); return 0; } |