Make the remove cred slight more atomic, now it might lose creds, but

there will be no empty cache at any time.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22832 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2008-04-07 11:47:49 +00:00
parent 9ec27909a6
commit fd298c28c9

View File

@@ -715,7 +715,7 @@ fcc_remove_cred(krb5_context context,
krb5_creds *cred)
{
krb5_error_code ret;
krb5_ccache copy;
krb5_ccache copy, newfile;
ret = krb5_cc_gen_new(context, &krb5_mcc_ops, &copy);
if (ret)
@@ -733,12 +733,20 @@ fcc_remove_cred(krb5_context context,
return ret;
}
fcc_destroy(context, id);
ret = krb5_cc_gen_new(context, &krb5_fcc_ops, &newfile);
if (ret) {
krb5_cc_destroy(context, copy);
return ret;
}
ret = krb5_cc_copy_cache(context, copy, id);
ret = krb5_cc_copy_cache(context, copy, newfile);
krb5_cc_destroy(context, copy);
if (ret) {
krb5_cc_destroy(context, newfile);
return ret;
}
return ret;
return krb5_cc_move(context, newfile, id);
}
static krb5_error_code