diff options
author | Ralph Boehme <slow@samba.org> | 2018-08-22 15:22:08 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-11-06 09:10:25 +0100 |
commit | a9b6f3a03da547daee0e7d24e4f112be5b84bee0 (patch) | |
tree | 59515fb231199d3444fed84c6f24beca24bb77b4 /source3 | |
parent | 257281c7c7f4b74e0a9d052ced1fa9d4ab74094c (diff) | |
download | samba-a9b6f3a03da547daee0e7d24e4f112be5b84bee0.tar.gz |
vfs_fruit: prepare fruit_pread_meta() for reading on fake-fd
If the read on the stream fails we may have hit a handle on a just
created stream (fio->created=true) with no data written yet.
If that's the case return an empty initialized FinderInfo blob.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit d7d92710711f6e555ed45c1dda528cd6a83e1bf5)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/modules/vfs_fruit.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 8ff82f6e461..442ed1a9052 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -4194,8 +4194,7 @@ static ssize_t fruit_pread_meta_stream(vfs_handle_struct *handle, int ret; nread = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); - - if (nread == n) { + if (nread == -1 || nread == n) { return nread; } @@ -4294,6 +4293,25 @@ static ssize_t fruit_pread_meta(vfs_handle_struct *handle, return -1; } + if (nread == -1 && fio->created) { + AfpInfo *ai = NULL; + char afpinfo_buf[AFP_INFO_SIZE]; + + ai = afpinfo_new(talloc_tos()); + if (ai == NULL) { + return -1; + } + + nread = afpinfo_pack(ai, afpinfo_buf); + TALLOC_FREE(ai); + if (nread != AFP_INFO_SIZE) { + return -1; + } + + memcpy(data, afpinfo_buf, to_return); + return to_return; + } + return nread; } |