[SCM] Samba Shared Repository - branch v3-6-test updated

Karolin Seeger kseeger at samba.org
Thu Sep 15 12:32:21 MDT 2011


The branch, v3-6-test has been updated
       via  d728783 s3: Do not fork the echo handler for smb2
       via  4ad4665 s3: Fork the echo handler only after SMB1 negprot is done
      from  703b787 s3-spoolss: Fix bug #8236 empty notify servername.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit d72878365e3ab0ef7bc31065261d744d7693d578
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Aug 31 15:06:35 2011 +0200

    s3: Do not fork the echo handler for smb2
    
    If a smb1 negprot negotiated smb2 we forked the echo responder. This will
    eventually lead to a panic from
    
    [2011/08/30 10:33:29.212578,  0, pid=3846917] smbd/smb2_server.c:243(smbd_smb2_request_create)
      Invalid SMB packet: first request: 0x0009
    
    because from the echo responder we always read using the normal smb1 protocol
    handling routine. If that is a bit down the smb2 stream, we get a non-negprot
    packet and panic.
    
    BTW, the echo responder is not required for smb2 anyway, Microsoft confirmed
    that it probes the server liveness using TCP keepalives and not smb2 echo
    requests.
    
    The last 2 patches address bug #8334 (smb2: smbd logs Invalid SMB packet: first
    request: 0x0008 and crashes).

commit 4ad4665e10a77038d7f3dd8400473c8fcf3db451
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 20 13:07:17 2011 +0200

    s3: Fork the echo handler only after SMB1 negprot is done
    
    This enables activating the echo responder also if SMB2 is enabled, albeit it
    will only be used for SMB1 at this moment.
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Fri May 20 15:06:03 CEST 2011 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/negprot.c |    6 ++++++
 source3/smbd/process.c |    9 ++-------
 source3/smbd/proto.h   |    1 +
 3 files changed, 9 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index a2e7e0b..a628514 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -716,6 +716,12 @@ void reply_negprot(struct smb_request *req)
 	}
 
 	TALLOC_FREE(cliprotos);
+
+	if (lp_async_smb_echo_handler() && (get_Protocol() < PROTOCOL_SMB2) &&
+	    !fork_echo_handler(sconn)) {
+		exit_server("Failed to fork echo handler");
+	}
+
 	END_PROFILE(SMBnegprot);
 	return;
 }
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index ccbaec5..a337469 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2806,7 +2806,7 @@ static void smbd_echo_loop(struct smbd_server_connection *sconn,
 /*
  * Handle SMBecho requests in a forked child process
  */
-static bool fork_echo_handler(struct smbd_server_connection *sconn)
+bool fork_echo_handler(struct smbd_server_connection *sconn)
 {
 	int listener_pipe[2];
 	int res;
@@ -2920,8 +2920,7 @@ void smbd_process(struct smbd_server_connection *sconn)
 	const char *remaddr = NULL;
 	int ret;
 
-	if (lp_maxprotocol() == PROTOCOL_SMB2 &&
-	    !lp_async_smb_echo_handler()) {
+	if (lp_maxprotocol() == PROTOCOL_SMB2) {
 		/*
 		 * We're not making the decision here,
 		 * we're just allowing the client
@@ -3042,10 +3041,6 @@ void smbd_process(struct smbd_server_connection *sconn)
 		exit_server("Failed to init smb_signing");
 	}
 
-	if (lp_async_smb_echo_handler() && !fork_echo_handler(sconn)) {
-		exit_server("Failed to fork echo handler");
-	}
-
 	/* Setup oplocks */
 	if (!init_oplocks(sconn->msg_ctx))
 		exit_server("Failed to init oplocks");
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index b7bb063..6cbbcfa 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -793,6 +793,7 @@ size_t req_wct_ofs(struct smb_request *req);
 void chain_reply(struct smb_request *req);
 bool req_is_in_chain(struct smb_request *req);
 void smbd_process(struct smbd_server_connection *sconn);
+bool fork_echo_handler(struct smbd_server_connection *sconn);
 
 /* The following definitions come from smbd/quotas.c  */
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list