summaryrefslogtreecommitdiff
path: root/source4/smb_server/smb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-03-06 14:19:11 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:52:17 -0500
commitd8503c6ba120172e9aae737c5510e547e8dea4a5 (patch)
treeae8ee4e9b792fedbb7259bf1ffc132e657bbb8d1 /source4/smb_server/smb
parent1c49d8f794762d0f3828237961012761212cb37e (diff)
downloadsamba-d8503c6ba120172e9aae737c5510e547e8dea4a5.tar.gz
samba-d8503c6ba120172e9aae737c5510e547e8dea4a5.tar.bz2
samba-d8503c6ba120172e9aae737c5510e547e8dea4a5.zip
r13860: - add support for SMB2 ("SMB 2.001") negotiation in SMB negprot requests
- the default max protocol is still NT1 metze (This used to be commit d1bae931b327dda28e648efc473e0462cf036f7c)
Diffstat (limited to 'source4/smb_server/smb')
-rw-r--r--source4/smb_server/smb/negprot.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/source4/smb_server/smb/negprot.c b/source4/smb_server/smb/negprot.c
index b2f136f4f7..61be84ca18 100644
--- a/source4/smb_server/smb/negprot.c
+++ b/source4/smb_server/smb/negprot.c
@@ -21,7 +21,10 @@
#include "includes.h"
#include "auth/auth.h"
#include "smb_server/smb_server.h"
+#include "libcli/smb2/smb2.h"
+#include "smb_server/smb2/smb2_server.h"
#include "smbd/service_stream.h"
+#include "lib/stream/packet.h"
/* initialise the auth_context for this server and return the cryptkey */
@@ -415,7 +418,33 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice)
req_send_reply_nosign(req);
}
-
+/*
+ after a SMB2 2.001 negprot reply to a SMB negprot request
+ no (SMB or SMB2) requests are allowed anymore,
+ vista resets the connection in this case
+*/
+static NTSTATUS smbsrv_recv_disabled_request(void *private, DATA_BLOB blob)
+{
+ struct smbsrv_connection *smb_conn = talloc_get_type(private, struct smbsrv_connection);
+ smbsrv_terminate_connection(smb_conn, "Receive Packet after SMB -> SMB2 negprot");
+ return NT_STATUS_OK;
+}
+
+/****************************************************************************
+ Reply for the SMB2 2.001 protocol
+****************************************************************************/
+static void reply_smb2(struct smbsrv_request *req, uint16_t choice)
+{
+ struct smbsrv_connection *smb_conn = req->smb_conn;
+
+ /* reply with a SMB2 packet */
+ smb2srv_reply_smb_negprot(req);
+ req = NULL;
+
+ /* disallow requests */
+ packet_set_callback(smb_conn->packet, smbsrv_recv_disabled_request);
+}
+
/* List of supported protocols, most desired first */
static const struct {
const char *proto_name;
@@ -423,6 +452,7 @@ static const struct {
void (*proto_reply_fn)(struct smbsrv_request *req, uint16_t choice);
int protocol_level;
} supported_protocols[] = {
+ {"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},