Move some samdb-specific code out of provision.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 11 Feb 2009 17:31:52 +0000 (18:31 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 11 Feb 2009 17:31:52 +0000 (18:31 +0100)
source4/scripting/python/samba/provision.py
source4/scripting/python/samba/samdb.py

index 91cc074031817789b02afb3ef6a715e87e5e9834..1d7011d305c0a297e312c5adcabc92c8cacd5fab 100644 (file)
@@ -394,7 +394,6 @@ def make_smbconf(smbconf, setup_path, hostname, domain, realm, serverrole,
             })
 
 
             })
 
 
-
 def setup_name_mappings(samdb, idmap, sid, domaindn, root_uid, nobody_uid,
                         users_gid, wheel_gid):
     """setup reasonable name mappings for sam names to unix names.
 def setup_name_mappings(samdb, idmap, sid, domaindn, root_uid, nobody_uid,
                         users_gid, wheel_gid):
     """setup reasonable name mappings for sam names to unix names.
@@ -408,11 +407,7 @@ def setup_name_mappings(samdb, idmap, sid, domaindn, root_uid, nobody_uid,
     :param users_gid: gid of the UNIX users group.
     :param wheel_gid: gid of the UNIX wheel group."""
     # add some foreign sids if they are not present already
     :param users_gid: gid of the UNIX users group.
     :param wheel_gid: gid of the UNIX wheel group."""
     # add some foreign sids if they are not present already
-    samdb.add_foreign(domaindn, "S-1-5-7", "Anonymous")
-    samdb.add_foreign(domaindn, "S-1-1-0", "World")
-    samdb.add_foreign(domaindn, "S-1-5-2", "Network")
-    samdb.add_foreign(domaindn, "S-1-5-18", "System")
-    samdb.add_foreign(domaindn, "S-1-5-11", "Authenticated Users")
+    samdb.add_stock_foreign_sids()
 
     idmap.setup_name_mapping("S-1-5-7", idmap.TYPE_UID, nobody_uid)
     idmap.setup_name_mapping("S-1-5-32-544", idmap.TYPE_GID, wheel_gid)
 
     idmap.setup_name_mapping("S-1-5-7", idmap.TYPE_UID, nobody_uid)
     idmap.setup_name_mapping("S-1-5-32-544", idmap.TYPE_GID, wheel_gid)
@@ -1423,6 +1418,7 @@ def provision_backend(setup_dir=None, message=None,
             "--server-role='" + serverrole + "'"]
     message("Run provision with: " + " ".join(args))
 
             "--server-role='" + serverrole + "'"]
     message("Run provision with: " + " ".join(args))
 
+
 def create_phpldapadmin_config(path, setup_path, ldapi_uri):
     """Create a PHP LDAP admin configuration file.
 
 def create_phpldapadmin_config(path, setup_path, ldapi_uri):
     """Create a PHP LDAP admin configuration file.
 
index 947c46079f55d71922c031e6fab5ae41a8549b94..9cc55e5629e829b5dd3b7f7af6a9e453f0e29aba 100644 (file)
@@ -65,6 +65,14 @@ description: %s
         for msg in self.parse_ldif(add):
             self.add(msg[1])
 
         for msg in self.parse_ldif(add):
             self.add(msg[1])
 
+    def add_stock_foreign_sids(self):
+        domaindn = self.domain_dn()
+        self.add_foreign(domaindn, "S-1-5-7", "Anonymous")
+        self.add_foreign(domaindn, "S-1-1-0", "World")
+        self.add_foreign(domaindn, "S-1-5-2", "Network")
+        self.add_foreign(domaindn, "S-1-5-18", "System")
+        self.add_foreign(domaindn, "S-1-5-11", "Authenticated Users")
+
     def enable_account(self, user_dn):
         """Enable an account.
         
     def enable_account(self, user_dn):
         """Enable an account.