summaryrefslogtreecommitdiff
path: root/source3/smbd/smb2_negprot.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-05-19 10:47:51 +0200
committerStefan Metzmacher <metze@samba.org>2009-05-20 15:43:00 +0200
commitd7d73b08e993f6ca5948c3bbe653352573c6f43d (patch)
tree23a01ac1076f26abe8c8a5093744320c9b991916 /source3/smbd/smb2_negprot.c
parent3ef6a5ae9ebefb18755337a83ba5488e8b8edd6e (diff)
downloadsamba-d7d73b08e993f6ca5948c3bbe653352573c6f43d.tar.gz
s3:smbd: allow SMB 2.002 dialect in SMB1 negprot
We create a dummy SMB2 Negotiate inbuf and pass the connection to the SMB2 engine. metze
Diffstat (limited to 'source3/smbd/smb2_negprot.c')
-rw-r--r--source3/smbd/smb2_negprot.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/source3/smbd/smb2_negprot.c b/source3/smbd/smb2_negprot.c
index d82d04885df..38dfe6dab3a 100644
--- a/source3/smbd/smb2_negprot.c
+++ b/source3/smbd/smb2_negprot.c
@@ -24,6 +24,42 @@
extern enum protocol_types Protocol;
+/*
+ * this is the entry point if SMB2 is selected via
+ * the SMB negprot
+ */
+void reply_smb2002(struct smb_request *req, uint16_t choice)
+{
+ uint8_t *smb2_inbuf;
+ uint8_t *smb2_hdr;
+ uint8_t *smb2_body;
+ uint8_t *smb2_dyn;
+ size_t len = 4 + SMB2_HDR_BODY + 0x24 + 2;
+
+ smb2_inbuf = talloc_zero_array(talloc_tos(), uint8_t, len);
+ if (smb2_inbuf == NULL) {
+ DEBUG(0, ("Could not push spnego blob\n"));
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ return;
+ }
+ smb2_hdr = smb2_inbuf + 4;
+ smb2_body = smb2_hdr + SMB2_HDR_BODY;
+ smb2_dyn = smb2_body + 0x24;
+
+ SIVAL(smb2_hdr, SMB2_HDR_PROTOCOL_ID, SMB2_MAGIC);
+ SIVAL(smb2_hdr, SMB2_HDR_LENGTH, SMB2_HDR_BODY);
+
+ SSVAL(smb2_body, 0x00, 0x0024); /* struct size */
+ SSVAL(smb2_body, 0x02, 0x0001); /* dialect count */
+
+ SSVAL(smb2_dyn, 0x00, 0x0202); /* dialect 2.002 */
+
+ req->outbuf = NULL;
+
+ smbd_smb2_first_negprot(smbd_server_conn, smb2_inbuf, len);
+ return;
+}
+
NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
{
const uint8_t *inbody;