diff options
author | Ralph Boehme <slow@samba.org> | 2019-05-21 11:39:18 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2019-06-21 06:49:32 +0000 |
commit | 8787ac7938c94e7ba21477354afc1059ab804e67 (patch) | |
tree | e2a0548117c97e8ce673ac5f8ed0056c1e3a5acd /source3 | |
parent | 2b8eeb231e0df6a85a51e8d9029deb3789cdae03 (diff) | |
download | samba-8787ac7938c94e7ba21477354afc1059ab804e67.tar.gz |
vfs_fruit: add and use is_adouble_file()
This adds a helper function that checks whether the last component of a path is
an AppleDouble sidecar file with "._" name prefix.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit ad70c947c759aa0965ee57f973fb8dc1909e0e39)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/modules/vfs_fruit.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index e79b548a511..0dd24293c9b 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -2172,6 +2172,27 @@ static bool is_apple_stream(const struct smb_filename *smb_fname) return false; } +static bool is_adouble_file(const char *path) +{ + const char *p = NULL; + int match; + + p = strrchr(path, '/'); + if (p == NULL) { + p = path; + } else { + p++; + } + + match = strncmp(p, + ADOUBLE_NAME_PREFIX, + strlen(ADOUBLE_NAME_PREFIX)); + if (match != 0) { + return false; + } + return true; +} + /** * Initialize config struct from our smb.conf config parameters **/ @@ -4204,16 +4225,12 @@ static int fruit_rmdir(struct vfs_handle_struct *handle, } while ((de = SMB_VFS_READDIR(handle->conn, dh, NULL)) != NULL) { - int match; struct adouble *ad = NULL; char *p = NULL; struct smb_filename *ad_smb_fname = NULL; int ret; - match = strncmp(de->d_name, - ADOUBLE_NAME_PREFIX, - strlen(ADOUBLE_NAME_PREFIX)); - if (match != 0) { + if (!is_adouble_file(de->d_name)) { continue; } |