diff options
author | Volker Lendecke <vl@samba.org> | 2014-06-11 09:32:56 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-06-11 18:47:14 +0200 |
commit | 25c14ef0928ed46131dd4599fed37ec74bbc74e5 (patch) | |
tree | 825b5f637fdd6008c26fbb179b3056df022f074f | |
parent | 62403c49924274d58b2e15196fa8082f984a548b (diff) | |
download | samba-25c14ef0928ed46131dd4599fed37ec74bbc74e5.tar.gz samba-25c14ef0928ed46131dd4599fed37ec74bbc74e5.tar.xz samba-25c14ef0928ed46131dd4599fed37ec74bbc74e5.zip |
smbd: Use full_path_tos() where appropriate
Recently I've got reports that SMB2_FIND is slower than trans2 findfirst,
so this tries to use recent performance-sensitive APIs right from the
start :-)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/smbd/smb2_find.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c index e9e0542bc26..481dcb9826c 100644 --- a/source3/smbd/smb2_find.c +++ b/source3/smbd/smb2_find.c @@ -330,17 +330,23 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx, if (!wcard_has_wild) { struct smb_filename *smb_fname = NULL; const char *fullpath; + char tmpbuf[PATH_MAX]; + char *to_free = NULL; if (ISDOT(fsp->fsp_name->base_name)) { fullpath = in_file_name; } else { - fullpath = talloc_asprintf(state, - "%s/%s", - fsp->fsp_name->base_name, - in_file_name); - } - if (tevent_req_nomem(fullpath, req)) { - return tevent_req_post(req, ev); + size_t len; + char *tmp; + + len = full_path_tos( + fsp->fsp_name->base_name, in_file_name, + tmpbuf, sizeof(tmpbuf), &tmp, &to_free); + if (len == -1) { + tevent_req_oom(req); + return tevent_req_post(req, ev); + } + fullpath = tmp; } status = filename_convert(state, conn, @@ -350,6 +356,8 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx, &wcard_has_wild, &smb_fname); + TALLOC_FREE(to_free); + if (!NT_STATUS_IS_OK(status)) { tevent_req_nterror(req, status); return tevent_req_post(req, ev); |