FreeBSD Bugzilla – Attachment 249703 Details for
Bug 277878
net/samba419: Function not implemented facl(ACE_GETACLCNT, filename) with vfs_zfsacl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
v0
0001-net-samba419.patch (text/plain), 18.08 KB, created by
Mikael Urankar
on 2024-04-04 11:29:58 UTC
(
hide
)
Description:
v0
Filename:
MIME Type:
Creator:
Mikael Urankar
Created:
2024-04-04 11:29:58 UTC
Size:
18.08 KB
patch
obsolete
>From 48962dd20519a86668835081fc20bff12d5c8040 Mon Sep 17 00:00:00 2001 >From: Mikael Urankar <mikael@FreeBSD.org> >Date: Thu, 4 Apr 2024 13:10:11 +0200 >Subject: [PATCH] net/samba419: > >PR: 277878 278159 >--- > net/samba419/Makefile | 4 +- > ...b-system-add-FreeBSD-proc_fd_pattern.patch | 149 ++++++ > ...-pathref-handling-for-FreeBSD-13plus.patch | 485 ------------------ > 3 files changed, 151 insertions(+), 487 deletions(-) > create mode 100644 net/samba419/files/0028-s3-lib-system-add-FreeBSD-proc_fd_pattern.patch > delete mode 100644 net/samba419/files/0100-Fix-pathref-handling-for-FreeBSD-13plus.patch > >diff --git a/net/samba419/Makefile b/net/samba419/Makefile >index 312dba2f48b8..62ccbec7e7a7 100644 >--- a/net/samba419/Makefile >+++ b/net/samba419/Makefile >@@ -1,6 +1,6 @@ > PORTNAME= ${SAMBA4_BASENAME}419 > PORTVERSION= ${SAMBA4_VERSION} >-PORTREVISION= 1 >+PORTREVISION= 2 > CATEGORIES?= net > MASTER_SITES= SAMBA/samba/stable SAMBA/samba/rc > DISTNAME= ${SAMBA4_DISTNAME} >@@ -44,7 +44,7 @@ EXTRA_PATCHES= \ > ${PATCHDIR}/0025-From-d9b748869a8f4018ebee302aae8246bf29f60309-Mon-Se.patch:-p1 \ > ${PATCHDIR}/0026-vfs-add-a-compatibility-option-to-the-vfs_streams_xa.patch:-p1 \ > ${PATCHDIR}/0027-Add-VFS-module-vfs_freebsd-that-implements-FreeBSD-s.patch:-p1 \ >- ${PATCHDIR}/0100-Fix-pathref-handling-for-FreeBSD-13plus.patch >+ ${PATCHDIR}/0028-s3-lib-system-add-FreeBSD-proc_fd_pattern.patch:-p1 \ > > SAMBA4_BASENAME= samba > SAMBA4_PORTNAME= ${SAMBA4_BASENAME}4 >diff --git a/net/samba419/files/0028-s3-lib-system-add-FreeBSD-proc_fd_pattern.patch b/net/samba419/files/0028-s3-lib-system-add-FreeBSD-proc_fd_pattern.patch >new file mode 100644 >index 000000000000..3c0b7e2b5329 >--- /dev/null >+++ b/net/samba419/files/0028-s3-lib-system-add-FreeBSD-proc_fd_pattern.patch >@@ -0,0 +1,149 @@ >+From 584c69e77abb537a7345222648a397a9963c01b7 Mon Sep 17 00:00:00 2001 >+From: "Timur I. Bakeyev" <timur@FreeBSD.org> >+Date: Sat, 15 Oct 2022 04:02:43 +0200 >+Subject: [PATCH 28/28] s3:lib:system - add FreeBSD proc_fd_pattern >+ >+Add support for FreeBSD equivalent of /proc/self/fd through a special >+fdescfs mount with option "nodup". This filesystem should be mounted >+either to the private $PIDDIR/fd/ directory or to /dev/fd in order to >+provide security and performance characteristics similar to Linux. >+ >+Signed-off-by: Timur I. Bakeyev <timur@FreeBSD.org> >+--- >+ source3/lib/system.c | 108 ++++++++++++++++++++++++++++++++++--------- >+ 1 file changed, 87 insertions(+), 21 deletions(-) >+ >+diff --git a/source3/lib/system.c b/source3/lib/system.c >+index 00d31692e00..d22ec08361c 100644 >+--- a/source3/lib/system.c >++++ b/source3/lib/system.c >+@@ -1094,39 +1094,105 @@ int sys_get_number_of_cores(void) >+ } >+ #endif >+ >+-static struct proc_fd_pattern { >+- const char *pattern; >+- const char *test_path; >+-} proc_fd_patterns[] = { >+- /* Linux */ >+- { "/proc/self/fd/%d", "/proc/self/fd/0" }, >+- { NULL, NULL }, >++static bool freebsd_fdesc_check(const char *pattern) >++{ >++ char fdesc_path[PATH_MAX]; >++ int fd, fd2; >++ >++ fd = open(lp_pid_directory(), O_DIRECTORY); >++ if (fd == -1) { >++ DBG_ERR("%s: failed to open pid directory: %s\n", >++ lp_pid_directory(), strerror(errno)); >++ return false; >++ } >++ >++ snprintf(fdesc_path, sizeof(fdesc_path), pattern, fd); >++ >++ fd2 = open(fdesc_path, O_DIRECTORY); >++ if (fd2 == -1) { >++ /* >++ * Setting O_DIRECTORY on open of fdescfs mount >++ * without `nodup` option will fail with ENOTDIR. >++ */ >++ if (errno == ENOTDIR) { >++ DBG_ERR("%s: fdescfs filesystem is not mounted with " >++ "'nodup' option. This specific mount option is " >++ "required in order to enable race-free handling " >++ "of paths.\n" >++ "See documentation for Samba's New VFS' " >++ "for more details. The `nodup` mount option was " >++ "introduced in FreeBSD 13.\n", fdesc_path); >++ close(fd); >++ return false; >++ } >++ DBG_ERR("%s: failed to open fdescfs path: %s\n", >++ fdesc_path, strerror(errno)); >++ close(fd); >++ return false; >++ } >++ close(fd); >++ close(fd2); >++ >++ return true; >++} >++ >++static char* linux_pattern(char *buf, size_t bufsize) >++{ >++ char proc_fd_path[PATH_MAX]; >++ const char *pattern = "/proc/self/fd/%lu"; >++ struct stat sb; >++ >++ snprintf(proc_fd_path, sizeof(proc_fd_path), pattern, 0); >++ if(stat(proc_fd_path, &sb) == 0) { >++ snprintf(buf, bufsize, "%s", pattern); >++ return buf; >++ } >++ return NULL; >++} >++ >++static char* freebsd_pattern(char *buf, size_t bufsize) { >++ const char** base; >++ const char* base_dir[] = { >++ lp_pid_directory(), /* This is a preffered location */ >++ "/dev", >++ NULL >++ }; >++ >++ for(base = &base_dir[0]; *base != NULL; base++) { >++ snprintf(buf, bufsize, "%s/fd/%%lu", *base); >++ if(freebsd_fdesc_check(buf)) { >++ return buf; >++ } >++ } >++ return NULL; >++} >++ >++static char* (*proc_fd_patterns[])(char *, size_t) = { >++ linux_pattern, >++ freebsd_pattern, >++ NULL >+ }; >+ >+-static const char *proc_fd_pattern; >++static char proc_fd_pattern_buf[PATH_MAX]; >++static const char *proc_fd_pattern = NULL; >+ >+ bool sys_have_proc_fds(void) >+ { >+- static bool checked; >+- static bool have_proc_fds; >+- struct proc_fd_pattern *p = NULL; >+- struct stat sb; >+- int ret; >++ static bool checked = false; >++ static bool have_proc_fds = false; >++ char* (**pattern_func)(char *, size_t) = NULL; >+ >+ if (checked) { >+ return have_proc_fds; >+ } >+ >+- for (p = &proc_fd_patterns[0]; p->test_path != NULL; p++) { >+- ret = stat(p->test_path, &sb); >+- if (ret != 0) { >+- continue; >++ for (pattern_func = &proc_fd_patterns[0]; *pattern_func != NULL; pattern_func++) { >++ if((*pattern_func)(proc_fd_pattern_buf, sizeof(proc_fd_pattern_buf)) != NULL) { >++ have_proc_fds = true; >++ proc_fd_pattern = proc_fd_pattern_buf; >++ break; >+ } >+- have_proc_fds = true; >+- proc_fd_pattern = p->pattern; >+- break; >+ } >+- >+ checked = true; >+ return have_proc_fds; >+ } >+-- >+2.37.1 >+ >diff --git a/net/samba419/files/0100-Fix-pathref-handling-for-FreeBSD-13plus.patch b/net/samba419/files/0100-Fix-pathref-handling-for-FreeBSD-13plus.patch >deleted file mode 100644 >index b2a51efb7c73..000000000000 >--- a/net/samba419/files/0100-Fix-pathref-handling-for-FreeBSD-13plus.patch >+++ /dev/null >@@ -1,485 +0,0 @@ >-https://bugzilla.samba.org/show_bug.cgi?id=15376 >- >---- source3/smbd/open.c 2023-04-19 12:18:56.254875400 +0200 >-+++ source3/smbd/open.c 2023-06-20 08:29:06.210298000 +0200 >-@@ -1204,9 +1204,6 @@ >- int new_fd; >- NTSTATUS status; >- >-- if (!fsp->fsp_flags.have_proc_fds) { >-- return NT_STATUS_MORE_PROCESSING_REQUIRED; >-- } >- >- old_fd = fsp_get_pathref_fd(fsp); >- if (old_fd == -1) { >-@@ -1222,22 +1219,28 @@ >- return NT_STATUS_INVALID_HANDLE; >- } >- >-- p = sys_proc_fd_path(old_fd, buf, sizeof(buf)); >-- if (p == NULL) { >-- return NT_STATUS_NO_MEMORY; >-- } >-+ >-+ if (sys_open_real_fd_from_pathref_fd(old_fd, &new_fd, flags) != 0) { >-+ if (!fsp->fsp_flags.have_proc_fds) { >-+ return NT_STATUS_MORE_PROCESSING_REQUIRED; >-+ } >- >-- proc_fname = (struct smb_filename) { >-- .base_name = discard_const_p(char, p), >-- }; >-+ p = sys_proc_fd_path(old_fd, buf, sizeof(buf)); >-+ if (p == NULL) { >-+ return NT_STATUS_NO_MEMORY; >-+ } >- >-- fsp->fsp_flags.is_pathref = false; >-+ proc_fname = (struct smb_filename) { >-+ .base_name = discard_const_p(char, p), >-+ }; >- >-- new_fd = SMB_VFS_OPENAT(fsp->conn, >-- fsp->conn->cwd_fsp, >-- &proc_fname, >-- fsp, >-- &how); >-+ new_fd = SMB_VFS_OPENAT(fsp->conn, >-+ fsp->conn->cwd_fsp, >-+ &proc_fname, >-+ fsp, >-+ &how); >-+ } >-+ >- if (new_fd == -1) { >- status = map_nt_error_from_unix(errno); >- fd_close(fsp); >-@@ -1250,6 +1260,8 @@ >- } >- >- fsp_set_fd(fsp, new_fd); >-+ fsp->fsp_flags.is_pathref = false; >-+ >- return NT_STATUS_OK; >- } >- >---- source3/lib/system.c 2023-01-18 16:32:24.174553200 +0100 >-+++ source3/lib/system.c 2023-06-19 23:35:30.132465000 +0200 >-@@ -1022,6 +1022,8 @@ >- } proc_fd_patterns[] = { >- /* Linux */ >- { "/proc/self/fd/%d", "/proc/self/fd/0" }, >-+ /* FreeBSD */ >-+ { "/compat/linux/dev/fd/%d", "/compat/linux/dev/fd/0" }, >- { NULL, NULL }, >- }; >- >-@@ -1077,4 +1079,27 @@ >- } >- >- return buf; >-+} >-+ >-+ >-+/* Helper function that opens a usable fd for accessing data >-+ (metadata & content) from a pathref fd */ >-+int sys_open_real_fd_from_pathref_fd(int fd, >-+ int *rfd, >-+ int flags) { >-+ int tfd; >-+ >-+#if defined(HAVE_OPENAT) && defined(O_EMPTY_PATH) >-+ /* This works for FreeBSD 13+ atleast */ >-+ >-+ tfd = openat(fd, "", O_EMPTY_PATH|flags); >-+ if (tfd < 0) { >-+ return errno; >-+ } >-+ >-+ *rfd = tfd; >-+ return 0; >-+#else >-+ return ENOSYS; >-+#endif >- } >---- source3/modules/vfs_default.c 2023-05-31 18:06:44.154299500 +0200 >-+++ source3/modules/vfs_default.c 2023-06-19 23:23:58.116903000 +0200 >-@@ -2721,7 +2721,7 @@ >- >- static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) >- { >-- int result; >-+ int result, fd, real_fd; >- >- START_PROFILE(syscall_fchmod); >- >-@@ -2731,8 +2731,9 @@ >- return result; >- } >- >-+ fd = fsp_get_pathref_fd(fsp); >-+ >- if (fsp->fsp_flags.have_proc_fds) { >-- int fd = fsp_get_pathref_fd(fsp); >- const char *p = NULL; >- char buf[PATH_MAX]; >- >-@@ -2746,6 +2747,17 @@ >- return result; >- } >- >-+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { >-+ int saved_errno; >-+ >-+ result = fchmod(real_fd, mode); >-+ saved_errno = errno; >-+ close(real_fd); >-+ errno = saved_errno; >-+ END_PROFILE(syscall_fchmod); >-+ return result; >-+ } >-+ >- /* >- * This is no longer a handle based call. >- */ >-@@ -2758,7 +2770,7 @@ >- static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid) >- { >- #ifdef HAVE_FCHOWN >-- int result; >-+ int result, fd, real_fd; >- >- START_PROFILE(syscall_fchown); >- if (!fsp->fsp_flags.is_pathref) { >-@@ -2767,8 +2779,9 @@ >- return result; >- } >- >-+ fd = fsp_get_pathref_fd(fsp); >-+ >- if (fsp->fsp_flags.have_proc_fds) { >-- int fd = fsp_get_pathref_fd(fsp); >- const char *p = NULL; >- char buf[PATH_MAX]; >- >-@@ -2782,6 +2795,17 @@ >- return result; >- } >- >-+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { >-+ int saved_errno; >-+ >-+ result = fchown(real_fd, uid, gid); >-+ saved_errno = errno; >-+ close(real_fd); >-+ errno = saved_errno; >-+ END_PROFILE(syscall_fchown); >-+ return result; >-+ } >-+ >- /* >- * This is no longer a handle based call. >- */ >-@@ -2855,7 +2879,7 @@ >- files_struct *fsp, >- struct smb_file_time *ft) >- { >-- int result = -1; >-+ int result = -1, fd, real_fd; >- struct timespec ts[2]; >- struct timespec *times = NULL; >- >-@@ -2900,8 +2924,9 @@ >- goto out; >- } >- >-+ fd = fsp_get_pathref_fd(fsp); >-+ >- if (fsp->fsp_flags.have_proc_fds) { >-- int fd = fsp_get_pathref_fd(fsp); >- const char *p = NULL; >- char buf[PATH_MAX]; >- >-@@ -2919,6 +2944,16 @@ >- goto out; >- } >- >-+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { >-+ int saved_errno; >-+ >-+ result = futimens(real_fd, times); >-+ saved_errno = errno; >-+ close(real_fd); >-+ errno = saved_errno; >-+ goto out; >-+ } >-+ >- /* >- * The fd is a pathref (opened with O_PATH) and there isn't fd to >- * path translation mechanism. Fallback to path based call. >-@@ -3322,6 +3357,7 @@ >- { >- #ifdef HAVE_FCHFLAGS >- int fd = fsp_get_pathref_fd(fsp); >-+ int real_fd; >- >- SMB_ASSERT(!fsp_is_alternate_stream(fsp)); >- >-@@ -3341,6 +3377,16 @@ >- return chflags(p, flags); >- } >- >-+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { >-+ int saved_errno, result; >-+ >-+ result = fchflags(real_fd, flags); >-+ saved_errno = errno; >-+ close(real_fd); >-+ errno = saved_errno; >-+ return result; >-+ } >-+ >- /* >- * This is no longer a handle based call. >- */ >-@@ -3569,6 +3615,7 @@ >- size_t size) >- { >- int fd = fsp_get_pathref_fd(fsp); >-+ int real_fd; >- >- SMB_ASSERT(!fsp_is_alternate_stream(fsp)); >- >-@@ -3588,6 +3635,16 @@ >- return getxattr(p, name, value, size); >- } >- >-+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { >-+ int saved_errno, result; >-+ >-+ result = fgetxattr(real_fd, name, value, size); >-+ saved_errno = errno; >-+ close(real_fd); >-+ errno = saved_errno; >-+ return result; >-+ } >-+ >- /* >- * This is no longer a handle based call. >- */ >-@@ -3895,6 +3952,7 @@ >- static ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) >- { >- int fd = fsp_get_pathref_fd(fsp); >-+ int real_fd; >- >- SMB_ASSERT(!fsp_is_alternate_stream(fsp)); >- >-@@ -3914,6 +3972,16 @@ >- return listxattr(p, list, size); >- } >- >-+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { >-+ int saved_errno, result; >-+ >-+ result = flistxattr(real_fd, list, size); >-+ saved_errno = errno; >-+ close(real_fd); >-+ errno = saved_errno; >-+ return result; >-+ } >-+ >- /* >- * This is no longer a handle based call. >- */ >-@@ -3923,6 +3991,7 @@ >- static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name) >- { >- int fd = fsp_get_pathref_fd(fsp); >-+ int real_fd; >- >- SMB_ASSERT(!fsp_is_alternate_stream(fsp)); >- >-@@ -3942,6 +4011,16 @@ >- return removexattr(p, name); >- } >- >-+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { >-+ int saved_errno, result; >-+ >-+ result = fremovexattr(real_fd, name); >-+ saved_errno = errno; >-+ close(real_fd); >-+ errno = saved_errno; >-+ return result; >-+ } >-+ >- /* >- * This is no longer a handle based call. >- */ >-@@ -3951,6 +4030,7 @@ >- static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) >- { >- int fd = fsp_get_pathref_fd(fsp); >-+ int real_fd; >- >- SMB_ASSERT(!fsp_is_alternate_stream(fsp)); >- >-@@ -3968,6 +4048,16 @@ >- } >- >- return setxattr(p, name, value, size, flags); >-+ } >-+ >-+ if (sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { >-+ int saved_errno, result; >-+ >-+ result = fsetxattr(real_fd, name, value, size, flags); >-+ saved_errno = errno; >-+ close(real_fd); >-+ errno = saved_errno; >-+ return result; >- } >- >- /* >---- source3/modules/vfs_zfsacl.c 2023-01-18 16:32:24.210553400 +0100 >-+++ source3/modules/vfs_zfsacl.c 2023-06-20 08:51:53.077953000 +0200 >-@@ -234,13 +234,39 @@ >- >- SMB_ASSERT(i == naces); >- >-- /* store acl */ >-- fd = fsp_get_pathref_fd(fsp); >-- if (fd == -1) { >-- errno = EBADF; >-- return false; >-+ if (!fsp->fsp_flags.is_pathref) { >-+ rv = facl(fsp_get_io_fd(fsp), ACE_SETACL, naces, acebuf); >-+ } else { >-+ const char *procfd_p = NULL; >-+ char buf[PATH_MAX]; >-+ >-+ fd = fsp_get_pathref_fd(fsp); >-+ if (fsp->fsp_flags.have_proc_fds && (procfd_p = sys_proc_fd_path(fd, buf, sizeof(buf)))) { >-+ rv = acl(procfd_p, ACE_SETACL, naces, acebuf); >-+ } else { >-+ int real_fd; >-+ >-+ fd = fsp_get_pathref_fd(fsp); >-+ >-+ /* First try this for versions of FreeBSD 13+ that allows facl() on O_PATH fd's */ >-+ rv = facl(fd, ACE_SETACL, naces, acebuf); >-+ >-+ if (rv < 0 && errno == EBADF && >-+ sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { >-+ /* Works on FreeBSD 13+ */ >-+ int saved_errno; >-+ >-+ rv = facl(real_fd, ACE_SETACL, naces, acebuf); >-+ saved_errno = errno; >-+ close(real_fd); >-+ errno = saved_errno; >-+ } else { >-+ /* Last ditch fallback */ >-+ rv = acl(fsp->fsp_name->base_name, ACE_SETACL, naces, acebuf); >-+ } >-+ } >- } >-- rv = facl(fd, ACE_SETACL, naces, acebuf); >-+ >- if (rv != 0) { >- if(errno == ENOSYS) { >- DEBUG(9, ("acl(ACE_SETACL, %s): Operation is not " >-@@ -284,14 +310,39 @@ >- { >- int naces, rv; >- ace_t *acebuf = NULL; >-- int fd; >-+ int fd = -1; >-+ const char *procfd_p = NULL; >-+ char buf[PATH_MAX]; >- >-- fd = fsp_get_pathref_fd(fsp); >-- if (fd == -1) { >-- errno = EBADF; >-- return -1; >-+ if (!fsp->fsp_flags.is_pathref) { >-+ naces = facl(fsp_get_io_fd(fsp), ACE_GETACLCNT, 0, NULL); >-+ } else { >-+ fd = fsp_get_pathref_fd(fsp); >-+ >-+ if (fsp->fsp_flags.have_proc_fds && (procfd_p = sys_proc_fd_path(fd, buf, sizeof(buf)))) { >-+ /* If we have procfd support, try this first */ >-+ naces = acl(procfd_p, ACE_GETACLCNT, 0, NULL); >-+ } else { >-+ int real_fd; >-+ >-+ /* First try this for versions of FreeBSD 13+ that allows facl() on O_PATH fd's */ >-+ naces = facl(fd, ACE_GETACLCNT, 0, NULL); >-+ if (naces < 0 && errno == EBADF && >-+ sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { >-+ /* Works on FreeBSD 13+ */ >-+ int saved_errno; >-+ >-+ naces = facl(real_fd, ACE_GETACLCNT, 0, NULL); >-+ saved_errno = errno; >-+ close(real_fd); >-+ errno = saved_errno; >-+ } else { >-+ /* Last ditch fallback */ >-+ naces = acl(fsp->fsp_name->base_name, ACE_GETACLCNT, 0, NULL); >-+ } >-+ } >- } >-- naces = facl(fd, ACE_GETACLCNT, 0, NULL); >-+ >- if (naces == -1) { >- int dbg_level = 10; >- >-@@ -309,7 +360,32 @@ >- return -1; >- } >- >-- rv = facl(fd, ACE_GETACL, naces, acebuf); >-+ if (!fsp->fsp_flags.is_pathref) { >-+ rv = facl(fsp_get_io_fd(fsp), ACE_GETACL, naces, acebuf); >-+ } else { >-+ if (procfd_p) { >-+ rv = acl(procfd_p, ACE_GETACL, naces, acebuf); >-+ } else { >-+ int real_fd; >-+ >-+ /* First try this for versions of FreeBSD that allows facl() on O_PATH fd's */ >-+ rv = facl(fd, ACE_GETACL, naces, acebuf); >-+ if (rv < 0 && errno == EBADF && >-+ sys_open_real_fd_from_pathref_fd(fd, &real_fd, O_RDONLY|O_NONBLOCK) == 0) { >-+ /* Works on FreeBSD 13+ */ >-+ int saved_errno; >-+ >-+ rv = facl(real_fd, ACE_GETACL, naces, acebuf); >-+ saved_errno = errno; >-+ close(real_fd); >-+ errno = saved_errno; >-+ } else { >-+ /* Last ditch fallback */ >-+ rv = acl(fsp->fsp_name->base_name, ACE_GETACL, naces, acebuf); >-+ } >-+ } >-+ } >-+ >- if (rv == -1) { >- DBG_DEBUG("acl(ACE_GETACL, %s): %s ", >- fsp_str_dbg(fsp), strerror(errno)); >---- source3/include/proto.h 2023-05-31 18:06:44.142299400 +0200 >-+++ source3/include/proto.h 2023-06-19 23:23:58.115127000 +0200 >-@@ -211,6 +211,10 @@ >- bool sys_have_proc_fds(void); >- const char *sys_proc_fd_path(int fd, char *buf, size_t bufsize); >- >-+int sys_open_real_fd_from_pathref_fd(int fd, >-+ int *mfd, >-+ int flags); >-+ >- struct stat; >- void init_stat_ex_from_stat (struct stat_ex *dst, >- const struct stat *src, >-- >2.44.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 277878
:
249703
|
249849
|
256497
|
256506
|
256507