svn rev #24754: trunk/src/ include/krb5/ lib/krb5/ccache/

tsitkova@MIT.EDU tsitkova at MIT.EDU
Tue Mar 29 14:52:22 EDT 2011


http://src.mit.edu/fisheye/changelog/krb5/?cs=24754
Commit By: tsitkova
Log Message:
In krb5_cc_move if something went wrong, free the dst credential cache.



Changed Files:
U   trunk/src/include/krb5/krb5.hin
U   trunk/src/lib/krb5/ccache/ccbase.c
Modified: trunk/src/include/krb5/krb5.hin
===================================================================
--- trunk/src/include/krb5/krb5.hin	2011-03-29 16:22:05 UTC (rev 24753)
+++ trunk/src/include/krb5/krb5.hin	2011-03-29 18:52:22 UTC (rev 24754)
@@ -2284,7 +2284,7 @@
  * @retval
  * 0 Sucess; @a src is freed.
  * @return
- * Kerberos error codes; @a src and @a dst are both still allocated.
+ * Kerberos error codes; @a src is still allocated, while @a dst is freed.
  */
 krb5_error_code KRB5_CALLCONV
 krb5_cc_move(krb5_context context, krb5_ccache src, krb5_ccache dst);

Modified: trunk/src/lib/krb5/ccache/ccbase.c
===================================================================
--- trunk/src/lib/krb5/ccache/ccbase.c	2011-03-29 16:22:05 UTC (rev 24753)
+++ trunk/src/lib/krb5/ccache/ccbase.c	2011-03-29 18:52:22 UTC (rev 24754)
@@ -386,9 +386,13 @@
     if (!ret) {
         ret = krb5_cc_initialize(context, dst, princ);
     }
-    if (!ret) {
-        ret = krb5_cc_lock(context, dst);
+    if (ret) {
+        krb5_cc_unlock(context, src);
+        krb5_cccol_unlock(context);
+        return ret;
     }
+
+    ret = krb5_cc_lock(context, dst);
     if (!ret) {
         ret = krb5_cc_copy_creds(context, src, dst);
         krb5_cc_unlock(context, dst);
@@ -397,6 +401,8 @@
     krb5_cc_unlock(context, src);
     if (!ret) {
         ret = krb5_cc_destroy(context, src);
+    } else {
+        ret = krb5_cc_destroy(context, dst);
     }
     krb5_cccol_unlock(context);
     if (princ) {




More information about the cvs-krb5 mailing list