s3:libsmb: make use of cli_state_disconnect()
authorStefan Metzmacher <metze@samba.org>
Fri, 22 Jul 2011 07:39:23 +0000 (09:39 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 22 Jul 2011 15:06:07 +0000 (17:06 +0200)
metze

source3/libsmb/async_smb.c
source3/libsmb/clientgen.c

index aac303c22e0ca82ea160f8337af1f8a7912534d6..724e8b7d4f41ee57e5eb6e372ea2ffd239c2d5a5 100644 (file)
@@ -489,10 +489,7 @@ static void cli_smb_sent(struct tevent_req *subreq)
        nwritten = writev_recv(subreq, &err);
        TALLOC_FREE(subreq);
        if (nwritten == -1) {
-               if (state->cli->fd != -1) {
-                       close(state->cli->fd);
-                       state->cli->fd = -1;
-               }
+               cli_state_disconnect(state->cli);
                tevent_req_nterror(req, map_nt_error_from_unix(err));
                return;
        }
@@ -537,10 +534,7 @@ static void cli_smb_received(struct tevent_req *subreq)
        received = read_smb_recv(subreq, talloc_tos(), &inbuf, &err);
        TALLOC_FREE(subreq);
        if (received == -1) {
-               if (cli->fd != -1) {
-                       close(cli->fd);
-                       cli->fd = -1;
-               }
+               cli_state_disconnect(cli);
                status = map_nt_error_from_unix(err);
                goto fail;
        }
@@ -620,8 +614,7 @@ static void cli_smb_received(struct tevent_req *subreq)
                DEBUG(10, ("cli_check_sign_mac failed\n"));
                TALLOC_FREE(inbuf);
                status = NT_STATUS_ACCESS_DENIED;
-               close(cli->fd);
-               cli->fd = -1;
+               cli_state_disconnect(cli);
                goto fail;
        }
 
index c394197ad9ea5e2fbed551707276fdfff58d44c7..7a417ec6c02e13acd1fada3374820909391254c5 100644 (file)
@@ -321,10 +321,7 @@ static void _cli_shutdown(struct cli_state *cli)
        data_blob_free(&cli->secblob);
        data_blob_free(&cli->user_session_key);
 
-       if (cli->fd != -1) {
-               close(cli->fd);
-       }
-       cli->fd = -1;
+       cli_state_disconnect(cli);
 
        /*
         * Need to free pending first, they remove themselves