s3:client: close the socket if receive_smb_raw() fails
authorStefan Metzmacher <metze@samba.org>
Fri, 8 Jul 2011 07:30:58 +0000 (09:30 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 8 Jul 2011 12:09:08 +0000 (14:09 +0200)
metze

source3/client/client.c

index b4e2b5e5257b8b1e7857513a375d0152925fcad2..130dbe0dcff47c04284781c95dec561bb09d1f7e 100644 (file)
@@ -4942,6 +4942,11 @@ static void readline_callback(void)
                status = receive_smb_raw(cli->fd, cli->inbuf, cli->bufsize, 0, 0, &len);
 
                if (!NT_STATUS_IS_OK(status)) {
+                       if (cli->fd != -1) {
+                               close(cli->fd);
+                               cli->fd = -1;
+                       }
+
                        DEBUG(0, ("Read from server failed, maybe it closed "
                                  "the connection\n"));