svn rev #25384: trunk/src/lib/krb5/ccache/
ghudson@MIT.EDU
ghudson at MIT.EDU
Wed Oct 19 23:45:12 EDT 2011
http://src.mit.edu/fisheye/changelog/krb5/?cs=25384
Commit By: ghudson
Log Message:
ticket: 6987
subject: Fix krb5_cc_set_config
target_version: 1.10
tags: pullup
krb5_cc_set_config has been non-functional since r24753 on cache types
which don't support removal of credential entries. Fix it by only
calling krb5_cc_remove_cred if data is NULL, since krb5_cc_store_cred
will do it anyway in the positive case.
Also fix an old memory leak in an uncommon error case.
Changed Files:
U trunk/src/lib/krb5/ccache/ccfns.c
Modified: trunk/src/lib/krb5/ccache/ccfns.c
===================================================================
--- trunk/src/lib/krb5/ccache/ccfns.c 2011-10-18 21:07:31 UTC (rev 25383)
+++ trunk/src/lib/krb5/ccache/ccfns.c 2011-10-20 03:45:12 UTC (rev 25384)
@@ -281,16 +281,14 @@
if (ret)
goto out;
- /* Remove old configuration */
- ret = krb5_cc_remove_cred(context, id, 0, &cred);
- if (ret && ret != KRB5_CC_NOTFOUND)
- goto out;
-
- if (data) {
+ if (data == NULL) {
+ ret = krb5_cc_remove_cred(context, id, 0, &cred);
+ } else {
cred.ticket.data = malloc(data->length);
if (cred.ticket.data == NULL) {
- krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
- return ENOMEM;
+ ret = ENOMEM;
+ krb5_set_error_message(context, ret, "malloc: out of memory");
+ goto out;
}
cred.ticket.length = data->length;
memcpy(cred.ticket.data, data->data, data->length);
More information about the cvs-krb5
mailing list