summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-08-14 10:46:46 +0000
committerVolker Lendecke <vl@samba.org>2013-08-14 15:54:43 +0200
commitfbee7c1eabf5baa9b59878a9e3f3ae482e6a9412 (patch)
tree2e5c9ebdff10b01c5e1f14491a6c9dc7892b3ea2
parent5f75814586f2d6f7c2dc8fd9342cb045c1f7e68c (diff)
downloadsamba-fbee7c1eabf5baa9b59878a9e3f3ae482e6a9412.tar.gz
samba-fbee7c1eabf5baa9b59878a9e3f3ae482e6a9412.tar.bz2
samba-fbee7c1eabf5baa9b59878a9e3f3ae482e6a9412.zip
smbd: Fix async echo handler forking (Bug 10086)
If SMB3 is chosen via an SMB1 negprot, we forked the echo handler because set_Protocol is called later, after the full protocol negotiation is done. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Aug 14 15:54:43 CEST 2013 on sn-devel-104
-rw-r--r--source3/smbd/negprot.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index cfe098351f..315bd89037 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -497,6 +497,7 @@ static const struct {
void reply_negprot(struct smb_request *req)
{
int choice= -1;
+ int chosen_level = -1;
int protocol;
const char *p;
int arch = ARCH_ALL;
@@ -653,8 +654,10 @@ void reply_negprot(struct smb_request *req)
if ((supported_protocols[protocol].protocol_level <= lp_srv_maxprotocol()) &&
(supported_protocols[protocol].protocol_level >= lp_srv_minprotocol()))
while (i < num_cliprotos) {
- if (strequal(cliprotos[i],supported_protocols[protocol].proto_name))
+ if (strequal(cliprotos[i],supported_protocols[protocol].proto_name)) {
choice = i;
+ chosen_level = supported_protocols[protocol].protocol_level;
+ }
i++;
}
if(choice != -1)
@@ -675,14 +678,14 @@ void reply_negprot(struct smb_request *req)
DEBUG( 5, ( "negprot index=%d\n", choice ) );
if ((lp_server_signing() == SMB_SIGNING_REQUIRED)
- && (get_Protocol() < PROTOCOL_NT1)) {
+ && (chosen_level < PROTOCOL_NT1)) {
exit_server_cleanly("SMB signing is required and "
"client negotiated a downlevel protocol");
}
TALLOC_FREE(cliprotos);
- if (lp_async_smb_echo_handler() && (get_Protocol() < PROTOCOL_SMB2_02) &&
+ if (lp_async_smb_echo_handler() && (chosen_level < PROTOCOL_SMB2_02) &&
!fork_echo_handler(sconn)) {
exit_server("Failed to fork echo handler");
}