aboutsummaryrefslogtreecommitdiffstats
path: root/community/mingetty/0004-allow-login-name-up-to-LOGIN_NAME_MAX-length.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/mingetty/0004-allow-login-name-up-to-LOGIN_NAME_MAX-length.patch')
-rw-r--r--community/mingetty/0004-allow-login-name-up-to-LOGIN_NAME_MAX-length.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/community/mingetty/0004-allow-login-name-up-to-LOGIN_NAME_MAX-length.patch b/community/mingetty/0004-allow-login-name-up-to-LOGIN_NAME_MAX-length.patch
new file mode 100644
index 00000000000..4597341648e
--- /dev/null
+++ b/community/mingetty/0004-allow-login-name-up-to-LOGIN_NAME_MAX-length.patch
@@ -0,0 +1,57 @@
+From 198214367eff70b5e021057d121025b2f80e19f3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Wed, 10 Nov 2010 16:53:09 +0100
+Subject: [PATCH] Allow login name up to LOGIN_NAME_MAX length
+
+POSIX mandates 9 bytes minimal length including trailing '\0'
+(limits.h:_POSIX_LOGIN_NAME_MAX). Current GNU/Linux run time limit is 256
+(getconf LOGIN_NAME_MAX).
+
+This patch removes hard-coded 40 bytes limit.
+---
+ mingetty.c | 18 +++++++++++++++---
+ 1 files changed, 15 insertions(+), 3 deletions(-)
+
+Patch-Source: https://src.fedoraproject.org/rpms/mingetty/raw/f35/f/mingetty-1.08-Allow-login-name-up-to-LOGIN_NAME_MAX-length.patch
+diff --git a/mingetty.c b/mingetty.c
+index dbc2cce..327e630 100644
+--- a/mingetty.c
++++ b/mingetty.c
+@@ -299,10 +299,21 @@ static void do_prompt (int showlogin)
+
+ static char *get_logname (void)
+ {
+- static char logname[40];
++ long int logname_size;
++ static char *logname = NULL;
++ char *logname_new;
+ char *bp;
+ unsigned char c;
+
++ logname_size = sysconf (_SC_LOGIN_NAME_MAX);
++ if (logname_size <= 0)
++ error ("Could not get maximal login name length");
++
++ logname_new = realloc (logname, logname_size);
++ if (!logname_new)
++ error ("Not enough memory");
++ logname = logname_new;
++
+ tcflush (0, TCIFLUSH); /* flush pending input */
+ for (*logname = 0; *logname == 0;) {
+ do_prompt (1);
+@@ -319,8 +330,9 @@ static char *get_logname (void)
+ } else if (!isprint (c))
+ error ("%s: invalid character 0x%x in login"
+ " name", tty, c);
+- else if ((size_t)(bp - logname) >= sizeof (logname) - 1)
+- error ("%s: too long login name", tty);
++ else if ((bp - logname) >= (logname_size - 1))
++ error ("%s: too long login name "
++ "(limit is %ld B)", tty, logname_size);
+ else
+ *bp++ = c;
+ }
+--
+1.7.3.2
+