]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: Do central cli_set_error (cherry picked from commit 0645deb1b4a70e45f88116fae16ec...
authorVolker Lendecke <vl@samba.org>
Thu, 19 May 2011 11:43:15 +0000 (13:43 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 18 Aug 2011 18:49:34 +0000 (20:49 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Fix bug #7864 (cli_errstr() usage is wrong).

source3/libsmb/async_smb.c
source3/libsmb/cliconnect.c
source3/libsmb/clifile.c
source3/libsmb/clifsinfo.c
source3/libsmb/clilist.c
source3/libsmb/clioplock.c
source3/libsmb/clirap.c
source3/libsmb/clireadwrite.c
source3/libsmb/clitrans.c

index 7b4cf01ab1d1e9a44fc7941a990ab7e1a5e9262a..7e8adda5d44a1f0421ab35f1c291bdca3f02a3ad 100644 (file)
@@ -872,6 +872,8 @@ NTSTATUS cli_smb_recv(struct tevent_req *req,
 
        status = cli_pull_error((char *)state->inbuf);
 
+       cli_set_error(state->cli, status);
+
        if (!have_andx_command((char *)state->inbuf, wct_ofs)) {
 
                if ((cmd == SMBsesssetupX)
index b8125818d71d02f1bff19a33eaf15bf1923a09c8..d3248993bd9bb0e9e8663f265a613f3bf3b6e54d 100644 (file)
@@ -361,9 +361,6 @@ static NTSTATUS cli_session_setup_lanman2(struct cli_state *cli, const char *use
        status = cli_session_setup_lanman2_recv(req);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -598,9 +595,6 @@ static NTSTATUS cli_session_setup_guest(struct cli_state *cli)
        status = cli_session_setup_guest_recv(req);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -802,9 +796,6 @@ static NTSTATUS cli_session_setup_plain(struct cli_state *cli,
        status = cli_session_setup_plain_recv(req);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1170,9 +1161,6 @@ static NTSTATUS cli_session_setup_nt1(struct cli_state *cli, const char *user,
        status = cli_session_setup_nt1_recv(req);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1788,9 +1776,6 @@ static NTSTATUS cli_session_setup_ntlmssp(struct cli_state *cli,
        status = cli_session_setup_ntlmssp_recv(req);
 fail:
        TALLOC_FREE(ev);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -2175,9 +2160,6 @@ NTSTATUS cli_ulogoff(struct cli_state *cli)
        status = cli_ulogoff_recv(req);
 fail:
        TALLOC_FREE(ev);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -2471,9 +2453,6 @@ NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
        status = cli_tcon_andx_recv(req);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -2554,9 +2533,6 @@ NTSTATUS cli_tdis(struct cli_state *cli)
        status = cli_tdis_recv(req);
 fail:
        TALLOC_FREE(ev);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -2809,9 +2785,6 @@ NTSTATUS cli_negprot(struct cli_state *cli)
        status = cli_negprot_recv(req);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
index 63563bbaea3b795ce64dc6dbff336b122b0a6e1e..64e49840e0d829bd5932dcfa3eb728f88026187a 100644 (file)
@@ -358,9 +358,6 @@ NTSTATUS cli_posix_symlink(struct cli_state *cli,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -503,9 +500,6 @@ NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -570,9 +564,6 @@ NTSTATUS cli_posix_hardlink(struct cli_state *cli,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -778,9 +769,6 @@ NTSTATUS cli_posix_getfacl(struct cli_state *cli,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -912,9 +900,6 @@ NTSTATUS cli_posix_stat(struct cli_state *cli,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1029,9 +1014,6 @@ NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode)
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1102,9 +1084,6 @@ NTSTATUS cli_posix_chown(struct cli_state *cli,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1224,9 +1203,6 @@ NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fn
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1368,9 +1344,6 @@ NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1433,9 +1406,6 @@ NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const cha
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1543,9 +1513,6 @@ NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_a
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1650,9 +1617,6 @@ NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname)
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1757,9 +1721,6 @@ NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname)
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1874,9 +1835,6 @@ NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag)
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -2038,9 +1996,6 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
        status = cli_ntcreate_recv(req, pfid);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -2289,9 +2244,6 @@ NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags,
        status = cli_open_recv(req, pfnum);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -2407,9 +2359,6 @@ NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum)
        status = cli_close_recv(req);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -2525,9 +2474,6 @@ NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size)
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -2587,7 +2533,6 @@ bool cli_lock(struct cli_state *cli, uint16_t fnum,
 
        status = cli_locktype(cli, fnum, offset, len, timeout,
                              (lock_type == READ_LOCK? 1 : 0));
-       cli_set_error(cli, status);
        return NT_STATUS_IS_OK(status);
 }
 
@@ -2698,9 +2643,6 @@ NTSTATUS cli_unlock(struct cli_state *cli,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -2751,7 +2693,6 @@ bool cli_lock64(struct cli_state *cli, uint16_t fnum,
 
        cli->timeout = saved_timeout;
 
-       cli_set_error(cli, status);
        return NT_STATUS_IS_OK(status);
 }
 
@@ -2866,9 +2807,6 @@ NTSTATUS cli_unlock64(struct cli_state *cli,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -3040,9 +2978,6 @@ NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -3107,9 +3042,6 @@ NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -3261,9 +3193,6 @@ NTSTATUS cli_getattrE(struct cli_state *cli,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -3410,9 +3339,6 @@ NTSTATUS cli_getatr(struct cli_state *cli,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -3525,9 +3451,6 @@ NTSTATUS cli_setattrE(struct cli_state *cli,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -3651,9 +3574,6 @@ NTSTATUS cli_setatr(struct cli_state *cli,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -3773,9 +3693,6 @@ NTSTATUS cli_chkpath(struct cli_state *cli, const char *path)
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -3887,9 +3804,6 @@ NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail)
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -4044,9 +3958,6 @@ NTSTATUS cli_ctemp(struct cli_state *cli,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -4373,9 +4284,6 @@ NTSTATUS cli_get_ea_list_path(struct cli_state *cli, const char *path,
        status = cli_get_ea_list_path_recv(req, ctx, pnum_eas, pea_list);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -4602,9 +4510,6 @@ NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -4663,9 +4568,6 @@ NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode)
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -4771,9 +4673,6 @@ NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname)
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -4835,9 +4734,6 @@ NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname)
 
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -5120,9 +5016,6 @@ NTSTATUS cli_qpathinfo(TALLOC_CTX *mem_ctx, struct cli_state *cli,
        status = cli_qpathinfo_recv(req, mem_ctx, rdata, num_rdata);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -5252,9 +5145,6 @@ NTSTATUS cli_qfileinfo(TALLOC_CTX *mem_ctx, struct cli_state *cli,
        status = cli_qfileinfo_recv(req, mem_ctx, rdata, num_rdata);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -5334,9 +5224,6 @@ NTSTATUS cli_flush(TALLOC_CTX *mem_ctx, struct cli_state *cli, uint16_t fnum)
        status = cli_flush_recv(req);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -5482,8 +5369,5 @@ NTSTATUS cli_shadow_copy_data(TALLOC_CTX *mem_ctx, struct cli_state *cli,
        status = cli_shadow_copy_data_recv(req, mem_ctx, pnames, pnum_names);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
index 95973bb4b76e8bc8cb84a4f0a877fff140c5883c..1d66eb4c6b8ba85802d9f9e872a06e9e63173907 100644 (file)
@@ -153,9 +153,6 @@ NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
                                                  pcaphigh);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -258,9 +255,6 @@ NTSTATUS cli_set_unix_extensions_capabilities(struct cli_state *cli,
        status = cli_set_unix_extensions_capabilities_recv(req);
 fail:
        TALLOC_FREE(ev);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -357,9 +351,6 @@ NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr)
        status = cli_get_fs_attr_info_recv(req, fs_attr);
 fail:
        TALLOC_FREE(ev);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
index 59d01b7fc19e82c4ac9d37af354e47c63eee7264..43fa7d7706b3e53acec27a5710f67b904d50fc7b 100644 (file)
@@ -514,9 +514,6 @@ NTSTATUS cli_list_old(struct cli_state *cli, const char *mask,
        }
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -843,9 +840,6 @@ NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
        }
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -968,8 +962,5 @@ NTSTATUS cli_list(struct cli_state *cli, const char *mask, uint16 attribute,
        }
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
index 8c9ab126baac3b93b0436e7470ba6e96016b0f9b..da55f971a80c534ead187bf7254747d7ef0e5d51 100644 (file)
@@ -118,9 +118,6 @@ NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char leve
        status = cli_oplock_ack_recv(req);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
index 6e774b1213a1e9629df4076c475fd9f174213a90..d39d38ed72f80365ba45585e9eec4964f5786432 100644 (file)
@@ -689,9 +689,6 @@ NTSTATUS cli_qpathinfo1(struct cli_state *cli,
                                     write_time, size, mode);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -867,9 +864,6 @@ NTSTATUS cli_qpathinfo2(struct cli_state *cli, const char *fname,
                                     write_time, change_time, size, mode, ino);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -981,9 +975,6 @@ NTSTATUS cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
                                            pstreams);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1249,9 +1240,6 @@ NTSTATUS cli_qpathinfo_basic(struct cli_state *cli, const char *name,
        status = cli_qpathinfo_basic_recv(req, sbuf, attributes);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
index b8af9e575c83b5b2112c7106e3497d5ca8090d1c..b0f988c2f9a6c829d954fa700f082673d790ea91 100644 (file)
@@ -680,9 +680,6 @@ NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
        status = cli_pull_recv(req, received);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -703,7 +700,6 @@ ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
        status = cli_pull(cli, fnum, offset, size, size,
                          cli_read_sink, &buf, &ret);
        if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
                return -1;
        }
        return ret;
@@ -1044,9 +1040,6 @@ NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
        status = cli_writeall_recv(req, pwritten);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
 
@@ -1276,8 +1269,5 @@ NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
        status = cli_push_recv(req);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }
index 3cdb90bdccc70d925762b8f55bda209f23fb8090..2f2801ec3f44dcfd6dec1147c622c3f896086517 100644 (file)
@@ -761,8 +761,5 @@ NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
                                rdata, min_rdata, num_rdata);
  fail:
        TALLOC_FREE(frame);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_set_error(cli, status);
-       }
        return status;
 }