[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1803-g53df343

Stefan Metzmacher metze at samba.org
Tue May 26 07:51:45 GMT 2009


The branch, master has been updated
       via  53df34364416d3ce037024147788fdc968bdb31f (commit)
       via  fadffbae88335a45f23d4861c6a097bccb191069 (commit)
       via  01b05df766cf55c356af495151ac665a82a57c4b (commit)
       via  d0051462b99ab3102cebe5ce17bf517b5bdf6c03 (commit)
      from  c36031778e1983ddb11d3e1fcab35e738dbf94bc (commit)

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


- Log -----------------------------------------------------------------
commit 53df34364416d3ce037024147788fdc968bdb31f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue May 26 09:37:29 2009 +0200

    s4:libcli/smb2: remove old dialect revision constants
    
    metze

commit fadffbae88335a45f23d4861c6a097bccb191069
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue May 26 08:44:27 2009 +0200

    s4:smb2srv: We only support SMB 2.002.
    
    We need to loop over all given dialects and check
    if we can find SMB2_DIALECT_REVISION_202.
    
    metze

commit 01b05df766cf55c356af495151ac665a82a57c4b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue May 26 09:38:09 2009 +0200

    s4:libcli/smb2: use new SMB2_DIVELECT_REVISION constants
    
    Also send them in the order a windows client would
    send them (the lowest first).
    
    metze

commit d0051462b99ab3102cebe5ce17bf517b5bdf6c03
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri May 22 22:23:42 2009 +0200

    s4:libcli/smb2: add some more SMB2 constants
    
    metze

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

Summary of changes:
 source4/libcli/smb2/connect.c        |    7 +++++--
 source4/libcli/smb2/smb2_constants.h |   14 ++++++++++----
 source4/smb_server/smb/negprot.c     |    1 -
 source4/smb_server/smb2/negprot.c    |   17 ++++++++++++-----
 4 files changed, 27 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index 8d6ea04..8c1a73b 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -164,8 +164,11 @@ static void continue_socket(struct composite_context *creq)
 	struct smbcli_socket *sock;
 	struct smb2_transport *transport;
 	struct smb2_request *req;
-	uint16_t dialects[3] = { SMB2_DIALECT_REVISION, SMB21_DIALECT_REVISION,
-				 SMB2_LONGHORN_BETA_DIALECT_REVISION };
+	uint16_t dialects[3] = {
+		SMB2_DIALECT_REVISION_000,
+		SMB2_DIALECT_REVISION_202,
+		SMB2_DIALECT_REVISION_210
+	};
 
 	c->status = smbcli_sock_connect_recv(creq, state, &sock);
 	if (!composite_is_ok(c)) return;
diff --git a/source4/libcli/smb2/smb2_constants.h b/source4/libcli/smb2/smb2_constants.h
index 86dfbfe..48f3097 100644
--- a/source4/libcli/smb2/smb2_constants.h
+++ b/source4/libcli/smb2/smb2_constants.h
@@ -68,10 +68,11 @@
 
 #define SMB2_MAGIC 0x424D53FE /* 0xFE 'S' 'M' 'B' */
 
-/* the dialects we support */
-#define SMB2_DIALECT_REVISION           0x202
-#define SMB21_DIALECT_REVISION          0x210
-#define SMB2_LONGHORN_BETA_DIALECT_REVISION	0x0 /* early beta dialect */
+/* SMB2 negotiate dialects */
+#define SMB2_DIALECT_REVISION_000       0x0000 /* early beta dialect */
+#define SMB2_DIALECT_REVISION_202       0x0202
+#define SMB2_DIALECT_REVISION_210       0x0210
+#define SMB2_DIALECT_REVISION_2FF       0x02FF
 
 /* SMB2 negotiate security_mode */
 #define SMB2_NEGOTIATE_SIGNING_ENABLED   0x01
@@ -79,9 +80,14 @@
 
 /* SMB2 capabilities - only 1 so far. I'm sure more will be added */
 #define SMB2_CAP_DFS                     0x00000001
+#define SMB2_CAP_LEASING                 0x00000002 /* only in dialect 0x210 */
 /* so we can spot new caps as added */
 #define SMB2_CAP_ALL                     SMB2_CAP_DFS
 
+/* SMB2 session flags */
+#define SMB2_SESSION_FLAG_IS_GUEST       0x0001
+#define SMB2_SESSION_FLAG_IS_NULL        0x0002
+
 /* SMB2 share flags */
 #define SMB2_SHAREFLAG_MANUAL_CACHING                    0x0000
 #define SMB2_SHAREFLAG_AUTO_CACHING                      0x0010
diff --git a/source4/smb_server/smb/negprot.c b/source4/smb_server/smb/negprot.c
index c3399fd..5ac5624 100644
--- a/source4/smb_server/smb/negprot.c
+++ b/source4/smb_server/smb/negprot.c
@@ -469,7 +469,6 @@ static const struct {
 	int protocol_level;
 } supported_protocols[] = {
 	{"SMB 2.002",			"SMB2",		reply_smb2,	PROTOCOL_SMB2},
-	{"SMB 2.001",			"SMB2",		reply_smb2,	PROTOCOL_SMB2},
 	{"NT LANMAN 1.0",		"NT1",		reply_nt1,	PROTOCOL_NT1},
 	{"NT LM 0.12",			"NT1",		reply_nt1,	PROTOCOL_NT1},
 	{"LANMAN2.1",			"LANMAN2",	reply_lanman2,	PROTOCOL_LANMAN2},
diff --git a/source4/smb_server/smb2/negprot.c b/source4/smb_server/smb2/negprot.c
index 0b65a19..f915392 100644
--- a/source4/smb_server/smb2/negprot.c
+++ b/source4/smb_server/smb2/negprot.c
@@ -97,14 +97,21 @@ static NTSTATUS smb2srv_negprot_backend(struct smb2srv_request *req, struct smb2
 	NTSTATUS status;
 	struct timeval current_time;
 	struct timeval boot_time;
+	uint16_t i;
+	uint16_t dialect = 0;
 
 	/* we only do one dialect for now */
 	if (io->in.dialect_count < 1) {
 		return NT_STATUS_NOT_SUPPORTED;
 	}
-	if (io->in.dialects[0] != 0 &&
-	    io->in.dialects[0] != SMB2_DIALECT_REVISION) {
-		DEBUG(0,("Got unexpected SMB2 dialect %u\n", io->in.dialects[0]));
+	for (i=0; i < io->in.dialect_count; i++) {
+		dialect = io->in.dialects[i];
+		if (dialect == SMB2_DIALECT_REVISION_202) {
+			break;
+		}
+	}
+	if (dialect != SMB2_DIALECT_REVISION_202) {
+		DEBUG(0,("Got unexpected SMB2 dialect %u\n", dialect));
 		return NT_STATUS_NOT_SUPPORTED;
 	}
 
@@ -128,7 +135,7 @@ static NTSTATUS smb2srv_negprot_backend(struct smb2srv_request *req, struct smb2
 		req->smb_conn->smb2_signing_required = true;
 		break;
 	}
-	io->out.dialect_revision   = SMB2_DIALECT_REVISION;
+	io->out.dialect_revision   = dialect;
 	io->out.capabilities       = 0;
 	io->out.max_transact_size  = lp_parm_ulong(req->smb_conn->lp_ctx, NULL, 
 						   "smb2", "max transaction size", 0x10000);
@@ -281,7 +288,7 @@ void smb2srv_reply_smb_negprot(struct smbsrv_request *smb_req)
 
 	SSVAL(req->in.body, 0x02, 1);
 	memset(req->in.body+0x04, 0, 32);
-	SSVAL(req->in.body, 0x24, 0);
+	SSVAL(req->in.body, 0x24, SMB2_DIALECT_REVISION_202);
 
 	smb2srv_negprot_recv(req);
 	return;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list