diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-03-09 22:29:19 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-03-29 16:17:56 +0200 |
commit | 172e9cc3ee3dcca288d04c744984a9a3b2a0d008 (patch) | |
tree | 146359ba4b1d7203810ae6a130bca8b046442502 /src/shared/install-printf.h | |
parent | 4a84db4c0c2eef6f40da35347c95dfa6b6e3d139 (diff) | |
download | systemd-172e9cc3ee3dcca288d04c744984a9a3b2a0d008.tar.gz |
shared/specifier: fix %u/%U/%g/%G when called as unprivileged user
We would resolve those specifiers to the calling user/group. This is mostly OK
when done in the manager, because the manager generally operates as root
in system mode, and a non-root in user mode. It would still be wrong if
called with --test though. But in systemctl, this would be generally wrong,
since we can call 'systemctl --system' as a normal user, either for testing
or even for actual operation with '--root=…'.
When operating in --global mode, %u/%U/%g/%G should return an error.
The information whether we're operating in system mode, user mode, or global
mode is passed as the data pointer to specifier_group_name(), specifier_user_name(),
specifier_group_id(), specifier_user_id(). We can't use userdata, because
it's already used for other things.
Diffstat (limited to 'src/shared/install-printf.h')
-rw-r--r-- | src/shared/install-printf.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/shared/install-printf.h b/src/shared/install-printf.h index 5ca9406797..d2cccdf66d 100644 --- a/src/shared/install-printf.h +++ b/src/shared/install-printf.h @@ -4,4 +4,9 @@ #include "install.h" #include "unit-name.h" -int install_name_printf(const UnitFileInstallInfo *i, const char *format, const char *root, char **ret); +int install_name_printf( + UnitFileScope scope, + const UnitFileInstallInfo *i, + const char *format, + const char *root, + char **ret); |