Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-abartlet
authorAndrew Bartlett <abartlet@samba.org>
Sat, 5 Apr 2008 10:35:36 +0000 (21:35 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 5 Apr 2008 10:35:36 +0000 (21:35 +1100)
(This used to be commit 7355055569654f5d4876034fa86fa70d0417dcf8)

source4/dsdb/samdb/ldb_modules/rootdse.c
source4/scripting/python/samba/provision.py
source4/setup/provision_rootdse_add.ldif
source4/torture/libnet/libnet_BecomeDC.c
source4/torture/rpc/testjoin.c
source4/torture/util.h
source4/torture/util_provision.c

index 3235b24ef90a4ce71dc4f0de67b1f1c0f2dc14c5..50f333d09572bfd6d70150641f748ff5be174531 100644 (file)
@@ -26,6 +26,7 @@
 #include "lib/ldb/include/ldb_private.h"
 #include "system/time.h"
 #include "dsdb/samdb/samdb.h"
+#include "version.h"
 
 struct private_data {
        int num_controls;
@@ -202,6 +203,13 @@ static int rootdse_add_dynamic(struct ldb_module *module, struct ldb_message *ms
                }
        }
 
+       if (schema && do_attribute_explicit(attrs, "vendorVersion")) {
+               if (ldb_msg_add_fmt(msg, "vendorVersion", 
+                                   "%s", SAMBA_VERSION_STRING) != 0) {
+                       goto failed;
+               }
+       }
+
        /* TODO: lots more dynamic attributes should be added here */
 
        return LDB_SUCCESS;
index 6917aa1a543381227e0b4afaf01559d24555cc3f..02460070b403b295c9d27af68dd979062c3a882f 100644 (file)
@@ -265,7 +265,8 @@ def provision_paths_from_lp(lp, dnsdomain):
     return paths
 
 def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, serverrole=None,
-              rootdn=None, domaindn=None, configdn=None, schemadn=None, sitename=None):
+                rootdn=None, domaindn=None, configdn=None, schemadn=None, serverdn=None, 
+                sitename=None):
 
     if hostname is None:
         hostname = socket.gethostname().split(".")[0].lower()
@@ -332,6 +333,7 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, serverrole=
     names.netbiosname = netbiosname
     names.hostname = hostname
     names.sitename = sitename
+    names.serverdn = "CN=%s,CN=Servers,CN=%s,CN=Sites,%s" % (netbiosname, sitename, configdn)
     
     return names
     
@@ -543,9 +545,7 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info,
         samdb.load_ldif_file_add(setup_path("provision_init.ldif"))
 
         message("Setting up sam.ldb rootDSE")
-        setup_samdb_rootdse(samdb, setup_path, names.schemadn, names.domaindn, names.hostname, 
-                            names.dnsdomain, names.realm, names.rootdn, names.configdn, names.netbiosname,
-                            names.sitename)
+        setup_samdb_rootdse(samdb, setup_path, names)
 
         if erase:
             message("Erasing data from partitions")
@@ -656,25 +656,22 @@ def setup_idmapdb(path, setup_path, session_info, credentials, lp):
     idmap_ldb.load_ldif_file_add(setup_path("idmap_init.ldif"))
     return idmap_ldb
 
-def setup_samdb_rootdse(samdb, setup_path, schemadn, domaindn, hostname, 
-                        dnsdomain, realm, rootdn, configdn, netbiosname,
-                        sitename):
+def setup_samdb_rootdse(samdb, setup_path, names):
     """Setup the SamDB rootdse.
 
     :param samdb: Sam Database handle
     :param setup_path: Obtain setup path
     """
     setup_add_ldif(samdb, setup_path("provision_rootdse_add.ldif"), {
-        "SCHEMADN": schemadn, 
-        "NETBIOSNAME": netbiosname,
-        "DNSDOMAIN": dnsdomain,
-        "DEFAULTSITE": sitename,
-        "REALM": realm,
-        "DNSNAME": "%s.%s" % (hostname, dnsdomain),
-        "DOMAINDN": domaindn,
-        "ROOTDN": rootdn,
-        "CONFIGDN": configdn,
-        "VERSION": samba.version(),
+        "SCHEMADN": names.schemadn, 
+        "NETBIOSNAME": names.netbiosname,
+        "DNSDOMAIN": names.dnsdomain,
+        "REALM": names.realm,
+        "DNSNAME": "%s.%s" % (names.hostname, names.dnsdomain),
+        "DOMAINDN": names.domaindn,
+        "ROOTDN": names.rootdn,
+        "CONFIGDN": names.configdn,
+        "SERVERDN": names.serverdn,
         })
         
 
@@ -879,7 +876,8 @@ FILL_DRS = "DRS"
 
 def provision(setup_dir, message, session_info, 
               credentials, smbconf=None, targetdir=None, samdb_fill=FILL_FULL, realm=None, 
-              rootdn=None, domaindn=None, schemadn=None, configdn=None,
+              rootdn=None, domaindn=None, schemadn=None, configdn=None, 
+              serverdn=None,
               domain=None, hostname=None, hostip=None, hostip6=None, 
               domainsid=None, adminpass=None, krbtgtpass=None, domainguid=None, 
               policyguid=None, invocationid=None, machinepass=None, 
@@ -932,7 +930,8 @@ def provision(setup_dir, message, session_info,
 
     names = guess_names(lp=lp, hostname=hostname, domain=domain, 
                         dnsdomain=realm, serverrole=serverrole, sitename=sitename,
-                        rootdn=rootdn, domaindn=domaindn, configdn=configdn, schemadn=schemadn)
+                        rootdn=rootdn, domaindn=domaindn, configdn=configdn, schemadn=schemadn,
+                        serverdn=serverdn)
 
     paths = provision_paths_from_lp(lp, names.dnsdomain)
 
@@ -1064,12 +1063,13 @@ def provision(setup_dir, message, session_info,
 def provision_become_dc(setup_dir=None,
                         smbconf=None, targetdir=None, realm=None, 
                         rootdn=None, domaindn=None, schemadn=None, configdn=None,
+                        serverdn=None,
                         domain=None, hostname=None, domainsid=None, 
                         adminpass=None, krbtgtpass=None, domainguid=None, 
                         policyguid=None, invocationid=None, machinepass=None, 
                         dnspass=None, root=None, nobody=None, nogroup=None, users=None, 
                         wheel=None, backup=None, aci=None, serverrole=None, 
-                        ldap_backend=None, ldap_backend_type=None, sitename=DEFAULTSITE):
+                        ldap_backend=None, ldap_backend_type=None, sitename=None):
 
     def message(text):
        """print a message if quiet is not set."""
@@ -1077,7 +1077,7 @@ def provision_become_dc(setup_dir=None,
 
     provision(setup_dir, message, system_session(), None,
               smbconf=smbconf, targetdir=targetdir, samdb_fill=FILL_DRS, realm=realm, 
-              rootdn=rootdn, domaindn=domaindn, schemadn=schemadn, configdn=configdn, 
+              rootdn=rootdn, domaindn=domaindn, schemadn=schemadn, configdn=configdn, serverdn=serverdn,
               domain=domain, hostname=hostname, hostip="127.0.0.1", domainsid=domainsid, machinepass=machinepass, serverrole="domain controller", sitename=sitename);
     
 
index 9f19796ec6c6049caf7ba0601a17a77721010812..14e0d71df6cda8dd48634d7cf3d90d48cbb71059 100644 (file)
@@ -1,7 +1,7 @@
 # the rootDSE module looks in this record for its base data
 dn: @ROOTDSE
 subschemaSubentry: CN=Aggregate,${SCHEMADN}
-dsServiceName: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
+dsServiceName: CN=NTDS Settings,${SERVERDN}
 defaultNamingContext: ${DOMAINDN}
 rootDomainNamingContext: ${ROOTDN}
 configurationNamingContext: ${CONFIGDN}
@@ -9,10 +9,9 @@ schemaNamingContext: ${SCHEMADN}
 supportedLDAPVersion: 3
 dnsHostName: ${DNSNAME}
 ldapServiceName: ${DNSDOMAIN}:${NETBIOSNAME}$@${REALM}
-serverName: CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
+serverName: ${SERVERDN}
 domainFunctionality: 0
 forestFunctionality: 0
 domainControllerFunctionality: 2
 isSynchronized: FALSE
 vendorName: Samba Team (http://samba.org)
-vendorVersion: ${VERSION}
index 3f8edd40e845d65215052b64893c7ea155ac4a81..f8699fe06abaccd4bfcef313e85443b7128322dc 100644 (file)
@@ -84,6 +84,7 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data,
        settings.netbios_name = p->dest_dsa->netbios_name;
        settings.realm = torture_join_dom_dns_name(s->tj);
        settings.domain = torture_join_dom_netbios_name(s->tj);
+       settings.server_dn_str = torture_join_server_dn_str(s->tj);
        settings.machine_password = cli_credentials_get_password(s->machine_account);
        settings.targetdir = s->targetdir;
 
index 02f04946d6e2adc2f6f56fee4246258a2eef5335..892886c08c53ceceda7501ac594267bf5cf1394d 100644 (file)
@@ -553,6 +553,14 @@ const char *torture_join_dom_dns_name(struct test_join *join)
        return join->dom_dns_name;
 }
 
+const char *torture_join_server_dn_str(struct test_join *join)
+{
+       if (join->libnet_r) {
+               return join->libnet_r->out.server_dn_str;
+       }
+       return NULL;
+}
+
 
 #if 0 /* Left as the documentation of the join process, but see new implementation in libnet_become_dc.c */
 struct test_join_ads_dc {
index 477a828120173cb97715d11a90f7bf107c443450..72f97e4766a7297f79ed88119b03203f2969f5eb 100644 (file)
@@ -27,6 +27,7 @@ struct provision_settings {
        const char *domain_dn_str;
        const char *config_dn_str;
        const char *schema_dn_str;
+       const char *server_dn_str;
        const struct GUID *invocation_id;
        const char *netbios_name;
        const char *host_ip;
index cce8e18fdcc7772ee1dc5acf607d3aca8935decd..3167a37cdf7b616cb19d2339c14577991e0f55e8 100644 (file)
@@ -105,6 +105,10 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
                PyDict_SetItemString(parameters, "configdn", 
                                     PyString_FromString(settings->config_dn_str));
        
+       if (settings->server_dn_str) 
+               PyDict_SetItemString(parameters, "serverdn", 
+                                    PyString_FromString(settings->server_dn_str));
+       
        if (settings->site_name) 
                PyDict_SetItemString(parameters, "sitename", 
                                     PyString_FromString(settings->site_name));