]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/shells: make sure line does not start with '#'
authorKarel Zak <kzak@redhat.com>
Mon, 12 Dec 2022 09:05:04 +0000 (10:05 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 12 Dec 2022 09:05:04 +0000 (10:05 +0100)
It's probably unnecessary, but better safe than sorry. The original
is_restricted_shell() from su(1) uses this check.

Signed-off-by: Karel Zak <kzak@redhat.com>
lib/shells.c

index 2d3ec01762ae9e1cb5a00a4622c0a54a454a8eb4..0707a18c8f6e9a853a2d1ff941a820ef54509386 100644 (file)
@@ -60,7 +60,7 @@ extern int is_known_shell(const char *shell_name)
 
        setusershell();
        while ((s = getusershell())) {
-               if (strcmp(shell_name, s) == 0) {
+               if (*s != '#' && strcmp(shell_name, s) == 0) {
                        ret = 1;
                        break;
                }