summaryrefslogtreecommitdiff
path: root/src/sysusers
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-08-19 15:49:16 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-08-22 12:52:25 +0200
commiteef74f912528764be3cb1925b8f72ad98f0d99c2 (patch)
treeefd1d8c6ca4ea550cb8b720e110b038e3b96447d /src/sysusers
parent87c696f24707d0785a0626164d0b15a376a6c586 (diff)
downloadsystemd-eef74f912528764be3cb1925b8f72ad98f0d99c2.tar.gz
sysusers: do not reject non-simplified paths for shell/home
/home/zbyszek/src/systemd-work/testcase.conf:3: '//sbin//nologin' is not a valid login shell field. This isn't very useful. The usual argument holds: people use templates to construct config, so paths may have doubled slashes and similar. Let's simplify paths so that the value that is pushed to /etc/passwd is nice and clean.
Diffstat (limited to 'src/sysusers')
-rw-r--r--src/sysusers/sysusers.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index 36d86fb6cb..4bb173da46 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -1573,6 +1573,8 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
return log_syntax(NULL, LOG_ERR, fname, line, r,
"Failed to replace specifiers in '%s': %m", home);
+ path_simplify(resolved_home);
+
if (!valid_home(resolved_home))
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EINVAL),
"'%s' is not a valid home directory field.", resolved_home);
@@ -1588,6 +1590,8 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
return log_syntax(NULL, LOG_ERR, fname, line, r,
"Failed to replace specifiers in '%s': %m", shell);
+ path_simplify(resolved_shell);
+
if (!valid_shell(resolved_shell))
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EINVAL),
"'%s' is not a valid login shell field.", resolved_shell);