1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-26 03:42:04 +03:00

Python: Simplify code in a couple of places. Copy Andrew's changes from g53b5166.

(This used to be commit f056f62495)
This commit is contained in:
Jelmer Vernooij
2008-01-11 16:13:46 +01:00
parent 35c597161b
commit 7c3e8c838f
3 changed files with 12 additions and 12 deletions

View File

@ -20,7 +20,7 @@ import samba
from samba import Ldb, substitute_var, valid_netbios_name
from samba.samdb import SamDB
import security
from ldb import Dn, SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError, \
from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError, \
LDB_ERR_NO_SUCH_OBJECT, timestring, CHANGETYPE_MODIFY, CHANGETYPE_NONE
"""Functions for setting up a Samba configuration."""
@ -64,7 +64,7 @@ def install_ok(lp, session_info, credentials):
return False
ldb = Ldb(lp.get("sam database"), session_info=session_info,
credentials=credentials, lp=lp)
if len(ldb.search(ldb.Dn("(cn=Administrator)"))) != 1:
if len(ldb.search("(cn=Administrator)")) != 1:
return False
return True
@ -766,9 +766,9 @@ def provision(lp, setup_dir, message, blank, paths, session_info,
samdb = SamDB(paths.samdb, session_info=session_info,
credentials=credentials, lp=lp)
domainguid = samdb.searchone(Dn(samdb, domaindn), "objectGUID")
domainguid = samdb.searchone(domaindn, "objectGUID")
assert isinstance(domainguid, str)
hostguid = samdb.searchone(Dn(samdb, domaindn), "objectGUID",
hostguid = samdb.searchone(domaindn, "objectGUID",
expression="(&(objectClass=computer)(cn=%s))" % hostname,
scope=SCOPE_SUBTREE)
assert isinstance(hostguid, str)