Add new build option to allow symlinks

This commit is contained in:
Andrea Mazzoleni 2026-05-16 16:55:53 +02:00
parent dccba9fd8c
commit 2f5ffc3e90
3 changed files with 15 additions and 1 deletions

View file

@ -34,6 +34,8 @@ SnapRAID HISTORY
build time. When not specified, the existing runtime discovery build time. When not specified, the existing runtime discovery
behaviour is preserved. Primarily intended for NixOS and other behaviour is preserved. Primarily intended for NixOS and other
non-FHS systems. non-FHS systems.
* Added --enable-symlink-tools configure option to allow the validation
logic to accept symbolic links for the specified --with-* paths.
14.7 2026/06 14.7 2026/06
============ ============

View file

@ -198,7 +198,10 @@ static int verify_executable(const char* exec_path, char* resolved_path)
* Open the executable * Open the executable
* O_NOFOLLOW prevents following symlinks to mitigate redirection attacks * O_NOFOLLOW prevents following symlinks to mitigate redirection attacks
*/ */
int fd = openat(dir_fd, exec_name, O_RDONLY | O_NOFOLLOW int fd = openat(dir_fd, exec_name, O_RDONLY
#if !HAVE_SYMLINK_TOOLS
| O_NOFOLLOW
#endif
#if !HAVE_FEXECVE #if !HAVE_FEXECVE
| O_CLOEXEC /* with fexecve cannot use O_CLOEXEC (Close on Exec) */ | O_CLOEXEC /* with fexecve cannot use O_CLOEXEC (Close on Exec) */
#endif #endif

View file

@ -498,6 +498,15 @@ WITH_TOOL([zfs], [zfs], [ZFS pool management])
WITH_TOOL([zpool], [zpool], [ZFS pool status]) WITH_TOOL([zpool], [zpool], [ZFS pool status])
WITH_TOOL([bcachefs], [bcachefs], [Bcachefs management]) WITH_TOOL([bcachefs], [bcachefs], [Bcachefs management])
# Enable support for symlinked tool paths
AC_ARG_ENABLE([symlink-tools],
[AS_HELP_STRING([--enable-symlink-tools], [allow paths specified with --with-* options to be symbolic links])],
[
AS_IF([test "x$enableval" = "xyes"], [
AC_DEFINE([HAVE_SYMLINK_TOOLS], [1], [Define to 1 if paths specified with --with-* options are allowed to be symlinks.])
])
])
AC_ARG_VAR([TESTENV], [Test environment]) AC_ARG_VAR([TESTENV], [Test environment])
AC_ARG_VAR([FAILENV], [Test environment for failing tests]) AC_ARG_VAR([FAILENV], [Test environment for failing tests])
AC_ARG_VAR([TESTENV_SSE2], [Test environment for SSE2]) AC_ARG_VAR([TESTENV_SSE2], [Test environment for SSE2])