From 0921e750018a53c02e9984006a48cb08cd370b92 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 22 Sep 2011 09:58:39 +1000 Subject: s4-dbcheck: fixed transaction nesting in dbcheck ensure we don't cancel a transaction we didn't start Pair-Programmed-With: Andrew Bartlett Autobuild-User: Andrew Tridgell Autobuild-Date: Thu Sep 22 03:39:59 CEST 2011 on sn-devel-104 --- source4/scripting/python/samba/netcmd/dbcheck.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source4/scripting') 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: -- cgit