make a copy of realm and admin_server to avoid un-consting

avoid shadowing


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15583 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-07-07 21:44:37 +00:00
parent 143fc05055
commit b37386a686

View File

@@ -47,7 +47,11 @@ open_kadmin_connection(char *principal,
memset(&conf, 0, sizeof(conf)); memset(&conf, 0, sizeof(conf));
if(realm) { if(realm) {
conf.realm = (char*)realm; conf.realm = strdup(realm);
if (conf.realm == NULL) {
krb5_set_error_string(context, "malloc: out of memory");
return NULL;
}
conf.mask |= KADM5_CONFIG_REALM; conf.mask |= KADM5_CONFIG_REALM;
} }
@@ -70,6 +74,7 @@ open_kadmin_connection(char *principal,
KADM5_ADMIN_SERVICE, KADM5_ADMIN_SERVICE,
&conf, 0, 0, &conf, 0, 0,
&kadm_handle); &kadm_handle);
free(conf.realm);
if(ret) { if(ret) {
krb5_warn(context, ret, "kadm5_init_with_password"); krb5_warn(context, ret, "kadm5_init_with_password");
return NULL; return NULL;
@@ -85,7 +90,7 @@ kt_get(struct get_options *opt, int argc, char **argv)
void *kadm_handle = NULL; void *kadm_handle = NULL;
krb5_enctype *etypes = NULL; krb5_enctype *etypes = NULL;
size_t netypes = 0; size_t netypes = 0;
int i = 0, j; int i, j;
unsigned int failed = 0; unsigned int failed = 0;
if((keytab = ktutil_open_keytab()) == NULL) if((keytab = ktutil_open_keytab()) == NULL)
@@ -95,7 +100,6 @@ kt_get(struct get_options *opt, int argc, char **argv)
krb5_set_default_realm(context, opt->realm_string); krb5_set_default_realm(context, opt->realm_string);
if (opt->enctypes_strings.num_strings != 0) { if (opt->enctypes_strings.num_strings != 0) {
int i;
etypes = malloc (opt->enctypes_strings.num_strings * sizeof(*etypes)); etypes = malloc (opt->enctypes_strings.num_strings * sizeof(*etypes));
if (etypes == NULL) { if (etypes == NULL) {
@@ -201,11 +205,11 @@ kt_get(struct get_options *opt, int argc, char **argv)
int do_add = TRUE; int do_add = TRUE;
if (netypes) { if (netypes) {
int i; int k;
do_add = FALSE; do_add = FALSE;
for (i = 0; i < netypes; ++i) for (k = 0; k < netypes; ++k)
if (keys[j].keytype == etypes[i]) { if (keys[j].keytype == etypes[k]) {
do_add = TRUE; do_add = TRUE;
break; break;
} }