[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Fri Sep 3 20:29:29 MDT 2010


The branch, master has been updated
       via  389d357 torture-lsa: cope with STATUS_SOME_UNMAPPED errors
       via  48323d8 selftest: run client tests with log level 1
       via  aefbdc4 waf: fixed make test with TESTS="test1 test2"
       via  b58bfb3 util: added samba_start_debugger()
      from  31d3227 s4:lib/messaging: make irpc_request private and remove unused code

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


- Log -----------------------------------------------------------------
commit 389d35708ea910e68468648396f405e52907c749
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Sep 2 18:41:45 2010 +1000

    torture-lsa: cope with STATUS_SOME_UNMAPPED errors
    
    Now that we support SePrintOperatorPrivilege, an interaction between
    the spoolss tests and the privileges tests cause a failure. The
    failure happens like this:
    
     - the spoolss.access test creates and then deletes an account with
       SePrintOperatorPrivilege privilege
    
     - this leaves the privileges database with an entry for a deleted
       account that is still visible via LSA calls. This is correct
       behaviour (verified against w2k8r2)
    
     - the lsa.privileges test then enumerates all accounts that have at
       least one privilege, and gets the SID for the deleted account
    
     - it then called LookupNames and LookupSids on this deleted account,
       and gets an error.
    
    The fix is to not call LookupSids and LookupNames on sids which have
    SID_NAME_UNKNOWN as the type
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 48323d88cc4ca3a08d1bd79c748061c775d57eca
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Sep 2 16:46:20 2010 +1000

    selftest: run client tests with log level 1
    
    this PIDL print functions to display

commit aefbdc4a9d78d0b92dabb960fadd13801202afe2
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Sep 2 16:45:50 2010 +1000

    waf: fixed make test with TESTS="test1 test2"
    
    when multiple tests are specified, make escapes the space in MAKEFLAGS
    with a backslash, so we need to use shlex.split()

commit b58bfb351025816b18389ac2377c429b8a777dde
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Jul 20 15:31:49 2010 +1000

    util: added samba_start_debugger()
    
    This developer function is useful for debugging unusual error
    conditions

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

Summary of changes:
 buildtools/wafsamba/samba_utils.py |    4 ++-
 lib/util/util.c                    |   14 ++++++++
 lib/util/util.h                    |    4 ++
 selftest/selftest.pl               |    1 +
 source4/torture/rpc/lsa.c          |   65 +++++++++++++++++++++++++++--------
 5 files changed, 72 insertions(+), 16 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 304264b..d858c5c 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -451,7 +451,9 @@ def CHECK_MAKEFLAGS(bld):
         return
     makeflags = os.environ.get('MAKEFLAGS')
     jobs_set = False
-    for opt in makeflags.split():
+    # we need to use shlex.split to cope with the escaping of spaces
+    # in makeflags
+    for opt in shlex.split(makeflags):
         # options can come either as -x or as x
         if opt[0:2] == 'V=':
             Options.options.verbose = Logs.verbose = int(opt[2:])
diff --git a/lib/util/util.c b/lib/util/util.c
index d645f7e..c0af4b0 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -891,3 +891,17 @@ void *allocate_anonymous_shared(size_t bufsz)
 
 }
 
+#ifdef DEVELOPER
+/* used when you want a debugger started at a particular point in the
+   code. Mostly useful in code that runs as a child process, where
+   normal gdb attach is harder to organise.
+*/
+void samba_start_debugger(void)
+{
+	char *cmd = NULL;
+	asprintf(&cmd, "xterm -e \"gdb --pid %u\"&", getpid());
+	system(cmd);
+	free(cmd);
+	sleep(2);
+}
+#endif
diff --git a/lib/util/util.h b/lib/util/util.h
index 8383344..994fad0 100644
--- a/lib/util/util.h
+++ b/lib/util/util.h
@@ -877,4 +877,8 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx,
 				     const char * const *argv0, ...);
 int samba_runcmd_recv(struct tevent_req *req, int *perrno);
 
+#ifdef DEVELOPER
+void samba_start_debugger(void);
+#endif
+
 #endif /* _SAMBA_UTIL_H_ */
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 7f5aa76..76e1886 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -602,6 +602,7 @@ sub write_clientconf($$)
 	ldb:nosync = true
 	system:anonymous = true
 	client lanman auth = Yes
+	log level = 1
 	torture:basedir = $prefix_abs/client
 #We don't want to pass our self-tests if the PAC code is wrong
 	gensec:require_pac = true
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 5d4f597..9283fc3 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -176,19 +176,28 @@ static bool test_LookupNames(struct dcerpc_binding_handle *b,
 	struct lsa_String *names;
 	uint32_t count = 0;
 	int i;
+	uint32_t *input_idx;
 
 	torture_comment(tctx, "\nTesting LookupNames with %d names\n", tnames->count);
 
 	sids.count = 0;
 	sids.sids = NULL;
 
+
+	r.in.num_names = 0;
+
+	input_idx = talloc_array(tctx, uint32_t, tnames->count);
 	names = talloc_array(tctx, struct lsa_String, tnames->count);
+
 	for (i=0;i<tnames->count;i++) {
-		init_lsa_String(&names[i], tnames->names[i].name.string);
+		if (tnames->names[i].sid_type != SID_NAME_UNKNOWN) {
+			init_lsa_String(&names[r.in.num_names], tnames->names[i].name.string);
+			input_idx[r.in.num_names] = i;
+			r.in.num_names++;
+		}
 	}
 
 	r.in.handle = handle;
-	r.in.num_names = tnames->count;
 	r.in.names = names;
 	r.in.sids = &sids;
 	r.in.level = 1;
@@ -201,7 +210,7 @@ static bool test_LookupNames(struct dcerpc_binding_handle *b,
 				   "LookupNames failed");
 	if (NT_STATUS_EQUAL(r.out.result, STATUS_SOME_UNMAPPED) ||
 	    NT_STATUS_EQUAL(r.out.result, NT_STATUS_NONE_MAPPED)) {
-		for (i=0;i< tnames->count;i++) {
+		for (i=0;i< r.in.num_names;i++) {
 			if (i < count && sids.sids[i].sid_type == SID_NAME_UNKNOWN) {
 				torture_comment(tctx, "LookupName of %s was unmapped\n",
 				       tnames->names[i].name.string);
@@ -219,22 +228,23 @@ static bool test_LookupNames(struct dcerpc_binding_handle *b,
 		return false;
 	}
 
-	for (i=0;i< tnames->count;i++) {
+	for (i=0;i< r.in.num_names;i++) {
 		if (i < count) {
-			if (sids.sids[i].sid_type != tnames->names[i].sid_type) {
+			if (sids.sids[i].sid_type != tnames->names[input_idx[i]].sid_type) {
 				torture_comment(tctx, "LookupName of %s got unexpected name type: %s\n",
-				       tnames->names[i].name.string, sid_type_lookup(sids.sids[i].sid_type));
+						tnames->names[input_idx[i]].name.string,
+						sid_type_lookup(sids.sids[i].sid_type));
 				return false;
 			}
 			if ((sids.sids[i].sid_type == SID_NAME_DOMAIN) &&
 			    (sids.sids[i].rid != (uint32_t)-1)) {
 				torture_comment(tctx, "LookupName of %s got unexpected rid: %d\n",
-					tnames->names[i].name.string, sids.sids[i].rid);
+					tnames->names[input_idx[i]].name.string, sids.sids[i].rid);
 				return false;
 			}
 		} else if (i >=count) {
 			torture_comment(tctx, "LookupName of %s failed to return a result\n",
-			       tnames->names[i].name.string);
+			       tnames->names[input_idx[i]].name.string);
 			return false;
 		}
 	}
@@ -394,14 +404,22 @@ static bool test_LookupNames2(struct dcerpc_binding_handle *b,
 
 	sids.count = 0;
 	sids.sids = NULL;
+	uint32_t *input_idx;
+
+	r.in.num_names = 0;
 
+	input_idx = talloc_array(tctx, uint32_t, tnames->count);
 	names = talloc_array(tctx, struct lsa_String, tnames->count);
+
 	for (i=0;i<tnames->count;i++) {
-		init_lsa_String(&names[i], tnames->names[i].name.string);
+		if (tnames->names[i].sid_type != SID_NAME_UNKNOWN) {
+			init_lsa_String(&names[r.in.num_names], tnames->names[i].name.string);
+			input_idx[r.in.num_names] = i;
+			r.in.num_names++;
+		}
 	}
 
 	r.in.handle = handle;
-	r.in.num_names = tnames->count;
 	r.in.names = names;
 	r.in.sids = &sids;
 	r.in.level = 1;
@@ -446,19 +464,26 @@ static bool test_LookupNames3(struct dcerpc_binding_handle *b,
 	struct lsa_String *names;
 	uint32_t count = 0;
 	int i;
+	uint32_t *input_idx;
 
 	torture_comment(tctx, "\nTesting LookupNames3 with %d names\n", tnames->count);
 
 	sids.count = 0;
 	sids.sids = NULL;
 
+	r.in.num_names = 0;
+
+	input_idx = talloc_array(tctx, uint32_t, tnames->count);
 	names = talloc_array(tctx, struct lsa_String, tnames->count);
 	for (i=0;i<tnames->count;i++) {
-		init_lsa_String(&names[i], tnames->names[i].name.string);
+		if (tnames->names[i].sid_type != SID_NAME_UNKNOWN) {
+			init_lsa_String(&names[r.in.num_names], tnames->names[i].name.string);
+			input_idx[r.in.num_names] = i;
+			r.in.num_names++;
+		}
 	}
 
 	r.in.handle = handle;
-	r.in.num_names = tnames->count;
 	r.in.names = names;
 	r.in.sids = &sids;
 	r.in.level = 1;
@@ -501,15 +526,23 @@ static bool test_LookupNames4(struct dcerpc_binding_handle *b,
 	struct lsa_String *names;
 	uint32_t count = 0;
 	int i;
+	uint32_t *input_idx;
 
 	torture_comment(tctx, "\nTesting LookupNames4 with %d names\n", tnames->count);
 
 	sids.count = 0;
 	sids.sids = NULL;
 
+	r.in.num_names = 0;
+
+	input_idx = talloc_array(tctx, uint32_t, tnames->count);
 	names = talloc_array(tctx, struct lsa_String, tnames->count);
 	for (i=0;i<tnames->count;i++) {
-		init_lsa_String(&names[i], tnames->names[i].name.string);
+		if (tnames->names[i].sid_type != SID_NAME_UNKNOWN) {
+			init_lsa_String(&names[r.in.num_names], tnames->names[i].name.string);
+			input_idx[r.in.num_names] = i;
+			r.in.num_names++;
+		}
 	}
 
 	r.in.num_names = tnames->count;
@@ -571,7 +604,8 @@ static bool test_LookupSids(struct dcerpc_binding_handle *b,
 
 	torture_assert_ntstatus_ok(tctx, dcerpc_lsa_LookupSids_r(b, tctx, &r),
 		"LookupSids failed");
-	if (!NT_STATUS_IS_OK(r.out.result)) {
+	if (!NT_STATUS_IS_OK(r.out.result) &&
+	    !NT_STATUS_EQUAL(r.out.result, STATUS_SOME_UNMAPPED)) {
 		torture_comment(tctx, "LookupSids failed - %s\n",
 				nt_errstr(r.out.result));
 		return false;
@@ -615,7 +649,8 @@ static bool test_LookupSids2(struct dcerpc_binding_handle *b,
 
 	torture_assert_ntstatus_ok(tctx, dcerpc_lsa_LookupSids2_r(b, tctx, &r),
 		"LookupSids2 failed");
-	if (!NT_STATUS_IS_OK(r.out.result)) {
+	if (!NT_STATUS_IS_OK(r.out.result) &&
+	    !NT_STATUS_EQUAL(r.out.result, STATUS_SOME_UNMAPPED)) {
 		torture_comment(tctx, "LookupSids2 failed - %s\n",
 				nt_errstr(r.out.result));
 		return false;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list