The branch, master has been updated via a18c45046d2 libsmb: Remove cli_state->raw_status via bdedf5d0eec libsmb: Remove unused cli_is_error() via 8171a1ccd3f libsmb: Remove a call to cli_is_error() via e071ec1ffe0 libsmb: Remove unused cli_errno() via e43a05ee3b5 libsmb: Don't set errno in cli_NetServerEnum() via 2d361cc1034 libsmb: Convert cli_NetServerEnum() to return NTSTATUS via b9c018d17ec libsmb: Remove a reference to cli_errno() via 16c31fe8049 libsmb: Remove unused cli_nt_error() via ac5713f3b27 libsmb: Make cli_api() static to clirap2.c via e02e6f28a93 torture3: Convert run_randomipc() away from cli_api() via ee174fb050c libsmb: Convert cli_NetServerEnum() away from cli_api() via c58ff4367a6 libsmb: Convert cli_RNetShareEnum() to NTSTATUS via 9812f87268c libsmb: Convert cli_RNetShareEnum() away from cli_api() via 76810077381 libsmb: Reduce indentation in cli_RNetShareEnum() via b1d5b8ef239 libsmb: Convert cli_oem_change_password() to NTSTATUS via 40e2fdfc6bb libsmb: Simplify smb1cli_trans_recv() via fd9a0dc9a9b libsmb: Remove a pointless variable via cf61617198c utils: Fix "net rap password" return code via 78a1e2817d6 libsmb: Fix cli_oem_change_password() via 86cc6f59cff libsmb: Convert cli_oem_change_password() away from cli_api() via 4f3a6dc8b0b samr: Avoid a "ret == false" for a bool via c6d9cb9b114 build: Fix LIBCLI_SAMR dependencies via b0e91608f2d libsmb: Remove a pointless variable assignment via 565f20d281d libsmb: Avoid an "else", we return in the "true" branch via 6d33f9935fd libsmb: Swap if/else branches in remote_password_change via bdabd9fff71 libsmb: Avoid an "else", we return in the "true" branch. via 18d506f521a libsmb: Modernize two DEBUGs via 73c6a7f13c2 libsmb: Make cli_qpathinfo_standard() static from 61d9c0d92e8 smbd: add options "fs:[logical|aligned|performance|effective aligned] bytes per sector"
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit a18c45046d2d7b69c7a5c9c20e911179f16c17ff Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 19 11:36:02 2024 +0200 libsmb: Remove cli_state->raw_status All callers which looked at this are gone Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> Autobuild-User(master): Volker Lendecke <v...@samba.org> Autobuild-Date(master): Tue Aug 20 10:57:12 UTC 2024 on atb-devel-224 commit bdedf5d0eec8d7e8d74917446c71c6e5d7dddf98 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 19 11:25:52 2024 +0200 libsmb: Remove unused cli_is_error() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 8171a1ccd3fbdd1f76669b4d39a7fb2d75040b41 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 19 11:24:24 2024 +0200 libsmb: Remove a call to cli_is_error() We are already in the !NT_STATUS_IS_OK if-branch, so this call was redundant Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit e071ec1ffe03945d4b856c001551d5215236b574 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 19 09:30:42 2024 +0200 libsmb: Remove unused cli_errno() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit e43a05ee3b512f77e524e86e1d41772598ab6a67 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 19 09:28:45 2024 +0200 libsmb: Don't set errno in cli_NetServerEnum() No caller looks at it, and if someone should ever want to return a more informative error, we now have NTSTATUS Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 2d361cc1034a18c36bc57d23cd3a413b1510795f Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 19 09:26:51 2024 +0200 libsmb: Convert cli_NetServerEnum() to return NTSTATUS Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit b9c018d17ecd10c9a860fbce5d8b2e391767c975 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 19 09:10:03 2024 +0200 libsmb: Remove a reference to cli_errno() If I see it correctly, this case was already covered by checking the return code of cli_trans() a few lines above. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 16c31fe80492051445b55da8a319296d389833cf Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 21:47:01 2024 +0200 libsmb: Remove unused cli_nt_error() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit ac5713f3b27337c281302e3fc9b5ecf641481c27 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 21:45:58 2024 +0200 libsmb: Make cli_api() static to clirap2.c Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit e02e6f28a938a52c2221f397d27d6ede7a7e901e Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 21:40:29 2024 +0200 torture3: Convert run_randomipc() away from cli_api() Not that it matters much, but I want to make cli_api() static in clirap2.c. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit ee174fb050cf2f11a1ce59820096a0a98c4d05ff Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 21:30:24 2024 +0200 libsmb: Convert cli_NetServerEnum() away from cli_api() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit c58ff4367a6571caec3c3d912160fec8c73e9f91 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 20:48:48 2024 +0200 libsmb: Convert cli_RNetShareEnum() to NTSTATUS Avoid a call to cli_nt_error() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 9812f87268c7fc6dc4193dcdf0f11ac7d4d2b991 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 20:36:45 2024 +0200 libsmb: Convert cli_RNetShareEnum() away from cli_api() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 768100773812443f02880ae9cc9a13acf7a043f3 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 20:19:56 2024 +0200 libsmb: Reduce indentation in cli_RNetShareEnum() Use a "goto done", review with "git show -b" Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit b1d5b8ef239a0c4ae92301e598eb864c2c025876 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 12:55:34 2024 +0200 libsmb: Convert cli_oem_change_password() to NTSTATUS Remove a few calls to cli_nt_error() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 40e2fdfc6bb4e991bc06a648ab6c0adc0ae6f040 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 11:29:46 2024 +0200 libsmb: Simplify smb1cli_trans_recv() tevent_req_received() called below takes care of this Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit fd9a0dc9a9bc4f254a86fe86c45253dcab103723 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 11:22:13 2024 +0200 libsmb: Remove a pointless variable Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit cf61617198c253d50f8e5460767f245910120362 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 12:40:29 2024 +0200 utils: Fix "net rap password" return code cli_oem_change_password() returns a bool, net_rap_password must return 0 for success Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 78a1e2817d6330b5d2a2c1821404f2a2d0f8ba49 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 12:37:13 2024 +0200 libsmb: Fix cli_oem_change_password() "(rdrcnt < 2)" was wrong, we don't look at rdata but at rparam. Use "min_rparam" to cli_trans and the fact that if that succeeds "rparam" is not NULL. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 86cc6f59cff3333024b7082574633c709f1c7fab Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 09:37:13 2024 +0200 libsmb: Convert cli_oem_change_password() away from cli_api() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 4f3a6dc8b0b3cabbd7683ea874a3c8888a6b30d8 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 18 12:07:51 2024 +0200 samr: Avoid a "ret == false" for a bool Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit c6d9cb9b11447f4220a117506e0b86104574f049 Author: Volker Lendecke <v...@samba.org> Date: Tue Aug 6 09:05:15 2024 +0200 build: Fix LIBCLI_SAMR dependencies cli_samr.c calls init_Lsa_String Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit b0e91608f2def93b4bbc8405b14af3bbe7f99296 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 5 17:31:15 2024 +0200 libsmb: Remove a pointless variable assignment We right away overwrite this Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 565f20d281d7f304727cc364bcec6c5877dbef65 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 5 17:29:46 2024 +0200 libsmb: Avoid an "else", we return in the "true" branch Reduce indentation Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 6d33f9935fd33a0e0691876b5d939f1aba0c22db Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 5 17:28:02 2024 +0200 libsmb: Swap if/else branches in remote_password_change bail out with an early return next Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit bdabd9fff71d8e8ccdfb7ba3b66ea1ef690be10d Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 5 17:22:02 2024 +0200 libsmb: Avoid an "else", we return in the "true" branch. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 18d506f521ab0ea1b3869b675280883ade6b57a9 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 5 17:11:43 2024 +0200 libsmb: Modernize two DEBUGs Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 73c6a7f13c20b77c1f2a5045a52ac57f422ce42c Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 5 15:10:00 2024 +0200 libsmb: Make cli_qpathinfo_standard() static Only used to get the size as a fallback Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> ----------------------------------------------------------------------- Summary of changes: libcli/smb/smb1cli_trans.c | 6 - source3/client/client.c | 10 +- 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/clierror.c | 55 ---- source3/libsmb/clifile.c | 12 - source3/libsmb/cliprint.c | 3 - source3/libsmb/clirap.c | 419 +++++++++++++-------------- source3/libsmb/clirap.h | 29 +- source3/libsmb/clitrans.c | 1 - source3/libsmb/libsmb_dir.c | 52 ++-- source3/libsmb/passchange.c | 58 ++-- source3/libsmb/proto.h | 3 - source3/rpc_server/samr/srv_samr_chgpasswd.c | 2 +- source3/torture/torture.c | 61 ++-- source3/utils/clirap2.c | 60 ++++ source3/utils/net_rap.c | 36 ++- source3/wscript_build | 3 +- 20 files changed, 399 insertions(+), 485 deletions(-) Changeset truncated at 500 lines: diff --git a/libcli/smb/smb1cli_trans.c b/libcli/smb/smb1cli_trans.c index 99021ce2b47..02b2b2efb08 100644 --- a/libcli/smb/smb1cli_trans.c +++ b/libcli/smb/smb1cli_trans.c @@ -822,22 +822,16 @@ NTSTATUS smb1cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, if (setup != NULL) { *setup = talloc_move(mem_ctx, &state->rsetup); *num_setup = state->num_rsetup; - } else { - TALLOC_FREE(state->rsetup); } if (param != NULL) { *param = talloc_move(mem_ctx, &state->rparam.data); *num_param = state->rparam.total; - } else { - TALLOC_FREE(state->rparam.data); } if (data != NULL) { *data = talloc_move(mem_ctx, &state->rdata.data); *num_data = state->rdata.total; - } else { - TALLOC_FREE(state->rdata.data); } status = state->status; diff --git a/source3/client/client.c b/source3/client/client.c index 08cf63018f3..e2dd700314c 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4995,7 +4995,7 @@ static bool browse_host_rpc(bool sort) static bool browse_host(bool sort) { - int ret; + NTSTATUS status; if (!grepable) { d_printf("\n\tSharename Type Comment\n"); @@ -5010,14 +5010,14 @@ static bool browse_host(bool sort) return false; } - ret = cli_RNetShareEnum(cli, browse_fn, NULL); - if (ret == -1) { - NTSTATUS status = cli_nt_error(cli); + status = cli_RNetShareEnum(cli, browse_fn, NULL); + if (!NT_STATUS_IS_OK(status)) { d_printf("Error returning browse list: %s\n", nt_errstr(status)); + return false; } - return (ret != -1); + return true; } /**************************************************************************** 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/clierror.c b/source3/libsmb/clierror.c index afbec47934b..3a024ea22e3 100644 --- a/source3/libsmb/clierror.c +++ b/source3/libsmb/clierror.c @@ -23,26 +23,6 @@ #include "libsmb/libsmb.h" #include "../libcli/smb/smbXcli_base.h" -/**************************************************************************** - Return the 32-bit NT status code from the last packet. -****************************************************************************/ - -NTSTATUS cli_nt_error(struct cli_state *cli) -{ - /* Deal with socket errors first. */ - if (!cli_state_is_connected(cli)) { - return NT_STATUS_CONNECTION_DISCONNECTED; - } - - if (NT_STATUS_IS_DOS(cli->raw_status)) { - int e_class = NT_STATUS_DOS_CLASS(cli->raw_status); - int code = NT_STATUS_DOS_CODE(cli->raw_status); - return dos_to_ntstatus(e_class, code); - } - - return cli->raw_status; -} - int cli_status_to_errno(NTSTATUS status) { int err; @@ -70,41 +50,6 @@ int cli_status_to_errno(NTSTATUS status) return err; } -/* Return a UNIX errno appropriate for the error received in the last - packet. */ - -int cli_errno(struct cli_state *cli) -{ - bool connected; - int err; - - connected = cli_state_is_connected(cli); - if (!connected) { - return EPIPE; - } - - err = cli_status_to_errno(cli->raw_status); - return err; -} - -/* Return true if the last packet was in error */ - -bool cli_is_error(struct cli_state *cli) -{ - /* A socket error is always an error. */ - if (!cli_state_is_connected(cli)) { - return true; - } - - if (NT_STATUS_IS_DOS(cli->raw_status)) { - /* Return error if error class in non-zero */ - uint8_t rcls = NT_STATUS_DOS_CLASS(cli->raw_status); - return rcls != 0; - } - - return NT_STATUS_IS_ERR(cli->raw_status); -} - bool cli_state_is_connected(struct cli_state *cli) { if (cli == NULL) { 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); -- Samba Shared Repository