summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/__init__.py12
-rw-r--r--source4/scripting/python/samba/provision.py8
-rw-r--r--source4/scripting/python/samba/samdb.py4
3 files changed, 12 insertions, 12 deletions
diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py
index e0b9e1d410..e858180169 100644
--- a/source4/scripting/python/samba/__init__.py
+++ b/source4/scripting/python/samba/__init__.py
@@ -112,15 +112,15 @@ class Ldb(ldb.Ldb):
for attr in ["@INDEXLIST", "@ATTRIBUTES", "@SUBCLASSES", "@MODULES",
"@OPTIONS", "@PARTITION", "@KLUDGEACL"]:
try:
- self.delete(ldb.Dn(self, attr))
+ self.delete(attr)
except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _):
# Ignore missing dn errors
pass
- basedn = ldb.Dn(self, "")
+ basedn = ""
# and the rest
for msg in self.search(basedn, ldb.SCOPE_SUBTREE,
- "(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))",
+ "(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
["dn"]):
try:
self.delete(msg.dn)
@@ -128,12 +128,12 @@ class Ldb(ldb.Ldb):
# Ignor eno such object errors
pass
- res = self.search(basedn, ldb.SCOPE_SUBTREE, "(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))", ["dn"])
+ res = self.search(basedn, ldb.SCOPE_SUBTREE, "(&(|(objectclass=*)(distinguishedName=*))(!(distinguisedName=@BASEINFO)))", ["dn"])
assert len(res) == 0
def erase_partitions(self):
"""Erase an ldb, removing all records."""
- res = self.search(ldb.Dn(self, ""), ldb.SCOPE_BASE, "(objectClass=*)",
+ res = self.search("", ldb.SCOPE_BASE, "(objectClass=*)",
["namingContexts"])
assert len(res) == 1
if not "namingContexts" in res[0]:
@@ -145,7 +145,7 @@ class Ldb(ldb.Ldb):
k = 0
while ++k < 10 and (previous_remaining != current_remaining):
# and the rest
- res2 = self.search(ldb.Dn(self, basedn), ldb.SCOPE_SUBTREE, "(|(objectclass=*)(dn=*))", ["dn"])
+ res2 = self.search(basedn, ldb.SCOPE_SUBTREE, "(|(objectclass=*)(distinguishedName=*))", ["distinguishedName"])
previous_remaining = current_remaining
current_remaining = len(res2)
for msg in res2:
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index db3749f721..1607cb343b 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -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)
diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py
index 2af56d8d8e..353eaee198 100644
--- a/source4/scripting/python/samba/samdb.py
+++ b/source4/scripting/python/samba/samdb.py
@@ -60,7 +60,7 @@ description: %s
:param sid: SID of the NT-side of the mapping.
:param unixname: Unix name to map to.
"""
- res = self.search(ldb.Dn(self, domaindn), ldb.SCOPE_SUBTREE,
+ res = self.search(domaindn, ldb.SCOPE_SUBTREE,
"objectSid=%s" % sid, ["dn"])
assert len(res) == 1, "Failed to find record for objectSid %s" % sid
@@ -103,7 +103,7 @@ userAccountControl: %u
res = self.search("", SCOPE_BASE, "defaultNamingContext=*",
["defaultNamingContext"])
assert(len(res) == 1 and res[0].defaultNamingContext is not None)
- domain_dn = res[0].defaultNamingContext
+ domain_dn = res[0]["defaultNamingContext"][0]
assert(domain_dn is not None)
dom_users = self.searchone(domain_dn, "dn", "name=Domain Users")
assert(dom_users is not None)