diff options
author | Greg Hudson <ghudson@mit.edu> | 2009-08-17 19:40:48 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2009-08-17 19:40:48 +0000 |
commit | 1b8c72b7ef064eabb37d726e831b4618cb37d2c7 (patch) | |
tree | 1df8b26a5af064e93ad262ce57801ebff42c80a8 /src/lib/kadm5/srv | |
parent | f75549596ed93c658805f3df40ca4d9853b28213 (diff) | |
download | krb5-1b8c72b7ef064eabb37d726e831b4618cb37d2c7.zip krb5-1b8c72b7ef064eabb37d726e831b4618cb37d2c7.tar.gz krb5-1b8c72b7ef064eabb37d726e831b4618cb37d2c7.tar.bz2 |
Modify kadm5 initializers to accept krb5 contexts
Add krb5_context parameters to all kadm5 initialization functions.
This allows extended error information to be retrieved by the caller
when an error is returned.
ticket: 6547
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22527 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/kadm5/srv')
-rw-r--r-- | src/lib/kadm5/srv/server_init.c | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/src/lib/kadm5/srv/server_init.c b/src/lib/kadm5/srv/server_init.c index e41ecca..47bc22c 100644 --- a/src/lib/kadm5/srv/server_init.c +++ b/src/lib/kadm5/srv/server_init.c @@ -90,20 +90,21 @@ static void free_db_args(kadm5_server_handle_t handle) } } -kadm5_ret_t kadm5_init_with_password(char *client_name, char *pass, - char *service_name, +kadm5_ret_t kadm5_init_with_password(krb5_context context, char *client_name, + char *pass, char *service_name, kadm5_config_params *params, krb5_ui_4 struct_version, krb5_ui_4 api_version, char **db_args, void **server_handle) { - return kadm5_init(client_name, pass, service_name, params, + return kadm5_init(context, client_name, pass, service_name, params, struct_version, api_version, db_args, server_handle); } -kadm5_ret_t kadm5_init_with_creds(char *client_name, +kadm5_ret_t kadm5_init_with_creds(krb5_context context, + char *client_name, krb5_ccache ccache, char *service_name, kadm5_config_params *params, @@ -120,14 +121,14 @@ kadm5_ret_t kadm5_init_with_creds(char *client_name, if (params && (params->mask & KADM5_CONFIG_MKEY_FROM_KBD) && params->mkey_from_kbd) return KADM5_BAD_SERVER_PARAMS; - return kadm5_init(client_name, NULL, service_name, params, + return kadm5_init(context, client_name, NULL, service_name, params, struct_version, api_version, db_args, server_handle); } -kadm5_ret_t kadm5_init_with_skey(char *client_name, char *keytab, - char *service_name, +kadm5_ret_t kadm5_init_with_skey(krb5_context context, char *client_name, + char *keytab, char *service_name, kadm5_config_params *params, krb5_ui_4 struct_version, krb5_ui_4 api_version, @@ -142,12 +143,12 @@ kadm5_ret_t kadm5_init_with_skey(char *client_name, char *keytab, if (params && (params->mask & KADM5_CONFIG_MKEY_FROM_KBD) && params->mkey_from_kbd) return KADM5_BAD_SERVER_PARAMS; - return kadm5_init(client_name, NULL, service_name, params, + return kadm5_init(context, client_name, NULL, service_name, params, struct_version, api_version, db_args, server_handle); } -kadm5_ret_t kadm5_init(char *client_name, char *pass, +kadm5_ret_t kadm5_init(krb5_context context, char *client_name, char *pass, char *service_name, kadm5_config_params *params_in, krb5_ui_4 struct_version, @@ -175,12 +176,7 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, return ret; } - ret = (int) krb5int_init_context_kdc(&(handle->context)); - if (ret) { - free_db_args(handle); - free(handle); - return(ret); - } + handle->context = context; initialize_ovk_error_table(); /* initialize_adb_error_table(); */ @@ -208,7 +204,6 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, expect to see admin_server being set sometimes. */ #define ILLEGAL_PARAMS (KADM5_CONFIG_ADMIN_SERVER) if (params_in && (params_in->mask & ILLEGAL_PARAMS)) { - krb5_free_context(handle->context); free_db_args(handle); free(handle); return KADM5_BAD_SERVER_PARAMS; @@ -218,7 +213,6 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, ret = kadm5_get_config_params(handle->context, 1, params_in, &handle->params); if (ret) { - krb5_free_context(handle->context); free_db_args(handle); free(handle); return(ret); @@ -236,7 +230,6 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, KADM5_CONFIG_IPROP_PORT) if ((handle->params.mask & REQUIRED_PARAMS) != REQUIRED_PARAMS) { - krb5_free_context(handle->context); free_db_args(handle); free(handle); return KADM5_MISSING_CONF_PARAMS; @@ -244,7 +237,6 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, if ((handle->params.mask & KADM5_CONFIG_IPROP_ENABLED) == KADM5_CONFIG_IPROP_ENABLED && handle->params.iprop_enabled) { if ((handle->params.mask & IPROP_REQUIRED_PARAMS) != IPROP_REQUIRED_PARAMS) { - krb5_free_context(handle->context); free_db_args(handle); free(handle); return KADM5_MISSING_CONF_PARAMS; @@ -253,7 +245,6 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, ret = krb5_set_default_realm(handle->context, handle->params.realm); if (ret) { - krb5_free_context(handle->context); free_db_args(handle); free(handle); return ret; @@ -262,7 +253,6 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, ret = krb5_db_open(handle->context, db_args, KRB5_KDB_OPEN_RW | KRB5_KDB_SRV_TYPE_ADMIN); if (ret) { - krb5_free_context(handle->context); free_db_args(handle); free(handle); return(ret); @@ -271,7 +261,6 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, if ((ret = krb5_parse_name(handle->context, client_name, &handle->current_caller))) { krb5_db_fini(handle->context); - krb5_free_context(handle->context); free_db_args(handle); free(handle); return ret; @@ -279,7 +268,6 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, if (! (handle->lhandle = malloc(sizeof(*handle)))) { krb5_db_fini(handle->context); - krb5_free_context(handle->context); free_db_args(handle); free(handle); return ENOMEM; @@ -302,7 +290,6 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, && handle->params.mkey_from_kbd); if (ret) { krb5_db_fini(handle->context); - krb5_free_context(handle->context); free_db_args(handle); free(handle); return ret; @@ -311,7 +298,6 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, ret = kdb_init_hist(handle, handle->params.realm); if (ret) { krb5_db_fini(handle->context); - krb5_free_context(handle->context); free_db_args(handle); free(handle); return ret; @@ -321,7 +307,6 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, if (ret) { krb5_db_fini(handle->context); krb5_free_principal(handle->context, handle->current_caller); - krb5_free_context(handle->context); free_db_args(handle); free(handle); return ret; @@ -344,7 +329,6 @@ kadm5_ret_t kadm5_destroy(void *server_handle) krb5_db_fini(handle->context); krb5_free_principal(handle->context, handle->current_caller); kadm5_free_config_params(handle->context, &handle->params); - krb5_free_context(handle->context); handle->magic_number = 0; free(handle->lhandle); free_db_args(handle); |