svn rev #21829: branches/mkey_migrate/src/plugins/kdb/db2/

raeburn@MIT.EDU raeburn at MIT.EDU
Thu Jan 29 14:54:22 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=21829
Commit By: raeburn
Log Message:
Unlock mutex for principal-iterator callback.  (Bug still present for policies.)


Changed Files:
U   branches/mkey_migrate/src/plugins/kdb/db2/db2_exp.c
U   branches/mkey_migrate/src/plugins/kdb/db2/kdb_db2.c
U   branches/mkey_migrate/src/plugins/kdb/db2/kdb_db2.h
Modified: branches/mkey_migrate/src/plugins/kdb/db2/db2_exp.c
===================================================================
--- branches/mkey_migrate/src/plugins/kdb/db2/db2_exp.c	2009-01-29 19:23:22 UTC (rev 21828)
+++ branches/mkey_migrate/src/plugins/kdb/db2/db2_exp.c	2009-01-29 19:54:21 UTC (rev 21829)
@@ -59,7 +59,7 @@
    locking code into the top and bottom of each referenced function
    won't do.  (We aren't doing recursive locks, currently.)  */
 
-static k5_mutex_t *krb5_db2_mutex;
+k5_mutex_t *krb5_db2_mutex;
 
 #define WRAP(NAME,TYPE,ARGLIST,ARGNAMES,ERROR_RESULT)	\
 	static TYPE wrap_##NAME ARGLIST			\

Modified: branches/mkey_migrate/src/plugins/kdb/db2/kdb_db2.c
===================================================================
--- branches/mkey_migrate/src/plugins/kdb/db2/kdb_db2.c	2009-01-29 19:23:22 UTC (rev 21828)
+++ branches/mkey_migrate/src/plugins/kdb/db2/kdb_db2.c	2009-01-29 19:54:21 UTC (rev 21829)
@@ -1202,8 +1202,19 @@
 	retval = krb5_decode_princ_contents(context, &contdata, &entries);
 	if (retval)
 	    break;
+	retval = k5_mutex_unlock(krb5_db2_mutex);
+	if (retval)
+	    break;
 	retval = (*func) (func_arg, &entries);
 	krb5_dbe_free_contents(context, &entries);
+	/* Note: If re-locking fails, the wrapper in db2_exp.c will
+	   still try to unlock it again.  That would be a bug.  Fix
+	   when integrating the locking better.  */
+	if (retval) {
+	    (void) k5_mutex_lock(krb5_db2_mutex);
+	    break;
+	}
+	retval = k5_mutex_lock(krb5_db2_mutex);
 	if (retval)
 	    break;
 	if (!recursive) {

Modified: branches/mkey_migrate/src/plugins/kdb/db2/kdb_db2.h
===================================================================
--- branches/mkey_migrate/src/plugins/kdb/db2/kdb_db2.h	2009-01-29 19:23:22 UTC (rev 21828)
+++ branches/mkey_migrate/src/plugins/kdb/db2/kdb_db2.h	2009-01-29 19:54:21 UTC (rev 21829)
@@ -216,4 +216,7 @@
 void krb5_db2_free_policy( krb5_context kcontext,
 			   osa_policy_ent_t entry );
 
+/* Thread-safety wrapper slapped on top of original implementation.  */
+extern k5_mutex_t *krb5_db2_mutex;
+
 #endif /* KRB5_KDB_DB2_H */




More information about the cvs-krb5 mailing list