mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Allow tools to be symlinks and hardlinks
This commit is contained in:
parent
7ef3c2bf80
commit
bb39c6ca3d
1 changed files with 1 additions and 11 deletions
|
|
@ -102,8 +102,6 @@ void os_signal_init(void)
|
|||
* be group-writable by a group other than the daemon's real/effective GID.
|
||||
* - The file must be a regular file with at least one execute bit set.
|
||||
* - The setuid and setgid bits must not be set.
|
||||
* - The file must not have more than one hard link, to prevent an attacker
|
||||
* from linking a controlled file into a trusted directory.
|
||||
* - On systems with fexecve(2) support, the returned fd is opened without
|
||||
* O_CLOEXEC so it can be passed directly to fexecve(2). On other systems
|
||||
* O_CLOEXEC is set and execve(2) must be used with @resolved_path.
|
||||
|
|
@ -195,9 +193,8 @@ 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_FEXECVE
|
||||
| O_CLOEXEC /* with fexecve cannot use O_CLOEXEC (Close on Exec) */
|
||||
#endif
|
||||
|
|
@ -259,13 +256,6 @@ static int verify_executable(const char* exec_path, char* resolved_path)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* verify the file has not been hardlinked multiple times */
|
||||
if (st.st_nlink > 1) {
|
||||
log_error(EINVAL, "File %s has multiple hard links", resolved_path);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue