From 728cfa5d3983c545f2a09947c8aabc90da3b5bc5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 8 Jun 2015 10:07:49 -0700 Subject: [PATCH] s3: libsmbclient: Use cache targetcli in SMBC_splice_ctx calls also. Bug 11295 - Excessive cli_resolve_path() usage can slow down transmission. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11295 Signed-off-by: Jeremy Allison Reviewed-by: David Disseldorp Autobuild-User(master): David Disseldorp Autobuild-Date(master): Wed Jun 10 04:09:36 CEST 2015 on sn-devel-104 --- source3/libsmb/libsmb_file.c | 62 ++------------------------------------------ 1 file changed, 2 insertions(+), 60 deletions(-) diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c index 29a6a0fbbec..6b436768ecb 100644 --- a/source3/libsmb/libsmb_file.c +++ b/source3/libsmb/libsmb_file.c @@ -299,12 +299,6 @@ SMBC_splice_ctx(SMBCCTX *context, void *priv) { off_t written; - char *server = NULL, *share = NULL, *user = NULL, *password = NULL; - char *path = NULL; - char *targetpath = NULL; - struct cli_state *srccli = NULL; - struct cli_state *dstcli = NULL; - uint16_t port = 0; TALLOC_CTX *frame = talloc_stackframe(); NTSTATUS status; @@ -330,64 +324,12 @@ SMBC_splice_ctx(SMBCCTX *context, return -1; } - if (SMBC_parse_path(frame, - context, - srcfile->fname, - NULL, - &server, - &port, - &share, - &path, - &user, - &password, - NULL)) { - errno = EINVAL; - TALLOC_FREE(frame); - return -1; - } - - status = cli_resolve_path(frame, "", context->internal->auth_info, - srcfile->srv->cli, path, - &srccli, &targetpath); - if (!NT_STATUS_IS_OK(status)) { - d_printf("Could not resolve %s\n", path); - errno = ENOENT; - TALLOC_FREE(frame); - return -1; - } - - if (SMBC_parse_path(frame, - context, - dstfile->fname, - NULL, - &server, - &port, - &share, - &path, - &user, - &password, - NULL)) { - errno = EINVAL; - TALLOC_FREE(frame); - return -1; - } - - status = cli_resolve_path(frame, "", context->internal->auth_info, - dstfile->srv->cli, path, - &dstcli, &targetpath); - if (!NT_STATUS_IS_OK(status)) { - d_printf("Could not resolve %s\n", path); - errno = ENOENT; - TALLOC_FREE(frame); - return -1; - } - - status = cli_splice(srccli, dstcli, + status = cli_splice(srcfile->targetcli, dstfile->targetcli, srcfile->cli_fd, dstfile->cli_fd, count, srcfile->offset, dstfile->offset, &written, splice_cb, priv); if (!NT_STATUS_IS_OK(status)) { - errno = SMBC_errno(context, srccli); + errno = SMBC_errno(context, srcfile->targetcli); TALLOC_FREE(frame); return -1; } -- 2.11.4.GIT