summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIra Cooper <ira@samba.org>2014-06-20 21:41:19 -0700
committerStefan Metzmacher <metze@samba.org>2014-06-23 14:28:25 +0200
commit439de096ae0e1c1b8812fa202f5eba7a891d7a0a (patch)
tree01d395d4e1d6b112400d26db9311a28f4cc12b74
parent6221937acac7017dee397d1c9846236d9fd5f613 (diff)
downloadsamba-439de096ae0e1c1b8812fa202f5eba7a891d7a0a.tar.gz
samba-439de096ae0e1c1b8812fa202f5eba7a891d7a0a.tar.xz
samba-439de096ae0e1c1b8812fa202f5eba7a891d7a0a.zip
s3: Fix fsctl_validate_neg_info to pass MS compliance suite.
It turns out that all the client and server need to agree on is what protocol should have been negotiated. If they disagree, they should disconnect. The contents of the list of protocols used during negotiate and during FSCTL_VALIDATE_NEGOTIATE_INFO do not need to match. Signed-off-by: Ira Cooper <ira@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Mon Jun 23 14:28:25 CEST 2014 on sn-devel-104
-rw-r--r--source3/smbd/smb2_ioctl_network_fs.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/source3/smbd/smb2_ioctl_network_fs.c b/source3/smbd/smb2_ioctl_network_fs.c
index 5e0dc10ab7..b2dfb212b0 100644
--- a/source3/smbd/smb2_ioctl_network_fs.c
+++ b/source3/smbd/smb2_ioctl_network_fs.c
@@ -355,9 +355,10 @@ static NTSTATUS fsctl_validate_neg_info(TALLOC_CTX *mem_ctx,
struct GUID in_guid;
uint16_t in_security_mode;
uint16_t in_num_dialects;
- uint16_t i;
+ uint16_t dialect;
DATA_BLOB out_guid_blob;
NTSTATUS status;
+ enum protocol_types protocol = PROTOCOL_NONE;
if (in_input->length < 0x18) {
return NT_STATUS_INVALID_PARAMETER;
@@ -381,20 +382,25 @@ static NTSTATUS fsctl_validate_neg_info(TALLOC_CTX *mem_ctx,
return status;
}
- if (in_num_dialects != conn->smb2.client.num_dialects) {
+ /*
+ * From: [MS-SMB2]
+ * 3.3.5.15.12 Handling a Validate Negotiate Info Request
+ *
+ * The server MUST determine the greatest common dialect
+ * between the dialects it implements and the Dialects array
+ * of the VALIDATE_NEGOTIATE_INFO request. If no dialect is
+ * matched, or if the value is not equal to Connection.Dialect,
+ * the server MUST terminate the transport connection
+ * and free the Connection object.
+ */
+ protocol = smbd_smb2_protocol_dialect_match(in_input->data + 0x18,
+ in_num_dialects,
+ &dialect);
+ if (conn->protocol != protocol) {
*disconnect = true;
return NT_STATUS_ACCESS_DENIED;
}
- for (i=0; i < in_num_dialects; i++) {
- uint16_t v = SVAL(in_input->data, 0x18 + i*2);
-
- if (conn->smb2.client.dialects[i] != v) {
- *disconnect = true;
- return NT_STATUS_ACCESS_DENIED;
- }
- }
-
if (!GUID_equal(&in_guid, &conn->smb2.client.guid)) {
*disconnect = true;
return NT_STATUS_ACCESS_DENIED;