From a18c45046d2d7b69c7a5c9c20e911179f16c17ff Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 19 Aug 2024 11:36:02 +0200 Subject: [PATCH] libsmb: Remove cli_state->raw_status All callers which looked at this are gone Signed-off-by: Volker Lendecke Reviewed-by: Andreas Schneider Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Tue Aug 20 10:57:12 UTC 2024 on atb-devel-224 --- source3/include/client.h | 1 - source3/libsmb/async_smb.c | 1 - source3/libsmb/cli_smb2_fnum.c | 71 +--------------------------------- source3/libsmb/clientgen.c | 1 - source3/libsmb/clifile.c | 12 ------ source3/libsmb/cliprint.c | 3 -- source3/libsmb/clirap.c | 3 -- source3/libsmb/clitrans.c | 1 - source3/libsmb/libsmb_dir.c | 5 --- 9 files changed, 2 insertions(+), 96 deletions(-) diff --git a/source3/include/client.h b/source3/include/client.h index 3bd441279d5..2024cec8fbe 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -49,7 +49,6 @@ struct cli_state { */ struct cli_state *prev, *next; int rap_error; - NTSTATUS raw_status; /* maybe via NT_STATUS_DOS() */ bool map_dos_errors; /* diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index 38e0bb93ca5..3e626d1cc8c 100644 --- a/source3/libsmb/async_smb.c +++ b/source3/libsmb/async_smb.c @@ -207,7 +207,6 @@ NTSTATUS cli_smb_recv(struct tevent_req *req, } map_dos_errors = state->cli->map_dos_errors; - state->cli->raw_status = status; talloc_free(state->ptr); state = NULL; } diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c index 34d65019d80..a8ac2bbcbe0 100644 --- a/source3/libsmb/cli_smb2_fnum.c +++ b/source3/libsmb/cli_smb2_fnum.c @@ -403,7 +403,6 @@ NTSTATUS cli_smb2_create_fnum_recv( (symlink != NULL)) { *symlink = talloc_move(mem_ctx, &state->symlink); } - state->cli->raw_status = status; return status; } if (pfnum != NULL) { @@ -419,7 +418,6 @@ NTSTATUS cli_smb2_create_fnum_recv( mem_ctx, &state->out_cblobs.blobs), }; } - state->cli->raw_status = NT_STATUS_OK; return NT_STATUS_OK; } @@ -568,15 +566,7 @@ static void cli_smb2_close_fnum_done(struct tevent_req *subreq) NTSTATUS cli_smb2_close_fnum_recv(struct tevent_req *req) { - struct cli_smb2_close_fnum_state *state = tevent_req_data( - req, struct cli_smb2_close_fnum_state); - NTSTATUS status = NT_STATUS_OK; - - if (tevent_req_is_nterror(req, &status)) { - state->cli->raw_status = status; - } - tevent_req_received(req); - return status; + return tevent_req_simple_recv_ntstatus(req); } NTSTATUS cli_smb2_close_fnum(struct cli_state *cli, uint16_t fnum) @@ -775,20 +765,7 @@ static void cli_smb2_delete_on_close_done(struct tevent_req *subreq) NTSTATUS cli_smb2_delete_on_close_recv(struct tevent_req *req) { - struct cli_smb2_delete_on_close_state *state = - tevent_req_data(req, - struct cli_smb2_delete_on_close_state); - NTSTATUS status; - - if (tevent_req_is_nterror(req, &status)) { - state->cli->raw_status = status; - tevent_req_received(req); - return status; - } - - state->cli->raw_status = NT_STATUS_OK; - tevent_req_received(req); - return NT_STATUS_OK; + return tevent_req_simple_recv_ntstatus(req); } NTSTATUS cli_smb2_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag) @@ -2396,8 +2373,6 @@ NTSTATUS cli_smb2_setpathinfo(struct cli_state *cli, cli_smb2_close_fnum(cli, fnum); } - cli->raw_status = status; - TALLOC_FREE(frame); return status; } @@ -2511,7 +2486,6 @@ NTSTATUS cli_smb2_setattrE(struct cli_state *cli, FSCC_FILE_BASIC_INFORMATION, /* in_file_info_class */ &inbuf, /* in_input_buffer */ 0); /* in_additional_info */ - cli->raw_status = status; return status; } @@ -2607,8 +2581,6 @@ NTSTATUS cli_smb2_dskattr(struct cli_state *cli, const char *path, cli_smb2_close_fnum(cli, fnum); } - cli->raw_status = status; - TALLOC_FREE(frame); return status; } @@ -2694,8 +2666,6 @@ fail: cli_smb2_close_fnum(cli, fnum); } - cli->raw_status = status; - TALLOC_FREE(frame); return status; } @@ -2769,8 +2739,6 @@ fail: cli_smb2_close_fnum(cli, fnum); } - cli->raw_status = status; - TALLOC_FREE(frame); return status; } @@ -2889,8 +2857,6 @@ fail: cli_smb2_close_fnum(cli, fnum); } - cli->raw_status = status; - TALLOC_FREE(frame); return status; } @@ -3065,7 +3031,6 @@ NTSTATUS cli_smb2_query_mxac(struct cli_state *cli, status = cli_smb2_query_mxac_recv(req, _mxac); fail: - cli->raw_status = status; TALLOC_FREE(frame); return status; } @@ -3398,9 +3363,6 @@ NTSTATUS cli_smb2_set_ea_fnum(struct cli_state *cli, 0); /* in_additional_info */ fail: - - cli->raw_status = status; - TALLOC_FREE(frame); return status; } @@ -3450,9 +3412,6 @@ NTSTATUS cli_smb2_set_ea_path(struct cli_state *cli, if (fnum != 0xffff) { cli_smb2_close_fnum(cli, fnum); } - - cli->raw_status = status; - return status; } @@ -3547,8 +3506,6 @@ NTSTATUS cli_smb2_get_ea_list_path(struct cli_state *cli, cli_smb2_close_fnum(cli, fnum); } - cli->raw_status = status; - TALLOC_FREE(frame); return status; } @@ -3650,8 +3607,6 @@ NTSTATUS cli_smb2_get_user_quota(struct cli_state *cli, } fail: - cli->raw_status = status; - TALLOC_FREE(frame); return status; } @@ -3723,8 +3678,6 @@ NTSTATUS cli_smb2_list_user_quota_step(struct cli_state *cli, pqt_list); cleanup: - cli->raw_status = status; - TALLOC_FREE(frame); return status; } @@ -3769,8 +3722,6 @@ NTSTATUS cli_smb2_get_fs_quota_info(struct cli_state *cli, status = parse_fs_quota_buffer(outbuf.data, outbuf.length, pqt); cleanup: - cli->raw_status = status; - TALLOC_FREE(frame); return status; } @@ -3809,9 +3760,6 @@ NTSTATUS cli_smb2_set_user_quota(struct cli_state *cli, &inbuf, /* in_input_buffer */ 0); /* in_additional_info */ cleanup: - - cli->raw_status = status; - TALLOC_FREE(frame); return status; @@ -3846,8 +3794,6 @@ NTSTATUS cli_smb2_set_fs_quota_info(struct cli_state *cli, &inbuf, /* in_input_buffer */ 0); /* in_additional_info */ cleanup: - cli->raw_status = status; - TALLOC_FREE(frame); return status; } @@ -3944,7 +3890,6 @@ NTSTATUS cli_smb2_read_recv(struct tevent_req *req, req, struct cli_smb2_read_state); if (tevent_req_is_nterror(req, &status)) { - state->cli->raw_status = status; return status; } /* @@ -3954,7 +3899,6 @@ NTSTATUS cli_smb2_read_recv(struct tevent_req *req, */ *received = (ssize_t)state->received; *rcvbuf = state->buf; - state->cli->raw_status = NT_STATUS_OK; return NT_STATUS_OK; } @@ -4053,7 +3997,6 @@ NTSTATUS cli_smb2_write_recv(struct tevent_req *req, NTSTATUS status; if (tevent_req_is_nterror(req, &status)) { - state->cli->raw_status = status; tevent_req_received(req); return status; } @@ -4061,7 +4004,6 @@ NTSTATUS cli_smb2_write_recv(struct tevent_req *req, if (pwritten != NULL) { *pwritten = (size_t)state->written; } - state->cli->raw_status = NT_STATUS_OK; tevent_req_received(req); return NT_STATUS_OK; } @@ -4219,13 +4161,11 @@ NTSTATUS cli_smb2_writeall_recv(struct tevent_req *req, NTSTATUS status; if (tevent_req_is_nterror(req, &status)) { - state->cli->raw_status = status; return status; } if (pwritten != NULL) { *pwritten = (size_t)state->written; } - state->cli->raw_status = NT_STATUS_OK; return NT_STATUS_OK; } @@ -4486,14 +4426,12 @@ NTSTATUS cli_smb2_splice_recv(struct tevent_req *req, off_t *written) NTSTATUS status; if (tevent_req_is_nterror(req, &status)) { - state->cli->raw_status = status; tevent_req_received(req); return status; } if (written != NULL) { *written = state->written; } - state->cli->raw_status = NT_STATUS_OK; tevent_req_received(req); return NT_STATUS_OK; } @@ -4713,8 +4651,6 @@ NTSTATUS cli_smb2_shadow_copy_data(TALLOC_CTX *mem_ctx, pnames, pnum_names); fail: - cli->raw_status = status; - TALLOC_FREE(frame); return status; } @@ -4755,9 +4691,6 @@ NTSTATUS cli_smb2_ftruncate(struct cli_state *cli, 0); fail: - - cli->raw_status = status; - TALLOC_FREE(frame); return status; } diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index bec1184d53f..d699f035847 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -119,7 +119,6 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx, goto error; } - cli->raw_status = NT_STATUS_INTERNAL_ERROR; cli->map_dos_errors = true; /* remove this */ cli->timeout = CLIENT_TIMEOUT; diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 57eb75eb228..30d08d6f6f2 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1878,8 +1878,6 @@ NTSTATUS cli_rename(struct cli_state *cli, } status = cli_rename_recv(req); - cli->raw_status = status; /* cli_smb2_rename_recv doesn't set this */ - fail: TALLOC_FREE(frame); return status; @@ -2461,8 +2459,6 @@ NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint32_t mayhave_a } status = cli_unlink_recv(req); - cli->raw_status = status; /* cli_smb2_unlink_recv doesn't set this */ - fail: TALLOC_FREE(frame); return status; @@ -2600,8 +2596,6 @@ NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname) } status = cli_mkdir_recv(req); - cli->raw_status = status; /* cli_smb2_mkdir_recv doesn't set this */ - fail: TALLOC_FREE(frame); return status; @@ -2732,8 +2726,6 @@ NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname) } status = cli_rmdir_recv(req); - cli->raw_status = status; /* cli_smb2_rmdir_recv doesn't set this */ - fail: TALLOC_FREE(frame); return status; @@ -3727,8 +3719,6 @@ NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, return status; } status = NT_STATUS_FILE_IS_A_DIRECTORY; - /* Set this so libsmbclient can retrieve it. */ - cli->raw_status = status; } return status; @@ -5345,8 +5335,6 @@ NTSTATUS cli_chkpath(struct cli_state *cli, const char *path) } status = cli_chkpath_recv(req); - cli->raw_status = status; /* cli_smb2_chkpath_recv doesn't set this */ - fail: TALLOC_FREE(frame); return status; diff --git a/source3/libsmb/cliprint.c b/source3/libsmb/cliprint.c index b354990f619..3808811cccd 100644 --- a/source3/libsmb/cliprint.c +++ b/source3/libsmb/cliprint.c @@ -112,7 +112,6 @@ NTSTATUS cli_print_queue(struct cli_state *cli, 0, /* min_rdata */ &rdrcnt); /* num_rdata */ if (!NT_STATUS_IS_OK(status)) { - cli->raw_status = status; return status; } @@ -201,7 +200,6 @@ NTSTATUS cli_printjob_del(struct cli_state *cli, int job) 0, /* min_rdata */ &rdrcnt); /* num_rdata */ if (!NT_STATUS_IS_OK(status)) { - cli->raw_status = status; return status; } @@ -212,7 +210,6 @@ NTSTATUS cli_printjob_del(struct cli_state *cli, int job) if (result_code == ERRnosuchprintjob) { status = NT_STATUS_INVALID_PARAMETER; - cli->raw_status = NT_STATUS_INVALID_PARAMETER; } return status; diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index 6d07aca3498..256331f77c3 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -1490,9 +1490,6 @@ NTSTATUS cli_qfileinfo_basic( write_time, change_time, ino); - - /* cli_smb2_query_info_fnum_recv doesn't set this */ - cli->raw_status = status; fail: TALLOC_FREE(frame); return status; diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c index e5b4c4a4618..2cd75d2a800 100644 --- a/source3/libsmb/clitrans.c +++ b/source3/libsmb/clitrans.c @@ -152,7 +152,6 @@ NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, map_error: map_dos_errors = state->cli->map_dos_errors; - state->cli->raw_status = status; if (NT_STATUS_IS_DOS(status) && map_dos_errors) { uint8_t eclass = NT_STATUS_DOS_CLASS(status); diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c index 1801afffc38..59bee575673 100644 --- a/source3/libsmb/libsmb_dir.c +++ b/source3/libsmb/libsmb_dir.c @@ -879,11 +879,6 @@ SMBC_opendir_ctx(SMBCCTX *context, (void *)dir); } if (!NT_STATUS_IS_OK(status)) { - /* - * Set cli->raw_status so SMBC_errno() - * will correctly return the error. - */ - srv->cli->raw_status = status; if (dir != NULL) { SAFE_FREE(dir->fname); SAFE_FREE(dir);