From c67da918cc24547469ca931034a99174b59b4ac1 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Mon, 13 Oct 1997 14:52:01 +0000 Subject: [PATCH] * alt_prof.c (kadm5_get_config_params): When KADM5_CONFIG_ENCTYPES is set on the input parameters, allocate a new copy of the key_salts for the output parameters. (kadm5_free_config_params): Free the admin_server and admin_lockfile names. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10224 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kadm5/ChangeLog | 8 ++++++++ src/lib/kadm5/alt_prof.c | 31 ++++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/lib/kadm5/ChangeLog b/src/lib/kadm5/ChangeLog index 321168b95..d929b0333 100644 --- a/src/lib/kadm5/ChangeLog +++ b/src/lib/kadm5/ChangeLog @@ -1,3 +1,11 @@ +Mon Oct 13 10:48:24 1997 Ezra Peisach + + * alt_prof.c (kadm5_get_config_params): When KADM5_CONFIG_ENCTYPES + is set on the input parameters, allocate a new copy of the + key_salts for the output parameters. + (kadm5_free_config_params): Free the admin_server and admin_lockfile + names. + Tue Oct 7 07:48:12 1997 Ezra Peisach * logger.c: Include ctype.h for isspace definition. diff --git a/src/lib/kadm5/alt_prof.c b/src/lib/kadm5/alt_prof.c index 247050d49..b1b07c5b5 100644 --- a/src/lib/kadm5/alt_prof.c +++ b/src/lib/kadm5/alt_prof.c @@ -30,6 +30,23 @@ #include #include + +static krb5_key_salt_tuple *copy_key_salt_tuple(ksalt, len) +krb5_key_salt_tuple *ksalt; +krb5_int32 len; +{ + int i; + krb5_key_salt_tuple *knew; + + if(len == 0) return 0; + if((knew = (krb5_key_salt_tuple *) + malloc((len ) * sizeof(krb5_key_salt_tuple)))) { + memcpy(knew, ksalt, len * sizeof(krb5_key_salt_tuple)); + return knew; + } + return 0; +} + /* * krb5_aprof_init() - Initialize alternate profile context. * @@ -590,9 +607,12 @@ krb5_error_code kadm5_get_config_params(context, kdcprofile, kdcenv, /* Get the value for the supported enctype/salttype matrix */ hierarchy[2] = "supported_enctypes"; if (params_in->mask & KADM5_CONFIG_ENCTYPES) { - params.mask |= KADM5_CONFIG_ENCTYPES; - params.keysalts = params_in->keysalts; - params.num_keysalts = params_in->num_keysalts; + params.keysalts = copy_key_salt_tuple(params_in->keysalts, + params_in->num_keysalts); + if(params.keysalts) { + params.mask |= KADM5_CONFIG_ENCTYPES; + params.num_keysalts = params_in->num_keysalts; + } } else { svalue = NULL; if (aprofile) @@ -645,6 +665,8 @@ kadm5_free_config_params(context, params) krb5_xfree(params->stash_file); if (params->keysalts) krb5_xfree(params->keysalts); + if (params->admin_server) + free(params->admin_server); if (params->admin_keytab) free(params->admin_keytab); if (params->dict_file) @@ -655,6 +677,9 @@ kadm5_free_config_params(context, params) free(params->realm); if (params->admin_dbname) free(params->admin_dbname); + if (params->admin_lockfile) + free(params->admin_lockfile); + } return(0); } -- 2.26.2