Add new build option to allow symlinks

This commit is contained in:
Andrea Mazzoleni 2026-05-16 16:55:53 +02:00
parent 6cd0b85f39
commit 39522d06d9
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
behaviour is preserved. Primarily intended for NixOS and other
non-FHS systems.
* Added --enable-symlink-tools configure option to allow the validation
logic to accept symbolic links for the specified --with-* paths.
14.6 2026/06
============

View file

@ -198,7 +198,10 @@ static int verify_executable(const char* exec_path, char* resolved_path)
* Open the executable
* 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
| O_CLOEXEC /* with fexecve cannot use O_CLOEXEC (Close on Exec) */
#endif

View file

@ -498,6 +498,15 @@ WITH_TOOL([zfs], [zfs], [ZFS pool management])
WITH_TOOL([zpool], [zpool], [ZFS pool status])
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([FAILENV], [Test environment for failing tests])
AC_ARG_VAR([TESTENV_SSE2], [Test environment for SSE2])