s3:smbd: avoid calling fd_is_readable() without async echo handler v4-0-test
authorStefan Metzmacher <metze@samba.org>
Wed, 11 Dec 2013 14:02:27 +0000 (15:02 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 10 Mar 2015 09:55:45 +0000 (10:55 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/process.c

index dcfbff699ed0575ec08d155622d9f878cf2608c8..d5fe325590c9551840053fac603788640a9436fd 100644 (file)
@@ -2389,21 +2389,23 @@ static void smbd_server_connection_read_handler(
        NTSTATUS status;
        uint32_t seqnum;
 
-       bool from_client;
+       bool async_echo = lp_async_smb_echo_handler();
+       bool from_client = false;
 
-       if (lp_async_smb_echo_handler()
-           && fd_is_readable(sconn->smb1.echo_handler.trusted_fd)) {
-               /*
-                * This is the super-ugly hack to prefer the packets
-                * forwarded by the echo handler over the ones by the
-                * client directly
-                */
-               fd = sconn->smb1.echo_handler.trusted_fd;
+       if (async_echo) {
+               if (fd_is_readable(sconn->smb1.echo_handler.trusted_fd)) {
+                       /*
+                        * This is the super-ugly hack to prefer the packets
+                        * forwarded by the echo handler over the ones by the
+                        * client directly
+                        */
+                       fd = sconn->smb1.echo_handler.trusted_fd;
+               }
        }
 
        from_client = (sconn->sock == fd);
 
-       if (from_client) {
+       if (async_echo && from_client) {
                smbd_lock_socket(sconn);
 
                if (!fd_is_readable(fd)) {
@@ -2422,7 +2424,7 @@ static void smbd_server_connection_read_handler(
                                    &inbuf_len, &seqnum,
                                    !from_client /* trusted channel */);
 
-       if (from_client) {
+       if (async_echo && from_client) {
                smbd_unlock_socket(sconn);
        }