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) {
 | 
						if (ret == HEIM_ERR_EOF) {
 | 
				
			||||||
            const char *enctypes;
 | 
					            const char *enctypes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            enctypes = krb5_config_get_string(context, NULL, "realms",
 | 
					            enctypes = krb5_config_get_string(contextp->context, NULL,
 | 
				
			||||||
                                              krb5_principal_get_realm(context,
 | 
					                                              "realms",
 | 
				
			||||||
 | 
					                                              krb5_principal_get_realm(contextp->context,
 | 
				
			||||||
                                                                       princ),
 | 
					                                                                       princ),
 | 
				
			||||||
                                              "supported_enctypes", NULL);
 | 
					                                              "supported_enctypes", NULL);
 | 
				
			||||||
            if (enctypes == NULL || enctypes[0] == '\0')
 | 
					            if (enctypes == NULL || enctypes[0] == '\0')
 | 
				
			||||||
                enctypes = "aes128-cts-hmac-sha1-96";
 | 
					                enctypes = "aes128-cts-hmac-sha1-96";
 | 
				
			||||||
            ret = krb5_string_to_keysalts2(context, enctypes, &n_ks_tuple,
 | 
					            ret = krb5_string_to_keysalts2(contextp->context, enctypes,
 | 
				
			||||||
                                           &ks_tuple);
 | 
					                                           &n_ks_tuple, &ks_tuple);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (ret != 0)
 | 
					        if (ret != 0)
 | 
				
			||||||
	    goto fail;
 | 
						    goto fail;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -129,12 +129,12 @@ kadm5_s_randkey_principal(void *server_handle,
 | 
				
			|||||||
    if (keepold) {
 | 
					    if (keepold) {
 | 
				
			||||||
	ret = hdb_add_current_keys_to_history(context->context, &ent.entry);
 | 
						ret = hdb_add_current_keys_to_history(context->context, &ent.entry);
 | 
				
			||||||
        if (ret == 0 && keepold == 1)
 | 
					        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)
 | 
						if (ret)
 | 
				
			||||||
	    goto out3;
 | 
						    goto out3;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        /* Remove all key history */
 | 
					        /* 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);
 | 
					                                  choice_HDB_extension_data_hist_keys);
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
	    goto out3;
 | 
						    goto out3;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user