Upgrading to version 1.3-15 from the archive

This commit is contained in:
Joey Schulze 1997-06-02 17:42:34 +00:00
parent 7834544c60
commit 251da95efb
6 changed files with 118 additions and 39 deletions

View File

@ -3,8 +3,8 @@
CC= gcc CC= gcc
#CFLAGS= -g -DSYSV -Wall #CFLAGS= -g -DSYSV -Wall
#LDFLAGS= -g #LDFLAGS= -g
CFLAGS= -O6 -DSYSV -fomit-frame-pointer -Wall CFLAGS= -O4 -DSYSV -fomit-frame-pointer -Wall
LDFLAGS= -s -N LDFLAGS= -s
# Look where your install program is # Look where your install program is
# #
@ -36,12 +36,12 @@ MAN_OWNER = root
# name for the syslogd pid to be syslog.pid. A number of people have # name for the syslogd pid to be syslog.pid. A number of people have
# suggested that this should be syslogd.pid. You may cast your # suggested that this should be syslogd.pid. You may cast your
# ballot below. # ballot below.
# SYSLOGD_PIDNAME = -DSYSLOGD_PIDNAME=\"syslogd.pid\" SYSLOGD_PIDNAME = -DSYSLOGD_PIDNAME=\"syslogd.pid\"
SYSLOGD_FLAGS= -DSYSLOG_INET -DSYSLOG_UNIXAF -DNO_SCCS ${FSSTND} \ SYSLOGD_FLAGS= -DSYSLOG_INET -DSYSLOG_UNIXAF -DNO_SCCS ${FSSTND} \
${SYSLOGD_PIDNAME} ${SYSLOGD_PIDNAME} -DDEBRELEASE=\"$(revision)\"
SYSLOG_FLAGS= -DALLOW_KERNEL_LOGGING SYSLOG_FLAGS= -DALLOW_KERNEL_LOGGING
KLOGD_FLAGS = ${FSSTND} ${KLOGD_START_DELAY} KLOGD_FLAGS = ${FSSTND} ${KLOGD_START_DELAY} -DDEBRELEASE=\"$(revision)\"
.c.o: .c.o:
${CC} ${CFLAGS} -c $*.c ${CC} ${CFLAGS} -c $*.c
@ -88,4 +88,4 @@ install_man:
${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 sysklogd.8 ${MANDIR}/man8/sysklogd.8 ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 sysklogd.8 ${MANDIR}/man8/sysklogd.8
${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslogd.8 ${MANDIR}/man8/syslogd.8 ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslogd.8 ${MANDIR}/man8/syslogd.8
${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslog.conf.5 ${MANDIR}/man5/syslog.conf.5 ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslog.conf.5 ${MANDIR}/man5/syslog.conf.5
${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 klogd.8 ${MANDIR}/MAN8/klogd.8 ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 klogd.8 ${MANDIR}/man8/klogd.8

21
klogd.c
View File

@ -141,6 +141,10 @@
* termination cleanup sequence. This minimizes the potential for * termination cleanup sequence. This minimizes the potential for
* conflicting pidfiles causing immediate termination at boot time. * conflicting pidfiles causing immediate termination at boot time.
* *
* Sun May 12 12:18:21 MET DST 1996: Martin Schulze
* Corrected incorrect/insecure use of strpbrk for a not necessarily
* null-terminated buffer. Used a patch from Chris Hanson
* (cph@martigny.ai.mit.edu), thanks.
*/ */
@ -350,8 +354,8 @@ static enum LOGSRC GetKernelLogSrc(void)
{ {
/* Initialize kernel logging. */ /* Initialize kernel logging. */
sys_syslog(1, NULL, 0); sys_syslog(1, NULL, 0);
Syslog(LOG_INFO, "klogd %s-%s, log source = sys_syslog " Syslog(LOG_INFO, "klogd %s-%s#%s, log source = sys_syslog "
"started.", VERSION, PATCHLEVEL); "started.", VERSION, PATCHLEVEL, DEBRELEASE);
return(kernel); return(kernel);
} }
@ -362,8 +366,8 @@ static enum LOGSRC GetKernelLogSrc(void)
exit(1); exit(1);
} }
Syslog(LOG_INFO, "klogd %s-%s, log source = %s started.", \ Syslog(LOG_INFO, "klogd %s-%s#%s, log source = %s started.", \
VERSION, PATCHLEVEL, _PATH_KLOG); VERSION, PATCHLEVEL, DEBRELEASE, _PATH_KLOG);
return(proc); return(proc);
} }
@ -439,6 +443,7 @@ static void LogLine(char *ptr, int len)
auto int idx = 0; auto int idx = 0;
static int index = 0; static int index = 0;
auto char *nl; auto char *nl;
auto char *pend = ptr + len;
static char line[LOG_LINE_LENGTH], static char line[LOG_LINE_LENGTH],
eline[LOG_LINE_LENGTH]; eline[LOG_LINE_LENGTH];
@ -467,8 +472,10 @@ static void LogLine(char *ptr, int len)
memset(line, '\0', sizeof(line)); memset(line, '\0', sizeof(line));
while (len) { while (len) {
nl = strpbrk(ptr, "\r\n"); /* Find first line terminator */ for (nl = ptr; nl < pend; nl += 1)
if (nl) { if ((*nl == '\n') || (*nl == '\r'))
break;
if (nl != pend) {
len -= nl - ptr + 1; len -= nl - ptr + 1;
strncat(line, ptr, nl - ptr); strncat(line, ptr, nl - ptr);
ptr = nl + 1; ptr = nl + 1;
@ -595,7 +602,7 @@ int main(argc, argv)
use_syscall = 1; use_syscall = 1;
break; break;
case 'v': case 'v':
printf("klogd %s-%s\n", VERSION, PATCHLEVEL); printf("klogd %s-%s#%s\n", VERSION, PATCHLEVEL,DEBRELEASE);
exit (1); exit (1);
} }

4
ksym.c
View File

@ -93,8 +93,8 @@ static int num_syms = 0;
static char *system_maps[] = static char *system_maps[] =
{ {
"/boot/System.map",
"/System.map", "/System.map",
"/boot/System.map",
"/usr/src/linux/System.map", "/usr/src/linux/System.map",
#if defined(TEST) #if defined(TEST)
"./System.map", "./System.map",
@ -403,7 +403,7 @@ static int CheckVersion(version)
{ {
auto char vstring[6]; auto char vstring[12];
auto int vnum, auto int vnum,
major, major,

View File

@ -1,4 +1,4 @@
# /etc/syslog.conf - Configuration file for sysklogd(8) # /etc/syslog.conf - Configuration file for syslogd(8)
# #
# For info about the format of this file, see "man syslog.conf". # For info about the format of this file, see "man syslog.conf".
# #

View File

@ -1,4 +1,4 @@
.\" syslog.conf - sysklogd(8) configuration file .\" syslog.conf - syslogd(8) configuration file
.\" Copyright (c) 1995 Martin Schulze <Martin.Schulze@Linux.DE> .\" Copyright (c) 1995 Martin Schulze <Martin.Schulze@Linux.DE>
.\" .\"
.\" This file is part of the sysklogd package, a kernel and system log daemon. .\" This file is part of the sysklogd package, a kernel and system log daemon.
@ -19,7 +19,7 @@
.\" .\"
.TH SYSLOG.CONF 5 "24 November 1995" "Version 1.3" "Linux System Administration" .TH SYSLOG.CONF 5 "24 November 1995" "Version 1.3" "Linux System Administration"
.SH NAME .SH NAME
syslog.conf \- sysklogd(8) configuration file syslog.conf \- syslogd(8) configuration file
.SH DESCRIPTION .SH DESCRIPTION
The The
.I syslog.conf .I syslog.conf

104
syslogd.c
View File

@ -269,6 +269,30 @@ static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88";
* when syslogd starts up. * when syslogd starts up.
* *
* Minor code cleanups. * Minor code cleanups.
*
* 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
* <mrn20@hermes.cam.ac.uk> for sending me a patch.
*
* Tue May 28 00:58:45 MET DST 1996: Martin Schulze
* Corrected behaviour of blocking pipes - i.e. the whole system
* hung. Michael Nonweiler <mrn20@hermes.cam.ac.uk> 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.
*/ */
@ -290,6 +314,7 @@ static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88";
#include <setjmp.h> #include <setjmp.h>
#include <stdarg.h> #include <stdarg.h>
#define SYSLOG_NAMES
#include <sys/syslog.h> #include <sys/syslog.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/errno.h> #include <sys/errno.h>
@ -473,10 +498,11 @@ int repeatinterval[] = { 30, 60 }; /* # of secs before flush */
#define F_WALL 6 /* everyone logged on */ #define F_WALL 6 /* everyone logged on */
#define F_FORW_SUSP 7 /* suspended host forwarding */ #define F_FORW_SUSP 7 /* suspended host forwarding */
#define F_FORW_UNKN 8 /* unknown host forwarding */ #define F_FORW_UNKN 8 /* unknown host forwarding */
char *TypeNames[9] = { #define F_PIPE 9 /* named pipe */
char *TypeNames[] = {
"UNUSED", "FILE", "TTY", "CONSOLE", "UNUSED", "FILE", "TTY", "CONSOLE",
"FORW", "USERS", "WALL", "FORW(SUSPENDED)", "FORW", "USERS", "WALL", "FORW(SUSPENDED)",
"FORW(UNKNOWN)" "FORW(UNKNOWN)", "PIPE"
}; };
struct filed *Files = (struct filed *) 0; struct filed *Files = (struct filed *) 0;
@ -642,7 +668,7 @@ int main(argc, argv)
break; break;
case 'v': case 'v':
printf("syslogd %s-%s\n", VERSION, PATCHLEVEL); printf("syslogd %s-%s\n", VERSION, PATCHLEVEL);
exit (1); exit (0);
case '?': case '?':
default: default:
usage(); usage();
@ -717,6 +743,8 @@ int main(argc, argv)
* we want to distribute good software. Joey * we want to distribute good software. Joey
*/ */
hent = gethostbyname(LocalHostName); hent = gethostbyname(LocalHostName);
if (hent != NULL)
{
sprintf(LocalHostName, "%s", hent->h_name); sprintf(LocalHostName, "%s", hent->h_name);
if ( (p = index(LocalHostName, '.')) ) if ( (p = index(LocalHostName, '.')) )
{ {
@ -724,6 +752,7 @@ int main(argc, argv)
LocalDomain = p; LocalDomain = p;
} }
} }
}
/* /*
* Convert to lower case to recognize the correct domain laterly * Convert to lower case to recognize the correct domain laterly
@ -813,11 +842,11 @@ int main(argc, argv)
dprintf("Debugging disabled, SIGUSR1 to turn on debugging.\n"); dprintf("Debugging disabled, SIGUSR1 to turn on debugging.\n");
debugging_on = 0; debugging_on = 0;
} }
/*
if (quitpid) { if (quitpid) {
kill(quitpid, SIGINT); kill(quitpid, SIGINT);
} }
*/
/* Main loop begins here. */ /* Main loop begins here. */
FD_ZERO(&unixm); FD_ZERO(&unixm);
FD_ZERO(&readfds); FD_ZERO(&readfds);
@ -1223,6 +1252,24 @@ void printsys(msg)
return; return;
} }
/*
* Decode a priority into textual information like auth.emerg.
*/
char *textpri(pri)
int pri;
{
static char res[20];
CODE *c_pri, *c_fac;
for (c_fac = facilitynames; c_fac->c_name && !(c_fac->c_val == LOG_FAC(pri)<<3); c_fac++);
for (c_pri = prioritynames; c_pri->c_name && !(c_pri->c_val == LOG_PRI(pri)); c_pri++);
/* sprintf (res, "%d.%d", LOG_FAC(pri), LOG_PRI(pri));*/
sprintf (res, "%s.%s<%d>", c_fac->c_name, c_pri->c_name, pri);
return res;
}
time_t now; time_t now;
/* /*
@ -1241,7 +1288,7 @@ void logmsg(pri, msg, from, flags)
int msglen; int msglen;
char *timestamp; char *timestamp;
dprintf("logmsg: pri %o, flags %x, from %s, msg %s\n", pri, flags, from, msg); dprintf("logmsg: %s, flags %x, from %s, msg %s\n", textpri(pri), flags, from, msg);
#ifndef SYSV #ifndef SYSV
omask = sigblock(sigmask(SIGHUP)|sigmask(SIGALRM)); omask = sigblock(sigmask(SIGHUP)|sigmask(SIGALRM));
@ -1497,9 +1544,10 @@ void fprintlog(f, from, flags, msg)
case F_TTY: case F_TTY:
case F_FILE: case F_FILE:
case F_PIPE:
f->f_time = now; f->f_time = now;
dprintf(" %s\n", f->f_un.f_fname); dprintf(" %s\n", f->f_un.f_fname);
if (f->f_type != F_FILE) { if (f->f_type == F_TTY || f->f_type == F_CONSOLE) {
v->iov_base = "\r\n"; v->iov_base = "\r\n";
v->iov_len = 2; v->iov_len = 2;
} else { } else {
@ -1507,13 +1555,30 @@ void fprintlog(f, from, flags, msg)
v->iov_len = 1; v->iov_len = 1;
} }
again: again:
/* f->f_file == -1 is an indicator that the we couldn't
open the file at startup. */
if (f->f_file == -1)
break;
if (writev(f->f_file, iov, 6) < 0) { if (writev(f->f_file, iov, 6) < 0) {
int e = errno; int e = errno;
/* If a named pipe is full, just ignore it for now
- mrn 24 May 96 */
if (f->f_type == F_PIPE && e == EAGAIN)
break;
(void) close(f->f_file); (void) close(f->f_file);
/* /*
* Check for EBADF on TTY's due to vhangup() XXX * Check for EBADF on TTY's due to vhangup() XXX
* Linux uses EIO instead (mrn 12 May 96)
*/ */
if (e == EBADF && f->f_type != F_FILE) { if ((f->f_type == F_TTY || f->f_type == F_CONSOLE)
#ifdef linux
&& e == EIO) {
#else
&& e == EBADF) {
#endif
f->f_file = open(f->f_un.f_fname, O_WRONLY|O_APPEND|O_NOCTTY); f->f_file = open(f->f_un.f_fname, O_WRONLY|O_APPEND|O_NOCTTY);
if (f->f_file < 0) { if (f->f_file < 0) {
f->f_type = F_UNUSED; f->f_type = F_UNUSED;
@ -1846,6 +1911,7 @@ void init()
/* /*
* Close all open log files. * Close all open log files.
*/ */
/*
Initialized = 0; Initialized = 0;
if ( nlogs > -1 ) if ( nlogs > -1 )
{ {
@ -1854,6 +1920,7 @@ void init()
free((void *) Files); free((void *) Files);
Files = (struct filed *) 0; Files = (struct filed *) 0;
} }
*/
#ifdef SYSV #ifdef SYSV
for (lognum = 0; lognum <= nlogs; lognum++ ) { for (lognum = 0; lognum <= nlogs; lognum++ ) {
@ -1867,6 +1934,7 @@ void init()
switch (f->f_type) { switch (f->f_type) {
case F_FILE: case F_FILE:
case F_PIPE:
case F_TTY: case F_TTY:
case F_CONSOLE: case F_CONSOLE:
(void) close(f->f_file); (void) close(f->f_file);
@ -1949,9 +2017,12 @@ void init()
printf("%s: ", TypeNames[f->f_type]); printf("%s: ", TypeNames[f->f_type]);
switch (f->f_type) { switch (f->f_type) {
case F_FILE: case F_FILE:
case F_PIPE:
case F_TTY: case F_TTY:
case F_CONSOLE: case F_CONSOLE:
printf("%s", f->f_un.f_fname); printf("%s", f->f_un.f_fname);
if (f->f_file == -1)
printf(" (unused)");
break; break;
case F_FORW: case F_FORW:
@ -1971,11 +2042,11 @@ void init()
} }
if ( AcceptRemote ) if ( AcceptRemote )
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL \ logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL "#" DEBRELEASE \
": restart (remote reception)." , LocalHostName, \ ": restart (remote reception)." , LocalHostName, \
ADDDATE); ADDDATE);
else else
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL \ logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL "#" DEBRELEASE \
": restart." , LocalHostName, ADDDATE); ": restart." , LocalHostName, ADDDATE);
(void) signal(SIGHUP, sighup_handler); (void) signal(SIGHUP, sighup_handler);
dprintf("syslogd: restarted.\n"); dprintf("syslogd: restarted.\n");
@ -2182,14 +2253,17 @@ void cfline(line, f)
dprintf ("filename: %s\n", p); /*ASP*/ dprintf ("filename: %s\n", p); /*ASP*/
if (syncfile) if (syncfile)
f->f_flags |= SYNC_FILE; f->f_flags |= SYNC_FILE;
if ( *p == '|' ) if ( *p == '|' ) {
f->f_file = open(++p, O_RDWR); f->f_file = open(++p, O_RDWR|O_NONBLOCK);
else f->f_type = F_PIPE;
} else {
f->f_file = open(p, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY, f->f_file = open(p, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY,
0644); 0644);
f->f_type = F_FILE;
}
if ( f->f_file < 0 ){ if ( f->f_file < 0 ){
f->f_file = F_UNUSED; f->f_file = -1;
dprintf("Error opening log file: %s\n", p); dprintf("Error opening log file: %s\n", p);
logerror(p); logerror(p);
break; break;
@ -2198,8 +2272,6 @@ void cfline(line, f)
f->f_type = F_TTY; f->f_type = F_TTY;
untty(); untty();
} }
else
f->f_type = F_FILE;
if (strcmp(p, ctty) == 0) if (strcmp(p, ctty) == 0)
f->f_type = F_CONSOLE; f->f_type = F_CONSOLE;
break; break;