diff options
Diffstat (limited to 'source4/lib/ldb/ldb_tdb/ldb_tdb.c')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 87582cf4eb..b47d79de52 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -249,6 +249,40 @@ static int ltdb_unlock(struct ldb_module *module, const char *lockname) /* + lock the database for read - use by ltdb_search +*/ +int ltdb_lock_read(struct ldb_module *module) +{ + struct ltdb_private *ltdb = module->private_data; + TDB_DATA key; + int ret; + key = ltdb_key(module, LDBLOCK); + if (!key.dptr) { + return -1; + } + ret = tdb_chainlock_read(ltdb->tdb, key); + talloc_free(key.dptr); + return ret; +} + +/* + unlock the database after a ltdb_lock_read() +*/ +int ltdb_unlock_read(struct ldb_module *module) +{ + struct ltdb_private *ltdb = module->private_data; + TDB_DATA key; + key = ltdb_key(module, LDBLOCK); + if (!key.dptr) { + return -1; + } + tdb_chainunlock_read(ltdb->tdb, key); + talloc_free(key.dptr); + return 0; +} + + +/* we've made a modification to a dn - possibly reindex and update sequence number */ |