From 05c061eaa5f4367a3d105b37f101be9f97c98ee5 Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Fri, 2 Jan 1998 03:07:16 +0000 Subject: [PATCH] * Added test in postinst if user and group exist. Christoph Lameter run into trouble upgrading a RedHat system. * Fixed little mistake which prevented klogd from accepting a console log level of 8 to get <7> alias KERN_DEBUG displayed. * Linked against libc6 (Bug#11731) * Added SHELL=/bin/bash to rules as Herbert Xu suggested * Corrected syslog.conf(5) manpage * syslogd resets the ignore priority flag now. Thanks to Herbert Thielen. (Bug#12009) * Fixed bug that caused syslogd to write into wrong files under some race conditions. Thanks to Herbet Xu. (Bug#13506) * /var/log/auth.log will only be touch if needed (Bug#14329) * debian/conffiles is treated like a document (Bug#14521) * Added script for generic logfile detection and rotation and included that in cron scripts, included also its manpage (Bug#14610) * Modified restart messages in /etc/init.d/sysklogd (Bug#15840) * klogd will first try to load /boot/System.map-$ver, then /boot/System.map, then /System.map-$ver and after that /System.map * Modified ExpandKadds() because there were some problems accessing memory r/w. (Bug#15336) --- ksym.c | 23 ++++++++++++----------- syslog.conf.5 | 7 +++---- syslogd.c | 27 ++++++++++++++++++++++++--- 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/ksym.c b/ksym.c index c3dc9ab..17f9f3e 100644 --- a/ksym.c +++ b/ksym.c @@ -107,8 +107,8 @@ static struct sym_table *sym_array = (struct sym_table *) 0; static char *system_maps[] = { - "/System.map", "/boot/System.map", + "/System.map", #if defined(TEST) "./System.map", #endif @@ -313,18 +313,20 @@ static char * FindSymbolFile() if ( debugging ) fputs("Searching for symbol map.\n", stderr); - for (mf = system_maps; *mf != (char *) 0; ++mf) + for (mf = system_maps; *mf != (char *) 0 && sym_file == (FILE *) 0; ++mf) { - sprintf (symfile, "%s", *mf); + + sprintf (symfile, "%s-%s", *mf, utsname.release); if ( debugging ) fprintf(stderr, "Trying %s.\n", symfile); if ( (sym_file = fopen(symfile, "r")) == (FILE *) 0 ) { - sprintf (symfile, "%s-%s", *mf, utsname.release); + sprintf (symfile, "%s", *mf); if ( debugging ) fprintf(stderr, "Trying %s.\n", symfile); if ( (sym_file = fopen(symfile, "r")) == (FILE *) 0 ) continue; } + } /* * At this point a map file was successfully opened. We @@ -352,9 +354,8 @@ static char * FindSymbolFile() switch ( version ) { case -1: - if ( debugging ) - fprintf(stderr, "Symbol table has incorrect " \ - "version number.\n"); + Syslog(LOG_ERR, "Symbol table has incorrect " \ + "version number.\n"); break; case 0: @@ -375,7 +376,6 @@ static char * FindSymbolFile() return(symfile); break; } - } /* @@ -653,6 +653,7 @@ extern char * ExpandKadds(line, el) *elp = el, *symbol; + char num[15]; auto int value; auto struct symbol sym; @@ -704,8 +705,9 @@ extern char * ExpandKadds(line, el) return(el); } dlm = *kp; - *kp = '\0'; - value = strtol(sl+1, (char **) 0, 16); + strncpy(num,sl+1,kp-sl-1); + num[kp-sl-1] = '\0'; + value = strtol(num, (char **) 0, 16); if ( (symbol = LookupSymbol(value, &sym)) == (char *) 0 ) symbol = sl; @@ -717,7 +719,6 @@ extern char * ExpandKadds(line, el) (sym.size==0) ? symbol+1 : symbol, \ sym.offset, sym.size); - *kp = dlm; value = 2; if ( sym.size != 0 ) { diff --git a/syslog.conf.5 b/syslog.conf.5 index f7a1d95..7dc9877 100644 --- a/syslog.conf.5 +++ b/syslog.conf.5 @@ -17,7 +17,7 @@ .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. .\" -.TH SYSLOG.CONF 5 "24 November 1995" "Version 1.3" "Linux System Administration" +.TH SYSLOG.CONF 5 "1 January 1998" "Version 1.3" "Linux System Administration" .SH NAME syslog.conf \- syslogd(8) configuration file .SH DESCRIPTION @@ -108,19 +108,18 @@ stands for no priority of the given facility. You can specify multiple facilities with the same priority pattern in one statement using the comma (``,'') operator. You may specify as -much facilities as you want. Remember that only the facility part from +much facilities as you want. Remember that only the facility part from such a statement is taken, a priority part would be skipped. Multiple selectors may be specified for a single .I action -using the semicolon (``;'') separator. Remember that each selector in +using the semicolon (``;'') separator. Remember that each selector in the .I selector field is capable to overwrite the preceding ones. Using this behavior you can exclude some priorities from the pattern. This - .BR syslogd (8) has a syntax extension to the original BSD source, that makes its use more intuitively. You may precede every priority with an equation sign diff --git a/syslogd.c b/syslogd.c index 346b16d..b0c1ac7 100644 --- a/syslogd.c +++ b/syslogd.c @@ -316,6 +316,15 @@ static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88"; * * Sun Jun 15 16:23:29 MET DST 1997: Michael Alan Dorman * Some more glibc patches made by . + * + * Thu Jan 1 16:04:52 CET 1998: Martin Schulze + * Applied patch from Herbert Thielen . + * This included some balance parentheses for emacs and a bug in + * the exclamation mark handling. + * + * Fixed small bug which caused syslogd to write messages to the + * wrong logfile under some very rare conditions. Thanks to + * Herbert Xu for fiddling this out. */ @@ -840,7 +849,7 @@ int main(argc, argv) (char *) &on, sizeof(on)) < 0 ) { logerror("setsockopt, suspending inet"); } - else { + else if (AcceptRemote) { if (bind(finet, (struct sockaddr *) &sin, \ sizeof(sin)) < 0) { logerror("bind, suspending inet"); @@ -1406,13 +1415,13 @@ void logmsg(pri, msg, from, flags) /* new line, save it */ if (f->f_prevcount) fprintlog(f, (char *)from, 0, (char *)NULL); + f->f_prevpri = pri; f->f_repeatcount = 0; (void) strncpy(f->f_lasttime, timestamp, 15); (void) strncpy(f->f_prevhost, from, sizeof(f->f_prevhost)); if (msglen < MAXSVLINE) { f->f_prevlen = msglen; - f->f_prevpri = pri; (void) strcpy(f->f_prevline, msg); fprintlog(f, (char *)from, flags, (char *)NULL); } else { @@ -1426,6 +1435,9 @@ void logmsg(pri, msg, from, flags) (void) sigsetmask(omask); #endif } +#if FALSE +} /* balance parentheses for emacs */ +#endif void fprintlog(f, from, flags, msg) register struct filed *f; @@ -1638,6 +1650,9 @@ void fprintlog(f, from, flags, msg) f->f_prevcount = 0; return; } +#if FALSE +}} /* balance parentheses for emacs */ +#endif jmp_buf ttybuf; @@ -1915,7 +1930,7 @@ void die(sig) /* Close the sockets. */ close(funix); - close(inetm); + if (InetInuse) close(inetm); /* Clean-up files. */ (void) unlink(LogName); @@ -2112,6 +2127,9 @@ void init() (void) signal(SIGHUP, sighup_handler); dprintf("syslogd: restarted.\n"); } +#if FALSE + }}} /* balance parentheses for emacs */ +#endif /* * Crack a configuration file line @@ -2168,6 +2186,9 @@ void cfline(line, f) *bp=*(bp+1); *bp='\0'; } + else { + ignorepri = 0; + } if ( *buf == '=' ) { singlpri = 1;