diff --git a/mgetty-1.1.31-162174_tcflush.patch b/mgetty-1.1.31-162174_tcflush.patch index 49cf94a..7bead4c 100644 --- a/mgetty-1.1.31-162174_tcflush.patch +++ b/mgetty-1.1.31-162174_tcflush.patch @@ -1,11 +1,12 @@ ---- mgetty-1.1.31/logname.c.162174_tcflush 2005-07-22 17:11:17.650852000 -0400 -+++ mgetty-1.1.31/logname.c 2005-07-22 17:13:13.114273000 -0400 -@@ -368,10 +368,11 @@ +--- mgetty-1.1.31/logname.c.161174_tcflush 2005-07-27 10:41:10.076619000 -0400 ++++ mgetty-1.1.31/logname.c 2005-07-27 10:44:39.675810000 -0400 +@@ -368,10 +368,12 @@ { printf( "\r\n\07\r\nYour login time (%d minutes) ran out. Goodbye.\r\n", (max_login_time / 60)+1 ); - -+ alarm(0); /* turn off alarm */ ++ signal(SIGALRM,SIG_DFL);/* turn off alarm */ ++ alarm(0); sleep(3); /* give message time to xmit */ lprintf( L_AUDIT, "failed dev=%s, pid=%d, login time out", Device, getpid() ); @@ -13,3 +14,78 @@ exit(0); /* bye bye... */ } ch = CKILL; /* timeout #1 -> clear input */ +--- mgetty-1.1.31/mgetty.c.161174_tcflush 2003-11-17 14:09:41.000000000 -0500 ++++ mgetty-1.1.31/mgetty.c 2005-07-27 10:41:43.155507000 -0400 +@@ -94,6 +94,7 @@ + lprintf( L_AUDIT, "failed dev=%s, pid=%d, got signal %d, exiting", + Device, getpid(), signo ); + rmlocks(); ++ tcflush(1,TCOFLUSH); + exit(10); + } + +--- mgetty-1.1.31/logfile.c.161174_tcflush 2003-01-14 16:30:20.000000000 -0500 ++++ mgetty-1.1.31/logfile.c 2005-07-27 10:43:49.279257000 -0400 +@@ -22,6 +22,7 @@ + #endif + + #ifdef SYSLOG ++#include + #include + + #if !defined(linux) && !defined(BSD) && !defined(_SCO_DS) && \ +@@ -212,6 +213,7 @@ + int errnr; + char * p; + static int first_open = TRUE; ++sigset_t ss, oss; + + if ( level > log_level ) /* log level high enough? */ + { +@@ -315,7 +317,24 @@ + tm->tm_mon+1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec, ws ); + #ifdef SYSLOG ++ /* block all handled signals before syslog(), else an lprintf in ++ * a signal handler could deadlock ++ */ ++ sigemptyset(&ss); ++ sigaddset(&ss, SIGALRM); ++ sigaddset(&ss, SIGCHLD); ++ sigaddset(&ss, SIGHUP); ++ sigaddset(&ss, SIGINT); ++ sigaddset(&ss, SIGPIPE); ++ sigaddset(&ss, SIGQUIT); ++ sigaddset(&ss, SIGTERM); ++ sigaddset(&ss, SIGUSR1); ++ sigaddset(&ss, SIGUSR2); ++ sigprocmask(SIG_BLOCK, &ss, &oss); ++ + syslog( LOG_NOTICE, "%s", ws ); ++ ++ sigprocmask(SIG_SETMASK, &oss, 0L); + #endif + } + else if ( level != L_ERROR && level != L_FATAL ) +@@ -334,7 +353,21 @@ + ( errnr <= sys_nerr ) ? sys_errlist[errnr]: + "" ); + #ifdef SYSLOG ++ sigemptyset(&ss); ++ sigaddset(&ss, SIGALRM); ++ sigaddset(&ss, SIGCHLD); ++ sigaddset(&ss, SIGHUP); ++ sigaddset(&ss, SIGINT); ++ sigaddset(&ss, SIGPIPE); ++ sigaddset(&ss, SIGQUIT); ++ sigaddset(&ss, SIGTERM); ++ sigaddset(&ss, SIGUSR1); ++ sigaddset(&ss, SIGUSR2); ++ sigprocmask(SIG_BLOCK, &ss, &oss); ++ + syslog( level == L_FATAL? LOG_ALERT: LOG_ERR, "%s: %m", ws ); ++ ++ sigprocmask(SIG_SETMASK, &oss, 0L); + #endif + + #ifndef SYSLOG diff --git a/mgetty-1.1.33-sprintf_chk.patch b/mgetty-1.1.33-sprintf_chk.patch new file mode 100644 index 0000000..c74ae8d --- /dev/null +++ b/mgetty-1.1.33-sprintf_chk.patch @@ -0,0 +1,11 @@ +--- mgetty-1.1.33/voice/libvoice/record.c.sprintf_chk 1999-07-24 17:26:49.000000000 -0400 ++++ mgetty-1.1.33/voice/libvoice/record.c 2005-07-27 11:34:44.091956000 -0400 +@@ -50,7 +50,7 @@ + if (!cvd.raw_data.d.i) + { + memset(&header, 0x00, sizeof(rmd_header)); +- sprintf(header.magic, "%s", "RMD1"); ++ memcpy(&(header.magic[0]), "RMD1", 4); + sprintf(header.voice_modem_type, "%s", voice_modem_rmd_name); + header.compression = htons(cvd.rec_compression.d.i); + header.speed = htons(cvd.rec_speed.d.i); diff --git a/mgetty.spec b/mgetty.spec index 89e0536..f0d7d05 100644 --- a/mgetty.spec +++ b/mgetty.spec @@ -5,7 +5,7 @@ Summary: A getty replacement for use with data and fax modems. Name: mgetty Version: 1.1.33 -Release: 2_FC5 +Release: 3_FC5 Source: ftp://alpha.greenie.net/pub/mgetty/source/1.1/mgetty%{version}-Apr10.tar.gz Source1: ftp://alpha.greenie.net/pub/mgetty/source/1.1/mgetty%{version}-Apr10.tar.gz.asc Source2: logrotate.mgetty @@ -29,6 +29,7 @@ Patch13: mgetty-1.1.31-W-format.patch Patch14: mgetty-1.1.31-sendmail_path.patch Patch15: mgetty-1.1.31-lfs.patch Patch16: mgetty-1.1.31-162174_tcflush.patch +Patch17: mgetty-1.1.33-sprintf_chk.patch License: GPL Group: Applications/Communications Prereq: /sbin/install-info @@ -116,6 +117,7 @@ cp policy.h-dist policy.h %patch14 -p1 -b .sendmail_path %patch15 -p1 -b .lfs %patch16 -p1 -b .162174_tcflush +%patch17 -p1 -b .sprintf_chk %build PATH=$PATH:/usr/X11R6/bin @@ -335,6 +337,10 @@ fi * Fri Jul 22 2005 Jason Vas Dias 1.1.31-10 - fix bug 162174: prevent uninterruptable hang on exit() when direct line disconnected (kernel bug 164002) + do tcflush(1,TCOFLUSH) before exit() in sig_goodbye() + block signals before entering syslog() + workaround build system 'buffer overflow checks' bug: + use memcpy instead of sprintf in record.c, line 53 * Mon Apr 25 2005 Jason Vas Dias 1.1.33-1 - Upgrade to new upstream version 1.1.33