summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2009-11-05 12:04:05 -0600
committerAndrew Bartlett <abartlet@samba.org>2009-11-12 22:23:21 +1100
commitbe766a384173bb02c5306e5884d1228973fe5dd7 (patch)
treefb2f8ab8bb0f93bb8d00969c5307c3218dc134ef /source4
parentfbc5696e38754b6014875c231edd5f56479e134b (diff)
downloadsamba-be766a384173bb02c5306e5884d1228973fe5dd7.tar.gz
samba-be766a384173bb02c5306e5884d1228973fe5dd7.tar.bz2
samba-be766a384173bb02c5306e5884d1228973fe5dd7.zip
s4:provision - Added start() method in LDAPBackend.
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/provision.py2
-rw-r--r--source4/scripting/python/samba/provisionbackend.py31
2 files changed, 20 insertions, 13 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index 012481bc78..1c194c042c 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -1276,6 +1276,8 @@ def provision(setup_dir, message, session_info,
ldap_dryrun_mode=ldap_dryrun_mode,
domainsid=domainsid)
+ provision_backend.start()
+
# only install a new shares config db if there is none
if not os.path.exists(paths.shareconf):
message("Setting up share.ldb")
diff --git a/source4/scripting/python/samba/provisionbackend.py b/source4/scripting/python/samba/provisionbackend.py
index 438ab2e59c..b2a1fa684d 100644
--- a/source4/scripting/python/samba/provisionbackend.py
+++ b/source4/scripting/python/samba/provisionbackend.py
@@ -69,8 +69,10 @@ class ProvisionBackend(object):
This works for OpenLDAP and Fedora DS
"""
self.paths = paths
+ self.setup_path = setup_path
self.slapd_command = None
self.slapd_command_escaped = None
+ self.lp = lp
self.names = names
self.type = backend_type
@@ -147,11 +149,14 @@ class ProvisionBackend(object):
self.credentials.guess(lp)
#Kerberos to an ldapi:// backend makes no sense
self.credentials.set_kerberos_state(DONT_USE_KERBEROS)
+ self.credentials.set_password(ldapadminpass)
self.secrets_credentials = Credentials()
self.secrets_credentials.guess(lp)
#Kerberos to an ldapi:// backend makes no sense
self.secrets_credentials.set_kerberos_state(DONT_USE_KERBEROS)
+ self.secrets_credentials.set_username("samba-admin")
+ self.secrets_credentials.set_password(ldapadminpass)
if self.type == "fedora-ds":
@@ -181,12 +186,20 @@ class ProvisionBackend(object):
else:
raise ProvisioningError("Unknown LDAP backend type selected")
- self.credentials.set_password(ldapadminpass)
- self.secrets_credentials.set_username("samba-admin")
- self.secrets_credentials.set_password(ldapadminpass)
+ def start(self):
+ pass
+
+ def shutdown(self):
+ pass
+ def post_setup(self):
+ pass
+
+
+class LDAPBackend(ProvisionBackend):
+ def start(self):
self.slapd_command_escaped = "\'" + "\' \'".join(self.slapd_command) + "\'"
- setup_file(setup_path("ldap_backend_startup.sh"), paths.ldapdir + "/ldap_backend_startup.sh", {
+ setup_file(self.setup_path("ldap_backend_startup.sh"), self.paths.ldapdir + "/ldap_backend_startup.sh", {
"SLAPD_COMMAND" : self.slapd_command_escaped})
# Now start the slapd, so we can provision onto it. We keep the
@@ -197,7 +210,7 @@ class ProvisionBackend(object):
while self.slapd.poll() is None:
# Wait until the socket appears
try:
- ldapi_db = Ldb(self.ldapi_uri, lp=lp, credentials=self.credentials)
+ ldapi_db = Ldb(self.ldapi_uri, lp=self.lp, credentials=self.credentials)
search_ol_rootdse = ldapi_db.search(base="", scope=SCOPE_BASE,
expression="(objectClass=OpenLDAProotDSE)")
# If we have got here, then we must have a valid connection to the LDAP server!
@@ -209,14 +222,6 @@ class ProvisionBackend(object):
raise ProvisioningError("slapd died before we could make a connection to it")
def shutdown(self):
- pass
-
- def post_setup(self):
- pass
-
-
-class LDAPBackend(ProvisionBackend):
- def shutdown(self):
# if an LDAP backend is in use, terminate slapd after final provision and check its proper termination
if self.slapd.poll() is None:
#Kill the slapd