core: accept "|" ExecStart= prefix to spawn target user's shell; teach run0 about the new logic (#37071)

I've always been reluctant to invoke the current user's shell in another
user's context, hence was fully grounded in `sudo -i`. With this bit in
place `run0` will finally be feature-complete on my side ;-)
This commit is contained in:
Mike Yuan
2025-05-12 16:10:03 +02:00
committed by GitHub
15 changed files with 322 additions and 108 deletions
+4 -1
View File
@@ -885,9 +885,12 @@ int replace_env_argv(
char ***ret_bad_variables) {
_cleanup_strv_free_ char **n = NULL, **unset_variables = NULL, **bad_variables = NULL;
size_t k = 0, l = 0;
size_t k = 0, l;
int r;
assert(!strv_isempty(argv));
assert(ret);
l = strv_length(argv);
n = new(char*, l+1);
+6
View File
@@ -145,6 +145,12 @@ static inline bool path_is_safe(const char *p) {
return path_is_valid_full(p, /* accept_dot_dot= */ false);
}
bool path_is_normalized(const char *p) _pure_;
static inline bool filename_or_absolute_path_is_valid(const char *p) {
if (path_is_absolute(p))
return path_is_valid(p);
return filename_is_valid(p);
}
int file_in_same_dir(const char *path, const char *filename, char **ret);