summaryrefslogtreecommitdiff
path: root/source4/scripting/python/samba
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-04-04 03:30:03 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-04-07 17:39:59 +0200
commit21ab06f8a233b38bee750250e455416ac0bef13e (patch)
tree17a6e2a91ed88226f629444a30becd198edfcf6c /source4/scripting/python/samba
parentfe4b212eba1d7645c8be98240a2630759050197d (diff)
downloadsamba-21ab06f8a233b38bee750250e455416ac0bef13e.tar.gz
samba-21ab06f8a233b38bee750250e455416ac0bef13e.tar.bz2
samba-21ab06f8a233b38bee750250e455416ac0bef13e.zip
s4-python: Move samdb_ntds_objectGUID to pydsdb.
Diffstat (limited to 'source4/scripting/python/samba')
-rw-r--r--source4/scripting/python/samba/provision.py11
-rw-r--r--source4/scripting/python/samba/samdb.py50
2 files changed, 48 insertions, 13 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index f3c5bcc6fb..d23333c66e 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -894,8 +894,8 @@ def setup_samdb(path, setup_path, session_info, provision_backend, lp,
samdb.set_opaque_integer("forestFunctionality", forestFunctionality)
samdb.set_opaque_integer("domainControllerFunctionality", domainControllerFunctionality)
- samdb.set_domain_sid(str(domainsid))
- samdb.set_invocation_id(invocationid)
+ samdb.domain_sid = str(domainsid)
+ samdb.invocation_id = invocationid
message("Adding DomainDN: %s" % names.domaindn)
@@ -947,11 +947,12 @@ def setup_samdb(path, setup_path, session_info, provision_backend, lp,
message("Reopening sam.ldb with new schema")
samdb.transaction_commit()
- samdb = Ldb(session_info=admin_session_info,
- credentials=provision_backend.credentials, lp=lp)
+ samdb = SamDB(session_info=admin_session_info,
+ credentials=provision_backend.credentials, lp=lp,
+ global_schema=False)
samdb.connect(path)
samdb.transaction_start()
- samdb.set_invocation_id(invocationid)
+ samdb.invocation_id = invocationid
message("Setting up sam.ldb configuration data")
setup_add_ldif(samdb, setup_path("provision_configuration.ldif"), {
diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py
index 22e8f46226..f584adb515 100644
--- a/source4/scripting/python/samba/samdb.py
+++ b/source4/scripting/python/samba/samdb.py
@@ -23,6 +23,7 @@
"""Convenience functions for using the SAM."""
+import dsdb
import samba
import glue
import ldb
@@ -38,10 +39,6 @@ class SamDB(samba.Ldb):
def __init__(self, url=None, lp=None, modules_dir=None, session_info=None,
credentials=None, flags=0, options=None):
- """Opens the SAM Database
- For parameter meanings see the super class (samba.Ldb)
- """
-
self.lp = lp
if url is None:
url = lp.get("sam database")
@@ -107,7 +104,8 @@ pwdLastSet: 0
""" % (user_dn)
self.modify_ldif(mod)
- def newuser(self, username, unixname, password, force_password_change_at_next_login_req=False):
+ def newuser(self, username, unixname, password,
+ force_password_change_at_next_login_req=False):
"""Adds a new user
Note: This call adds also the ID mapping for winbind; therefore it works
@@ -154,7 +152,7 @@ pwdLastSet: 0
raise
self.transaction_commit()
- def setpassword(self, filter, password, force_password_change_at_next_login_req=False):
+ def setpassword(self, filter, password, force_change_at_next_login=False):
"""Sets the password for a user
Note: This call uses the "userPassword" attribute to set the password.
@@ -163,7 +161,7 @@ pwdLastSet: 0
:param filter: LDAP filter to find the user (eg samccountname=name)
:param password: Password for the user
- :param force_password_change_at_next_login_req: Force password change
+ :param force_change_at_next_login: Force password change
"""
self.transaction_start()
try:
@@ -181,7 +179,7 @@ userPassword:: %s
self.modify_ldif(setpw)
- if force_password_change_at_next_login_req:
+ if force_change_at_next_login:
self.force_password_change_at_next_login(
"(dn=" + str(user_dn) + ")")
@@ -230,3 +228,39 @@ accountExpires: %u
self.transaction_cancel()
raise
self.transaction_commit()
+
+ def set_domain_sid(self, sid):
+ """Change the domain SID used by this LDB.
+
+ :param sid: The new domain sid to use.
+ """
+ dsdb.samdb_set_domain_sid(self, sid)
+
+ def get_domain_sid(self):
+ """Read the domain SID used by this LDB.
+
+ """
+ dsdb.samdb_get_domain_sid(self)
+
+ def set_invocation_id(self, invocation_id):
+ """Set the invocation id for this SamDB handle.
+
+ :param invocation_id: GUID of the invocation id.
+ """
+ dsdb.dsdb_set_ntds_invocation_id(self, invocation_id)
+
+ def get_invocation_id(self):
+ "Get the invocation_id id"
+ return dsdb.samdb_ntds_invocation_id(self)
+
+ invocation_id = property(get_invocation_id, set_invocation_id)
+
+ domain_sid = property(get_domain_sid, set_domain_sid)
+
+ def get_ntds_GUID(self):
+ "Get the NTDS objectGUID"
+ return dsdb.samdb_ntds_objectGUID(self)
+
+ def server_site_name(self):
+ "Get the server site name"
+ return dsdb.samdb_server_site_name(self)