diff options
author | Samanta Navarro <ferivoz@riseup.net> | 2023-05-18 11:58:19 +0000 |
---|---|---|
committer | Iker Pedrosa <ikerpedrosam@gmail.com> | 2023-05-18 16:03:41 +0200 |
commit | 7321ceaf69a7028a04056e548d861b291634c2d0 (patch) | |
tree | dcc94db311cb02a743e9c5e4d8b90bb5eca0f15f | |
parent | 812f934e77700afedbf5e929b282f29a47b2d9c6 (diff) |
chsh: Verify that login shell path is absolute
The getusershell implementation of musl returns every line within the
/etc/shells file, which even includes comments. Only consider absolute
paths for login shells.
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
-rw-r--r-- | src/chsh.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -574,7 +574,8 @@ int main (int argc, char **argv) fail_exit (1); } if ( !amroot - && ( is_restricted_shell (loginsh) + && ( loginsh[0] != '/' + || is_restricted_shell (loginsh) || (access (loginsh, X_OK) != 0))) { fprintf (stderr, _("%s: %s is an invalid shell\n"), Prog, loginsh); fail_exit (1); |