execute: when recursively chowning StateDirectory= when spawning services, follow initial symlink
It should be OK to allow one level of symlink for the various types of directories like StateDirectory=, LogsDirectory= and such.
This commit is contained in:
@@ -111,12 +111,15 @@ int path_chown_recursive(
|
||||
const char *path,
|
||||
uid_t uid,
|
||||
gid_t gid,
|
||||
mode_t mask) {
|
||||
mode_t mask,
|
||||
int flags) {
|
||||
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
struct stat st;
|
||||
|
||||
fd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME);
|
||||
assert((flags & ~AT_SYMLINK_FOLLOW) == 0);
|
||||
|
||||
fd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC|O_NOATIME|(FLAGS_SET(flags, AT_SYMLINK_FOLLOW) ? 0 : O_NOFOLLOW));
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
int path_chown_recursive(const char *path, uid_t uid, gid_t gid, mode_t mask);
|
||||
int path_chown_recursive(const char *path, uid_t uid, gid_t gid, mode_t mask, int flags);
|
||||
|
||||
int fd_chown_recursive(int fd, uid_t uid, gid_t gid, mode_t mask);
|
||||
|
||||
Reference in New Issue
Block a user