krb5 commit: Support write locks in DB2 iteration

Tom Yu tlyu at MIT.EDU
Sat Aug 2 14:24:25 EDT 2014


https://github.com/krb5/krb5/commit/0cc00db2987f6b103b7e8bee72b7ddfbad2faea8
commit 0cc00db2987f6b103b7e8bee72b7ddfbad2faea8
Author: Tom Yu <tlyu at mit.edu>
Date:   Sat Aug 2 14:20:33 2014 -0400

    Support write locks in DB2 iteration
    
    Add support to krb5_db_iterate() for requesting write locks in the DB2
    back end.
    
    ticket: 7977

 src/plugins/kdb/db2/kdb_db2.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/plugins/kdb/db2/kdb_db2.c b/src/plugins/kdb/db2/kdb_db2.c
index f4e9458..8d419ea 100644
--- a/src/plugins/kdb/db2/kdb_db2.c
+++ b/src/plugins/kdb/db2/kdb_db2.c
@@ -935,8 +935,14 @@ ctx_iterate(krb5_context context, krb5_db2_context *dbc,
     krb5_db_entry *entry;
     krb5_error_code retval;
     int dbret;
+    int lockmode;
 
-    retval = ctx_lock(context, dbc, KRB5_LOCKMODE_SHARED);
+    if (iterflags & KRB5_DB_ITER_WRITE)
+        lockmode = KRB5_LOCKMODE_EXCLUSIVE;
+    else
+        lockmode = KRB5_LOCKMODE_SHARED;
+
+    retval = ctx_lock(context, dbc, lockmode);
     if (retval)
         return retval;
 


More information about the cvs-krb5 mailing list