samba-tool domain classicupgrade: Print a better error when the ldap backend PW was...
authorAndrew Bartlett <abartlet@samba.org>
Tue, 15 Jan 2013 10:53:30 +0000 (21:53 +1100)
committerKarolin Seeger <kseeger@samba.org>
Sun, 7 Apr 2013 19:34:00 +0000 (21:34 +0200)
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 669c302f2d78ab4bbd35982373ae079246c8979d)

python/samba/upgrade.py

index d6f906b72d567d156226dc17ecaa3a497a9e5811..1a33841c48b09f128563455a883bbbea2d286159 100644 (file)
@@ -598,7 +598,10 @@ def upgrade_from_samba3(samba3, logger, targetdir, session_info=None,
     if samba3.lp.get("passdb backend").split(":")[0].strip() == "ldapsam":
         base_dn =  samba3.lp.get("ldap suffix")
         ldapuser = samba3.lp.get("ldap admin dn")
-        ldappass = (secrets_db.get_ldap_bind_pw(ldapuser)).strip('\x00')
+        ldappass = secrets_db.get_ldap_bind_pw(ldapuser)
+        if ldappass is None:
+            raise ProvisioningError("ldapsam passdb backend detected but no LDAP Bind PW found in secrets.tdb for user %s.  Please point this tool at the secrets.tdb that was used by the previous installation.")
+        ldappass = ldappass.strip('\x00')
         ldap = True
     else:
         ldapuser = None