]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
agetty: Fix input of non-ASCII characters in get_logname()
authorStanislav Brabec <sbrabec@suse.cz>
Wed, 27 Feb 2019 22:22:19 +0000 (23:22 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 4 Mar 2019 10:38:17 +0000 (11:38 +0100)
As login supports non-ASCII characters in the logname, agetty should be
consistent.

8b58ffdd re-activated old and ASCII-only get_logname(), which restricted
the input to ASCII only. As the code does not read whole characters,
isascii(ascval) and isprint(ascval) returns nonsenses after entering a
non-ASCII character.

As keyboard maps don't contain unprintable non-control characters, it
seems to be relatively safe to remove both checks.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Lubomir Rintel <lkundrak@v3.sk>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
term-utils/agetty.c

index 1a3ebc308f4ef2bf7314980b24971b137d348c98..0ef8ba36d87e414750e2b28eeadfb921c0c40ae7 100644 (file)
@@ -2175,8 +2175,6 @@ static char *get_logname(struct issue *ie, struct options *op, struct termios *t
                        case CTL('D'):
                                exit(EXIT_SUCCESS);
                        default:
-                               if (!isascii(ascval) || !isprint(ascval))
-                                       break;
                                if ((size_t)(bp - logname) >= sizeof(logname) - 1)
                                        log_err(_("%s: input overrun"), op->tty);
                                if ((tp->c_lflag & ECHO) == 0)