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
#CFLAGS= -g -DSYSV -Wall
#LDFLAGS= -g
CFLAGS= -O6 -DSYSV -fomit-frame-pointer -Wall
LDFLAGS= -s -N
CFLAGS= -O4 -DSYSV -fomit-frame-pointer -Wall
LDFLAGS= -s
# 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
# suggested that this should be syslogd.pid. You may cast your
# ballot below.
# SYSLOGD_PIDNAME = -DSYSLOGD_PIDNAME=\"syslogd.pid\"
SYSLOGD_PIDNAME = -DSYSLOGD_PIDNAME=\"syslogd.pid\"
SYSLOGD_FLAGS= -DSYSLOG_INET -DSYSLOG_UNIXAF -DNO_SCCS ${FSSTND} \
${SYSLOGD_PIDNAME}
${SYSLOGD_PIDNAME} -DDEBRELEASE=\"$(revision)\"
SYSLOG_FLAGS= -DALLOW_KERNEL_LOGGING
KLOGD_FLAGS = ${FSSTND} ${KLOGD_START_DELAY}
KLOGD_FLAGS = ${FSSTND} ${KLOGD_START_DELAY} -DDEBRELEASE=\"$(revision)\"
.c.o:
${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 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 klogd.8 ${MANDIR}/MAN8/klogd.8
${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 klogd.8 ${MANDIR}/man8/klogd.8

23
klogd.c
View File

@ -140,7 +140,11 @@
* 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.
*
*
* 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. */
sys_syslog(1, NULL, 0);
Syslog(LOG_INFO, "klogd %s-%s, log source = sys_syslog "
"started.", VERSION, PATCHLEVEL);
Syslog(LOG_INFO, "klogd %s-%s#%s, log source = sys_syslog "
"started.", VERSION, PATCHLEVEL, DEBRELEASE);
return(kernel);
}
@ -362,8 +366,8 @@ static enum LOGSRC GetKernelLogSrc(void)
exit(1);
}
Syslog(LOG_INFO, "klogd %s-%s, log source = %s started.", \
VERSION, PATCHLEVEL, _PATH_KLOG);
Syslog(LOG_INFO, "klogd %s-%s#%s, log source = %s started.", \
VERSION, PATCHLEVEL, DEBRELEASE, _PATH_KLOG);
return(proc);
}
@ -439,6 +443,7 @@ static void LogLine(char *ptr, int len)
auto int idx = 0;
static int index = 0;
auto char *nl;
auto char *pend = ptr + len;
static char line[LOG_LINE_LENGTH],
eline[LOG_LINE_LENGTH];
@ -467,8 +472,10 @@ static void LogLine(char *ptr, int len)
memset(line, '\0', sizeof(line));
while (len) {
nl = strpbrk(ptr, "\r\n"); /* Find first line terminator */
if (nl) {
for (nl = ptr; nl < pend; nl += 1)
if ((*nl == '\n') || (*nl == '\r'))
break;
if (nl != pend) {
len -= nl - ptr + 1;
strncat(line, ptr, nl - ptr);
ptr = nl + 1;
@ -595,7 +602,7 @@ int main(argc, argv)
use_syscall = 1;
break;
case 'v':
printf("klogd %s-%s\n", VERSION, PATCHLEVEL);
printf("klogd %s-%s#%s\n", VERSION, PATCHLEVEL,DEBRELEASE);
exit (1);
}

4
ksym.c
View File

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

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>
.\"
.\" 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"
.SH NAME
syslog.conf \- sysklogd(8) configuration file
syslog.conf \- syslogd(8) configuration file
.SH DESCRIPTION
The
.I syslog.conf

112
syslogd.c
View File

@ -269,6 +269,30 @@ static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88";
* when syslogd starts up.
*
* 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 <stdarg.h>
#define SYSLOG_NAMES
#include <sys/syslog.h>
#include <sys/param.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_FORW_SUSP 7 /* suspended 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",
"FORW", "USERS", "WALL", "FORW(SUSPENDED)",
"FORW(UNKNOWN)"
"FORW(UNKNOWN)", "PIPE"
};
struct filed *Files = (struct filed *) 0;
@ -642,7 +668,7 @@ int main(argc, argv)
break;
case 'v':
printf("syslogd %s-%s\n", VERSION, PATCHLEVEL);
exit (1);
exit (0);
case '?':
default:
usage();
@ -717,11 +743,14 @@ int main(argc, argv)
* we want to distribute good software. Joey
*/
hent = gethostbyname(LocalHostName);
sprintf(LocalHostName, "%s", hent->h_name);
if ( (p = index(LocalHostName, '.')) )
if (hent != NULL)
{
*p++ = '\0';
LocalDomain = p;
sprintf(LocalHostName, "%s", hent->h_name);
if ( (p = index(LocalHostName, '.')) )
{
*p++ = '\0';
LocalDomain = p;
}
}
}
@ -813,11 +842,11 @@ int main(argc, argv)
dprintf("Debugging disabled, SIGUSR1 to turn on debugging.\n");
debugging_on = 0;
}
/*
if (quitpid) {
kill(quitpid, SIGINT);
}
*/
/* Main loop begins here. */
FD_ZERO(&unixm);
FD_ZERO(&readfds);
@ -1223,6 +1252,24 @@ void printsys(msg)
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;
/*
@ -1241,7 +1288,7 @@ void logmsg(pri, msg, from, flags)
int msglen;
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
omask = sigblock(sigmask(SIGHUP)|sigmask(SIGALRM));
@ -1497,9 +1544,10 @@ void fprintlog(f, from, flags, msg)
case F_TTY:
case F_FILE:
case F_PIPE:
f->f_time = now;
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_len = 2;
} else {
@ -1507,13 +1555,30 @@ void fprintlog(f, from, flags, msg)
v->iov_len = 1;
}
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) {
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);
/*
* 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);
if (f->f_file < 0) {
f->f_type = F_UNUSED;
@ -1846,6 +1911,7 @@ void init()
/*
* Close all open log files.
*/
/*
Initialized = 0;
if ( nlogs > -1 )
{
@ -1854,6 +1920,7 @@ void init()
free((void *) Files);
Files = (struct filed *) 0;
}
*/
#ifdef SYSV
for (lognum = 0; lognum <= nlogs; lognum++ ) {
@ -1867,6 +1934,7 @@ void init()
switch (f->f_type) {
case F_FILE:
case F_PIPE:
case F_TTY:
case F_CONSOLE:
(void) close(f->f_file);
@ -1949,9 +2017,12 @@ void init()
printf("%s: ", TypeNames[f->f_type]);
switch (f->f_type) {
case F_FILE:
case F_PIPE:
case F_TTY:
case F_CONSOLE:
printf("%s", f->f_un.f_fname);
if (f->f_file == -1)
printf(" (unused)");
break;
case F_FORW:
@ -1971,11 +2042,11 @@ void init()
}
if ( AcceptRemote )
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL \
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL "#" DEBRELEASE \
": restart (remote reception)." , LocalHostName, \
ADDDATE);
else
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL \
logmsg(LOG_SYSLOG|LOG_INFO, "syslogd " VERSION "-" PATCHLEVEL "#" DEBRELEASE \
": restart." , LocalHostName, ADDDATE);
(void) signal(SIGHUP, sighup_handler);
dprintf("syslogd: restarted.\n");
@ -2182,14 +2253,17 @@ void cfline(line, f)
dprintf ("filename: %s\n", p); /*ASP*/
if (syncfile)
f->f_flags |= SYNC_FILE;
if ( *p == '|' )
f->f_file = open(++p, O_RDWR);
else
if ( *p == '|' ) {
f->f_file = open(++p, O_RDWR|O_NONBLOCK);
f->f_type = F_PIPE;
} else {
f->f_file = open(p, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY,
0644);
f->f_type = F_FILE;
}
if ( f->f_file < 0 ){
f->f_file = F_UNUSED;
f->f_file = -1;
dprintf("Error opening log file: %s\n", p);
logerror(p);
break;
@ -2198,8 +2272,6 @@ void cfline(line, f)
f->f_type = F_TTY;
untty();
}
else
f->f_type = F_FILE;
if (strcmp(p, ctty) == 0)
f->f_type = F_CONSOLE;
break;