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)
committerMichael Adam <obnox@samba.org>
Wed, 27 Jul 2011 14:20:10 +0000 (16:20 +0200)
This enables activating the echo responder also if SMB2 is enabled, albeit it
will only be used for SMB1 at this moment.

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

index a2e7e0b54f955ab3d3be463aa00233c38e166c32..562dcea5514f35765bb02a842c52388d9657ce8b 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 c03ca459c0ead12bb89fa39f4b08266f3f63ce0e..6d39a92d8a4f24e867c1136f33fba5e96f41aa27 100644 (file)
@@ -2797,7 +2797,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;
@@ -2911,8 +2911,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
@@ -3033,10 +3032,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 73644793fa775c8b489e4549edc9cf7b41120578..bd120b5cc01f6953e7289fdd1cc4d565afbe17f1 100644 (file)
@@ -801,6 +801,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  */