diff options
author | Stefan Metzmacher <metze@samba.org> | 2022-08-08 15:23:29 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2022-08-15 15:03:36 +0000 |
commit | ce804b78164a3166a16ca3071028536761fd18d7 (patch) | |
tree | 02ffe5ed5fcb9c23f8c61e356157bf3a4aa1cec9 /lib/replace/system | |
parent | 2369d0833361faf4a125431e735fce7efb6024d6 (diff) | |
download | samba-ce804b78164a3166a16ca3071028536761fd18d7.tar.gz |
lib/replace: add a replacement for openat2() that returns ENOSYS
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'lib/replace/system')
-rw-r--r-- | lib/replace/system/filesys.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/replace/system/filesys.h b/lib/replace/system/filesys.h index bb9482c69af..8005b18780f 100644 --- a/lib/replace/system/filesys.h +++ b/lib/replace/system/filesys.h @@ -243,4 +243,39 @@ int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size #endif /* !defined(HAVE_XATTR_XATTR) || defined(XATTR_ADDITIONAL_OPTIONS) */ +#ifdef HAVE_LINUX_OPENAT2_H +#include <linux/openat2.h> +#else /* ! HAVE_LINUX_OPENAT2_H */ +/* how->resolve flags for openat2(2). */ +#define RESOLVE_NO_XDEV 0x01 /* Block mount-point crossings + (includes bind-mounts). */ +#define RESOLVE_NO_MAGICLINKS 0x02 /* Block traversal through procfs-style + "magic-links". */ +#define RESOLVE_NO_SYMLINKS 0x04 /* Block traversal through all symlinks + (implies OEXT_NO_MAGICLINKS) */ +#define RESOLVE_BENEATH 0x08 /* Block "lexical" trickery like + "..", symlinks, and absolute + paths which escape the dirfd. */ +#define RESOLVE_IN_ROOT 0x10 /* Make all jumps to "/" and ".." + be scoped inside the dirfd + (similar to chroot(2)). */ +#define RESOLVE_CACHED 0x20 /* Only complete if resolution can be + completed through cached lookup. May + return -EAGAIN if that's not + possible. */ +struct __rep_open_how { + uint64_t flags; + uint64_t mode; + uint64_t resolve; +}; +#define open_how __rep_open_how +#endif /* ! HAVE_LINUX_OPENAT2_H */ + +#ifndef HAVE_OPENAT2 +long rep_openat2(int dirfd, const char *pathname, + struct open_how *how, size_t size); +#define openat2(dirfd, pathname, how, size) \ + rep_openat2(dirfd, pathname, how, size) +#endif /* !HAVE_OPENAT2 */ + #endif |