mirror of
https://github.com/samba-team/samba.git
synced 2025-07-30 19:42:05 +03:00
Partially revert 1f0298dd1b
It's fine to catch keyboard interrupts and other kinds of errors when it's done just for resource management, where the error is reraised later. Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sat Feb 25 17:29:34 CET 2012 on sn-devel-104
This commit is contained in:
@ -701,7 +701,7 @@ class dc_join(object):
|
||||
ctx.destination_dsa_guid = destination_dsa_guid
|
||||
|
||||
print "Committing SAM database"
|
||||
except Exception:
|
||||
except:
|
||||
ctx.local_samdb.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
@ -877,7 +877,7 @@ class dc_join(object):
|
||||
ctx.join_provision_own_domain()
|
||||
ctx.join_setup_trusts()
|
||||
ctx.join_finalise()
|
||||
except Exception:
|
||||
except:
|
||||
print "Join failed - cleaning up"
|
||||
ctx.cleanup_old_join()
|
||||
raise
|
||||
|
@ -117,7 +117,7 @@ class cmd_dbcheck(Command):
|
||||
else:
|
||||
error_count = chk.check_database(DN=DN, scope=search_scope,
|
||||
controls=controls, attrs=attrs)
|
||||
except Exception:
|
||||
except:
|
||||
if started_transaction:
|
||||
samdb.transaction_cancel()
|
||||
raise
|
||||
|
@ -718,7 +718,7 @@ def setup_samdb_partitions(samdb_path, logger, lp, session_info,
|
||||
|
||||
logger.info("Setting up sam.ldb rootDSE")
|
||||
setup_samdb_rootdse(samdb, names)
|
||||
except Exception:
|
||||
except:
|
||||
samdb.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
@ -860,7 +860,7 @@ def setup_secretsdb(paths, session_info, backend_credentials, lp):
|
||||
"LDAPADMINREALM": backend_credentials.get_realm(),
|
||||
"LDAPADMINPASS_B64": b64encode(backend_credentials.get_password())
|
||||
})
|
||||
except Exception:
|
||||
except:
|
||||
secrets_ldb.transaction_cancel()
|
||||
raise
|
||||
return secrets_ldb
|
||||
@ -1200,7 +1200,7 @@ def fill_samdb(samdb, lp, names,
|
||||
msg["subRefs"] = ldb.MessageElement(names.configdn , ldb.FLAG_MOD_ADD,
|
||||
"subRefs")
|
||||
|
||||
except Exception:
|
||||
except:
|
||||
samdb.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
@ -1285,22 +1285,23 @@ def fill_samdb(samdb, lp, names,
|
||||
})
|
||||
|
||||
logger.info("Setting up self join")
|
||||
setup_self_join(samdb, admin_session_info, names=names, fill=fill, invocationid=invocationid,
|
||||
dnspass=dnspass,
|
||||
machinepass=machinepass,
|
||||
domainsid=domainsid,
|
||||
next_rid=next_rid,
|
||||
dc_rid=dc_rid,
|
||||
policyguid=policyguid,
|
||||
policyguid_dc=policyguid_dc,
|
||||
domainControllerFunctionality=domainControllerFunctionality,
|
||||
ntdsguid=ntdsguid)
|
||||
setup_self_join(samdb, admin_session_info, names=names, fill=fill,
|
||||
invocationid=invocationid,
|
||||
dnspass=dnspass,
|
||||
machinepass=machinepass,
|
||||
domainsid=domainsid,
|
||||
next_rid=next_rid,
|
||||
dc_rid=dc_rid,
|
||||
policyguid=policyguid,
|
||||
policyguid_dc=policyguid_dc,
|
||||
domainControllerFunctionality=domainControllerFunctionality,
|
||||
ntdsguid=ntdsguid)
|
||||
|
||||
ntds_dn = "CN=NTDS Settings,%s" % names.serverdn
|
||||
names.ntdsguid = samdb.searchone(basedn=ntds_dn,
|
||||
attribute="objectGUID", expression="", scope=ldb.SCOPE_BASE)
|
||||
assert isinstance(names.ntdsguid, str)
|
||||
except Exception:
|
||||
except:
|
||||
samdb.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
@ -1771,7 +1772,7 @@ def provision(logger, session_info, credentials, smbconf=None,
|
||||
|
||||
create_phpldapadmin_config(paths.phpldapadminconfig,
|
||||
ldapi_url)
|
||||
except Exception:
|
||||
except:
|
||||
secrets_ldb.transaction_cancel()
|
||||
raise
|
||||
|
||||
@ -1832,9 +1833,9 @@ def provision_become_dc(smbconf=None, targetdir=None,
|
||||
serverdn=None, domain=None, hostname=None, domainsid=None,
|
||||
adminpass=None, krbtgtpass=None, domainguid=None, policyguid=None,
|
||||
policyguid_dc=None, invocationid=None, machinepass=None, dnspass=None,
|
||||
dns_backend=None, root=None, nobody=None, users=None, wheel=None, backup=None,
|
||||
serverrole=None, ldap_backend=None, ldap_backend_type=None,
|
||||
sitename=None, debuglevel=1):
|
||||
dns_backend=None, root=None, nobody=None, users=None, wheel=None,
|
||||
backup=None, serverrole=None, ldap_backend=None,
|
||||
ldap_backend_type=None, sitename=None, debuglevel=1):
|
||||
|
||||
logger = logging.getLogger("provision")
|
||||
samba.set_debug_level(debuglevel)
|
||||
@ -1887,6 +1888,7 @@ class ProvisioningError(Exception):
|
||||
|
||||
class InvalidNetbiosName(Exception):
|
||||
"""A specified name was not a valid NetBIOS name."""
|
||||
|
||||
def __init__(self, name):
|
||||
super(InvalidNetbiosName, self).__init__(
|
||||
"The name '%r' is not a valid NetBIOS name" % name)
|
||||
|
@ -77,7 +77,7 @@ def setup_ldb(ldb, ldif_path, subst_vars):
|
||||
ldb.transaction_start()
|
||||
try:
|
||||
setup_add_ldif(ldb, ldif_path, subst_vars)
|
||||
except Exception:
|
||||
except:
|
||||
ldb.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
|
@ -715,7 +715,7 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid):
|
||||
"DOMAINSID" : str(domainsid),
|
||||
"DESCRIPTOR" : descr})
|
||||
setup_add_ldif(dom_ldb, setup_path("provision_basedn_options.ldif"), None)
|
||||
except Exception:
|
||||
except:
|
||||
logger.error("Failed to setup database for BIND, AD based DNS cannot be used")
|
||||
raise
|
||||
del partfile[domaindn]
|
||||
@ -750,7 +750,7 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid):
|
||||
tdb_copy(logger,
|
||||
os.path.join(private_dir, pfile),
|
||||
os.path.join(dns_dir, pfile))
|
||||
except Exception:
|
||||
except:
|
||||
logger.error("Failed to setup database for BIND, AD based DNS cannot be used")
|
||||
raise
|
||||
|
||||
|
@ -222,7 +222,7 @@ pwdLastSet: 0
|
||||
raise Exception('Unable to find group "%s"' % groupname)
|
||||
assert(len(targetgroup) == 1)
|
||||
self.delete(targetgroup[0].dn)
|
||||
except Exception:
|
||||
except:
|
||||
self.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
@ -280,7 +280,7 @@ member: %s
|
||||
if modified is True:
|
||||
self.modify_ldif(addtargettogroup)
|
||||
|
||||
except Exception:
|
||||
except:
|
||||
self.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
@ -406,7 +406,7 @@ member: %s
|
||||
if setpassword:
|
||||
self.setpassword("(samAccountName=%s)" % ldb.binary_encode(username), password,
|
||||
force_password_change_at_next_login_req)
|
||||
except Exception:
|
||||
except:
|
||||
self.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
@ -428,7 +428,7 @@ member: %s
|
||||
raise Exception('Unable to find user "%s"' % username)
|
||||
assert(len(target) == 1)
|
||||
self.delete(target[0].dn)
|
||||
except Exception:
|
||||
except:
|
||||
self.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
@ -468,7 +468,7 @@ unicodePwd:: %s
|
||||
|
||||
# modify the userAccountControl to remove the disabled bit
|
||||
self.enable_account(search_filter)
|
||||
except Exception:
|
||||
except:
|
||||
self.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
@ -511,7 +511,7 @@ accountExpires: %u
|
||||
""" % (user_dn, userAccountControl, accountExpires)
|
||||
|
||||
self.modify_ldif(setexp)
|
||||
except Exception:
|
||||
except:
|
||||
self.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
@ -841,7 +841,7 @@ accountExpires: %u
|
||||
self.transaction_start()
|
||||
try:
|
||||
seq = super(SamDB, self).sequence_number(seq_type)
|
||||
except Exception:
|
||||
except:
|
||||
self.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
|
@ -137,7 +137,7 @@ dn: @INDEXLIST
|
||||
self.ldb.add_ldif(self.schema_dn_add)
|
||||
self.ldb.modify_ldif(self.schema_dn_modify)
|
||||
self.ldb.add_ldif(self.schema_data)
|
||||
except Exception:
|
||||
except:
|
||||
self.ldb.transaction_cancel()
|
||||
raise
|
||||
else:
|
||||
|
Reference in New Issue
Block a user