Ceph supports O_PATH since v0.93 from 2015:
https://ceph.io/geen-categorie/v0-93-hammer-release-candidate-released/
This seems to be old enough so we can hopefully use this without a runtime
version check.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
int flags,
mode_t mode)
{
+ bool have_opath = false;
+ bool became_root = false;
int result = -ENOENT;
/*
goto out;
}
+#ifdef O_PATH
+ have_opath = true;
+ if (fsp->fsp_flags.is_pathref) {
+ flags |= O_PATH;
+ }
+#endif
+
+ if (fsp->fsp_flags.is_pathref && !have_opath) {
+ become_root();
+ became_root = true;
+ }
+
result = ceph_open(handle->data, smb_fname->base_name, flags, mode);
+
+ if (became_root) {
+ unbecome_root();
+ }
+
out:
+ fsp->fsp_flags.have_proc_fds = false;
DBG_DEBUG("[CEPH] open(...) = %d\n", result);
WRAP_RETURN(result);
}