libsmb: Use tevent_req_nterror() properly
authorVolker Lendecke <vl@samba.org>
Wed, 16 Aug 2023 09:59:03 +0000 (11:59 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 22 Aug 2023 16:45:31 +0000 (16:45 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/cli_smb2_fnum.c
source3/libsmb/cliconnect.c
source3/libsmb/clifsinfo.c
source3/libsmb/climessage.c
source3/libsmb/clirap.c
source3/libsmb/smbsock_connect.c

index a7d51b6ae615d99f540e3fe2feb2b91c4e0cedfe..355933122832e85ba3c8c6a4cda2d083a5abeeb0 100644 (file)
@@ -1462,7 +1462,7 @@ struct tevent_req *cli_smb2_list_send(
 
                status = smb2_create_blob_add(in_cblobs, in_cblobs,
                                              SMB2_CREATE_TAG_POSIX, blob);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (tevent_req_nterror(req, status)) {
                        tevent_req_nterror(req, status);
                        return tevent_req_post(req, ev);
                }
index b687a22e11cf142b2bc1543d469d805c8b70ea69..af9f215dc754613338c17cfebbdd29c182844ca0 100644 (file)
@@ -1742,9 +1742,8 @@ static void cli_session_setup_creds_done_nt1(struct tevent_req *subreq)
                                                &state->out_native_lm,
                                                &state->out_primary_domain);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (tevent_req_nterror(req, status)) {
                DEBUG(3, ("NT1 login failed: %s\n", nt_errstr(status)));
-               tevent_req_nterror(req, status);
                return;
        }
 
@@ -1792,9 +1791,8 @@ static void cli_session_setup_creds_done_lm21(struct tevent_req *subreq)
                                                 &state->out_native_os,
                                                 &state->out_native_lm);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (tevent_req_nterror(req, status)) {
                DEBUG(3, ("LM21 login failed: %s\n", nt_errstr(status)));
-               tevent_req_nterror(req, status);
                return;
        }
 
@@ -1906,8 +1904,7 @@ static void cli_ulogoff_done(struct tevent_req *subreq)
        NTSTATUS status;
 
        status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
        cli_state_set_uid(state->cli, UID_FIELD_INVALID);
@@ -2146,8 +2143,7 @@ struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
                return req;
        }
        status = smb1cli_req_chain_submit(&subreq, 1);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return tevent_req_post(req, ev);
        }
        return req;
@@ -2172,8 +2168,7 @@ static void cli_tcon_andx_done(struct tevent_req *subreq)
        status = cli_smb_recv(subreq, state, &in, 0, &wct, &vwv,
                              &num_bytes, &bytes);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
 
@@ -2479,8 +2474,7 @@ static void cli_tdis_done(struct tevent_req *subreq)
 
        status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
        TALLOC_FREE(state->cli->smb1.tcon);
@@ -2572,8 +2566,7 @@ static struct tevent_req *cli_connect_sock_send(
 
                status = resolve_name_list(state, host, name_type,
                                           &addrs, &num_addrs);
-               if (!NT_STATUS_IS_OK(status)) {
-                       tevent_req_nterror(req, status);
+               if (tevent_req_nterror(req, status)) {
                        return tevent_req_post(req, ev);
                }
        } else {
index 39083c68e37c249b301d544b5ea987ca3f13d012..50fb6e52c9f47f75d03d37f836a5f55c82ccdc05 100644 (file)
@@ -85,8 +85,7 @@ static void cli_unix_extensions_version_done(struct tevent_req *subreq)
        status = cli_trans_recv(subreq, state, NULL, NULL, 0, NULL,
                                NULL, 0, NULL, &data, 12, &num_data);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
 
@@ -302,8 +301,7 @@ static void cli_get_fs_attr_info_done(struct tevent_req *subreq)
        status = cli_trans_recv(subreq, talloc_tos(), NULL, NULL, 0, NULL,
                                NULL, 0, NULL, &data, 12, &num_data);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
        state->fs_attr = IVAL(data, 0);
index 80196bc851951da34efbd114cabd3732fcf1c04d..856361589f5098e5daad3b162ada91476a3ff78e 100644 (file)
@@ -100,8 +100,7 @@ static void cli_message_start_done(struct tevent_req *subreq)
        status = cli_smb_recv(subreq, state, NULL, 0, &wct, &vwv,
                              NULL, NULL);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
        if (wct >= 1) {
@@ -190,8 +189,7 @@ static void cli_message_text_done(struct tevent_req *subreq)
 
        status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
        tevent_req_done(req);
@@ -241,8 +239,7 @@ static void cli_message_end_done(struct tevent_req *subreq)
 
        status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
        tevent_req_done(req);
@@ -302,8 +299,7 @@ static void cli_message_started(struct tevent_req *subreq)
 
        status = cli_message_start_recv(subreq, &state->grp);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
 
@@ -329,8 +325,7 @@ static void cli_message_sent(struct tevent_req *subreq)
 
        status = cli_message_text_recv(subreq);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
 
@@ -366,8 +361,7 @@ static void cli_message_done(struct tevent_req *subreq)
 
        status = cli_message_end_recv(subreq);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
        tevent_req_done(req);
index 688a8a14f5f6ed749a5165ef360476de309dc1f6..2bc873827f28cf5f483e6ca7def4597e4ed2118b 100644 (file)
@@ -863,8 +863,7 @@ static void cli_qpathinfo2_done(struct tevent_req *subreq)
 
        status = cli_qpathinfo_recv(subreq, state, &data, &num_data);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
 
@@ -1511,8 +1510,7 @@ static void cli_qpathinfo_basic_done(struct tevent_req *subreq)
        status = cli_qpathinfo_recv(subreq, state, &state->data,
                                    &state->num_data);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
        tevent_req_done(req);
index 80ea743b3884b08ff2bc140babab93916e190107..7f0baadd368ae63d155ec83b29b1dcc504f40ac0 100644 (file)
@@ -237,8 +237,7 @@ static void nb_connect_connected(struct tevent_req *subreq)
 
        status = open_socket_out_recv(subreq, &state->sock);
        TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
        subreq = cli_session_request_send(state, state->ev, state->sock,