s3:libsmb only log a dead connection if it was not closed
authorChristian Ambach <christian.ambach@de.ibm.com>
Tue, 22 Feb 2011 14:45:44 +0000 (15:45 +0100)
committerVolker Lendecke <vlendec@samba.org>
Wed, 23 Feb 2011 15:51:03 +0000 (16:51 +0100)
in case the cli was closed before (e.g. via a dropped ip message)
it can be expected that the read here returns with an error and so
we should not log that a connection is dead when it was closed before

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Feb 23 16:51:03 CET 2011 on sn-devel-104

source3/libsmb/clientgen.c

index 3816419dfd6d8fc918bb2e1b91cb6f22ac73f82a..e26c1718d80e1a749e2e7c0cc0ee3a65426d5d2c 100644 (file)
@@ -248,13 +248,18 @@ bool cli_receive_smb(struct cli_state *cli)
 
        /* If the server is not responding, note that now */
        if (len < 0) {
-               char addr[INET6_ADDRSTRLEN];
-
-               print_sockaddr(addr, sizeof(addr), &cli->dest_ss);
-                DEBUG(0, ("Receiving SMB: Server %s stopped responding\n",
-                         addr));
-               close(cli->fd);
-               cli->fd = -1;
+               /*
+                * only log if the connection should still be open and not when
+                * the connection was closed due to a dropped ip message
+                */
+               if (cli->fd != -1) {
+                       char addr[INET6_ADDRSTRLEN];
+                       print_sockaddr(addr, sizeof(addr), &cli->dest_ss);
+                       DEBUG(0, ("Receiving SMB: Server %s stopped responding\n",
+                               addr));
+                       close(cli->fd);
+                       cli->fd = -1;
+               }
                return false;
        }