summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-09-22 09:58:39 +1000
committerAndrew Tridgell <tridge@samba.org>2011-09-22 03:39:59 +0200
commit0921e750018a53c02e9984006a48cb08cd370b92 (patch)
treea897e26719707b2fcb265cda43530a2f3b8e6213 /source4
parent4dbc604d9c055530f4f4440aae704ed9f9b81c6d (diff)
downloadsamba-0921e750018a53c02e9984006a48cb08cd370b92.tar.gz
samba-0921e750018a53c02e9984006a48cb08cd370b92.tar.bz2
samba-0921e750018a53c02e9984006a48cb08cd370b92.zip
s4-dbcheck: fixed transaction nesting in dbcheck
ensure we don't cancel a transaction we didn't start Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Thu Sep 22 03:39:59 CEST 2011 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/netcmd/dbcheck.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/netcmd/dbcheck.py b/source4/scripting/python/samba/netcmd/dbcheck.py
index 92d27a1189..7840a61725 100644
--- a/source4/scripting/python/samba/netcmd/dbcheck.py
+++ b/source4/scripting/python/samba/netcmd/dbcheck.py
@@ -94,8 +94,11 @@ class cmd_dbcheck(Command):
else:
attrs = attrs.split()
+ started_transaction = False
+
if yes and fix:
samdb.transaction_start()
+ started_transaction = True
try:
chk = dbcheck(samdb, samdb_schema=samdb_schema, verbose=verbose,
fix=fix, yes=yes, quiet=quiet)
@@ -109,10 +112,11 @@ class cmd_dbcheck(Command):
error_count = chk.check_database(DN=DN, scope=search_scope,
controls=controls, attrs=attrs)
except:
- samdb.transaction_cancel()
+ if started_transaction:
+ samdb.transaction_cancel()
raise
- if yes and fix:
+ if started_transaction:
samdb.transaction_commit()
if error_count != 0: