s3:smbd: avoid calling fd_is_readable() without async echo handler
authorStefan Metzmacher <metze@samba.org>
Wed, 11 Dec 2013 14:02:27 +0000 (15:02 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 14 Dec 2013 19:19:10 +0000 (20:19 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Dec 14 20:19:10 CET 2013 on sn-devel-104

source3/smbd/process.c

index 7d9f76719276e2fc6cca294ff83a1004aaec952c..8bd1c2e0497ac47fc3d745393d971fc7dc3a74e4 100644 (file)
@@ -2383,21 +2383,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)) {
@@ -2416,7 +2418,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);
        }