s3: Fork the echo handler only after SMB1 negprot is done
authorVolker Lendecke <vl@samba.org>
Fri, 20 May 2011 11:07:17 +0000 (13:07 +0200)
committerVolker Lendecke <vlendec@samba.org>
Fri, 20 May 2011 13:06:03 +0000 (15:06 +0200)
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@samba.org>
Autobuild-Date: Fri May 20 15:06:03 CEST 2011 on sn-devel-104

source3/smbd/negprot.c
source3/smbd/process.c
source3/smbd/proto.h

index 9f201b8bee74032995d903e62c579b67651b75c8..aa10563aaed290859ad82468b8e69147838a8368 100644 (file)
@@ -716,6 +716,11 @@ void reply_negprot(struct smb_request *req)
        }
 
        TALLOC_FREE(cliprotos);
+
+       if (lp_async_smb_echo_handler() && !fork_echo_handler(sconn)) {
+               exit_server("Failed to fork echo handler");
+       }
+
        END_PROFILE(SMBnegprot);
        return;
 }
index 5f9845cba05a4831a8dd240e1e6abb9b8eb74dea..7f04a7bcb61bc027e2c037c966a1c1f3037424e7 100644 (file)
@@ -2798,7 +2798,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;
@@ -2912,8 +2912,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
@@ -3034,10 +3033,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");
index 1f2b1a9cffa003a0ebaedac2091e93300cd24f68..589d45daded8ad10d6be7384a0796563b038c367 100644 (file)
@@ -750,6 +750,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  */