From 71772c48f241bdc048f99f297b5e0a77fdfda253 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 4 Dec 2022 11:07:09 +0100 Subject: [PATCH] libsmb: Remove sync cli_posix_readlink() wrapper cli_readlink() now covers smb1 posix extensions as well Signed-off-by: Volker Lendecke Reviewed-by: Andreas Schneider --- source3/libsmb/clifile.c | 42 ------------------------------------------ source3/libsmb/proto.h | 5 ----- source3/torture/test_posix.c | 11 +++++++---- source3/torture/torture.c | 2 +- 4 files changed, 8 insertions(+), 52 deletions(-) diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 31776a58621..91bb1095643 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -482,48 +482,6 @@ NTSTATUS cli_posix_readlink_recv( return NT_STATUS_OK; } -NTSTATUS cli_posix_readlink( - struct cli_state *cli, - const char *fname, - TALLOC_CTX *mem_ctx, - char **target) -{ - 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_readlink_send(frame, ev, cli, fname); - if (req == NULL) { - status = NT_STATUS_NO_MEMORY; - goto fail; - } - - if (!tevent_req_poll_ntstatus(req, ev, &status)) { - goto fail; - } - - status = cli_posix_readlink_recv(req, mem_ctx, target); - - fail: - TALLOC_FREE(frame); - return status; -} - /**************************************************************************** Hard link a file (UNIX extensions). ****************************************************************************/ diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h index 58fb2cbbf18..3d732fe8524 100644 --- a/source3/libsmb/proto.h +++ b/source3/libsmb/proto.h @@ -266,11 +266,6 @@ struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx, const char *fname); NTSTATUS cli_posix_readlink_recv( struct tevent_req *req, TALLOC_CTX *mem_ctx, char **target); -NTSTATUS cli_posix_readlink( - struct cli_state *cli, - const char *fname, - TALLOC_CTX *mem_ctx, - char **target); struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli, diff --git a/source3/torture/test_posix.c b/source3/torture/test_posix.c index a4edb9e9c3d..dc11c62c987 100644 --- a/source3/torture/test_posix.c +++ b/source3/torture/test_posix.c @@ -543,10 +543,13 @@ bool run_posix_readlink_test(int dummy) for (i = 0; state[i].name != NULL; i++) { char *target = NULL; - status = cli_posix_readlink(cli_unix, - state[i].name, - talloc_tos(), - &target); + status = cli_readlink( + cli_unix, + state[i].name, + talloc_tos(), + &target, + NULL, + NULL); if (!NT_STATUS_IS_OK(status)) { printf("POSIX readlink on %s failed (%s)\n", state[i].name, nt_errstr(status)); diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 925a9d424ad..4d22c539e52 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -8044,7 +8044,7 @@ static bool run_simple_posix_open_test(int dummy) goto out; } - status = cli_posix_readlink(cli1, sname, talloc_tos(), &target); + status = cli_readlink(cli1, sname, talloc_tos(), &target, NULL, NULL); if (!NT_STATUS_IS_OK(status)) { printf("POSIX readlink on %s failed (%s)\n", sname, nt_errstr(status)); goto out; -- 2.11.4.GIT