mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
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 <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Wed Jun 10 04:09:36 CEST 2015 on sn-devel-104
This commit is contained in:
parent
0615b72a6b
commit
728cfa5d39
@ -299,12 +299,6 @@ SMBC_splice_ctx(SMBCCTX *context,
|
|||||||
void *priv)
|
void *priv)
|
||||||
{
|
{
|
||||||
off_t written;
|
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();
|
TALLOC_CTX *frame = talloc_stackframe();
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
@ -330,64 +324,12 @@ SMBC_splice_ctx(SMBCCTX *context,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SMBC_parse_path(frame,
|
status = cli_splice(srcfile->targetcli, dstfile->targetcli,
|
||||||
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,
|
|
||||||
srcfile->cli_fd, dstfile->cli_fd,
|
srcfile->cli_fd, dstfile->cli_fd,
|
||||||
count, srcfile->offset, dstfile->offset, &written,
|
count, srcfile->offset, dstfile->offset, &written,
|
||||||
splice_cb, priv);
|
splice_cb, priv);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
errno = SMBC_errno(context, srccli);
|
errno = SMBC_errno(context, srcfile->targetcli);
|
||||||
TALLOC_FREE(frame);
|
TALLOC_FREE(frame);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user