diff --git a/src/klogd.c b/src/klogd.c index 1879fbe..efd50fd 100644 --- a/src/klogd.c +++ b/src/klogd.c @@ -22,242 +22,6 @@ * MA 02110-1301, USA. */ -/* - * Steve Lord (lord@cray.com) 7th Nov 92 - * - * Modified to check for kernel info by Dr. G.W. Wettstein 02/17/93. - * - * Fri Mar 12 16:53:56 CST 1993: Dr. Wettstein - * Modified LogLine to use a newline as the line separator in - * the kernel message buffer. - * - * Added debugging code to dump the contents of the kernel message - * buffer at the start of the LogLine function. - * - * Thu Jul 29 11:40:32 CDT 1993: Dr. Wettstein - * Added syscalls to turn off logging of kernel messages to the - * console when klogd becomes responsible for kernel messages. - * - * klogd now catches SIGTERM and SIGKILL signals. Receipt of these - * signals cases the clean_up function to be called which shuts down - * kernel logging and re-enables logging of messages to the console. - * - * Sat Dec 11 11:54:22 CST 1993: Dr. Wettstein - * Added fixes to allow compilation with no complaints with -Wall. - * - * When the daemon catches a fatal signal (SIGTERM, SIGKILL) a - * message is output to the logfile advising that the daemon is - * going to terminate. - * - * Thu Jan 6 11:54:10 CST 1994: Dr. Wettstein - * Major re-write/re-organization of the code. - * - * Klogd now assigns kernel messages to priority levels when output - * to the syslog facility is requested. The priority level is - * determined by decoding the prioritization sequence which is - * tagged onto the start of the kernel messages. - * - * Added the following program options: -f arg -c arg -s -o -d - * - * The -f switch can be used to specify that output should - * be written to the named file. - * - * The -c switch is used to specify the level of kernel - * messages which are to be directed to the console. - * - * The -s switch causes the program to use the syscall - * interface to the kernel message facility. This can be - * used to override the presence of the /proc filesystem. - * - * The -o switch causes the program to operate in 'one-shot' - * mode. A single call will be made to read the complete - * kernel buffer. The contents of the buffer will be - * output and the program will terminate. - * - * The -d switch causes 'debug' mode to be activated. This - * will cause the daemon to generate LOTS of output to stderr. - * - * The buffer decomposition function (LogLine) was re-written to - * squash a bug which was causing only partial kernel messages to - * be written to the syslog facility. - * - * The signal handling code was modified to properly differentiate - * between the STOP and TSTP signals. - * - * Added pid saving when the daemon detaches into the background. Thank - * you to Juha Virtanen (jiivee@hut.fi) for providing this patch. - * - * Mon Feb 6 07:31:29 CST 1995: Dr. Wettstein - * Significant re-organization of the signal handling code. The - * signal handlers now only set variables. Not earth shaking by any - * means but aesthetically pleasing to the code purists in the group. - * - * Patch to make things more compliant with the file system standards. - * Thanks to Chris Metcalf for prompting this helpful change. - * - * The routines responsible for reading the kernel log sources now - * initialize the buffers before reading. I think that this will - * solve problems with non-terminated kernel messages producing - * output of the form: new old old old - * - * This may also help influence the occassional reports of klogd - * failing under significant load. I think that the jury may still - * be out on this one though. My thanks to Joerg Ahrens for initially - * tipping me off to the source of this problem. Also thanks to - * Michael O'Reilly for tipping me off to the best fix for this problem. - * And last but not least Mark Lord for prompting me to try this as - * a means of attacking the stability problem. - * - * Specifying a - as the arguement to the -f switch will cause output - * to be directed to stdout rather than a filename of -. Thanks to - * Randy Appleton for a patch which prompted me to do this. - * - * Wed Feb 22 15:37:37 CST 1995: Dr. Wettstein - * Added version information to logging startup messages. - * - * Wed Jul 26 18:57:23 MET DST 1995: Martin Schulze - * Added an commandline argument "-n" to avoid forking. This obsoletes - * the compiler define NO_FORK. It's more useful to have this as an - * argument as there are many binary versions and one doesn't need to - * recompile the daemon. - * - * Thu Aug 10 19:01:08 MET DST 1995: Martin Schulze - * Added my pidfile.[ch] to it to perform a better handling with pidfiles. - * Now both, syslogd and klogd, can only be started once. They check the - * pidfile. - * - * Fri Nov 17 15:05:43 CST 1995: Dr. Wettstein - * Added support for kernel address translation. This required moving - * some definitions and includes to the new klogd.h file. Some small - * code cleanups and modifications. - * - * Mon Nov 20 10:03:39 MET 1995 - * Added -v option to print the version and exit. - * - * Thu Jan 18 11:19:46 CST 1996: Dr. Wettstein - * Added suggested patches from beta-testers. These address two - * two problems. The first is segmentation faults which occur with - * the ELF libraries. This was caused by passing a null pointer to - * the strcmp function. - * - * Added a second patch to remove the pidfile as part of the - * termination cleanup sequence. This minimizes the potential for - * conflicting pidfiles causing immediate termination at boot time. - * - * Wed Aug 21 09:13:03 CDT 1996: Dr. Wettstein - * Added ability to reload static symbols and kernel module symbols - * under control of SIGUSR1 and SIGUSR2 signals. - * - * Added -p switch to select 'paranoid' behavior with respect to the - * loading of kernel module symbols. - * - * Informative line now printed whenever a state change occurs due - * to signal reception by the daemon. - * - * Added the -i and -I command line switches to signal the currently - * executing daemon. - * - * Tue Nov 19 10:15:36 PST 1996: Leland Olds - * Corrected vulnerability to buffer overruns by rewriting LogLine - * routine. Obscenely long kernel messages will now be broken up - * into lines no longer than LOG_LINE_LENGTH. - * - * The last version of LogLine was vulnerable to buffer overruns: - * - Kernel messages longer than LOG_LINE_LENGTH caused a buffer - * overrun. - * - If a line was determined to be shorter than LOG_LINE_LENGTH, - * the routine "ExpandKadds" could cause the line grow by - * an unknown amount and overrun a buffer. - * I turned these routines into a little parsing state machine that - * should not have these problems. - * - * Sun Jun 15 16:23:29 MET DST 1997: Michael Alan Dorman - * Some more glibc patches made by . - * - * Thu Aug 21 12:11:27 MET DST 1997: Martin Schulze - * Fixed little mistake which prevented klogd from accepting a - * console log - * - * Fri Jan 9 00:39:52 CET 1998: Martin Schulze - * Changed the behaviour of klogd when receiving a terminate - * signal. Now the program terminates immediately instead of - * completing the receipt of a kernel message, i.e the read() - * call. The old behaveiour could result in klogd being - * recognized as being undead, because it'll only die after a - * message has been received. - * - * Fri Jan 9 11:03:48 CET 1998: Martin Schulze - * Corrected some code that caused klogd to dump core when - * receiving messages containing '%', some of them exist in - * 2.1.78. Thanks to Chu-yeon Park for - * informing me. - * - * Fri Jan 9 23:38:19 CET 1998: Florian La Roche - * Added -x switch to omit EIP translation and System.map evaluation. - * - * Sun Jan 25 20:47:46 CET 1998: Martin Schulze - * As the bug covering the %'s introduced a problem with - * unevaluated priorities I've worked out a real fix that strips - * %'s to an even number which is harmless for printf. - * - * Sat Oct 10 20:01:48 CEST 1998: Martin Schulze - * Added support for TESTING define which will turn klogd into - * stdio-mode used for debugging. - * - * Mon Apr 13 18:18:45 CEST 1998: Martin Schulze - * Modified System.map read function to try all possible map - * files until a file with matching version is found. Added support for - * Debian release. - * - * Mon Oct 12 13:01:27 MET DST 1998: Martin Schulze - * Used unsigned long and strtoul() to resolve kernel oops symbols. - * - * Sun Jan 3 18:38:03 CET 1999: Martin Schulze - * Shortened LOG_LINE_LENGTH in order to get long lines splitted - * up earlier and syslogd has a better chance concatenating them - * together again. - * - * Sat Aug 21 12:27:02 CEST 1999: Martin Schulze - * Skip newline when reading in messages. - * - * Tue Sep 12 22:14:33 CEST 2000: Martin Schulze - * Don't feed a buffer directly to a printf-type routine, use - * "%s" as format string instead. Thanks to Jouko Pynnönen - * for pointing this out. - * - * Tue Sep 12 22:44:57 CEST 2000: Martin Schulze - * Commandline option `-2': When symbols are expanded, print the - * line twice. Once with addresses converted to symbols, once with the - * raw text. Allows external programs such as ksymoops do their own - * processing on the original data. Thanks to Keith Owens - * for the patch. - * - * Mon Sep 18 09:32:27 CEST 2000: Martin Schulze - * Added patch to fix priority decoding after moving kernel - * messgages into "%s". Thanks to Solar Designer - * for the patch. - * - * Sun Mar 11 20:23:44 CET 2001: Martin Schulze - * Stop LogLine() from being called with wrong argument when a - * former calculation failed already. Thanks to Thomas Roessler - * for providing a patch. - * - * Ignore zero bytes, no busy loop is entered anymore. Several - * people have submitted patches: Troels Walsted Hansen - * , Wolfgang Oertl - * and Thomas Roessler. - * - * Thu Apr 29 15:24:07 2004: Solar Designer - * Prevent potential buffer overflow in reading messages from the - * kernel log rinbuffer. - * - * Sat May 26 16:33:18 2007: Martin Schulze - * Improved daemonise routine to stabilise startup. - * - * Mon May 28 18:07:59 CEST 2007: Matthew Fischer - * Remove special treatment of the percent sign. - */ - #include "config.h" #include diff --git a/src/klogd.h b/src/klogd.h index dd82e98..f8900be 100644 --- a/src/klogd.h +++ b/src/klogd.h @@ -22,20 +22,11 @@ * MA 02110-1301, USA. */ -/* - * Symbols and definitions needed by klogd. - * - * Thu Nov 16 12:45:06 CST 1995: Dr. Wettstein - * Initial version. - */ -/* Useful include files. */ #include #include #include - -/* Function prototypes. */ extern int InitKsyms(char *); extern int InitMsyms(void); extern char *ExpandKadds(char *, char *); diff --git a/src/ksym.c b/src/ksym.c index 4d57d6a..a3aa488 100644 --- a/src/ksym.c +++ b/src/ksym.c @@ -27,108 +27,8 @@ /* * This file contains functions which handle the translation of kernel * numeric addresses into symbols for the klogd utility. - * - * Sat Oct 28 09:00:14 CDT 1995: Dr. Wettstein - * Initial Version. - * - * Fri Nov 24 12:50:52 CST 1995: Dr. Wettstein - * Added VERBOSE_DEBUGGING define to make debugging output more - * manageable. - * - * Added support for verification of the loaded kernel symbols. If - * no version information can be be found in the mapfile a warning - * message is issued but translation will still take place. This - * will be the default case if kernel versions < 1.3.43 are used. - * - * If the symbols in the mapfile are of the same version as the kernel - * that is running an informative message is issued. If the symbols - * in the mapfile do not match the current kernel version a warning - * message is issued and translation is disabled. - * - * Wed Dec 6 16:14:11 CST 1995: Dr. Wettstein - * Added /boot/System.map to the list of symbol maps to search for. - * Also made this map the first item in the search list. I am open - * to CONSTRUCTIVE suggestions for any additions or corrections to - * the list of symbol maps to search for. Be forewarned that the - * list in use is the consensus agreement between myself, Linus and - * some package distributers. It is a given that no list will suit - * everyone's taste. If you have rabid concerns about the list - * please feel free to edit the system_maps array and compile your - * own binaries. - * - * Added support for searching of the list of symbol maps. This - * allows support for access to multiple symbol maps. The theory - * behind this is that a production kernel may have a system map in - * /boot/System.map. If a test kernel is booted this system map - * would be skipped in favor of one found in /usr/src/linux. - * - * Thu Jan 18 11:18:31 CST 1996: Dr. Wettstein - * Added patch from beta-testers to allow for reading of both - * ELF and a.out map files. - * - * Wed Aug 21 09:15:49 CDT 1996: Dr. Wettstein - * Reloading of kernel module symbols is now turned on by the - * SetParanoiaLevel function. The default behavior is to NOT reload - * the kernel module symbols when a protection fault is detected. - * - * Added support for freeing of the current kernel module symbols. - * This was necessary to support reloading of the kernel module symbols. - * - * When a matching static symbol table is loaded the kernel version - * number is printed. - * - * Mon Jun 9 17:12:42 CST 1997: Martin Schulze - * Added #1 and #2 to some error messages in order to being able - * to divide them (ulmo@Q.Net) - * - * Fri Jun 13 10:50:23 CST 1997: Martin Schulze - * Changed definition of LookupSymbol to non-static because it is - * used in klogd.c, too. - * - * Fri Jan 9 23:00:08 CET 1998: Martin Schulze - * Fixed bug that caused klogd to die if there is no System.map available. - * - * Sun 29 Mar 18:14:07 BST 1998: Mark Simon Phillips - * Switched to fgets() as gets() is not buffer overrun secure. - * - * Mon Apr 13 18:18:45 CEST 1998: Martin Schulze - * Modified loop for detecting the correct system map. Now it won't - * stop if a file has been found but doesn't contain the correct map. - * Special thanks go go Mark Simon Phillips for the hint. - * - * Mon Oct 12 00:42:30 CEST 1998: Martin Schulze - * Modified CheckVersion() - * . Use shift to decode the kernel version - * . Compare integers of kernel version - * . extract major.minor.patch from utsname.release via sscanf() - * The reason lays in possible use of kernel flavours which - * modify utsname.release but no the Version_ symbol. - * - * Sun Feb 21 22:27:49 EST 1999: Keith Owens - * Fixed bug that caused klogd to die if there is no sym_array available. - * - * Tue Sep 12 23:48:12 CEST 2000: Martin Schulze - * Close symbol file in InitKsyms() when an error occurred. - * - * Thu Apr 29 18:07:16 CEST 2004: Dmitry Levin - * Close file descriptor in FindSymbolFile() in order not to leak - * file descriptors. - * - * Fri Jul 16 08:32:49 CEST 2004: Ulf Härnhammar - * Added boundary check for fscanf() in InitKsyms() and - * CheckMapVersion() to prevent an unintended crash when reading - * an incorrect System.map. - * - * Mon May 28 08:27:51 CEST 2007: Martin Schulze - * Added back /usr/src/linux/System.map as fall-back location. - * - * Thu May 31 16:56:26 CEST 2007: Martin Schulze - * Improved symbol lookup, since symbols are spread over the entire - * address space. Return the symbol that fits best instead of - * the first hit. */ -/* Includes. */ #include "klogd.h" #include "ksyms.h" #include "module.h" diff --git a/src/ksym_mod.c b/src/ksym_mod.c index edf40cd..1e72aeb 100644 --- a/src/ksym_mod.c +++ b/src/ksym_mod.c @@ -41,69 +41,6 @@ * possible. * * At least that is the plan. - * - * Wed Aug 21 09:20:09 CDT 1996: Dr. Wettstein - * The situation where no module support has been compiled into a - * kernel is now detected. An informative message is output indicating - * that the kernel has no loadable module support whenever kernel - * module symbols are loaded. - * - * An informative message is printed indicating the number of kernel - * modules and the number of symbols loaded from these modules. - * - * Sun Jun 15 16:23:29 MET DST 1997: Michael Alan Dorman - * Some more glibc patches made by . - * - * Sat Jan 10 15:00:18 CET 1998: Martin Schulze - * Fixed problem with klogd not being able to be built on a kernel - * newer than 2.1.18. It was caused by modified structures - * inside the kernel that were included. I have worked in a - * patch from Alessandro Suardi . - * - * Sun Jan 25 20:57:34 CET 1998: Martin Schulze - * Another patch for Linux/alpha by Christopher C Chimelis - * . - * - * Thu Mar 19 23:39:29 CET 1998: Manuel Rodrigues - * Changed lseek() to llseek() in order to support > 2GB address - * space which provided by kernels > 2.1.70. - * - * Mon Apr 13 18:18:45 CEST 1998: Martin Schulze - * Removed as it's no longer part of recent glibc - * versions. Added prototyp for llseek() which has been - * forgotton in from glibc. Added more log - * information if problems occurred while reading a system map - * file, by submission from Mark Simon Phillips . - * - * Sun Jan 3 18:38:03 CET 1999: Martin Schulze - * Corrected return value of AddModule if /dev/kmem can't be - * loaded. This will prevent klogd from segfaulting if /dev/kmem - * is not available. Patch from Topi Miettinen . - * - * Tue Sep 12 23:11:13 CEST 2000: Martin Schulze - * Changed llseek() to lseek64() in order to skip a libc warning. - * - * Wed Mar 31 17:35:01 CEST 2004: Martin Schulze - * Removed references to since it doesn't work - * anymore with its recent content from Linux 2.4/2.6, created - * module.h locally instead. - * - * Fri May 25 20:07:30 CEST 2007: Martin Schulze - * Use new query_module function rather than the old obsolete - * hack of stepping through /dev/kmem. - * - * Mon May 28 16:46:59 CEST 2007: Martin Schulze - * Since Linux 2.6 query_module is depricated and no implemented - * anymore. Thus, overhauled symbol import via /proc/kallsyms - * - * Thu May 31 12:12:23 CEST 2007: Martin Schulze - * Only read kernel symbols from /proc/kallsyms if no System.map - * has been read as it may contain more symbols. - * - * Thu May 31 16:56:26 CEST 2007: Martin Schulze - * Improved symbol lookup, since symbols are spread over the entire - * address space. Return the symbol that fits best instead of - * the first hit. */ #include "config.h" diff --git a/src/ksyms.h b/src/ksyms.h index c279c72..79b3635 100644 --- a/src/ksyms.h +++ b/src/ksyms.h @@ -23,7 +23,6 @@ * MA 02110-1301, USA. */ -/* Variables, structures and type definitions static to this module. */ struct symbol { char *name; @@ -31,7 +30,5 @@ struct symbol { int offset; }; - -/* Function prototypes. */ extern char *LookupSymbol(unsigned long, struct symbol *); extern char *LookupModuleSymbol(unsigned long int, struct symbol *); diff --git a/src/module.h b/src/module.h index 5d5f1cc..d86238b 100644 --- a/src/module.h +++ b/src/module.h @@ -23,20 +23,6 @@ * MA 02110-1301, USA. */ -/* ChangeLog: - * - * Wed Mar 31 17:35:01 CEST 2004: Martin Schulze - * Created local copy of module.h based on the content of Linux - * 2.2 since doesn't work anymore with its - * recent content from Linux 2.4/2.6. - * - * Thu May 25 09:14:33 CEST 2006: Martin Schulze - * Removed asm/atomic.h since it is not needed anymore. - * - * Mon May 28 16:46:59 CEST 2007: Martin Schulze - * Removed several structs not used anymore. Moved structs from - * ksym_mod.c over here. - */ struct sym_table { unsigned long value; diff --git a/src/pidfile.c b/src/pidfile.c index 831ab90..a1d9925 100644 --- a/src/pidfile.c +++ b/src/pidfile.c @@ -22,11 +22,6 @@ * MA 02110-1301, USA. */ -/* - * Sat Aug 19 13:24:33 MET DST 1995: Martin Schulze - * First version (v0.2) released - */ - #include #include #include diff --git a/src/syslog_tst.c b/src/syslog_tst.c index 4b3b534..b94bacb 100644 --- a/src/syslog_tst.c +++ b/src/syslog_tst.c @@ -1,20 +1,5 @@ /* Program to test daemon logging. */ -/* - * Sat Dec 11 12:07:50 CST 1993: Dr. Wettstein - * Compiles clean with -Wall. Renamed for first public distribution. - * Use this freely but if you make a ton of money with it I - * expect a cut... :-) - * - * Thu Jan 6 11:52:10 CST 1994: Dr. Wettstein - * Added support for reading getting log input from the standard - * input. To activate this use a - as the single arguement to the - * the program. Note that there is a hack in the code to pause - * after each 1K has been written. This eliminates what appears - * to be a problem with overrunning a UNIX domain socket with - * excessive amounts of input. - */ - #include #include #include diff --git a/src/syslogd.c b/src/syslogd.c index 71c0313..dd15d5b 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -48,479 +48,6 @@ static char sccsid[] __attribute__((unused)) = * To kill syslogd, send a signal 15 (terminate). A signal 1 (hup) will * cause it to reread its configuration file. * - * Defined Constants: - * - * MAXLINE -- the maximum line length that can be handled. - * DEFUPRI -- the default priority for user messages - * DEFSPRI -- the default priority for kernel messages - * - * Author: Eric Allman - * extensive changes by Ralph Campbell - * more extensive changes by Eric Allman (again) - * - * Steve Lord: Fix UNIX domain socket code, added linux kernel logging - * change defines to - * SYSLOG_INET - listen on a UDP socket - * SYSLOG_UNIXAF - listen on unix domain socket - * SYSLOG_KERNEL - listen to linux kernel - * - * Mon Feb 22 09:55:42 CST 1993: Dr. Wettstein - * Additional modifications to the source. Changed priority scheme - * to increase the level of configurability. In its stock configuration - * syslogd no longer logs all messages of a certain priority and above - * to a log file. The * wildcard is supported to specify all priorities. - * Note that this is a departure from the BSD standard. - * - * Syslogd will now listen to both the inetd and the unixd socket. The - * strategy is to allow all local programs to direct their output to - * syslogd through the unixd socket while the program listens to the - * inetd socket to get messages forwarded from other hosts. - * - * Fri Mar 12 16:55:33 CST 1993: Dr. Wettstein - * Thanks to Stephen Tweedie (dcs.ed.ac.uk!sct) for helpful bug-fixes - * and an enlightened commentary on the prioritization problem. - * - * Changed the priority scheme so that the default behavior mimics the - * standard BSD. In this scenario all messages of a specified priority - * and above are logged. - * - * Add the ability to specify a wildcard (=) as the first character - * of the priority name. Doing this specifies that ONLY messages with - * this level of priority are to be logged. For example: - * - * *.=debug /usr/adm/debug - * - * Would log only messages with a priority of debug to the /usr/adm/debug - * file. - * - * Providing an * as the priority specifies that all messages are to be - * logged. Note that this case is degenerate with specifying a priority - * level of debug. The wildcard * was retained because I believe that - * this is more intuitive. - * - * Thu Jun 24 11:34:13 CDT 1993: Dr. Wettstein - * Modified sources to incorporate changes in libc4.4. Messages from - * syslog are now null-terminated, syslogd code now parses messages - * based on this termination scheme. Linux as of libc4.4 supports the - * fsync system call. Modified code to fsync after all writes to - * log files. - * - * Sat Dec 11 11:59:43 CST 1993: Dr. Wettstein - * Extensive changes to the source code to allow compilation with no - * complaints with -Wall. - * - * Reorganized the facility and priority name arrays so that they - * compatible with the syslog.h source found in /usr/include/syslog.h. - * NOTE that this should really be changed. The reason I do not - * allow the use of the values defined in syslog.h is on account of - * the extensions made to allow the wildcard character in the - * priority field. To fix this properly one should malloc an array, - * copy the contents of the array defined by syslog.h and then - * make whatever modifications that are desired. Next round. - * - * Thu Jan 6 12:07:36 CST 1994: Dr. Wettstein - * Added support for proper decomposition and re-assembly of - * fragment messages on UNIX domain sockets. Lack of this capability - * was causing 'partial' messages to be output. Since facility and - * priority information is encoded as a leader on the messages this - * was causing lines to be placed in erroneous files. - * - * Also added a patch from Shane Alderton (shane@ion.apana.org.au) to - * correct a problem with syslogd dumping core when an attempt was made - * to write log messages to a logged-on user. Thank you. - * - * Many thanks to Juha Virtanen (jiivee@hut.fi) for a series of - * interchanges which lead to the fixing of problems with messages set - * to priorities of none and emerg. Also thanks to Juha for a patch - * to exclude users with a class of LOGIN from receiving messages. - * - * Shane Alderton provided an additional patch to fix zombies which - * were conceived when messages were written to multiple users. - * - * Mon Feb 6 09:57:10 CST 1995: Dr. Wettstein - * Patch to properly reset the single priority message flag. Thanks - * to Christopher Gori for spotting this bug and forwarding a patch. - * - * Wed Feb 22 15:38:31 CST 1995: Dr. Wettstein - * Added version information to startup messages. - * - * Added defines so that paths to important files are taken from - * the definitions in paths.h. Hopefully this will insure that - * everything follows the FSSTND standards. Thanks to Chris Metcalf - * for a set of patches to provide this functionality. Also thanks - * Elias Levy for prompting me to get these into the sources. - * - * Wed Jul 26 18:57:23 MET DST 1995: Martin Schulze - * Linux' gethostname only returns the hostname and not the fqdn as - * expected in the code. But if you call hostname with an fqdn then - * gethostname will return an fqdn, so we have to mention that. This - * has been changed. - * - * The 'LocalDomain' and the hostname of a remote machine is - * converted to lower case, because the original caused some - * inconsistency, because the (at least my) nameserver did respond an - * fqdn containing of upper- _and_ lowercase letters while - * 'LocalDomain' consisted only of lowercase letters and that didn't - * match. - * - * Sat Aug 5 18:59:15 MET DST 1995: Martin Schulze - * Now no messages that were received from any remote host are sent - * out to another. At my domain this missing feature caused ugly - * syslog-loops, sometimes. - * - * Remember that no message is sent out. I can't figure out any - * scenario where it might be useful to change this behavior and to - * send out messages to other hosts than the one from which we - * received the message, but I might be shortsighted. :-/ - * - * Thu Aug 10 19:01:08 MET DST 1995: Martin Schulze - * Added my pidfile.[ch] to it to perform a better handling with - * pidfiles. Now both, syslogd and klogd, can only be started - * once. They check the pidfile. - * - * Sun Aug 13 19:01:41 MET DST 1995: Martin Schulze - * Add an addition to syslog.conf's interpretation. If a priority - * begins with an exclamation mark ('!') the normal interpretation - * of the priority is inverted: ".!*" is the same as ".none", ".!=info" - * don't logs the info priority, ".!crit" won't log any message with - * the priority crit or higher. For example: - * - * mail.*;mail.!=info /usr/adm/mail - * - * Would log all messages of the facility mail except those with - * the priority info to /usr/adm/mail. This makes the syslogd - * much more flexible. - * - * Defined TABLE_ALLPRI=255 and changed some occurrences. - * - * Sat Aug 19 21:40:13 MET DST 1995: Martin Schulze - * Making the table of facilities and priorities while in debug - * mode more readable. - * - * If debugging is turned on, printing the whole table of - * facilities and priorities every hexadecimal or 'X' entry is - * now 2 characters wide. - * - * The number of the entry is prepended to each line of - * facilities and priorities, and F_UNUSED lines are not shown - * anymore. - * - * Corrected some #ifdef SYSV's. - * - * Mon Aug 21 22:10:35 MET DST 1995: Martin Schulze - * Corrected a strange behavior during parsing of configuration - * file. The original BSD syslogd doesn't understand spaces as - * separators between specifier and action. This syslogd now - * understands them. The old behavior caused some confusion over - * the Linux community. - * - * Thu Oct 19 00:02:07 MET 1995: Martin Schulze - * The default behavior has changed for security reasons. The - * syslogd will not receive any remote message unless you turn - * reception on with the "-r" option. - * - * Not defining SYSLOG_INET will result in not doing any network - * activity, i.e. not sending or receiving messages. I changed - * this because the old idea is implemented with the "-r" option - * and the old thing didn't work anyway. - * - * Thu Oct 26 13:14:06 MET 1995: Martin Schulze - * Added another logfile type F_FORW_UNKN. The problem I ran into - * was a name server that runs on my machine and a forwarder of - * kern.crit to another host. The hosts address can only be - * fetched using the nameserver. But named is started after - * syslogd, so syslogd complained. - * - * This logfile type will retry to get the address of the - * hostname ten times and then complain. This should be enough to - * get the named up and running during boot sequence. - * - * Fri Oct 27 14:08:15 1995: Dr. Wettstein - * Changed static array of logfiles to a dynamic array. This - * can grow during process. - * - * Fri Nov 10 23:08:18 1995: Martin Schulze - * Inserted a new tabular sys_h_errlist that contains plain text - * for error codes that are returned from the net subsystem and - * stored in h_errno. I have also changed some wrong lookups to - * sys_errlist. - * - * Wed Nov 22 22:32:55 1995: Martin Schulze - * Added the fabulous strip-domain feature that allows us to - * strip off (several) domain names from the fqdn and only log - * the simple hostname. This is useful if you're in a LAN that - * has a central log server and also different domains. - * - * I have also also added the -l switch do define hosts as - * local. These will get logged with their simple hostname, too. - * - * Thu Nov 23 19:02:56 MET DST 1995: Martin Schulze - * Added the possibility to omit fsyncing of logfiles after every - * write. This will give some performance back if you have - * programs that log in a very verbose manner (like innd or - * smartlist). Thanks to Stephen R. van den Berg - * for the idea. - * - * Thu Jan 18 11:14:36 CST 1996: Dr. Wettstein - * Added patche from beta-testers to stop compile error. Also - * added removal of pid file as part of termination cleanup. - * - * Wed Feb 14 12:42:09 CST 1996: Dr. Wettstein - * Allowed forwarding of messages received from remote hosts to - * be controlled by a command-line switch. Specifying -h allows - * forwarding. The default behavior is to disable forwarding of - * messages which were received from a remote host. - * - * Parent process of syslogd does not exit until child process has - * finished initialization process. This allows rc.* startup to - * pause until syslogd facility is up and operating. - * - * Re-arranged the select code to move UNIX domain socket accepts - * to be processed later. This was a contributed change which - * has been proposed to correct the delays sometimes encountered - * when syslogd starts up. - * - * Minor code cleanups. - * - * Thu May 2 15:15:33 CDT 1996: Dr. Wettstein - * Fixed bug in init function which resulted in file descripters - * being orphaned when syslogd process was re-initialized with SIGHUP - * signal. Thanks to Edvard Tuinder - * (Edvard.Tuinder@praseodymium.cistron.nl) for putting me on the - * trail of this bug. I am amazed that we didn't catch this one - * before now. - * - * Tue May 14 00:03:35 MET DST 1996: Martin Schulze - * Corrected a mistake that causes the syslogd to stop logging at - * some virtual consoles under Linux. This was caused by checking - * the wrong error code. Thanks to Michael Nonweiler - * for sending me a patch. - * - * Mon May 20 13:29:32 MET DST 1996: Miquel van Smoorenburg - * Added continuation line supported and fixed a bug in - * the init() code. - * - * Tue May 28 00:58:45 MET DST 1996: Martin Schulze - * Corrected behaviour of blocking pipes - i.e. the whole system - * hung. Michael Nonweiler has sent us - * a patch to correct this. A new logfile type F_PIPE has been - * introduced. - * - * Mon Feb 3 10:12:15 MET DST 1997: Martin Schulze - * Corrected behaviour of logfiles if the file can't be opened. - * There was a bug that causes syslogd to try to log into non - * existing files which ate cpu power. - * - * Sun Feb 9 03:22:12 MET DST 1997: Martin Schulze - * Modified syslogd.c to not kill itself which confuses bash 2.0. - * - * Mon Feb 10 00:09:11 MET DST 1997: Martin Schulze - * Improved debug code to decode the numeric facility/priority - * pair into textual information. - * - * Tue Jun 10 12:35:10 MET DST 1997: Martin Schulze - * Corrected freeing of logfiles. Thanks to Jos Vos - * for reporting the bug and sending an idea to fix the problem. - * - * Tue Jun 10 12:51:41 MET DST 1997: Martin Schulze - * Removed sleep(10) from parent process. This has caused a slow - * startup in former times - and I don't see any reason for this. - * - * 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 . - * 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. - * - * Thu Jan 8 22:46:35 CET 1998: Martin Schulze - * Reworked one line of the above patch as it prevented syslogd - * from binding the socket with the result that no messages were - * forwarded to other hosts. - * - * Sat Jan 10 01:33:06 CET 1998: Martin Schulze - * Fixed small bugs in F_FORW_UNKN meachanism. Thanks to Torsten - * Neumann for pointing me to it. - * - * Mon Jan 12 19:50:58 CET 1998: Martin Schulze - * Modified debug output concerning remote receiption. - * - * Mon Feb 23 23:32:35 CET 1998: Topi Miettinen - * Re-worked handling of Unix and UDP sockets to support closing / - * opening of them in order to have it open only if it is needed - * either for forwarding to a remote host or by receiption from - * the network. - * - * Wed Feb 25 10:54:09 CET 1998: Martin Schulze - * Fixed little comparison mistake that prevented the MARK - * feature to work properly. - * - * Wed Feb 25 13:21:44 CET 1998: Martin Schulze - * Corrected Topi's patch as it prevented forwarding during - * startup due to an unknown LogPort. - * - * Sat Oct 10 20:01:48 CEST 1998: Martin Schulze - * Added support for TESTING define which will turn syslogd into - * stdio-mode used for debugging. - * - * Sun Oct 11 20:16:59 CEST 1998: Martin Schulze - * Reworked the initialization/fork code. Now the parent - * process activates a signal handler which the daughter process - * will raise if it is initialized. Only after that one the - * parent process may exit. Otherwise klogd might try to flush - * its log cache while syslogd can't receive the messages yet. - * - * Mon Oct 12 13:30:35 CEST 1998: Martin Schulze - * Redirected some error output with regard to argument parsing to - * stderr. - * - * Mon Oct 12 14:02:51 CEST 1998: Martin Schulze - * Applied patch provided vom Topi Miettinen with regard to the - * people from OpenBSD. This provides the additional '-a' - * argument used for specifying additional UNIX domain sockets to - * listen to. This is been used with chroot()'ed named's for - * example. See for http://www.psionic.com/papers/dns.html - * - * Mon Oct 12 18:29:44 CEST 1998: Martin Schulze - * Added `ftp' facility which was introduced in glibc version 2. - * It's #ifdef'ed so won't harm with older libraries. - * - * Mon Oct 12 19:59:21 MET DST 1998: Martin Schulze - * Code cleanups with regard to bsd -> posix transition and - * stronger security (buffer length checking). Thanks to Topi - * Miettinen - * . index() --> strchr() - * . sprintf() --> snprintf() - * . bcopy() --> memcpy() - * . bzero() --> memset() - * . UNAMESZ --> UT_NAMESIZE - * . sys_errlist --> strerror() - * - * Mon Oct 12 20:22:59 CEST 1998: Martin Schulze - * Added support for setutent()/getutent()/endutend() instead of - * binary reading the UTMP file. This is the the most portable - * way. This allows /var/run/utmp format to change, even to a - * real database or utmp daemon. Also if utmp file locking is - * implemented in libc, syslog will use it immediately. Thanks - * to Topi Miettinen . - * - * Mon Oct 12 20:49:18 MET DST 1998: Martin Schulze - * Avoid logging of SIGCHLD when syslogd is in the process of - * exiting and closing its files. Again thanks to Topi. - * - * Mon Oct 12 22:18:34 CEST 1998: Martin Schulze - * Modified printline() to support 8bit characters - such as - * russion letters. Thanks to Vladas Lapinskas . - * - * Sat Nov 14 02:29:37 CET 1998: Martin Schulze - * ``-m 0'' now turns of MARK logging entirely. - * - * Tue Jan 19 01:04:18 MET 1999: Martin Schulze - * Finally fixed an error with `-a' processing, thanks to Topi - * Miettinen . - * - * Sun May 23 10:08:53 CEST 1999: Martin Schulze - * Removed superflous call to utmpname(). The path to the utmp - * file is defined in the used libc and should not be hardcoded - * into the syslogd binary referring the system it was compiled on. - * - * Sun Sep 17 21:26:16 CEST 2000: Martin Schulze - * Don't close open sockets upon reload. Thanks to Bill - * Nottingham. - * - * Mon Sep 18 09:10:47 CEST 2000: Martin Schulze - * Fixed bug in printchopped() that caused syslogd to emit - * kern.emerg messages when splitting long lines. Thanks to - * Daniel Jacobowitz for the fix. - * - * Mon Sep 18 15:33:26 CEST 2000: Martin Schulze - * Removed unixm/unix domain sockets and switch to Datagram Unix - * Sockets. This should remove one possibility to play DoS with - * syslogd. Thanks to Olaf Kirch for the patch. - * - * Sun Mar 11 20:23:44 CET 2001: Martin Schulze - * Don't return a closed fd if `-a' is called with a wrong path. - * Thanks to Bill Nottingham for providing - * a patch. - * Thu Apr 13 05:08:10 CEST 2001: Jon Burgess - * Moved the installation of the signal handler up a little bit - * so it guaranteed to be available when the child is forked, - * hence, fixing a race condition. This used to create problems - * with UML and fast machines. - * - * Sat Apr 17 18:03:05 CEST 2004: Steve Grubb - * Correct memory allocation for for commandline arguments in - * crunch_list(). - * - * Thu Apr 29 12:38:39 CEST 2004: Solar Designer - * Applied Openwall paranoia patches to improve crunch_list(). - * - * Tue May 4 16:47:30 CEST 2004: Solar Designer - * Ensure that "len" is not placed in a register, and that the - * endtty() signal handler is not installed too early which could - * cause a segmentation fault or worse. - * - * Tue May 4 16:52:01 CEST 2004: Solar Designer - * Adjust the size of a variable to prevent a buffer overflow - * should _PATH_DEV ever contain something different than "/dev/". - * - * Tue Nov 2 20:28:23 CET 2004: Colin Phipps - * Don't block on the network socket, in case a packet gets lost - * between select and recv. - * - * Sun Nov 7 12:28:47 CET 2004: Martin Schulze - * Discard any timestamp information found in received syslog - * messages. This will affect local messages sent from a - * different timezone. - * - * Sun Nov 7 13:47:00 CET 2004: Martin Schulze - * Remove trailing newline when forwarding messages. - * - * Thu May 25 09:47:38 CEST 2006: Martin Schulze - * Reset the 'restart' flag immediately after entering the - * restart code, so that subsequent SIGHUPs are able to set it - * again and cause a new restart. This fixes a race condition - * when somebody sends tons of HUP signals. - * - * Thu May 24 15:24:49 CEST 2007: Martin Schulze - * Ignore errors caused by filled up disks so that the log - * continues to be written as soon as space becomes available - * again. - * - * Sat May 26 10:05:05 CEST 2007: Martin Schulze - * Only try to gather the local domain name when messages are to - * be received from the network, it's not needed otherwise. - * - * Sat May 26 12:22:44 CEST 2007: Martin Schulze - * Properly accompany the MARK message with the facility. - * - * Mon May 28 19:44:39 CEST 2007: Martin Schulze - * Notify the waiting parent process if the client dies to it - * doesn't wait the entire five minutes. - * - * Wed Jul 4 21:02:22 CEST 2007: Martin Schulze - * Open a pipe with O_NOCTTY to avoid them becoming the controlling - * tty and normal files with O_NONBLOCK to avoid blocking. - * - * Fri Oct 26 17:21:15 CEST 2007: Thomas Jarosch - * Move hostname setting code from main() into init(). - * - * Wed May 7 21:00:39 CEST 2007: Martin Schulze - * Make sure that the service name is only queried, when it is needed, - * i.e. when we are sending to or receiving from the network. - * - * Sun Oct 11 11:28:07 CEST 2009: Joachim Nilsson - * Port log rotation from BusyBox syslogd. This adds -b and -c - * options for size and rotate count. Disabled by default. - * - * Fri Sep 10 08:29:04 CEST 2010: Martin Schulze - * Replace strcpy with memmove to fix continuation line problems - * on 64bit architectures, patch by David Couture. */ #define MAXLINE 1024 /* maximum line length */