diff --git a/lib/hdb/db.c b/lib/hdb/db.c index 40479cdaf..4b80a74fb 100644 --- a/lib/hdb/db.c +++ b/lib/hdb/db.c @@ -68,9 +68,9 @@ DB_lock(krb5_context context, HDB *db, int operation) krb5_error_code ret; if (db->lock_count > 0) { - assert( db->lock_type == HDB_WLOCK ); db->lock_count++; - return 0; + if (db->lock_type == HDB_WLOCK || db->lock_type == operation) + return 0; } if(fd < 0) { diff --git a/lib/hdb/db3.c b/lib/hdb/db3.c index be2f80c09..20ac64c89 100644 --- a/lib/hdb/db3.c +++ b/lib/hdb/db3.c @@ -77,10 +77,10 @@ DB_lock(krb5_context context, HDB *db, int operation) int fd; krb5_error_code ret; - if (db->lock_count > 0) { - assert( db->lock_type == HDB_WLOCK ); + if (db->lock_count > 1) { db->lock_count++; - return 0; + if (db->lock_count == HDB_WLOCK || db->lock_count == operation) + return 0; } if ((*d->fd)(d, &fd)) diff --git a/lib/hdb/hdb-mitdb.c b/lib/hdb/hdb-mitdb.c index 12fbda640..90c6aec99 100644 --- a/lib/hdb/hdb-mitdb.c +++ b/lib/hdb/hdb-mitdb.c @@ -650,10 +650,10 @@ mdb_lock(krb5_context context, HDB *db, int operation) int fd = (*d->fd)(d); krb5_error_code ret; - if (db->lock_count > 0) { - assert( db->lock_type == HDB_WLOCK ); + if (db->lock_count > 1) { db->lock_count++; - return 0; + if (db->lock_type == HDB_WLOCK || db->lock_count == operation) + return 0; } if(fd < 0) {