[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Wed Dec 20 07:51:02 UTC 2017


The branch, master has been updated
       via  676261f selftest: replace global with explicit environment variables
       via  af005fc selftest: apply NSS_WRAPPER_HOSTNAME to child processes
       via  bfcbc9b selftest: fix samba3.rpc.samba3.netlogon running after an nt4_member test
       via  ef240aa ldb: Intersect the index from SCOPE_ONELEVEL with the index for the search expression
       via  44eee9c selftest: Do not use dn= filter string
      from  0e57105 systemd: Only start samba and nmbd when network interfaces are up

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 676261fa08273114b888bb46f65de3de091b615b
Author: Jamie McClymont <jamiemcclymont at catalyst.net.nz>
Date:   Fri Dec 8 15:20:36 2017 +1300

    selftest: replace global with explicit environment variables
    
    This patch removes setting of NSS_WRAPPER and RESOLV_WRAPPER variables globally
    in Samba3.pm (because setting them persistently/globally can create hidden
    ordering dependencies). Instead, they are set on subprocesses as required, which
    appears to be the following two places (aside from those places where they are
    already set explicitly):
    * calls to createuser in provision
    * calls to wbinfo --ping-dc in wait_for_start
    
    Signed-off-by: Jamie McClymont <jamiemcclymont at catalyst.net.nz>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Wed Dec 20 08:50:26 CET 2017 on sn-devel-144

commit af005fcc845ae3cd233dcb929fe774f38aaf38d8
Author: Jamie McClymont <jamiemcclymont at catalyst.net.nz>
Date:   Fri Dec 8 14:47:09 2017 +1300

    selftest: apply NSS_WRAPPER_HOSTNAME to child processes
    
    Currently, Samba3.pm returns a value for NSS_WRAPPER_HOSTNAME in provision, but
    selftest.pl does not apply it, so Samba3.pm /also/ sets it in its own
    environment. This breaks a command like this:
    
    make test TESTS="samba3.blackbox.smbclient_ntlm.plain samba3.rpc.samba3.netlogon"
    
    ... since samba3.blackbox.smbclient_ntlm.plain runs in an nt4_member env,
    thereby setting ENV{NSS_WRAPPER_HOSTNAME} to the value for a member, and
    samba3.rpc.samba3.netlogon depended on NSS_WRAPPER_HOSTNAME as a username (until
    previous commit).
    
    Signed-off-by: Jamie McClymont <jamiemcclymont at catalyst.net.nz>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit bfcbc9be612bf947f4238208b5a35a715ec36007
Author: Jamie McClymont <jamiemcclymont at catalyst.net.nz>
Date:   Wed Dec 6 12:49:48 2017 +1300

    selftest: fix samba3.rpc.samba3.netlogon running after an nt4_member test
    
    samba3.rpc.samba3.netlogon is using get_myname to find a username with which to
    perform a join. This means that the test tries to join with the existing
    localnt4dc2 user, which happens to work if get_myname is working
    correctly (which it isn't -- see next commit about NSS_WRAPPER_HOSTNAME!)
    
    This commit fixes a test run with, for example:
      TESTS="samba3.blackbox.smbclient_ntlm.plain samba3.rpc.samba3.netlogon"
    (given samba3.blackbox.smbclient_ntlm.plain is in the nt4_member env)
    
    ...which previously failed due to the combination of this and the
    NSS_WRAPPER_HOSTNAME bug.
    
    Signed-off-by: Jamie McClymont <jamiemcclymont at catalyst.net.nz>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ef240aaca0ef693a96726ac2366c454294b87b96
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Dec 18 16:22:01 2017 +1300

    ldb: Intersect the index from SCOPE_ONELEVEL with the index for the search expression
    
    This helps ensure we do not have to scan all objects at this level
    which could be very many (one per DNS zone entry).
    
    However, due to the O(n*m) behaviour in list_intersect() for older
    databases, we only do this in the GUID index mode, leaving the behaviour
    unchanged for existing callers that do not specify the GUID index mode.
    
    NOTE WELL: the behaviour of disallowDNFilter is enforced
    in the index code, so this fixes SCOPE_ONELEVEL to also
    honour disallowDNFilter, hence the additional tests.
    
    The change to select the SUBTREE index in the absense of
    the ONELEVEL index enforces this.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13191
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>

commit 44eee9ce9e9818df8387b2b3782504408112f12c
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Dec 20 14:55:04 2017 +1300

    selftest: Do not use dn= filter string
    
    This accidentially worked with SCOPE_ONELEVEL against Samba but dn= filters are
    not valid in AD.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>

-----------------------------------------------------------------------

Summary of changes:
 lib/ldb/ldb_tdb/ldb_index.c            |  78 +++++++++++++++++--
 lib/ldb/tests/python/api.py            | 134 ++++++++++++++++++++++++++++++++-
 python/samba/tests/samba_tool/sites.py |   4 +-
 selftest/selftest.pl                   |   1 +
 selftest/target/Samba3.pm              |  41 ++++++----
 source3/selftest/tests.py              |   3 +
 source4/torture/rpc/samba3rpc.c        |   8 +-
 7 files changed, 241 insertions(+), 28 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c
index 0afeae5..f2fce42 100644
--- a/lib/ldb/ldb_tdb/ldb_index.c
+++ b/lib/ldb/ldb_tdb/ldb_index.c
@@ -151,6 +151,13 @@ ldb_schema_set_override_GUID_index() must be called.
 struct dn_list {
 	unsigned int count;
 	struct ldb_val *dn;
+	/*
+	 * Do not optimise the intersection of this list,
+	 * we must never return an entry not in this
+	 * list.  This allows the index for
+	 * SCOPE_ONELEVEL to be trusted.
+	 */
+	bool strict;
 };
 
 struct ltdb_idxptr {
@@ -1029,10 +1036,10 @@ static bool list_intersect(struct ldb_context *ldb,
 	   what really matches, as all results are filtered by the
 	   full expression at the end - this shortcut avoids a lot of
 	   work in some cases */
-	if (list->count < 2 && list2->count > 10) {
+	if (list->count < 2 && list2->count > 10 && list2->strict == false) {
 		return true;
 	}
-	if (list2->count < 2 && list->count > 10) {
+	if (list2->count < 2 && list->count > 10 && list->strict == false) {
 		list->count = list2->count;
 		list->dn = list2->dn;
 		/* note that list2 may not be the parent of list2->dn,
@@ -1073,6 +1080,7 @@ static bool list_intersect(struct ldb_context *ldb,
 		}
 	}
 
+	list->strict |= list2->strict;
 	list->dn = talloc_steal(list, list3->dn);
 	list->count = list3->count;
 	talloc_free(list3);
@@ -1411,6 +1419,8 @@ static int ltdb_index_dn_one(struct ldb_module *module,
 			     struct ldb_dn *parent_dn,
 			     struct dn_list *list)
 {
+	/* Ensure we do not shortcut on intersection for this list */
+	list->strict = true;
 	return ltdb_index_dn_attr(module, ltdb,
 				  LTDB_IDXONE, parent_dn, list);
 }
@@ -1630,9 +1640,11 @@ static void ltdb_dn_list_sort(struct ltdb_private *ltdb,
 */
 int ltdb_search_indexed(struct ltdb_context *ac, uint32_t *match_count)
 {
+	struct ldb_context *ldb = ldb_module_get_ctx(ac->module);
 	struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(ac->module), struct ltdb_private);
 	struct dn_list *dn_list;
 	int ret;
+	enum ldb_scope index_scope;
 
 	/* see if indexing is enabled */
 	if (!ltdb->cache->attribute_indexes &&
@@ -1647,7 +1659,19 @@ int ltdb_search_indexed(struct ltdb_context *ac, uint32_t *match_count)
 		return ldb_module_oom(ac->module);
 	}
 
-	switch (ac->scope) {
+	/*
+	 * For the purposes of selecting the switch arm below, if we
+	 * don't have a one-level index then treat it like a subtree
+	 * search
+	 */
+	if (ac->scope == LDB_SCOPE_ONELEVEL &&
+	    !ltdb->cache->one_level_indexes) {
+		index_scope = LDB_SCOPE_SUBTREE;
+	} else {
+		index_scope = ac->scope;
+	}
+
+	switch (index_scope) {
 	case LDB_SCOPE_BASE:
 		/*
 		 * If we ever start to also load the index values for
@@ -1663,10 +1687,6 @@ int ltdb_search_indexed(struct ltdb_context *ac, uint32_t *match_count)
 		break;
 
 	case LDB_SCOPE_ONELEVEL:
-		if (!ltdb->cache->one_level_indexes) {
-			talloc_free(dn_list);
-			return LDB_ERR_OPERATIONS_ERROR;
-		}
 		/*
 		 * If we ever start to also load the index values for
 		 * the tree, we must ensure we strictly intersect with
@@ -1677,6 +1697,50 @@ int ltdb_search_indexed(struct ltdb_context *ac, uint32_t *match_count)
 			talloc_free(dn_list);
 			return ret;
 		}
+
+		/*
+		 * If we have too many matches, running the filter
+		 * tree over the SCOPE_ONELEVEL can be quite expensive
+		 * so we now check the filter tree index as well.
+		 *
+		 * We only do this in the GUID index mode, which is
+		 * O(n*log(m)) otherwise the intersection below will
+		 * be too costly at O(n*m).
+		 *
+		 * We don't set a heuristic for 'too many' but instead
+		 * do it always and rely on the index lookup being
+		 * fast enough in the small case.
+		 */
+		if (ltdb->cache->GUID_index_attribute != NULL) {
+			struct dn_list *idx_one_tree_list
+				= talloc_zero(ac, struct dn_list);
+			if (idx_one_tree_list == NULL) {
+				return ldb_module_oom(ac->module);
+			}
+
+			if (!ltdb->cache->attribute_indexes) {
+				talloc_free(idx_one_tree_list);
+				talloc_free(dn_list);
+				return LDB_ERR_OPERATIONS_ERROR;
+			}
+			/*
+			 * Here we load the index for the tree.
+			 */
+			ret = ltdb_index_dn(ac->module, ltdb, ac->tree,
+					    idx_one_tree_list);
+			if (ret != LDB_SUCCESS) {
+				talloc_free(idx_one_tree_list);
+				talloc_free(dn_list);
+				return ret;
+			}
+
+			if (!list_intersect(ldb, ltdb,
+					    dn_list, idx_one_tree_list)) {
+				talloc_free(idx_one_tree_list);
+				talloc_free(dn_list);
+				return LDB_ERR_OPERATIONS_ERROR;
+			}
+		}
 		break;
 
 	case LDB_SCOPE_SUBTREE:
diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py
index 14bbdcb..409f446 100755
--- a/lib/ldb/tests/python/api.py
+++ b/lib/ldb/tests/python/api.py
@@ -794,7 +794,16 @@ class SearchTests(TestCase):
 
     def test_check_base_error(self):
         """Testing a search"""
-        self.l.add({"dn": "@OPTIONS", "checkBaseOnSearch": b"TRUE"})
+        checkbaseonsearch = {"dn": "@OPTIONS",
+                             "checkBaseOnSearch": b"TRUE"}
+        try:
+            self.l.add(checkbaseonsearch)
+        except ldb.LdbError as err:
+            enum = err.args[0]
+            self.assertEqual(enum, ldb.ERR_ENTRY_ALREADY_EXISTS)
+            m = ldb.Message.from_dict(self.l,
+                                      checkbaseonsearch)
+            self.l.modify(m)
 
         try:
             res11 = self.l.search(base="OU=OU11x,DC=SAMBA,DC=ORG",
@@ -973,6 +982,54 @@ class SearchTests(TestCase):
                               expression="(@IDXONE=DC=SAMBA,DC=ORG)")
         self.assertEqual(len(res11), 0)
 
+    def test_dn_filter_one(self):
+        """Testing that a dn= filter succeeds
+        (or fails with disallowDNFilter
+        set and IDXGUID or (IDX and not IDXONE) mode)
+        when the scope is SCOPE_ONELEVEL.
+
+        This should be made more consistent, but for now lock in
+        the behaviour
+
+        """
+
+        res11 = self.l.search(base="DC=SAMBA,DC=ORG",
+                              scope=ldb.SCOPE_ONELEVEL,
+                              expression="(dn=OU=OU1,DC=SAMBA,DC=ORG)")
+        if hasattr(self, 'disallowDNFilter') and \
+           hasattr(self, 'IDX') and \
+           (hasattr(self, 'IDXGUID') or \
+            ((hasattr(self, 'IDXONE') == False and hasattr(self, 'IDX')))):
+            self.assertEqual(len(res11), 0)
+        else:
+            self.assertEqual(len(res11), 1)
+
+    def test_dn_filter_subtree(self):
+        """Testing that a dn= filter succeeds
+        (or fails with disallowDNFilter set)
+        when the scope is SCOPE_SUBTREE"""
+
+        res11 = self.l.search(base="DC=SAMBA,DC=ORG",
+                              scope=ldb.SCOPE_SUBTREE,
+                              expression="(dn=OU=OU1,DC=SAMBA,DC=ORG)")
+        if hasattr(self, 'disallowDNFilter') \
+           and hasattr(self, 'IDX'):
+            self.assertEqual(len(res11), 0)
+        else:
+            self.assertEqual(len(res11), 1)
+
+    def test_dn_filter_base(self):
+        """Testing that (incorrectly) a dn= filter works
+        when the scope is SCOPE_BASE"""
+
+        res11 = self.l.search(base="OU=OU1,DC=SAMBA,DC=ORG",
+                              scope=ldb.SCOPE_BASE,
+                              expression="(dn=OU=OU1,DC=SAMBA,DC=ORG)")
+
+        # At some point we should fix this, but it isn't trivial
+        self.assertEqual(len(res11), 1)
+
+
 
 class IndexedSearchTests(SearchTests):
     """Test searches using the index, to ensure the index doesn't
@@ -980,19 +1037,94 @@ class IndexedSearchTests(SearchTests):
     def setUp(self):
         super(IndexedSearchTests, self).setUp()
         self.l.add({"dn": "@INDEXLIST",
+                    "@IDXATTR": [b"x", b"y", b"ou"]})
+        self.IDX = True
+
+class IndexedSearchDnFilterTests(SearchTests):
+    """Test searches using the index, to ensure the index doesn't
+       break things"""
+    def setUp(self):
+        super(IndexedSearchDnFilterTests, self).setUp()
+        self.l.add({"dn": "@OPTIONS",
+                    "disallowDNFilter": "TRUE"})
+        self.disallowDNFilter = True
+
+        self.l.add({"dn": "@INDEXLIST",
+                    "@IDXATTR": [b"x", b"y", b"ou"]})
+        self.IDX = True
+
+class IndexedAndOneLevelSearchTests(SearchTests):
+    """Test searches using the index including @IDXONE, to ensure
+       the index doesn't break things"""
+    def setUp(self):
+        super(IndexedAndOneLevelSearchTests, self).setUp()
+        self.l.add({"dn": "@INDEXLIST",
+                    "@IDXATTR": [b"x", b"y", b"ou"],
+                    "@IDXONE": [b"1"]})
+        self.IDX = True
+
+class IndexedAndOneLevelDNFilterSearchTests(SearchTests):
+    """Test searches using the index including @IDXONE, to ensure
+       the index doesn't break things"""
+    def setUp(self):
+        super(IndexedAndOneLevelDNFilterSearchTests, self).setUp()
+        self.l.add({"dn": "@OPTIONS",
+                    "disallowDNFilter": "TRUE"})
+        self.disallowDNFilter = True
+
+        self.l.add({"dn": "@INDEXLIST",
                     "@IDXATTR": [b"x", b"y", b"ou"],
                     "@IDXONE": [b"1"]})
+        self.IDX = True
+        self.IDXONE = True
 
 class GUIDIndexedSearchTests(SearchTests):
     """Test searches using the index, to ensure the index doesn't
        break things"""
     def setUp(self):
         super(GUIDIndexedSearchTests, self).setUp()
+
+        self.l.add({"dn": "@INDEXLIST",
+                    "@IDXATTR": [b"x", b"y", b"ou"],
+                    "@IDXGUID": [b"objectUUID"],
+                    "@IDX_DN_GUID": [b"GUID"]})
+        self.IDXGUID = True
+        self.IDXONE = True
+
+class GUIDIndexedDNFilterSearchTests(SearchTests):
+    """Test searches using the index, to ensure the index doesn't
+       break things"""
+    def setUp(self):
+        super(GUIDIndexedDNFilterSearchTests, self).setUp()
+        self.l.add({"dn": "@OPTIONS",
+                    "disallowDNFilter": "TRUE"})
+        self.disallowDNFilter = True
+
+        self.l.add({"dn": "@INDEXLIST",
+                    "@IDXATTR": [b"x", b"y", b"ou"],
+                    "@IDXGUID": [b"objectUUID"],
+                    "@IDX_DN_GUID": [b"GUID"]})
+        self.IDX = True
+        self.IDXGUID = True
+
+class GUIDAndOneLevelIndexedSearchTests(SearchTests):
+    """Test searches using the index including @IDXONE, to ensure
+       the index doesn't break things"""
+    def setUp(self):
+        super(GUIDAndOneLevelIndexedSearchTests, self).setUp()
+        self.l.add({"dn": "@OPTIONS",
+                    "disallowDNFilter": "TRUE"})
+        self.disallowDNFilter = True
+
         self.l.add({"dn": "@INDEXLIST",
                     "@IDXATTR": [b"x", b"y", b"ou"],
                     "@IDXONE": [b"1"],
                     "@IDXGUID": [b"objectUUID"],
                     "@IDX_DN_GUID": [b"GUID"]})
+        self.IDX = True
+        self.IDXGUID = True
+        self.IDXONE = True
+
 
 class AddModifyTests(TestCase):
     def tearDown(self):
diff --git a/python/samba/tests/samba_tool/sites.py b/python/samba/tests/samba_tool/sites.py
index 8f96bba..3694825 100644
--- a/python/samba/tests/samba_tool/sites.py
+++ b/python/samba/tests/samba_tool/sites.py
@@ -50,7 +50,7 @@ class SitesCmdTestCase(BaseSitesCmdTestCase):
         dnsite = ldb.Dn(self.samdb, "CN=%s,%s" % (sitename, dnsites))
 
         ret = self.samdb.search(base=dnsites, scope=ldb.SCOPE_ONELEVEL,
-                                expression='(dn=%s)' % str(dnsite))
+                                expression='(cn=%s)' % sitename)
         self.assertEquals(len(ret), 1)
 
         # now delete it
@@ -106,7 +106,7 @@ class SitesSubnetCmdTestCase(BaseSitesCmdTestCase):
                                            (cidr, self.config_dn)))
 
             ret = self.samdb.search(base=dnsubnets, scope=ldb.SCOPE_ONELEVEL,
-                                    expression='(dn=%s)' % dnsubnet)
+                                    expression='(CN=%s)' % cidr)
             self.assertIsNotNone(ret)
             self.assertEqual(len(ret), 1)
             self.samdb.delete(dnsubnet, ["tree_delete:0"])
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 8c41459..2316f9f 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -883,6 +883,7 @@ my @exported_envvars = (
 	"NSS_WRAPPER_PASSWD",
 	"NSS_WRAPPER_GROUP",
 	"NSS_WRAPPER_HOSTS",
+	"NSS_WRAPPER_HOSTNAME",
 	"NSS_WRAPPER_MODULE_SO_PATH",
 	"NSS_WRAPPER_MODULE_FN_PREFIX",
 
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 229435d..c9888c2 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1374,10 +1374,16 @@ sub check_or_start($$$$$) {
 	return $self->wait_for_start($env_vars, $nmbd, $winbindd, $smbd);
 }
 
-sub createuser($$$$)
+sub createuser($$$$$)
 {
-	my ($self, $username, $password, $conffile) = @_;
+	my ($self, $username, $password, $conffile, $env) = @_;
 	my $cmd = "UID_WRAPPER_ROOT=1 " . Samba::bindir_path($self, "smbpasswd")." -c $conffile -L -s -a $username > /dev/null";
+
+	keys %$env;
+	while(my($var, $val) = each %$env) {
+		$cmd = "$var=\"$val\" $cmd";
+	}
+
 	unless (open(PWD, "|$cmd")) {
 	    warn("Unable to set password for $username account\n$cmd");
 	    return undef;
@@ -1399,6 +1405,7 @@ sub provision($$$$$$$$$)
 
 	my $swiface = Samba::get_interface($server);
 	my %ret = ();
+	my %createuser_env = ();
 	my $server_ip = "127.0.0.$swiface";
 	my $server_ipv6 = sprintf("fd00:0000:0000:0000:0000:0000:5357:5f%02x", $swiface);
 
@@ -2242,21 +2249,21 @@ force_user:x:$gid_force_user:
 		close(EVENTLOG);
 	}
 
-	$ENV{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
-	$ENV{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
-	$ENV{NSS_WRAPPER_HOSTS} = $nss_wrapper_hosts;
-	$ENV{NSS_WRAPPER_HOSTNAME} = "${hostname}.samba.example.com";
+	$createuser_env{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd;
+	$createuser_env{NSS_WRAPPER_GROUP} = $nss_wrapper_group;
+	$createuser_env{NSS_WRAPPER_HOSTS} = $nss_wrapper_hosts;
+	$createuser_env{NSS_WRAPPER_HOSTNAME} = "${hostname}.samba.example.com";
 	if ($ENV{SAMBA_DNS_FAKING}) {
-		$ENV{RESOLV_WRAPPER_CONF} = $resolv_conf;
+		$createuser_env{RESOLV_WRAPPER_CONF} = $resolv_conf;
 	} else {
-		$ENV{RESOLV_WRAPPER_HOSTS} = $dns_host_file;
+		$createuser_env{RESOLV_WRAPPER_HOSTS} = $dns_host_file;
 	}
 
-	createuser($self, $unix_name, $password, $conffile) || die("Unable to create user");
-	createuser($self, "force_user", $password, $conffile) || die("Unable to create force_user");
-	createuser($self, "smbget_user", $password, $conffile) || die("Unable to create smbget_user");
-	createuser($self, "user1", $password, $conffile) || die("Unable to create user1");
-	createuser($self, "user2", $password, $conffile) || die("Unable to create user2");
+	createuser($self, $unix_name, $password, $conffile, \%createuser_env) || die("Unable to create user");
+	createuser($self, "force_user", $password, $conffile, \%createuser_env) || die("Unable to create force_user");
+	createuser($self, "smbget_user", $password, $conffile, \%createuser_env) || die("Unable to create smbget_user");
+	createuser($self, "user1", $password, $conffile, \%createuser_env) || die("Unable to create user1");
+	createuser($self, "user2", $password, $conffile, \%createuser_env) || die("Unable to create user2");
 
 	open(DNS_UPDATE_LIST, ">$prefix/dns_update_list") or die("Unable to open $$prefix/dns_update_list");
 	print DNS_UPDATE_LIST "A $server. $server_ip\n";
@@ -2350,9 +2357,15 @@ sub wait_for_start($$$$$)
 	if ($winbindd eq "yes") {
 	    print "checking for winbindd\n";
 	    my $count = 0;
+	    my $cmd = "";
+	    $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR='$envvars->{SELFTEST_WINBINDD_SOCKET_DIR}' ";
+	    $cmd .= "NSS_WRAPPER_PASSWD='$envvars->{NSS_WRAPPER_PASSWD}' ";
+	    $cmd .= "NSS_WRAPPER_GROUP='$envvars->{NSS_WRAPPER_GROUP}' ";
+	    $cmd .= Samba::bindir_path($self, "wbinfo") . " --ping-dc";
+
 	    do {
-		$ret = system("SELFTEST_WINBINDD_SOCKET_DIR=" . $envvars->{SELFTEST_WINBINDD_SOCKET_DIR} . " " . Samba::bindir_path($self, "wbinfo") . " --ping-dc");
 		if ($ret != 0) {
+		    $ret = system($cmd);
 		    sleep(1);
 		}
 		$count++;
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 4bb3707..d4e919d 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -534,6 +534,9 @@ for t in tests:
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/aio -U$USERNAME%$PASSWORD', 'aio')
         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
+    elif t == "rpc.samba3.netlogon" or t == "rpc.samba3.sessionkey":
+        plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=torture:wksname=samba3rpctest')
+        plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD --option=torture:wksname=samba3rpctest')
     else:
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 54239d4..9cd479c 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -1373,9 +1373,7 @@ static bool torture_netlogon_samba3(struct torture_context *torture)
 	struct smbcli_session_options session_options;
 
 	wks_name = torture_setting_string(torture, "wksname", NULL);
-	if (wks_name == NULL) {
-		wks_name = get_myname(torture);
-	}
+	torture_assert(torture, wks_name != NULL, "wksname not set");
 
 	lpcfg_smbcli_options(torture->lp_ctx, &options);
 	lpcfg_smbcli_session_options(torture->lp_ctx, &session_options);
@@ -1513,7 +1511,9 @@ static bool torture_samba3_sessionkey(struct torture_context *torture)
 	struct cli_credentials *anon_creds;
 	const char *wks_name;
 
-	wks_name = torture_setting_string(torture, "wksname", get_myname(torture));
+
+	wks_name = torture_setting_string(torture, "wksname", NULL);
+	torture_assert(torture, wks_name != NULL, "wksname not set");
 
 	if (!(anon_creds = cli_credentials_init_anon(torture))) {
 		torture_fail(torture, "create_anon_creds failed\n");


-- 
Samba Shared Repository



More information about the samba-cvs mailing list