Break out the that we request from principal from the entry and pass
it in as a separate argument. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17310 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -42,16 +42,17 @@ kadm5_s_rename_principal(void *server_handle,
|
||||
{
|
||||
kadm5_server_context *context = server_handle;
|
||||
kadm5_ret_t ret;
|
||||
hdb_entry_ex ent, ent2;
|
||||
hdb_entry_ex ent;
|
||||
krb5_principal remove = NULL;
|
||||
|
||||
memset(&ent, 0, sizeof(ent));
|
||||
ent.entry.principal = source;
|
||||
if(krb5_principal_compare(context->context, source, target))
|
||||
return KADM5_DUP; /* XXX is this right? */
|
||||
ret = context->db->hdb_open(context->context, context->db, O_RDWR, 0);
|
||||
if(ret)
|
||||
return ret;
|
||||
ret = context->db->hdb_fetch(context->context, context->db, 0, &ent);
|
||||
ret = context->db->hdb_fetch(context->context, context->db,
|
||||
source, 0, &ent);
|
||||
if(ret){
|
||||
context->db->hdb_close(context->context, context->db);
|
||||
goto out;
|
||||
@@ -80,12 +81,12 @@ kadm5_s_rename_principal(void *server_handle,
|
||||
}
|
||||
if(ret)
|
||||
goto out2;
|
||||
ent2.entry.principal = ent.entry.principal;
|
||||
remove = ent.entry.principal;
|
||||
ent.entry.principal = target;
|
||||
|
||||
ret = hdb_seal_keys(context->context, context->db, &ent.entry);
|
||||
if (ret) {
|
||||
ent.entry.principal = ent2.entry.principal;
|
||||
ent.entry.principal = remove;
|
||||
goto out2;
|
||||
}
|
||||
|
||||
@@ -95,11 +96,11 @@ kadm5_s_rename_principal(void *server_handle,
|
||||
|
||||
ret = context->db->hdb_store(context->context, context->db, 0, &ent);
|
||||
if(ret){
|
||||
ent.entry.principal = ent2.entry.principal;
|
||||
ent.entry.principal = remove;
|
||||
goto out2;
|
||||
}
|
||||
ret = context->db->hdb_remove(context->context, context->db, &ent2);
|
||||
ent.entry.principal = ent2.entry.principal;
|
||||
ret = context->db->hdb_remove(context->context, context->db, remove);
|
||||
ent.entry.principal = remove;
|
||||
out2:
|
||||
context->db->hdb_close(context->context, context->db);
|
||||
hdb_free_entry(context->context, &ent);
|
||||
|
Reference in New Issue
Block a user