%n sysklogd %v 1.3 %c * %l * %b * %d * %f * %t sysklogd-1.3.tgz %w Linux %% %setup patch -u -p1 <<'ENDPATCH' diff -ru2N sysklogd-1.3/Makefile sysklogd-MCC/Makefile --- sysklogd-1.3/Makefile Mon Feb 19 21:18:23 1996 +++ sysklogd-MCC/Makefile Thu Aug 29 00:49:59 1996 @@ -5,5 +5,5 @@ #LDFLAGS= -g CFLAGS= -O6 -DSYSV -fomit-frame-pointer -Wall -LDFLAGS= -s -N +LDFLAGS= # Look where your install program is @@ -37,5 +37,5 @@ # 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} \ @@ -49,5 +49,9 @@ all: syslogd klogd syslog_tst -install: install_man install_exec +install: all + install -s -m 544 syslogd klogd $(BINDIR) + install -m 444 sysklogd.8 syslogd.8 klogd.8 ${MANDIR}/man8 + install -m 444 syslog.conf.5 ${MANDIR}/man5 + gzip -9f ${MANDIR}/man5/*.5 ${MANDIR}/man8/*.8 syslogd: syslogd.o pidfile.o diff -ru2N sysklogd-1.3/klogd.c sysklogd-MCC/klogd.c --- sysklogd-1.3/klogd.c Sat Feb 17 20:02:54 1996 +++ sysklogd-MCC/klogd.c Thu Aug 29 00:56:38 1996 @@ -141,5 +141,9 @@ * 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. */ @@ -440,4 +444,5 @@ static int index = 0; auto char *nl; + auto char *pend = ptr + len; static char line[LOG_LINE_LENGTH], eline[LOG_LINE_LENGTH]; @@ -468,6 +473,8 @@ 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); diff -ru2N sysklogd-1.3/ksym.c sysklogd-MCC/ksym.c --- sysklogd-1.3/ksym.c Sat Feb 17 20:02:49 1996 +++ sysklogd-MCC/ksym.c Thu Aug 29 00:56:38 1996 @@ -404,5 +404,5 @@ { - auto char vstring[6]; + auto char vstring[12]; auto int vnum, diff -ru2N sysklogd-1.3/sysklogd.8 sysklogd-MCC/sysklogd.8 --- sysklogd-1.3/sysklogd.8 Sat Feb 17 20:02:54 1996 +++ sysklogd-MCC/sysklogd.8 Thu Aug 29 00:54:43 1996 @@ -3,5 +3,5 @@ .\" Sun Aug 30 11:35:55 MET: Martin Schulze: Updates .\" -.TH SYSKLOGD 8 "13 December 1995" "Version 1.3" "Linux System Administration" +.TH SYSLOGD 8 "13 December 1995" "Version 1.3" "Linux System Administration" .SH NAME sysklogd \- Linux system logging utilities. diff -ru2N sysklogd-1.3/syslog.conf.5 sysklogd-MCC/syslog.conf.5 --- sysklogd-1.3/syslog.conf.5 Fri Dec 15 21:11:35 1995 +++ sysklogd-MCC/syslog.conf.5 Thu Aug 29 00:55:39 1996 @@ -20,5 +20,5 @@ .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 diff -ru2N sysklogd-1.3/syslogd.c sysklogd-MCC/syslogd.c --- sysklogd-1.3/syslogd.c Mon Feb 19 15:24:33 1996 +++ sysklogd-MCC/syslogd.c Thu Aug 29 00:56:39 1996 @@ -270,4 +270,16 @@ * * 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 causes by checking + * the wrong error code. Thanks to Michael Nonweiler + * 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 has sent us + * a patch to correct this. A new logfile type F_PIPE has been + * introduced. */ @@ -474,8 +486,9 @@ #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" }; @@ -718,9 +731,12 @@ */ 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; + } } } @@ -1498,7 +1514,8 @@ 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; @@ -1510,9 +1527,21 @@ 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) { @@ -1847,4 +1876,5 @@ * Close all open log files. */ +/* Initialized = 0; if ( nlogs > -1 ) @@ -1855,4 +1885,5 @@ Files = (struct filed *) 0; } +*/ #ifdef SYSV @@ -1868,4 +1899,5 @@ switch (f->f_type) { case F_FILE: + case F_PIPE: case F_TTY: case F_CONSOLE: @@ -1950,4 +1982,5 @@ switch (f->f_type) { case F_FILE: + case F_PIPE: case F_TTY: case F_CONSOLE: @@ -2183,9 +2216,12 @@ 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 ){ @@ -2199,6 +2235,4 @@ untty(); } - else - f->f_type = F_FILE; if (strcmp(p, ctty) == 0) f->f_type = F_CONSOLE; ENDPATCH make * make install %%