s3: Do central cli_set_error
authorVolker Lendecke <vl@samba.org>
Thu, 19 May 2011 11:43:15 +0000 (13:43 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 19 May 2011 15:31:30 +0000 (17:31 +0200)
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 182e652f36b72337309a70d56ae3253172c4dfb3..dfab82ada17ad69c6d69272fee0fa850ad892e39 100644 (file)
@@ -739,6 +739,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 7bfad1e732077c7abfd1e79f39d2e5806cebd042..374dd97ff46515579872f55121183daad0134615 100644 (file)
@@ -359,9 +359,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;
 }
 
@@ -593,9 +590,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;
 }
 
@@ -794,9 +788,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;
 }
 
@@ -1159,9 +1150,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;
 }
 
@@ -1776,9 +1764,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;
 }
 
@@ -2146,9 +2131,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;
 }
 
@@ -2442,9 +2424,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;
 }
 
@@ -2525,9 +2504,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;
 }
 
@@ -2777,9 +2753,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 f5b6fabe216ad1a0865a375aeea014094a734907..1bf72aaf8fb8e556e79eb86c4ccd0c19d5115476 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;
 }
 
@@ -502,9 +499,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;
 }
 
@@ -569,9 +563,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;
 }
 
@@ -683,9 +674,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;
 }
 
@@ -817,9 +805,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;
 }
 
@@ -934,9 +919,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;
 }
 
@@ -1007,9 +989,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;
 }
 
@@ -1129,9 +1108,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;
 }
 
@@ -1273,9 +1249,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;
 }
 
@@ -1338,9 +1311,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;
 }
 
@@ -1448,9 +1418,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;
 }
 
@@ -1555,9 +1522,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;
 }
 
@@ -1662,9 +1626,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;
 }
 
@@ -1779,9 +1740,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;
 }
 
@@ -1943,9 +1901,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;
 }
 
@@ -2144,9 +2099,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;
 }
 
@@ -2262,9 +2214,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;
 }
 
@@ -2380,9 +2329,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;
 }
 
@@ -2442,7 +2388,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);
 }
 
@@ -2553,9 +2498,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;
 }
 
@@ -2606,7 +2548,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);
 }
 
@@ -2721,9 +2662,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;
 }
 
@@ -2895,9 +2833,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;
 }
 
@@ -2962,9 +2897,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;
 }
 
@@ -3116,9 +3048,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;
 }
 
@@ -3265,9 +3194,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;
 }
 
@@ -3380,9 +3306,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;
 }
 
@@ -3506,9 +3429,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;
 }
 
@@ -3628,9 +3548,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;
 }
 
@@ -3742,9 +3659,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;
 }
 
@@ -3899,9 +3813,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;
 }
 
@@ -4228,9 +4139,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;
 }
 
@@ -4457,9 +4365,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;
 }
 
@@ -4518,9 +4423,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;
 }
 
@@ -4626,9 +4528,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;
 }
 
@@ -4690,9 +4589,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;
 }
 
@@ -4975,9 +4871,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;
 }
 
@@ -5107,9 +5000,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;
 }
 
@@ -5189,9 +5079,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;
 }
 
@@ -5337,8 +5224,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 b346654c8d407e089ed9ca32f8df18a271c27490..db4199d3276a0805ecb826f2f7e40be1af99db1a 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 9408cb7d1d5fe71b8d6be73f003b7c66869dc166..49354e66bdb131d9918675ec18d770c4563ae22d 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 291f3b1484a531e013b17cc0ed81905092cafb25..5ecc8544d2e8624bb713a2edd6497f5073fd21fc 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 b7fd2bfc971c50f38d6dc051e4e2c0fb91a2add7..9f228c9b08d7a73e0425c97cae5f82512f285ae8 100644 (file)
@@ -665,9 +665,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;
 }
 
@@ -688,7 +685,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;
@@ -1029,9 +1025,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;
 }
 
@@ -1261,8 +1254,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 a464cf39b33877862da77aa64aff722d12a1d0be..44dafa7e43f2537bca7affe6356ffe4339b58b6f 100644 (file)
@@ -646,8 +646,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;
 }