From d8503c6ba120172e9aae737c5510e547e8dea4a5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 6 Mar 2006 14:19:11 +0000 Subject: 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) --- source4/smb_server/smb/negprot.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'source4/smb_server/smb/negprot.c') 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}, -- cgit