Fix wrong context bugs in kadmin randkey
This commit is contained in:
		| @@ -486,14 +486,15 @@ kadmind_dispatch(void *kadm_handlep, krb5_boolean initial, | ||||
| 	if (ret == HEIM_ERR_EOF) { | ||||
|             const char *enctypes; | ||||
|  | ||||
|             enctypes = krb5_config_get_string(context, NULL, "realms", | ||||
|                                               krb5_principal_get_realm(context, | ||||
|             enctypes = krb5_config_get_string(contextp->context, NULL, | ||||
|                                               "realms", | ||||
|                                               krb5_principal_get_realm(contextp->context, | ||||
|                                                                        princ), | ||||
|                                               "supported_enctypes", NULL); | ||||
|             if (enctypes == NULL || enctypes[0] == '\0') | ||||
|                 enctypes = "aes128-cts-hmac-sha1-96"; | ||||
|             ret = krb5_string_to_keysalts2(context, enctypes, &n_ks_tuple, | ||||
|                                            &ks_tuple); | ||||
|             ret = krb5_string_to_keysalts2(contextp->context, enctypes, | ||||
|                                            &n_ks_tuple, &ks_tuple); | ||||
|         } | ||||
|         if (ret != 0) | ||||
| 	    goto fail; | ||||
|   | ||||
| @@ -129,12 +129,12 @@ kadm5_s_randkey_principal(void *server_handle, | ||||
|     if (keepold) { | ||||
| 	ret = hdb_add_current_keys_to_history(context->context, &ent.entry); | ||||
|         if (ret == 0 && keepold == 1) | ||||
|             ret = hdb_prune_keys_kvno(context, &ent.entry, 0); | ||||
|             ret = hdb_prune_keys_kvno(context->context, &ent.entry, 0); | ||||
| 	if (ret) | ||||
| 	    goto out3; | ||||
|     } else { | ||||
|         /* Remove all key history */ | ||||
|         ret = hdb_clear_extension(context, &ent.entry, | ||||
|         ret = hdb_clear_extension(context->context, &ent.entry, | ||||
|                                   choice_HDB_extension_data_hist_keys); | ||||
| 	if (ret) | ||||
| 	    goto out3; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Nicolas Williams
					Nicolas Williams