Use O_PATH when available; this avoids the need for READ/LIST access on
that directory. Keep using O_RDONLY if the system does not have O_PATH.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15507
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit
b317622a8fed0ee195ffe40129eb5bcad28dd985)
struct smb_filename *dir_name = NULL;
struct smb_filename *rel_name = NULL;
int ret = -1;
+#ifdef O_PATH
+ int open_flags = O_PATH;
+#else
+ int open_flags = O_RDONLY;
+#endif
status = SMB_VFS_PARENT_PATHNAME(handle->conn,
talloc_tos(),
return -1;
}
- fd = open(dir_name->base_name, O_RDONLY, 0);
+ fd = open(dir_name->base_name, open_flags, 0);
if (fd == -1) {
TALLOC_FREE(dir_name);
return -1;