[SCM] Samba Shared Repository - branch master updated

Kai Blin kai at samba.org
Thu Jan 14 07:19:03 MST 2010


The branch, master has been updated
       via  743adfd... s3 selftest: Enable the WINBIND-STRUCT tests
       via  cf38a1f... s3 test: Fix WINBINDD-STRUCT tests
       via  89e6eac... s3 selftest: Fix LOOKUP_SID test.
       via  e95c04f... s3 selftest: Fix WINBINDD_LIST_GROUPS test
       via  932d4a8... s3 winbindd: Return number of groups in data.num_entries for WINBINDD_LIST_GROUPS
       via  a4f21d5... s3 selftest: Allow the enumeration of users and groups
       via  a6015a8... s3 selftest: Fix the WINBINDD_GETDCNAMEe test.
       via  36db924... s3 winbindd: Get WINBINDD_CHECK_MACHACC torture test to work again.
      from  b1d2bb3... s4:provision_users.ldif - Add a comment that some objects under "Users" are now located elsewhere

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


- Log -----------------------------------------------------------------
commit 743adfda911e9123132fcc0d599080d869f419ab
Author: Kai Blin <kai at samba.org>
Date:   Wed Jan 13 13:58:20 2010 +0100

    s3 selftest: Enable the WINBIND-STRUCT tests

commit cf38a1f850dd3712e7cd71364cc86ecba7871d03
Author: Kai Blin <kai at samba.org>
Date:   Thu Jan 14 13:21:44 2010 +0100

    s3 test: Fix WINBINDD-STRUCT tests
    
    The struct-based tests are working in make selftest, make them work in plain
    "make test" as well.

commit 89e6eac290da6457b1d2259c32759d2b8a2b481b
Author: Kai Blin <kai at samba.org>
Date:   Wed Jan 13 16:46:17 2010 +0100

    s3 selftest: Fix LOOKUP_SID test.
    
    WINBINDD_LIST_USERS does not give a domain name if we're a DC and the user is
    from our domain.

commit e95c04f0f19a6e00251f9eceb94c519a0f91b308
Author: Kai Blin <kai at samba.org>
Date:   Wed Jan 13 16:02:00 2010 +0100

    s3 selftest: Fix WINBINDD_LIST_GROUPS test
    
    If there's no groups in the database, there are no entries in extra_data. This
    caused WINBINDD_LIST_GROUPS test to fail. Use the fact that
    WINBINDD_LIST_GROUPS now reports the number of groups in data.num_entries to
    identify the "no groups" case.

commit 932d4a874bb79ad76b95b43491b223d766ab4196
Author: Kai Blin <kai at samba.org>
Date:   Wed Jan 13 15:59:57 2010 +0100

    s3 winbindd: Return number of groups in data.num_entries for WINBINDD_LIST_GROUPS
    
    This allows to test if there's something wrong with the group list in
    extra_data or if there's simply no groups in the database.
    
    Volker, please check.

commit a4f21d5dc886b708d401a32d2208c316b537b07f
Author: Kai Blin <kai at samba.org>
Date:   Wed Jan 13 15:21:14 2010 +0100

    s3 selftest: Allow the enumeration of users and groups
    
    This fixes the WINBINDD_GETPWENT test.

commit a6015a858d9658730c0cc9b963ad86a740dd4bb8
Author: Kai Blin <kai at samba.org>
Date:   Wed Jan 13 14:49:26 2010 +0100

    s3 selftest: Fix the WINBINDD_GETDCNAMEe test.
    
    The WINBINDD_GETDCNAME test expected an NSS_STATUS_SUCCESS return from all
    calls. However, this does not apply for BUILTIN and the DC's own domain.
    Make the test work again by skipping those two.

commit 36db924446b8c6a1627e9abb22f774240678851a
Author: Kai Blin <kai at samba.org>
Date:   Wed Jan 13 14:10:33 2010 +0100

    s3 winbindd: Get WINBINDD_CHECK_MACHACC torture test to work again.
    
    WINBINDD_CHECK_MACHACC used to report an NTSTATUS error and appropriate error
    strings. Make this work again.

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

Summary of changes:
 selftest/target/Samba3.pm                      |    2 +
 source3/script/tests/selftest.sh               |    3 +
 source3/script/tests/test_posix_s3.sh          |    2 +-
 source3/winbindd/winbindd_check_machine_acct.c |    5 ++-
 source3/winbindd/winbindd_list_groups.c        |    4 +-
 source4/torture/winbind/struct_based.c         |   63 ++++++++++++++++++------
 6 files changed, 60 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index e1e5210..0e16022 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -479,6 +479,8 @@ sub provision($$$$$$)
 	winbindd:socket dir = $wbsockdir
 	idmap uid = 100000-200000
 	idmap gid = 100000-200000
+	winbind enum users = yes
+	winbind enum groups = yes
 
 #	min receivefile size = 4000
 
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index c952ef2..91052a7 100755
--- a/source3/script/tests/selftest.sh
+++ b/source3/script/tests/selftest.sh
@@ -244,6 +244,8 @@ cat >$SERVERCONFFILE<<EOF
 	winbindd:socket dir = $WINBINDD_SOCKET_DIR
 	idmap uid = 100000-200000
 	idmap gid = 100000-200000
+	winbind enum users = yes
+	winbind enum groups = yes
 
 #	min receivefile size = 4000
 
@@ -347,6 +349,7 @@ TORTURE4_OPTIONS="$SAMBA4CONFIGURATION"
 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --maximum-runtime=$TORTURE_MAXTIME"
 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --target=samba3"
 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:localdir=$SHRDIR"
+TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:winbindd_netbios_name=$SERVER"
 export TORTURE4_OPTIONS
 
 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
diff --git a/source3/script/tests/test_posix_s3.sh b/source3/script/tests/test_posix_s3.sh
index b16f8b2..26bca35 100755
--- a/source3/script/tests/test_posix_s3.sh
+++ b/source3/script/tests/test_posix_s3.sh
@@ -51,7 +51,7 @@ rpc="$rpc RPC-SCHANNEL RPC-SCHANNEL2 RPC-BENCH-SCHANNEL1 RPC-JOIN"
 
 local="LOCAL-NSS-WRAPPER LOCAL-NDR"
 
-winbind="WINBIND-WBCLIENT"
+winbind="WINBIND-STRUCT WINBIND-WBCLIENT"
 
 # NOTE: to enable the UNIX-WHOAMI test, we need to change the default share
 # config to allow guest access. I'm not sure whether this would break other
diff --git a/source3/winbindd/winbindd_check_machine_acct.c b/source3/winbindd/winbindd_check_machine_acct.c
index 33b6d9f..57595c1 100644
--- a/source3/winbindd/winbindd_check_machine_acct.c
+++ b/source3/winbindd/winbindd_check_machine_acct.c
@@ -93,5 +93,8 @@ static void winbindd_check_machine_acct_done(struct tevent_req *subreq)
 NTSTATUS winbindd_check_machine_acct_recv(struct tevent_req *req,
 					  struct winbindd_response *presp)
 {
-	return tevent_req_simple_recv_ntstatus(req);
+	NTSTATUS status = tevent_req_simple_recv_ntstatus(req);
+
+	set_auth_errors(presp, status);
+	return status;
 }
diff --git a/source3/winbindd/winbindd_list_groups.c b/source3/winbindd/winbindd_list_groups.c
index 3795045..a621762 100644
--- a/source3/winbindd/winbindd_list_groups.c
+++ b/source3/winbindd/winbindd_list_groups.c
@@ -153,7 +153,7 @@ NTSTATUS winbindd_list_groups_recv(struct tevent_req *req,
 	NTSTATUS status;
 	char *result;
 	int i;
-	uint32_t j;
+	uint32_t j, num_entries = 0;
 	size_t len;
 
 	if (tevent_req_is_nterror(req, &status)) {
@@ -193,10 +193,12 @@ NTSTATUS winbindd_list_groups_recv(struct tevent_req *req,
 			len += this_len;
 			result[len] = ',';
 			len += 1;
+			num_entries++;
 		}
 	}
 	result[len-1] = '\0';
 
+	response->data.num_entries = num_entries;
 	response->extra_data.data = result;
 	response->length += len;
 
diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c
index de1507a..560fa43 100644
--- a/source4/torture/winbind/struct_based.c
+++ b/source4/torture/winbind/struct_based.c
@@ -166,10 +166,10 @@ static bool torture_winbind_struct_netbios_name(struct torture_context *torture)
 	DO_STRUCT_REQ_REP(WINBINDD_NETBIOS_NAME, NULL, &rep);
 
 	expected = torture_setting_string(torture,
-					  "winbindd netbios name",
+					  "winbindd_netbios_name",
 					  lp_netbios_name(torture->lp_ctx));
 	expected = strupper_talloc(torture, expected);
-	
+
 	torture_assert_str_equal(torture,
 				 rep.data.netbios_name, expected,
 				 "winbindd's netbios name doesn't match");
@@ -473,6 +473,9 @@ static bool torture_winbind_struct_getdcname(struct torture_context *torture)
 {
 	bool ok;
 	bool strict = torture_setting_bool(torture, "strict mode", false);
+	const char *domain_name = torture_setting_string(torture,
+					"winbindd netbios domain",
+					lp_workgroup(torture->lp_ctx));
 	struct torture_trust_domain *listd = NULL;
 	uint32_t i, count = 0;
 
@@ -485,6 +488,13 @@ static bool torture_winbind_struct_getdcname(struct torture_context *torture)
 		struct winbindd_request req;
 		struct winbindd_response rep;
 
+		/* getdcname is not expected to work on "BUILTIN" or our own
+		 * domain */
+		if (strequal(listd[i].netbios_name, "BUILTIN") ||
+		    strequal(listd[i].netbios_name, domain_name)) {
+			continue;
+		}
+
 		ZERO_STRUCT(req);
 		ZERO_STRUCT(rep);
 
@@ -616,7 +626,7 @@ static bool torture_winbind_struct_list_users(struct torture_context *torture)
 	torture_comment(torture, "Running WINBINDD_LIST_USERS (struct based)\n");
 
 	ok = get_user_list(torture, &users);
-	torture_assert(torture, ok, "failed to get group list");
+	torture_assert(torture, ok, "failed to get user list");
 
 	for (count = 0; users[count]; count++) { }
 
@@ -625,7 +635,8 @@ static bool torture_winbind_struct_list_users(struct torture_context *torture)
 	return true;
 }
 
-static bool get_group_list(struct torture_context *torture, char ***groups)
+static bool get_group_list(struct torture_context *torture, int *num_entries,
+			   char ***groups)
 {
 	struct winbindd_request req;
 	struct winbindd_response rep;
@@ -638,8 +649,17 @@ static bool get_group_list(struct torture_context *torture, char ***groups)
 	ZERO_STRUCT(rep);
 
 	DO_STRUCT_REQ_REP(WINBINDD_LIST_GROUPS, &req, &rep);
-
 	extra_data = (char *)rep.extra_data.data;
+
+	*num_entries = rep.data.num_entries;
+
+	if (*num_entries == 0) {
+		torture_assert(torture, extra_data == NULL,
+			       "extra data is null for >0 reported entries\n");
+		*groups = NULL;
+		return true;
+	}
+
 	torture_assert(torture, extra_data, "NULL extra data");
 
 	for(count = 0;
@@ -653,6 +673,9 @@ static bool get_group_list(struct torture_context *torture, char ***groups)
 
 	SAFE_FREE(rep.extra_data.data);
 
+	torture_assert_int_equal(torture, *num_entries, count,
+				 "Wrong number of group entries reported.");
+
 	*groups = g;
 	return true;
 }
@@ -665,11 +688,9 @@ static bool torture_winbind_struct_list_groups(struct torture_context *torture)
 
 	torture_comment(torture, "Running WINBINDD_LIST_GROUPS (struct based)\n");
 
-	ok = get_group_list(torture, &groups);
+	ok = get_group_list(torture, &count, &groups);
 	torture_assert(torture, ok, "failed to get group list");
 
-	for (count = 0; groups[count]; count++) { }
-
 	torture_comment(torture, "got %d groups\n", count);
 
 	return true;
@@ -893,6 +914,9 @@ static bool lookup_name_sid_list(struct torture_context *torture, char **list)
 		struct winbindd_response rep;
 		char *sid;
 		char *name;
+		const char *domain_name = torture_setting_string(torture,
+						"winbindd netbios domain",
+						lp_workgroup(torture->lp_ctx));
 
 		ZERO_STRUCT(req);
 		ZERO_STRUCT(rep);
@@ -911,10 +935,15 @@ static bool lookup_name_sid_list(struct torture_context *torture, char **list)
 
 		DO_STRUCT_REQ_REP(WINBINDD_LOOKUPSID, &req, &rep);
 
-		name = talloc_asprintf(torture, "%s%c%s",
-				       rep.data.name.dom_name,
-				       winbind_separator(torture),
-				       rep.data.name.name);
+		if (strequal(rep.data.name.dom_name, domain_name)) {
+			name = talloc_asprintf(torture, "%s",
+					       rep.data.name.name);
+		} else {
+			name = talloc_asprintf(torture, "%s%c%s",
+					       rep.data.name.dom_name,
+					       winbind_separator(torture),
+					       rep.data.name.name);
+		}
 
 		torture_assert_casestr_equal(torture, list[count], name,
 					 "LOOKUP_SID after LOOKUP_NAME != id");
@@ -935,7 +964,7 @@ static bool name_is_in_list(const char *name, const char **list)
 {
 	uint32_t count;
 
-	for (count = 0; list[count]; count++) {
+	for (count = 0; list && list[count]; count++) {
 		if (strequal(name, list[count])) {
 			return true;
 		}
@@ -954,7 +983,7 @@ static bool torture_winbind_struct_lookup_name_sid(struct torture_context *tortu
 	bool strict = torture_setting_bool(torture, "strict mode", false);
 	char **users;
 	char **groups;
-	uint32_t count;
+	uint32_t count, num_groups;
 	bool ok;
 
 	torture_comment(torture, "Running WINBINDD_LOOKUP_NAME_SID (struct based)\n");
@@ -963,9 +992,11 @@ static bool torture_winbind_struct_lookup_name_sid(struct torture_context *tortu
 	torture_assert(torture, ok, "failed to retrieve list of users");
 	lookup_name_sid_list(torture, users);
 
-	ok = get_group_list(torture, &groups);
+	ok = get_group_list(torture, &num_groups, &groups);
 	torture_assert(torture, ok, "failed to retrieve list of groups");
-	lookup_name_sid_list(torture, groups);
+	if (num_groups > 0) {
+		lookup_name_sid_list(torture, groups);
+	}
 
 	ZERO_STRUCT(req);
 	ZERO_STRUCT(rep);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list