summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-10-23 22:43:24 +1100
committerAndrew Tridgell <tridge@samba.org>2009-10-25 13:15:18 +1100
commitdffb572ce0b350bf42549c882275b627d9b36e59 (patch)
treeb1dd38c099a093c46bc56579bea38d22324739bb /source4/lib/ldb/ldb_tdb
parent5002cddcb0d9e539ded949bcc805c035e038362d (diff)
downloadsamba-dffb572ce0b350bf42549c882275b627d9b36e59.tar.gz
samba-dffb572ce0b350bf42549c882275b627d9b36e59.tar.bz2
samba-dffb572ce0b350bf42549c882275b627d9b36e59.zip
s4-ldb: don't allow modifies outside a transaction.
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 01153fe203..d6175863da 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -200,6 +200,14 @@ static int ltdb_check_special_dn(struct ldb_module *module,
static int ltdb_modified(struct ldb_module *module, struct ldb_dn *dn)
{
int ret = LDB_SUCCESS;
+ struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private);
+
+ /* only allow modifies inside a transaction, otherwise the
+ * ldb is unsafe */
+ if (ltdb->in_transaction == 0) {
+ ldb_set_errstring(ldb_module_get_ctx(module), "ltdb modify without transaction");
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
if (ldb_dn_is_special(dn) &&
(ldb_dn_check_special(dn, LTDB_INDEXLIST) ||