summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5/ccache/ccfns.c
diff options
context:
space:
mode:
authorZhanna Tsitkov <tsitkova@mit.edu>2008-12-05 21:02:08 +0000
committerZhanna Tsitkov <tsitkova@mit.edu>2008-12-05 21:02:08 +0000
commite4040340176779c57b3b0322a8654efde7850cd1 (patch)
tree1b610418b3eff5f7035a2d3c99bfa01e50f8ea95 /src/lib/krb5/ccache/ccfns.c
parent5fb682827a9bf683f0a02db312d6fe3a358167d2 (diff)
downloadkrb5-e4040340176779c57b3b0322a8654efde7850cd1.tar.gz
krb5-e4040340176779c57b3b0322a8654efde7850cd1.tar.xz
krb5-e4040340176779c57b3b0322a8654efde7850cd1.zip
When storing info into cred cache, remove any dups.
Ticket: 6291 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21292 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/ccache/ccfns.c')
-rw-r--r--src/lib/krb5/ccache/ccfns.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/krb5/ccache/ccfns.c b/src/lib/krb5/ccache/ccfns.c
index 853d6c90b8..5d95a64289 100644
--- a/src/lib/krb5/ccache/ccfns.c
+++ b/src/lib/krb5/ccache/ccfns.c
@@ -1,7 +1,7 @@
/*
* lib/krb5/ccache/ccfns.c
*
- * Copyright 2000, 2007 by the Massachusetts Institute of Technology.
+ * Copyright 2000, 2007, 2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
@@ -69,6 +69,9 @@ krb5_cc_store_cred (krb5_context context, krb5_ccache cache,
krb5_ticket *tkt;
krb5_principal s1, s2;
+ /* remove any dups */
+ krb5_cc_remove_cred(context, cache, 0, creds);
+
ret = cache->ops->store(context, cache, creds);
if (ret) return ret;
@@ -82,9 +85,11 @@ krb5_cc_store_cred (krb5_context context, krb5_ccache cache,
if (ret) return 0;
s2 = tkt->server;
if (!krb5_principal_compare(context, s1, s2)) {
- creds->server = s2;
- ret = cache->ops->store(context, cache, creds);
- creds->server = s1;
+ creds->server = s2;
+ /* remove any dups */
+ krb5_cc_remove_cred(context, cache, 0, creds);
+ ret = cache->ops->store(context, cache, creds);
+ creds->server = s1;
}
krb5_free_ticket(context, tkt);
return ret;