ldb_tdb: Disallow reads without a transaction or read lock
[metze/samba/wip.git] / lib / ldb / ldb_tdb / ldb_tdb.c
index fc14e170c89915c03e331dd5bcad19848265620a..0833a4fd0cac1effeca5aeb43e0266fd33a37164 100644 (file)
@@ -1900,6 +1900,11 @@ static int ltdb_tdb_parse_record(struct ltdb_private *ltdb,
        };
        int ret;
 
+       if (tdb_transaction_active(ltdb->tdb) == false &&
+           ltdb->read_lock_count == 0) {
+               return LDB_ERR_PROTOCOL_ERROR;
+       }
+
        ret = tdb_parse_record(ltdb->tdb, key, ltdb_tdb_parse_record_wrapper,
                               &kv_ctx);
        if (ret == 0) {