From: Volker Lendecke Date: Fri, 2 Aug 2024 21:09:07 +0000 (+0200) Subject: libsmb: Remove cli_posix_chmod X-Git-Tag: tdb-1.4.13~1417 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=230d8efe72cf18a7609641c247cbc246f2b9066b;p=thirdparty%2Fsamba.git libsmb: Remove cli_posix_chmod Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 52fbf8ab5da..57eb75eb228 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -989,98 +989,6 @@ static NTSTATUS cli_posix_chown_chmod_internal_recv(struct tevent_req *req) return tevent_req_simple_recv_ntstatus(req); } -/**************************************************************************** - chmod a file (UNIX extensions). -****************************************************************************/ - -struct cli_posix_chmod_state { - uint8_t dummy; -}; - -static void cli_posix_chmod_done(struct tevent_req *subreq); - -struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct cli_state *cli, - const char *fname, - mode_t mode) -{ - struct tevent_req *req = NULL, *subreq = NULL; - struct cli_posix_chmod_state *state = NULL; - - req = tevent_req_create(mem_ctx, &state, struct cli_posix_chmod_state); - if (req == NULL) { - return NULL; - } - - subreq = cli_posix_chown_chmod_internal_send( - state, - ev, - cli, - fname, - unix_perms_to_wire(mode), - SMB_UID_NO_CHANGE, - SMB_GID_NO_CHANGE); - if (tevent_req_nomem(subreq, req)) { - return tevent_req_post(req, ev); - } - tevent_req_set_callback(subreq, cli_posix_chmod_done, req); - return req; -} - -static void cli_posix_chmod_done(struct tevent_req *subreq) -{ - NTSTATUS status = cli_posix_chown_chmod_internal_recv(subreq); - tevent_req_simple_finish_ntstatus(subreq, status); -} - -NTSTATUS cli_posix_chmod_recv(struct tevent_req *req) -{ - return tevent_req_simple_recv_ntstatus(req); -} - -NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode) -{ - TALLOC_CTX *frame = talloc_stackframe(); - struct tevent_context *ev = NULL; - struct tevent_req *req = NULL; - NTSTATUS status = NT_STATUS_OK; - - if (smbXcli_conn_has_async_calls(cli->conn)) { - /* - * Can't use sync call while an async call is in flight - */ - status = NT_STATUS_INVALID_PARAMETER; - goto fail; - } - - ev = samba_tevent_context_init(frame); - if (ev == NULL) { - status = NT_STATUS_NO_MEMORY; - goto fail; - } - - req = cli_posix_chmod_send(frame, - ev, - cli, - fname, - mode); - if (req == NULL) { - status = NT_STATUS_NO_MEMORY; - goto fail; - } - - if (!tevent_req_poll_ntstatus(req, ev, &status)) { - goto fail; - } - - status = cli_posix_chmod_recv(req); - - fail: - TALLOC_FREE(frame); - return status; -} - struct cli_fchmod_state { uint8_t data[100]; /* smb1 posix extensions */ }; diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h index 50912451940..23aa14d8b6f 100644 --- a/source3/libsmb/proto.h +++ b/source3/libsmb/proto.h @@ -312,13 +312,7 @@ NTSTATUS cli_posix_stat_recv(struct tevent_req *req, struct stat_ex *sbuf); NTSTATUS cli_posix_stat(struct cli_state *cli, const char *fname, struct stat_ex *sbuf); -struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct cli_state *cli, - const char *fname, - mode_t mode); -NTSTATUS cli_posix_chmod_recv(struct tevent_req *req); -NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode); +; struct tevent_req *cli_fchmod_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,