From 369bc84dd6e9a44d7ed9e4be10d7d434641f8788 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 19 May 2011 13:43:15 +0200 Subject: [PATCH] s3: Do central cli_set_error (cherry picked from commit 0645deb1b4a70e45f88116fae16ec7f3a1b4d5ed) Signed-off-by: Stefan Metzmacher --- source3/libsmb/async_smb.c | 2 + source3/libsmb/cliconnect.c | 27 ---------- source3/libsmb/clifile.c | 116 ----------------------------------------- source3/libsmb/clifsinfo.c | 9 --- source3/libsmb/clilist.c | 9 --- source3/libsmb/clioplock.c | 3 - source3/libsmb/clirap.c | 12 ---- source3/libsmb/clireadwrite.c | 10 ---- source3/libsmb/clitrans.c | 3 - 9 files changed, 2 insertions(+), 189 deletions(-) diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index 7b4cf01..7e8adda 100644 --- a/source3/libsmb/async_smb.c +++ b/source3/libsmb/async_smb.c @@ -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) diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index b812581..d324899 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -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; } diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 0de81b7..38d00d5 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -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; } @@ -2239,9 +2194,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; } @@ -2357,9 +2309,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; } @@ -2475,9 +2424,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; } @@ -2537,7 +2483,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); } @@ -2648,9 +2593,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; } @@ -2701,7 +2643,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); } @@ -2816,9 +2757,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; } @@ -2990,9 +2928,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; } @@ -3057,9 +2992,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; } @@ -3211,9 +3143,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; } @@ -3360,9 +3289,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; } @@ -3475,9 +3401,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; } @@ -3601,9 +3524,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; } @@ -3723,9 +3643,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; } @@ -3837,9 +3754,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; } @@ -3994,9 +3908,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; } @@ -4323,9 +4234,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; } @@ -4552,9 +4460,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; } @@ -4613,9 +4518,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; } @@ -4721,9 +4623,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; } @@ -4785,9 +4684,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; } @@ -5070,9 +4966,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; } @@ -5202,9 +5095,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; } @@ -5284,9 +5174,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; } @@ -5432,8 +5319,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; } diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c index 94568c9..ca82e33 100644 --- a/source3/libsmb/clifsinfo.c +++ b/source3/libsmb/clifsinfo.c @@ -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; } diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index 59d01b7..43fa7d7 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -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; } diff --git a/source3/libsmb/clioplock.c b/source3/libsmb/clioplock.c index 8c9ab12..da55f97 100644 --- a/source3/libsmb/clioplock.c +++ b/source3/libsmb/clioplock.c @@ -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; } diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index 6e774b1..d39d38e 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -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; } diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index b8af9e5..b0f988c 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -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; } diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c index 3cdb90b..2f2801e 100644 --- a/source3/libsmb/clitrans.c +++ b/source3/libsmb/clitrans.c @@ -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; } -- 1.7.4.1