[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Wed Mar 7 04:45:07 MST 2012


The branch, master has been updated
       via  0eaf91f selftest: mark samba4.smb2.getinfo.getinfo as knownfail
       via  ee6cd3b s4:torture: smb2.getinfo test return status of stream creation
       via  aa993a8 s4:torture/smb2: add simple smb2.session.reauth test
       via  7e9a4c6 s4:libcli/smb2: allow smb2_session_setup_spnego to handle reauth
      from  b47959a s4-libcli: pysmb: Fix typo in secinfo_flags

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


- Log -----------------------------------------------------------------
commit 0eaf91ffb8138a6faee7c5cc446b8e348d76cd2d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Mar 6 21:23:52 2012 +0100

    selftest: mark samba4.smb2.getinfo.getinfo as knownfail
    
    Samba4 seems to have problems with streams on directories.
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Wed Mar  7 12:44:10 CET 2012 on sn-devel-104

commit ee6cd3b84e712e754bc5c6b7b8fdf1e2f170a0f7
Author: Gregor Beck <gbeck at sernet.de>
Date:   Tue Mar 6 11:48:52 2012 +0100

    s4:torture: smb2.getinfo test return status of stream creation
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit aa993a89f0fc3be18da5d4c342447dacf88e65d9
Author: Gregor Beck <gbeck at sernet.de>
Date:   Tue Mar 6 15:46:48 2012 +0100

    s4:torture/smb2: add simple smb2.session.reauth test
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 7e9a4c6c11b90a27b570158e33b37efed3a4998e
Author: Gregor Beck <gbeck at sernet.de>
Date:   Tue Mar 6 15:45:37 2012 +0100

    s4:libcli/smb2: allow smb2_session_setup_spnego to handle reauth
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 selftest/knownfail             |    1 +
 source4/libcli/smb2/session.c  |   12 ++++++++
 source4/torture/smb2/getinfo.c |    8 ++++-
 source4/torture/smb2/session.c |   57 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 76 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/knownfail b/selftest/knownfail
index 455ff5a..3bfe490 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -129,6 +129,7 @@
 ^samba4.smb2.oplock.batch9$ # samba 4 oplocks are a mess
 ^samba4.smb2.oplock.batch10$ # samba 4 oplocks are a mess
 ^samba4.smb2.oplock.batch20$ # samba 4 oplocks are a mess
+^samba4.smb2.getinfo.getinfo # streams on directories does not work
 ^samba4.ntvfs.cifs.krb5.base.createx_access.createx_access$
 ^samba4.ldap.acl.*.AclSearchTests.test_search_anonymous3$  # ACL search behaviour not enabled by default
 ^samba4.ldap.acl.*.AclSearchTests.test_search1$  # ACL search behaviour not enabled by default
diff --git a/source4/libcli/smb2/session.c b/source4/libcli/smb2/session.c
index d727d55..2657266 100644
--- a/source4/libcli/smb2/session.c
+++ b/source4/libcli/smb2/session.c
@@ -76,6 +76,7 @@ struct smb2_session_setup_spnego_state {
 	struct smb2_session *session;
 	struct cli_credentials *credentials;
 	uint64_t previous_session_id;
+	bool reauth;
 	NTSTATUS gensec_status;
 	DATA_BLOB in_secblob;
 	DATA_BLOB out_secblob;
@@ -95,6 +96,7 @@ struct tevent_req *smb2_session_setup_spnego_send(
 {
 	struct tevent_req *req;
 	struct smb2_session_setup_spnego_state *state;
+	uint64_t current_session_id;
 	const char *chosen_oid;
 	struct tevent_req *subreq;
 	NTSTATUS status;
@@ -114,6 +116,11 @@ struct tevent_req *smb2_session_setup_spnego_send(
 	state->credentials = credentials;
 	state->previous_session_id = previous_session_id;
 
+	current_session_id = smb2cli_session_current_id(state->session->smbXcli);
+	if (current_session_id != 0) {
+		state->reauth = true;
+	}
+
 	server_gss_blob = smbXcli_conn_server_gss_blob(session->transport->conn);
 	if (server_gss_blob) {
 		negprot_secblob = *server_gss_blob;
@@ -219,6 +226,11 @@ static void smb2_session_setup_spnego_done(struct tevent_req *subreq)
 	if (NT_STATUS_IS_OK(peer_status) && NT_STATUS_IS_OK(state->gensec_status)) {
 		DATA_BLOB session_key;
 
+		if (state->reauth) {
+			tevent_req_done(req);
+			return;
+		}
+
 		status = gensec_session_key(session->gensec, state,
 					    &session_key);
 		if (tevent_req_nterror(req, status)) {
diff --git a/source4/torture/smb2/getinfo.c b/source4/torture/smb2/getinfo.c
index 2e30190..16db715 100644
--- a/source4/torture/smb2/getinfo.c
+++ b/source4/torture/smb2/getinfo.c
@@ -196,13 +196,17 @@ bool torture_smb2_getinfo(struct torture_context *torture)
 	torture_assert_ntstatus_ok(torture, status,
 				   "setup complex file " FNAME);
 
-	torture_setup_complex_file(tree, FNAME ":streamtwo");
+	status = torture_setup_complex_file(tree, FNAME ":streamtwo");
+	torture_assert_ntstatus_ok(torture, status,
+				   "setup complex file " FNAME ":streamtwo");
 
 	status = torture_setup_complex_dir(tree, DNAME);
 	torture_assert_ntstatus_ok(torture, status,
 				   "setup complex dir " DNAME);
 
-	torture_setup_complex_file(tree, DNAME ":streamtwo");
+	status = torture_setup_complex_file(tree, DNAME ":streamtwo");
+	torture_assert_ntstatus_ok(torture, status,
+				   "setup complex dir " DNAME ":streamtwo");
 
 	ret &= torture_smb2_fileinfo(torture, tree);
 	ret &= torture_smb2_fsinfo(torture, tree);
diff --git a/source4/torture/smb2/session.c b/source4/torture/smb2/session.c
index 814d017..3a0ef08 100644
--- a/source4/torture/smb2/session.c
+++ b/source4/torture/smb2/session.c
@@ -25,6 +25,7 @@
 #include "torture/torture.h"
 #include "torture/smb2/proto.h"
 #include "../libcli/smb/smbXcli_base.h"
+#include "lib/cmdline/popt_common.h"
 
 #define CHECK_VAL(v, correct) do { \
 	if ((v) != (correct)) { \
@@ -129,12 +130,68 @@ done:
 	return ret;
 }
 
+bool test_session_reauth(struct torture_context *tctx, struct smb2_tree *tree)
+{
+	NTSTATUS status;
+	TALLOC_CTX *mem_ctx = talloc_new(tctx);
+	char fname[256];
+	struct smb2_handle _h1;
+	struct smb2_handle *h1 = NULL;
+	struct smb2_create io1;
+	bool ret = true;
+	union smb_fileinfo qfinfo;
+
+	/* Add some random component to the file name. */
+	snprintf(fname, 256, "session_reconnect_%s.dat",
+		 generate_random_str(tctx, 8));
+
+	smb2_util_unlink(tree, fname);
+
+	smb2_oplock_create_share(&io1, fname,
+				 smb2_util_share_access(""),
+				 smb2_util_oplock_level("b"));
+
+	status = smb2_create(tree, mem_ctx, &io1);
+	CHECK_STATUS(status, NT_STATUS_OK);
+	_h1 = io1.out.file.handle;
+	h1 = &_h1;
+	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
+	CHECK_VAL(io1.out.oplock_level, smb2_util_oplock_level("b"));
+
+	status = smb2_session_setup_spnego(tree->session,
+					   cmdline_credentials,
+					   0 /* previous_session_id */);
+	CHECK_STATUS(status, NT_STATUS_OK);
+
+	/* try to access the file via the old handle */
+
+	ZERO_STRUCT(qfinfo);
+	qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
+	qfinfo.generic.in.file.handle = _h1;
+	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
+	CHECK_STATUS(status, NT_STATUS_OK);
+
+done:
+	if (h1 != NULL) {
+		smb2_util_close(tree, *h1);
+	}
+
+	smb2_util_unlink(tree, fname);
+
+	talloc_free(tree);
+
+	talloc_free(mem_ctx);
+
+	return ret;
+}
+
 struct torture_suite *torture_smb2_session_init(void)
 {
 	struct torture_suite *suite =
 	    torture_suite_create(talloc_autofree_context(), "session");
 
 	torture_suite_add_1smb2_test(suite, "reconnect", test_session_reconnect);
+	torture_suite_add_1smb2_test(suite, "reauth", test_session_reauth);
 
 	suite->description = talloc_strdup(suite, "SMB2-SESSION tests");
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list