mingetty rebuild,

This commit is contained in:
Ertuğrul Erata
2017-01-30 21:42:20 +03:00
parent 2d3ffe831b
commit 09e4150df2
8 changed files with 183 additions and 8 deletions
+2 -2
View File
@@ -16,6 +16,6 @@ def build():
def install():
pisitools.dosbin("mingetty", "/sbin")
pisitools.doman("mingetty.8")
#pisitools.insinto("/usr/share/locale/tr/LC_MESSAGES", "tr.mo")
pisitools.domo("tr.po", "tr", "mingetty.mo")
pisitools.dodoc("COPYING")
pisitools.dodoc("COPYING")
@@ -0,0 +1,56 @@
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(-)
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
@@ -0,0 +1,31 @@
From 1b0a3a3b484148ccf9746722f55fc28327ad2e2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 10 Jun 2011 13:46:15 +0200
Subject: [PATCH] Clear scroll-back buffer on clear screen
This is implemented in Linux since 3.0 version.
---
mingetty.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/mingetty.c b/mingetty.c
index 327e630..d2ad0fc 100644
--- a/mingetty.c
+++ b/mingetty.c
@@ -192,8 +192,11 @@ static void open_tty (void)
/* Write a reset string to the terminal. This is very linux-specific
and should be checked for other systems. */
- if (noclear == 0)
- write (0, "\033c", 2);
+ if (noclear == 0) {
+ write (0, "\033[3;J", 5); /* Clear scroll-back buffer,
+ since Linux 3.0 */
+ write (0, "\033c", 2); /* Reset */
+ }
sigaction (SIGHUP, &sa_old, NULL);
}
--
1.7.5.2
@@ -0,0 +1,34 @@
Check chdir() on chroot() syscalls (and similar) as chroot without proper
chdir() allows to escape from changed root.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=597382
--- a/mingetty.c
+++ b/mingetty.c
@@ -414,12 +431,21 @@
while ((logname = get_logname ()) == 0)
/* do nothing */ ;
- if (ch_root)
- chroot (ch_root);
- if (ch_dir)
- chdir (ch_dir);
- if (priority)
- nice (priority);
+ if (ch_root) {
+ if (chroot (ch_root))
+ error ("chroot(\"%s\") failed: %s", ch_root, strerror (errno));
+ if (chdir("/"))
+ error ("chdir(\"/\") failed: %s", strerror (errno));
+ }
+ if (ch_dir) {
+ if (chdir (ch_dir))
+ error ("chdir(\"%s\") failed: %s", ch_dir, strerror (errno));
+ }
+ if (priority) {
+ errno = 0; /* see the nice(2) NOTES for why we do this */
+ if ((nice(priority) == -1) && (errno != 0))
+ error ("nice(%d) failed: %s", priority, strerror (errno));
+ }
execl (loginprog, loginprog, autologin? "-f" : "--", logname, NULL);
error ("%s: can't exec %s: %s", tty, loginprog, strerror (errno));
@@ -0,0 +1,22 @@
Limit TTY name to size of `buf' buffer
Patch from <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=221841>.
--- a/mingetty.c
+++ b/mingetty.c
@@ -138,11 +138,12 @@
int fd;
/* Set up new standard input. */
- if (tty[0] == '/')
- strcpy (buf, tty);
- else {
+ if (tty[0] == '/') {
+ strncpy (buf, tty, sizeof(buf)-1);
+ buf[sizeof(buf)-1] = '\0';
+ } else {
strcpy (buf, "/dev/");
- strcat (buf, tty);
+ strncat (buf, tty, sizeof(buf)-strlen(buf)-1);
}
/* There is always a race between this reset and the call to
vhangup() that s.o. can use to get access to your tty. */
@@ -0,0 +1,14 @@
LOG_AUTH facility is deprecated in favor of LOG_AUTHPRIV.
http://sourceforge.net/tracker/?func=detail&aid=3036068&group_id=80387&atid=559616
--- a/mingetty.c 2008-01-18 06:13:07.000000000 -0500
+++ b/mingetty.c 2010-07-28 11:30:51.265400691 -0400
@@ -83,7 +83,7 @@
va_list va_alist;
va_start (va_alist, fmt);
- openlog (progname, LOG_PID, LOG_AUTH);
+ openlog (progname, LOG_PID, LOG_AUTHPRIV);
vsyslog (LOG_ERR, fmt, va_alist);
/* no need, we exit anyway: closelog (); */
va_end (va_alist);
@@ -0,0 +1,10 @@
--- mingetty-1.00/Makefile.rpm Mon Mar 4 15:27:11 2002
+++ mingetty-1.00/Makefile Mon Mar 4 15:27:34 2002
@@ -1,6 +1,6 @@
DESTDIR=
CC=gcc
-CFLAGS=-O2 -Wall -W -pipe -D_GNU_SOURCE
+CFLAGS+=$(CFLAGS) -Wall -D_GNU_SOURCE
MANDIR=/usr/share/man/man8
SBINDIR=/sbin
+14 -6
View File
@@ -17,14 +17,15 @@
<Dependency>gettext</Dependency>
</BuildDependencies>
<Patches>
<!--<Patch level="1">gettext.patch</Patch>-->
<!--Patch level="1">gettext.patch</Patch-->
<Patch>tr.patch</Patch>
<Patch level="1">mingetty-utf8.patch</Patch>
<!-- Fixes the translation issues mentioned in # 5856 -->
<!--<Patch level="1">login-locale.patch</Patch>-->
<!-- Grab last modifications from openSUSE -->
<!--<Patch>mingetty-1.0.7s-suse.patch</Patch>-->
<!--fedora patches-->
<Patch level="1">fedora/mingetty-1.08-check_chroot_chdir_nice.patch</Patch>
<Patch level="1">fedora/mingetty-1.08-openlog_authpriv.patch</Patch>
<Patch level="1">fedora/mingetty-1.08-limit_tty_length.patch</Patch>
<!--Patch level="1">fedora/mingetty-1.08-Clear-scroll-back-buffer-on-clear-screen.patch</Patch>
<Patch>fedora/mingetty-1.08-Allow-login-name-up-to-LOGIN_NAME_MAX-length.patch</Patch-->
</Patches>
</Source>
@@ -42,6 +43,13 @@
</Package>
<History>
<Update release="3">
<Date>2017-01-30</Date>
<Version>1.08</Version>
<Comment>Version bump.</Comment>
<Name>Ertuğrul Erata</Name>
<Email>ertugrulerata@gmail.com</Email>
</Update>
<Update release="2">
<Date>2016-04-27</Date>
<Version>1.0.8</Version>