[8f3d581] | 1 | Submitted By: Robert Connolly <robert at linuxfromscratch dot org> (ashes)
|
---|
| 2 | Date: 2005-01-23
|
---|
| 3 | Initial Package Version: 1.4.1
|
---|
| 4 | Upstream Status: Not submitted
|
---|
| 5 | Origin: http://www.infodrom.org/projects/sysklogd/cvs.php3
|
---|
| 6 | Description: This patch is a cvs snapshot update as of 20050123.
|
---|
| 7 | Minus the debain and CVS directories. See the CHANGES.
|
---|
| 8 |
|
---|
| 9 | diff -Naur sysklogd-1.4.1/CHANGES sysklogd-20050123/CHANGES
|
---|
| 10 | --- sysklogd-1.4.1/CHANGES 2001-03-11 14:35:51.000000000 -0500
|
---|
| 11 | +++ sysklogd-20050123/CHANGES 2005-01-15 14:14:21.000000000 -0500
|
---|
| 12 | @@ -1,3 +1,42 @@
|
---|
| 13 | +Version 1.4.2
|
---|
| 14 | +
|
---|
| 15 | + . Dmitry V. Levin <ldv@altlinux.org>
|
---|
| 16 | + - Close file descriptor in FindSymbolFile() in ksym.c in order not to
|
---|
| 17 | + leak file descriptors.
|
---|
| 18 | + . Solar Designer <solar@openwall.com>
|
---|
| 19 | + - improve crunch_list()
|
---|
| 20 | + - Prevent potential buffer overflow in reading messages from the
|
---|
| 21 | + kernel log ringbuffer.
|
---|
| 22 | + - Ensure that "len" is not placed in a register, and that the
|
---|
| 23 | + endtty() signal handler is not installed too early which could
|
---|
| 24 | + cause a segmentation fault or worse.
|
---|
| 25 | + . Steve Grubb <linux_4ever@yahoo.com>
|
---|
| 26 | + - fix memory calculation in crunch_list()
|
---|
| 27 | + . Martin Schulze <joey@infodrom.org>
|
---|
| 28 | + - klogd will reconnect to the logger (mostly syslogd) after it went
|
---|
| 29 | + away
|
---|
| 30 | + - On heavily loaded system syslog will not spit out error messages
|
---|
| 31 | + anymore when recvfrom() results in EAGAIN
|
---|
| 32 | + - Makefile improvements
|
---|
| 33 | + - Local copy of module.h
|
---|
| 34 | + - Improved sysklogd.8
|
---|
| 35 | + - Always log with syslogd's timezone and locale
|
---|
| 36 | + - Remove trailing newline when forwarding messages
|
---|
| 37 | + . Jon Burgess <Jon_Burgess@eur.3com.com>
|
---|
| 38 | + - Moved the installation of the signal handler up a little bit so it
|
---|
| 39 | + guaranteed to be available when the child is forked, hence, fixing a
|
---|
| 40 | + race condition. This used to create problems with UML and fast
|
---|
| 41 | + machines.
|
---|
| 42 | + . Greg Trounson <gregt@maths.otago.ac.nz>
|
---|
| 43 | + - Improved README.linux
|
---|
| 44 | + . Ulf Härnhammar <Ulf.Harnhammar.9485@student.uu.se>
|
---|
| 45 | + - Bondary check for fscanf() in InitKsyms() and CheckMapVersion()
|
---|
| 46 | + . Colin Phipps <cph@cph.demon.co.uk>
|
---|
| 47 | + - Don't block on the network socket in case of package los
|
---|
| 48 | + . Dirk Mueller <mueller@kde.org>
|
---|
| 49 | + - Don't crash when filesize limit is reached (e.g. without LFS)
|
---|
| 50 | +
|
---|
| 51 | +
|
---|
| 52 | Version 1.4.1
|
---|
| 53 |
|
---|
| 54 | . klogd will set the console log level only if `-c' is given on the
|
---|
| 55 | @@ -30,3 +69,9 @@
|
---|
| 56 | . Olaf Kirch <okir@caldera.de>
|
---|
| 57 | - Remove Unix Domain Sockets and switch to Datagram Unix Sockets
|
---|
| 58 | . Several bugfixes and improvements, please refer to the .c files
|
---|
| 59 | +
|
---|
| 60 | +
|
---|
| 61 | +Local variables:
|
---|
| 62 | +mode: indented-text
|
---|
| 63 | +fill-column: 72
|
---|
| 64 | +End:
|
---|
| 65 | diff -Naur sysklogd-1.4.1/klogd.8 sysklogd-20050123/klogd.8
|
---|
| 66 | --- sysklogd-1.4.1/klogd.8 2001-03-11 14:35:51.000000000 -0500
|
---|
| 67 | +++ sysklogd-20050123/klogd.8 2001-03-11 18:00:51.000000000 -0500
|
---|
| 68 | @@ -321,7 +321,7 @@
|
---|
| 69 | .B klogd
|
---|
| 70 | to reload the module symbol information whenever a protection fault
|
---|
| 71 | is detected. Caution should be used before invoking the program in
|
---|
| 72 | -\'paranoid\' mode. The stability of the kernel and the operating
|
---|
| 73 | +\&'paranoid\&' mode. The stability of the kernel and the operating
|
---|
| 74 | environment is always under question when a protection fault occurs.
|
---|
| 75 | Since the klogd daemon must execute system calls in order to read the
|
---|
| 76 | module symbol information there is the possibility that the system may
|
---|
| 77 | diff -Naur sysklogd-1.4.1/klogd.c sysklogd-20050123/klogd.c
|
---|
| 78 | --- sysklogd-1.4.1/klogd.c 2001-03-11 14:40:10.000000000 -0500
|
---|
| 79 | +++ sysklogd-20050123/klogd.c 2004-04-29 09:29:03.000000000 -0400
|
---|
| 80 | @@ -243,6 +243,9 @@
|
---|
| 81 | * people have submitted patches: Troels Walsted Hansen
|
---|
| 82 | * <troels@thule.no>, Wolfgang Oertl <Wolfgang.Oertl@uibk.ac.at>
|
---|
| 83 | * and Thomas Roessler.
|
---|
| 84 | + * Thu Apr 29 15:24:07 2004: Solar Designer <solar@openwall.com>
|
---|
| 85 | + * Prevent potential buffer overflow in reading messages from the
|
---|
| 86 | + * kernel log rinbuffer.
|
---|
| 87 | */
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | @@ -938,7 +941,7 @@
|
---|
| 91 | * messages into this fresh buffer.
|
---|
| 92 | */
|
---|
| 93 | memset(log_buffer, '\0', sizeof(log_buffer));
|
---|
| 94 | - if ( (rdcnt = ksyslog(2, log_buffer, sizeof(log_buffer))) < 0 )
|
---|
| 95 | + if ( (rdcnt = ksyslog(2, log_buffer, sizeof(log_buffer)-1)) < 0 )
|
---|
| 96 | {
|
---|
| 97 | if ( errno == EINTR )
|
---|
| 98 | return;
|
---|
| 99 | diff -Naur sysklogd-1.4.1/ksym.c sysklogd-20050123/ksym.c
|
---|
| 100 | --- sysklogd-1.4.1/ksym.c 2000-09-12 17:53:31.000000000 -0400
|
---|
| 101 | +++ sysklogd-20050123/ksym.c 2004-07-16 02:48:27.000000000 -0400
|
---|
| 102 | @@ -105,6 +105,15 @@
|
---|
| 103 | *
|
---|
| 104 | * Tue Sep 12 23:48:12 CEST 2000: Martin Schulze <joey@infodrom.ffis.de>
|
---|
| 105 | * Close symbol file in InitKsyms() when an error occurred.
|
---|
| 106 | + *
|
---|
| 107 | + * Thu Apr 29 18:07:16 CEST 2004: Dmitry Levin <ldv@altlinux.org>
|
---|
| 108 | + * Close file descriptor in FindSymbolFile() in order not to leak
|
---|
| 109 | + * file descriptors.
|
---|
| 110 | + *
|
---|
| 111 | + * Fri Jul 16 08:32:49 CEST 2004: Ulf Härnhammar <Ulf.Harnhammar.9485@student.uu.se>
|
---|
| 112 | + * Added boundary check for fscanf() in InitKsyms() and
|
---|
| 113 | + * CheckMapVersion() to prevent an unintended crash when reading
|
---|
| 114 | + * an incorrect System.map.
|
---|
| 115 | */
|
---|
| 116 |
|
---|
| 117 |
|
---|
| 118 | @@ -236,7 +245,7 @@
|
---|
| 119 | */
|
---|
| 120 | while ( !feof(sym_file) )
|
---|
| 121 | {
|
---|
| 122 | - if ( fscanf(sym_file, "%lx %c %s\n", &address, &type, sym)
|
---|
| 123 | + if ( fscanf(sym_file, "%lx %c %511s\n", &address, &type, sym)
|
---|
| 124 | != 3 )
|
---|
| 125 | {
|
---|
| 126 | Syslog(LOG_ERR, "Error in symbol table input (#1).");
|
---|
| 127 | @@ -344,6 +353,7 @@
|
---|
| 128 | if ( (sym_file = fopen(symfile, "r")) != (FILE *) 0 ) {
|
---|
| 129 | if (CheckMapVersion(symfile) == 1)
|
---|
| 130 | file = symfile;
|
---|
| 131 | + fclose (sym_file);
|
---|
| 132 | }
|
---|
| 133 | if (sym_file == (FILE *) 0 || file == (char *) 0) {
|
---|
| 134 | sprintf (symfile, "%s", *mf);
|
---|
| 135 | @@ -352,6 +362,7 @@
|
---|
| 136 | if ( (sym_file = fopen(symfile, "r")) != (FILE *) 0 ) {
|
---|
| 137 | if (CheckMapVersion(symfile) == 1)
|
---|
| 138 | file = symfile;
|
---|
| 139 | + fclose (sym_file);
|
---|
| 140 | }
|
---|
| 141 | }
|
---|
| 142 |
|
---|
| 143 | @@ -533,7 +544,7 @@
|
---|
| 144 | version = 0;
|
---|
| 145 | while ( !feof(sym_file) && (version == 0) )
|
---|
| 146 | {
|
---|
| 147 | - if ( fscanf(sym_file, "%lx %c %s\n", &address, \
|
---|
| 148 | + if ( fscanf(sym_file, "%lx %c %511s\n", &address, \
|
---|
| 149 | &type, sym) != 3 )
|
---|
| 150 | {
|
---|
| 151 | Syslog(LOG_ERR, "Error in symbol table input (#2).");
|
---|
| 152 | @@ -899,3 +910,11 @@
|
---|
| 153 | return;
|
---|
| 154 | }
|
---|
| 155 | #endif
|
---|
| 156 | +
|
---|
| 157 | +/*
|
---|
| 158 | + * Local variables:
|
---|
| 159 | + * c-indent-level: 8
|
---|
| 160 | + * c-basic-offset: 8
|
---|
| 161 | + * tab-width: 8
|
---|
| 162 | + * End:
|
---|
| 163 | + */
|
---|
| 164 | diff -Naur sysklogd-1.4.1/ksym_mod.c sysklogd-20050123/ksym_mod.c
|
---|
| 165 | --- sysklogd-1.4.1/ksym_mod.c 2000-09-12 17:15:28.000000000 -0400
|
---|
| 166 | +++ sysklogd-20050123/ksym_mod.c 2004-03-31 10:47:08.000000000 -0500
|
---|
| 167 | @@ -78,6 +78,11 @@
|
---|
| 168 | *
|
---|
| 169 | * Tue Sep 12 23:11:13 CEST 2000: Martin Schulze <joey@infodrom.ffis.de>
|
---|
| 170 | * Changed llseek() to lseek64() in order to skip a libc warning.
|
---|
| 171 | + *
|
---|
| 172 | + * Wed Mar 31 17:35:01 CEST 2004: Martin Schulze <joey@infodrom.org>
|
---|
| 173 | + * Removed references to <linux/module.h> since it doesn't work
|
---|
| 174 | + * anymore with its recent content from Linux 2.4/2.6, created
|
---|
| 175 | + * module.h locally instead.
|
---|
| 176 | */
|
---|
| 177 |
|
---|
| 178 |
|
---|
| 179 | @@ -89,11 +94,12 @@
|
---|
| 180 | #include <errno.h>
|
---|
| 181 | #include <sys/fcntl.h>
|
---|
| 182 | #include <sys/stat.h>
|
---|
| 183 | +#include "module.h"
|
---|
| 184 | #if !defined(__GLIBC__)
|
---|
| 185 | #include <linux/time.h>
|
---|
| 186 | -#include <linux/module.h>
|
---|
| 187 | +#include <linux/linkage.h>
|
---|
| 188 | #else /* __GLIBC__ */
|
---|
| 189 | -#include <linux/module.h>
|
---|
| 190 | +#include <linux/linkage.h>
|
---|
| 191 | extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
|
---|
| 192 | extern int get_kernel_syms __P ((struct kernel_sym *__table));
|
---|
| 193 | #endif /* __GLIBC__ */
|
---|
| 194 | @@ -107,7 +113,7 @@
|
---|
| 195 |
|
---|
| 196 | #if !defined(__GLIBC__)
|
---|
| 197 | /*
|
---|
| 198 | - * The following bit uses some kernel/library magic to product what
|
---|
| 199 | + * The following bit uses some kernel/library magic to produce what
|
---|
| 200 | * looks like a function call to user level code. This function is
|
---|
| 201 | * actually a system call in disguise. The purpose of the getsyms
|
---|
| 202 | * call is to return a current copy of the in-kernel symbol table.
|
---|
| 203 | diff -Naur sysklogd-1.4.1/Makefile sysklogd-20050123/Makefile
|
---|
| 204 | --- sysklogd-1.4.1/Makefile 1998-10-12 16:25:15.000000000 -0400
|
---|
| 205 | +++ sysklogd-20050123/Makefile 2004-04-29 07:04:03.000000000 -0400
|
---|
| 206 | @@ -4,12 +4,15 @@
|
---|
| 207 | #CFLAGS= -g -DSYSV -Wall
|
---|
| 208 | #LDFLAGS= -g
|
---|
| 209 | CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce
|
---|
| 210 | +# -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
|
---|
| 211 | LDFLAGS= -s
|
---|
| 212 |
|
---|
| 213 | # Look where your install program is.
|
---|
| 214 | INSTALL = /usr/bin/install
|
---|
| 215 | -BINDIR = /usr/sbin
|
---|
| 216 | -MANDIR = /usr/man
|
---|
| 217 | +
|
---|
| 218 | +# Destination paths, set prefix=/opt if required
|
---|
| 219 | +BINDIR = $(prefix)/usr/sbin
|
---|
| 220 | +MANDIR = $(prefix)/usr/share/man
|
---|
| 221 |
|
---|
| 222 | # There is one report that under an all ELF system there may be a need to
|
---|
| 223 | # explicilty link with libresolv.a. If linking syslogd fails you may wish
|
---|
| 224 | @@ -34,8 +37,9 @@
|
---|
| 225 | # The following define establishes ownership for the man pages.
|
---|
| 226 | # Avery tells me that there is a difference between Debian and
|
---|
| 227 | # Slackware. Rather than choose sides I am leaving it up to the user.
|
---|
| 228 | -MAN_OWNER = root
|
---|
| 229 | -# MAN_OWNER = man
|
---|
| 230 | +MAN_USER = root
|
---|
| 231 | +MAN_GROUP = root
|
---|
| 232 | +MAN_PERMS = 644
|
---|
| 233 |
|
---|
| 234 | # The following define establishes the name of the pid file for the
|
---|
| 235 | # syslogd daemon. The library include file (paths.h) defines the
|
---|
| 236 | @@ -116,7 +120,7 @@
|
---|
| 237 | ${INSTALL} -m 500 -s klogd ${BINDIR}/klogd
|
---|
| 238 |
|
---|
| 239 | install_man:
|
---|
| 240 | - ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 sysklogd.8 ${MANDIR}/man8/sysklogd.8
|
---|
| 241 | - ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslogd.8 ${MANDIR}/man8/syslogd.8
|
---|
| 242 | - ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslog.conf.5 ${MANDIR}/man5/syslog.conf.5
|
---|
| 243 | - ${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 klogd.8 ${MANDIR}/man8/klogd.8
|
---|
| 244 | + ${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} sysklogd.8 ${MANDIR}/man8/sysklogd.8
|
---|
| 245 | + ${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} syslogd.8 ${MANDIR}/man8/syslogd.8
|
---|
| 246 | + ${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} syslog.conf.5 ${MANDIR}/man5/syslog.conf.5
|
---|
| 247 | + ${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} klogd.8 ${MANDIR}/man8/klogd.8
|
---|
| 248 | diff -Naur sysklogd-1.4.1/module.h sysklogd-20050123/module.h
|
---|
| 249 | --- sysklogd-1.4.1/module.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 250 | +++ sysklogd-20050123/module.h 2004-07-27 07:36:10.000000000 -0400
|
---|
| 251 | @@ -0,0 +1,90 @@
|
---|
| 252 | +/*
|
---|
| 253 | + module.h - Miscellaneous module definitions
|
---|
| 254 | + Copyright (c) 1996 Richard Henderson <rth@tamu.edu>
|
---|
| 255 | + Copyright (c) 2004 Martin Schulze <joey@infodrom.org>
|
---|
| 256 | +
|
---|
| 257 | + This file is part of the sysklogd package.
|
---|
| 258 | +
|
---|
| 259 | + This program is free software; you can redistribute it and/or modify
|
---|
| 260 | + it under the terms of the GNU General Public License as published by
|
---|
| 261 | + the Free Software Foundation; either version 2 of the License, or
|
---|
| 262 | + (at your option) any later version.
|
---|
| 263 | +
|
---|
| 264 | + This program is distributed in the hope that it will be useful,
|
---|
| 265 | + but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 266 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 267 | + GNU General Public License for more details.
|
---|
| 268 | +
|
---|
| 269 | + You should have received a copy of the GNU General Public License
|
---|
| 270 | + along with this program; if not, write to the Free Software
|
---|
| 271 | + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 272 | +*/
|
---|
| 273 | +
|
---|
| 274 | +/* ChangeLog:
|
---|
| 275 | + *
|
---|
| 276 | + * Wed Mar 31 17:35:01 CEST 2004: Martin Schulze <joey@infodrom.org>
|
---|
| 277 | + * Created local copy of module.h based on the content of Linux
|
---|
| 278 | + * 2.2 since <linux/module.h> doesn't work anymore with its
|
---|
| 279 | + * recent content from Linux 2.4/2.6.
|
---|
| 280 | + */
|
---|
| 281 | +
|
---|
| 282 | +#include <asm/atomic.h>
|
---|
| 283 | +
|
---|
| 284 | +#define MODULE_NAME_LEN 60
|
---|
| 285 | +
|
---|
| 286 | +struct kernel_sym
|
---|
| 287 | +{
|
---|
| 288 | + unsigned long value;
|
---|
| 289 | + char name[MODULE_NAME_LEN];
|
---|
| 290 | +};
|
---|
| 291 | +
|
---|
| 292 | +
|
---|
| 293 | +struct list_head {
|
---|
| 294 | + struct list_head *next, *prev;
|
---|
| 295 | +};
|
---|
| 296 | +
|
---|
| 297 | +
|
---|
| 298 | +struct module_info
|
---|
| 299 | +{
|
---|
| 300 | + unsigned long addr;
|
---|
| 301 | + unsigned long size;
|
---|
| 302 | + unsigned long flags;
|
---|
| 303 | + long usecount;
|
---|
| 304 | +};
|
---|
| 305 | +
|
---|
| 306 | +
|
---|
| 307 | +struct module
|
---|
| 308 | +{
|
---|
| 309 | + unsigned long size_of_struct; /* == sizeof(module) */
|
---|
| 310 | + struct module *next;
|
---|
| 311 | + const char *name;
|
---|
| 312 | + unsigned long size;
|
---|
| 313 | +
|
---|
| 314 | + union
|
---|
| 315 | + {
|
---|
| 316 | + int usecount;
|
---|
| 317 | + long pad;
|
---|
| 318 | + } uc; /* Needs to keep its size - so says rth */
|
---|
| 319 | +
|
---|
| 320 | + unsigned long flags; /* AUTOCLEAN et al */
|
---|
| 321 | +
|
---|
| 322 | + unsigned nsyms;
|
---|
| 323 | + unsigned ndeps;
|
---|
| 324 | +
|
---|
| 325 | + struct module_symbol *syms;
|
---|
| 326 | + struct module_ref *deps;
|
---|
| 327 | + struct module_ref *refs;
|
---|
| 328 | + int (*init)(void);
|
---|
| 329 | + void (*cleanup)(void);
|
---|
| 330 | + const struct exception_table_entry *ex_table_start;
|
---|
| 331 | + const struct exception_table_entry *ex_table_end;
|
---|
| 332 | +#ifdef __alpha__
|
---|
| 333 | + unsigned long gp;
|
---|
| 334 | +#endif
|
---|
| 335 | + /* Members past this point are extensions to the basic
|
---|
| 336 | + module support and are optional. Use mod_opt_member()
|
---|
| 337 | + to examine them. */
|
---|
| 338 | + const struct module_persist *persist_start;
|
---|
| 339 | + const struct module_persist *persist_end;
|
---|
| 340 | + int (*can_unload)(void);
|
---|
| 341 | +};
|
---|
| 342 | diff -Naur sysklogd-1.4.1/pidfile.c sysklogd-20050123/pidfile.c
|
---|
| 343 | --- sysklogd-1.4.1/pidfile.c 1998-02-10 17:37:12.000000000 -0500
|
---|
| 344 | +++ sysklogd-20050123/pidfile.c 2003-09-27 22:38:18.000000000 -0400
|
---|
| 345 | @@ -87,7 +87,7 @@
|
---|
| 346 | int fd;
|
---|
| 347 | int pid;
|
---|
| 348 |
|
---|
| 349 | - if ( ((fd = open(pidfile, O_RDWR|O_CREAT, 0644)) == -1)
|
---|
| 350 | + if ( ((fd = open(pidfile, O_RDWR|O_CREAT|O_TRUNC, 0644)) == -1)
|
---|
| 351 | || ((f = fdopen(fd, "r+")) == NULL) ) {
|
---|
| 352 | fprintf(stderr, "Can't open or create %s.\n", pidfile);
|
---|
| 353 | return 0;
|
---|
| 354 | diff -Naur sysklogd-1.4.1/README.1st sysklogd-20050123/README.1st
|
---|
| 355 | --- sysklogd-1.4.1/README.1st 1997-06-02 13:21:39.000000000 -0400
|
---|
| 356 | +++ sysklogd-20050123/README.1st 2003-09-04 09:22:23.000000000 -0400
|
---|
| 357 | @@ -1,5 +1,5 @@
|
---|
| 358 | -Very important information before using version 1.3
|
---|
| 359 | ----------------------------------------------------
|
---|
| 360 | +Important information
|
---|
| 361 | +---------------------
|
---|
| 362 |
|
---|
| 363 | The included version of syslogd behaves in a slightly different manner
|
---|
| 364 | to the one in former releases. Please review the following important
|
---|
| 365 | @@ -63,3 +63,10 @@
|
---|
| 366 | these scripts should remove all old .pid files found in /var/run.
|
---|
| 367 | This will insure that klogd and syslogd start properly even if prior
|
---|
| 368 | executions have been terminated harshly.
|
---|
| 369 | +
|
---|
| 370 | +* Large file support, i.e. support to write to log files that are
|
---|
| 371 | + larger than 2 GB is not part of syslogd, but a matter of the Glibc
|
---|
| 372 | + emitting different system calls to the kernel interface. To support
|
---|
| 373 | + large files you'll have to compile syslogd with the compiler defines
|
---|
| 374 | + -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE so that glibc adjusts the
|
---|
| 375 | + system calls.
|
---|
| 376 | diff -Naur sysklogd-1.4.1/README.linux sysklogd-20050123/README.linux
|
---|
| 377 | --- sysklogd-1.4.1/README.linux 1999-01-18 19:09:12.000000000 -0500
|
---|
| 378 | +++ sysklogd-20050123/README.linux 2004-07-09 13:22:29.000000000 -0400
|
---|
| 379 | @@ -40,12 +40,17 @@
|
---|
| 380 | a useful addition to the software gene pool.
|
---|
| 381 |
|
---|
| 382 | There is a mailing list covering this package and syslog in general.
|
---|
| 383 | -The lists address is sysklogd@Infodrom.North.DE . To subscribe send a
|
---|
| 384 | -mail to Majordomo@Infodrom.North.DE with a line "subscribe sysklogd"
|
---|
| 385 | +The lists address is infodrom-sysklogd@lists.infodrom.org . To subscribe send a
|
---|
| 386 | +mail to majordomo@lists.infodrom.org with a line "subscribe infodrom-sysklogd"
|
---|
| 387 | in the message body.
|
---|
| 388 |
|
---|
| 389 | -New versions of this package will be available at Joey's ftp server.
|
---|
| 390 | -ftp://ftp.infodrom.north.de/pub/people/joey/sysklogd/
|
---|
| 391 | +A second mailing list exists as infodrom-sysklogd-cvs@lists.infodrom.org. Only
|
---|
| 392 | +CVS messages and diffs are distributed there. Whenever new code is added to
|
---|
| 393 | +sysklogd, CVS generates a mail from these changes which will be sent to
|
---|
| 394 | +this list. Discussions will take place on the first list.
|
---|
| 395 | +
|
---|
| 396 | +The latest version of this software can be found at:
|
---|
| 397 | +http://www.infodrom.org/projects/sysklogd/download.php3
|
---|
| 398 |
|
---|
| 399 | Best regards,
|
---|
| 400 |
|
---|
| 401 | @@ -67,6 +72,6 @@
|
---|
| 402 |
|
---|
| 403 | Martin Schulze
|
---|
| 404 | Infodrom Oldenburg
|
---|
| 405 | -joey@linux.de
|
---|
| 406 | +joey@infodrom.org
|
---|
| 407 |
|
---|
| 408 | -And a host of bug reporters whose contributions cannot be underestimated.
|
---|
| 409 | +And a number of bug reporters whose contributions cannot be underestimated.
|
---|
| 410 | diff -Naur sysklogd-1.4.1/sysklogd.8 sysklogd-20050123/sysklogd.8
|
---|
| 411 | --- sysklogd-1.4.1/sysklogd.8 2001-03-11 14:35:51.000000000 -0500
|
---|
| 412 | +++ sysklogd-20050123/sysklogd.8 2004-07-09 13:33:32.000000000 -0400
|
---|
| 413 | @@ -84,7 +84,7 @@
|
---|
| 414 | .B MAXFUNIX
|
---|
| 415 | within the syslogd.c source file. An example for a chroot() daemon is
|
---|
| 416 | described by the people from OpenBSD at
|
---|
| 417 | -http://www.psionic.com/papers/dns.html.
|
---|
| 418 | +<http://www.guides.sk/psionic/dns/>.
|
---|
| 419 | .TP
|
---|
| 420 | .B "\-d"
|
---|
| 421 | Turns on debug mode. Using this the daemon will not proceed a
|
---|
| 422 | @@ -117,7 +117,8 @@
|
---|
| 423 | between two \fI-- MARK --\fR lines is 20 minutes. This can be changed
|
---|
| 424 | with this option. Setting the
|
---|
| 425 | .I interval
|
---|
| 426 | -to zero turns it off entirely.
|
---|
| 427 | +to zero turns it off entirely. Depending on other log messages
|
---|
| 428 | +generated these lines may not be written consecutively.
|
---|
| 429 | .TP
|
---|
| 430 | .B "\-n"
|
---|
| 431 | Avoid auto-backgrounding. This is needed especially if the
|
---|
| 432 | @@ -364,8 +365,10 @@
|
---|
| 433 |
|
---|
| 434 | To avoid this in further times no messages that were received from a
|
---|
| 435 | remote host are sent out to another (or the same) remote host
|
---|
| 436 | -anymore. If there are scenarios where this doesn't make sense, please
|
---|
| 437 | -drop me (Joey) a line.
|
---|
| 438 | +anymore. If you experience are setup in which this doesn't make
|
---|
| 439 | +sense, please use the
|
---|
| 440 | +.B \-h
|
---|
| 441 | +commandline switch.
|
---|
| 442 |
|
---|
| 443 | If the remote host is located in the same domain as the host,
|
---|
| 444 | .B syslogd
|
---|
| 445 | diff -Naur sysklogd-1.4.1/syslog.c sysklogd-20050123/syslog.c
|
---|
| 446 | --- sysklogd-1.4.1/syslog.c 2001-03-11 14:35:51.000000000 -0500
|
---|
| 447 | +++ sysklogd-20050123/syslog.c 2003-08-27 11:56:01.000000000 -0400
|
---|
| 448 | @@ -47,6 +47,9 @@
|
---|
| 449 | * Sun Mar 11 20:23:44 CET 2001: Martin Schulze <joey@infodrom.ffis.de>
|
---|
| 450 | * Use SOCK_DGRAM for loggin, renables it to work.
|
---|
| 451 | *
|
---|
| 452 | + * Wed Aug 27 17:48:16 CEST 2003: Martin Schulze <joey@Infodrom.org>
|
---|
| 453 | + * Improved patch by Michael Pomraning <mjp@securepipe.com> to
|
---|
| 454 | + * reconnect klogd to the logger after it went away.
|
---|
| 455 | */
|
---|
| 456 |
|
---|
| 457 | #include <sys/types.h>
|
---|
| 458 | @@ -98,6 +101,7 @@
|
---|
| 459 | register char *p;
|
---|
| 460 | time_t now;
|
---|
| 461 | int fd, saved_errno;
|
---|
| 462 | + int result;
|
---|
| 463 | char tbuf[2048], fmt_cpy[1024], *stdp = (char *) 0;
|
---|
| 464 |
|
---|
| 465 | saved_errno = errno;
|
---|
| 466 | @@ -167,7 +171,16 @@
|
---|
| 467 | }
|
---|
| 468 |
|
---|
| 469 | /* output the message to the local logger */
|
---|
| 470 | - if (write(LogFile, tbuf, cnt + 1) >= 0 || !(LogStat&LOG_CONS))
|
---|
| 471 | + result = write(LogFile, tbuf, cnt + 1);
|
---|
| 472 | +
|
---|
| 473 | + if (result == -1
|
---|
| 474 | + && (errno == ECONNRESET || errno == ENOTCONN || errno == ECONNREFUSED)) {
|
---|
| 475 | + closelog();
|
---|
| 476 | + openlog(LogTag, LogStat | LOG_NDELAY, LogFacility);
|
---|
| 477 | + result = write(LogFile, tbuf, cnt + 1);
|
---|
| 478 | + }
|
---|
| 479 | +
|
---|
| 480 | + if (result >= 0 || !(LogStat&LOG_CONS))
|
---|
| 481 | return;
|
---|
| 482 |
|
---|
| 483 | /*
|
---|
| 484 | diff -Naur sysklogd-1.4.1/syslog.conf.5 sysklogd-20050123/syslog.conf.5
|
---|
| 485 | --- sysklogd-1.4.1/syslog.conf.5 1999-08-21 06:49:14.000000000 -0400
|
---|
| 486 | +++ sysklogd-20050123/syslog.conf.5 2003-05-22 15:31:20.000000000 -0400
|
---|
| 487 | @@ -64,7 +64,7 @@
|
---|
| 488 | The
|
---|
| 489 | .I facility
|
---|
| 490 | is one of the following keywords:
|
---|
| 491 | -.BR auth ", " authpriv ", " cron ", " daemon ", " kern ", " lpr ", "
|
---|
| 492 | +.BR auth ", " authpriv ", " cron ", " daemon ", " ftp ", " kern ", " lpr ", "
|
---|
| 493 | .BR mail ", " mark ", " news ", " security " (same as " auth "), "
|
---|
| 494 | .BR syslog ", " user ", " uucp " and " local0 " through " local7 .
|
---|
| 495 | The keyword
|
---|
| 496 | @@ -121,12 +121,21 @@
|
---|
| 497 |
|
---|
| 498 | This
|
---|
| 499 | .BR syslogd (8)
|
---|
| 500 | -has a syntax extension to the original BSD source, that makes its use
|
---|
| 501 | +has a syntax extension to the original BSD source, which makes its use
|
---|
| 502 | more intuitively. You may precede every priority with an equation sign
|
---|
| 503 | -(``='') to specify only this single priority and not any of the
|
---|
| 504 | -above. You may also (both is valid, too) precede the priority with an
|
---|
| 505 | -exclamation mark (``!'') to ignore all that priorities, either exact
|
---|
| 506 | -this one or this and any higher priority. If you use both extensions
|
---|
| 507 | +(``='') to specify that
|
---|
| 508 | +.B syslogd
|
---|
| 509 | +should only refer to this single priority and not this priority and
|
---|
| 510 | +all higher priorities.
|
---|
| 511 | +
|
---|
| 512 | +You may also precide the priority with an exclamation mark (``!'') if
|
---|
| 513 | +you want
|
---|
| 514 | +.B syslogd
|
---|
| 515 | +to ignore this priority and all higher priorities.
|
---|
| 516 | +You may even use both, the exclamation mark and the equation sign if
|
---|
| 517 | +you want
|
---|
| 518 | +.B syslogd
|
---|
| 519 | +to ignore only this single priority. If you use both extensions
|
---|
| 520 | than the exclamation mark must occur before the equation sign, just
|
---|
| 521 | use it intuitively.
|
---|
| 522 |
|
---|
| 523 | @@ -300,7 +309,7 @@
|
---|
| 524 | .B syslogd
|
---|
| 525 | log all messages that come with either the
|
---|
| 526 | .BR info " or the " notice
|
---|
| 527 | -facility into the file
|
---|
| 528 | +priority into the file
|
---|
| 529 | .IR /var/log/messages ,
|
---|
| 530 | except for all messages that use the
|
---|
| 531 | .B mail
|
---|
| 532 | diff -Naur sysklogd-1.4.1/syslogd.c sysklogd-20050123/syslogd.c
|
---|
| 533 | --- sysklogd-1.4.1/syslogd.c 2001-03-11 14:40:10.000000000 -0500
|
---|
| 534 | +++ sysklogd-20050123/syslogd.c 2005-01-15 14:13:08.000000000 -0500
|
---|
| 535 | @@ -441,6 +441,39 @@
|
---|
| 536 | * Don't return a closed fd if `-a' is called with a wrong path.
|
---|
| 537 | * Thanks to Bill Nottingham <notting@redhat.com> for providing
|
---|
| 538 | * a patch.
|
---|
| 539 | + * Thu Apr 13 05:08:10 CEST 2001: Jon Burgess <Jon_Burgess@eur.3com.com>
|
---|
| 540 | + * Moved the installation of the signal handler up a little bit
|
---|
| 541 | + * so it guaranteed to be available when the child is forked,
|
---|
| 542 | + * hence, fixing a race condition. This used to create problems
|
---|
| 543 | + * with UML and fast machines.
|
---|
| 544 | + *
|
---|
| 545 | + * Sat Apr 17 18:03:05 CEST 2004: Steve Grubb <linux_4ever@yahoo.com>
|
---|
| 546 | + * Correct memory allocation for for commandline arguments in
|
---|
| 547 | + * crunch_list().
|
---|
| 548 | + *
|
---|
| 549 | + * Thu Apr 29 12:38:39 CEST 2004: Solar Designer <solar@openwall.com>
|
---|
| 550 | + * Applied Openwall paranoia patches to improve crunch_list().
|
---|
| 551 | + *
|
---|
| 552 | + * Tue May 4 16:47:30 CEST 2004: Solar Designer <solar@openwall.com>
|
---|
| 553 | + * Ensure that "len" is not placed in a register, and that the
|
---|
| 554 | + * endtty() signal handler is not installed too early which could
|
---|
| 555 | + * cause a segmentation fault or worse.
|
---|
| 556 | + *
|
---|
| 557 | + * Tue May 4 16:52:01 CEST 2004: Solar Designer <solar@openwall.com>
|
---|
| 558 | + * Adjust the size of a variable to prevent a buffer overflow
|
---|
| 559 | + * should _PATH_DEV ever contain something different than "/dev/".
|
---|
| 560 | + *
|
---|
| 561 | + * Tue Nov 2 20:28:23 CET 2004: Colin Phipps <cph@cph.demon.co.uk>
|
---|
| 562 | + * Don't block on the network socket, in case a packet gets lost
|
---|
| 563 | + * between select and recv.
|
---|
| 564 | + *
|
---|
| 565 | + * Sun Nov 7 12:28:47 CET 2004: Martin Schulze <joey@infodrom.org>
|
---|
| 566 | + * Discard any timestamp information found in received syslog
|
---|
| 567 | + * messages. This will affect local messages sent from a
|
---|
| 568 | + * different timezone.
|
---|
| 569 | + *
|
---|
| 570 | + * Sun Nov 7 13:47:00 CET 2004: Martin Schulze <joey@infodrom.org>
|
---|
| 571 | + * Remove trailing newline when forwarding messages.
|
---|
| 572 | */
|
---|
| 573 |
|
---|
| 574 |
|
---|
| 575 | @@ -890,11 +923,11 @@
|
---|
| 576 | dprintf("Checking pidfile.\n");
|
---|
| 577 | if (!check_pid(PidFile))
|
---|
| 578 | {
|
---|
| 579 | + signal (SIGTERM, doexit);
|
---|
| 580 | if (fork()) {
|
---|
| 581 | /*
|
---|
| 582 | * Parent process
|
---|
| 583 | */
|
---|
| 584 | - signal (SIGTERM, doexit);
|
---|
| 585 | sleep(300);
|
---|
| 586 | /*
|
---|
| 587 | * Not reached unless something major went wrong. 5
|
---|
| 588 | @@ -992,6 +1025,7 @@
|
---|
| 589 | (void) signal(SIGCHLD, reapchild);
|
---|
| 590 | (void) signal(SIGALRM, domark);
|
---|
| 591 | (void) signal(SIGUSR1, Debug ? debug_switch : SIG_IGN);
|
---|
| 592 | + (void) signal(SIGXFSZ, SIG_IGN);
|
---|
| 593 | (void) alarm(TIMERINTVL);
|
---|
| 594 |
|
---|
| 595 | /* Create a partial message table for all file descriptors. */
|
---|
| 596 | @@ -1141,13 +1175,13 @@
|
---|
| 597 | */
|
---|
| 598 | printchopped(from, line, \
|
---|
| 599 | i + 2, finet);
|
---|
| 600 | - } else if (i < 0 && errno != EINTR) {
|
---|
| 601 | + } else if (i < 0 && errno != EINTR && errno != EAGAIN) {
|
---|
| 602 | dprintf("INET socket error: %d = %s.\n", \
|
---|
| 603 | errno, strerror(errno));
|
---|
| 604 | logerror("recvfrom inet");
|
---|
| 605 | /* should be harmless now that we set
|
---|
| 606 | * BSDCOMPAT on the socket */
|
---|
| 607 | - sleep(10);
|
---|
| 608 | + sleep(1);
|
---|
| 609 | }
|
---|
| 610 | }
|
---|
| 611 | #endif
|
---|
| 612 | @@ -1216,6 +1250,7 @@
|
---|
| 613 | {
|
---|
| 614 | int fd, on = 1;
|
---|
| 615 | struct sockaddr_in sin;
|
---|
| 616 | + int sockflags;
|
---|
| 617 |
|
---|
| 618 | fd = socket(AF_INET, SOCK_DGRAM, 0);
|
---|
| 619 | if (fd < 0) {
|
---|
| 620 | @@ -1241,6 +1276,24 @@
|
---|
| 621 | close(fd);
|
---|
| 622 | return -1;
|
---|
| 623 | }
|
---|
| 624 | + /* We must not block on the network socket, in case a packet
|
---|
| 625 | + * gets lost between select and recv, otherise the process
|
---|
| 626 | + * will stall until the timeout, and other processes trying to
|
---|
| 627 | + * log will also stall.
|
---|
| 628 | + */
|
---|
| 629 | + if ((sockflags = fcntl(fd, F_GETFL)) != -1) {
|
---|
| 630 | + sockflags |= O_NONBLOCK;
|
---|
| 631 | + /*
|
---|
| 632 | + * SETFL could fail too, so get it caught by the subsequent
|
---|
| 633 | + * error check.
|
---|
| 634 | + */
|
---|
| 635 | + sockflags = fcntl(fd, F_SETFL, sockflags);
|
---|
| 636 | + }
|
---|
| 637 | + if (sockflags == -1) {
|
---|
| 638 | + logerror("fcntl(O_NONBLOCK), suspending inet");
|
---|
| 639 | + close(fd);
|
---|
| 640 | + return -1;
|
---|
| 641 | + }
|
---|
| 642 | if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
|
---|
| 643 | logerror("bind, suspending inet");
|
---|
| 644 | close(fd);
|
---|
| 645 | @@ -1254,30 +1307,26 @@
|
---|
| 646 | crunch_list(list)
|
---|
| 647 | char *list;
|
---|
| 648 | {
|
---|
| 649 | - int count, i;
|
---|
| 650 | + int i, m, n;
|
---|
| 651 | char *p, *q;
|
---|
| 652 | char **result = NULL;
|
---|
| 653 |
|
---|
| 654 | p = list;
|
---|
| 655 |
|
---|
| 656 | /* strip off trailing delimiters */
|
---|
| 657 | - while (p[strlen(p)-1] == LIST_DELIMITER) {
|
---|
| 658 | - count--;
|
---|
| 659 | + while (*p && p[strlen(p)-1] == LIST_DELIMITER)
|
---|
| 660 | p[strlen(p)-1] = '\0';
|
---|
| 661 | - }
|
---|
| 662 | /* cut off leading delimiters */
|
---|
| 663 | - while (p[0] == LIST_DELIMITER) {
|
---|
| 664 | - count--;
|
---|
| 665 | + while (p[0] == LIST_DELIMITER)
|
---|
| 666 | p++;
|
---|
| 667 | - }
|
---|
| 668 |
|
---|
| 669 | - /* count delimiters to calculate elements */
|
---|
| 670 | - for (count=i=0; p[i]; i++)
|
---|
| 671 | - if (p[i] == LIST_DELIMITER) count++;
|
---|
| 672 | + /* count delimiters to calculate the number of elements */
|
---|
| 673 | + for (n = i = 0; p[i]; i++)
|
---|
| 674 | + if (p[i] == LIST_DELIMITER) n++;
|
---|
| 675 |
|
---|
| 676 | - if ((result = (char **)malloc(sizeof(char *) * count+2)) == NULL) {
|
---|
| 677 | + if ((result = (char **)malloc(sizeof(char *) * (n + 2))) == NULL) {
|
---|
| 678 | printf ("Sorry, can't get enough memory, exiting.\n");
|
---|
| 679 | - exit(0);
|
---|
| 680 | + exit(1);
|
---|
| 681 | }
|
---|
| 682 |
|
---|
| 683 | /*
|
---|
| 684 | @@ -1285,30 +1334,28 @@
|
---|
| 685 | * characters are different from any delimiters,
|
---|
| 686 | * so we don't have to care about this.
|
---|
| 687 | */
|
---|
| 688 | - count = 0;
|
---|
| 689 | - while ((q=strchr(p, LIST_DELIMITER))) {
|
---|
| 690 | - result[count] = (char *) malloc((q - p + 1) * sizeof(char));
|
---|
| 691 | - if (result[count] == NULL) {
|
---|
| 692 | + m = 0;
|
---|
| 693 | + while ((q = strchr(p, LIST_DELIMITER)) && m < n) {
|
---|
| 694 | + result[m] = (char *) malloc((q - p + 1) * sizeof(char));
|
---|
| 695 | + if (result[m] == NULL) {
|
---|
| 696 | printf ("Sorry, can't get enough memory, exiting.\n");
|
---|
| 697 | - exit(0);
|
---|
| 698 | + exit(1);
|
---|
| 699 | }
|
---|
| 700 | - strncpy(result[count], p, q - p);
|
---|
| 701 | - result[count][q - p] = '\0';
|
---|
| 702 | + memcpy(result[m], p, q - p);
|
---|
| 703 | + result[m][q - p] = '\0';
|
---|
| 704 | p = q; p++;
|
---|
| 705 | - count++;
|
---|
| 706 | + m++;
|
---|
| 707 | }
|
---|
| 708 | - if ((result[count] = \
|
---|
| 709 | - (char *)malloc(sizeof(char) * strlen(p) + 1)) == NULL) {
|
---|
| 710 | + if ((result[m] = strdup(p)) == NULL) {
|
---|
| 711 | printf ("Sorry, can't get enough memory, exiting.\n");
|
---|
| 712 | - exit(0);
|
---|
| 713 | + exit(1);
|
---|
| 714 | }
|
---|
| 715 | - strcpy(result[count],p);
|
---|
| 716 | - result[++count] = NULL;
|
---|
| 717 | + result[++m] = NULL;
|
---|
| 718 |
|
---|
| 719 | #if 0
|
---|
| 720 | - count=0;
|
---|
| 721 | - while (result[count])
|
---|
| 722 | - dprintf ("#%d: %s\n", count, StripDomains[count++]);
|
---|
| 723 | + m = 0;
|
---|
| 724 | + while (result[m])
|
---|
| 725 | + dprintf ("#%d: %s\n", m, result[m++]);
|
---|
| 726 | #endif
|
---|
| 727 | return result;
|
---|
| 728 | }
|
---|
| 729 | @@ -1548,21 +1595,25 @@
|
---|
| 730 |
|
---|
| 731 | /*
|
---|
| 732 | * Check to see if msg looks non-standard.
|
---|
| 733 | + *
|
---|
| 734 | + * A message looks like
|
---|
| 735 | + * Nov 17 11:42:33 CRON[
|
---|
| 736 | + * 01234567890123456
|
---|
| 737 | + * ^ ^ ^ ^ ^
|
---|
| 738 | + *
|
---|
| 739 | + * Remote messages are not accompanied by a timestamp.
|
---|
| 740 | + * Local messages are accompanied by a timestamp (program's timezone)
|
---|
| 741 | */
|
---|
| 742 | msglen = strlen(msg);
|
---|
| 743 | - if (msglen < 16 || msg[3] != ' ' || msg[6] != ' ' ||
|
---|
| 744 | - msg[9] != ':' || msg[12] != ':' || msg[15] != ' ')
|
---|
| 745 | - flags |= ADDDATE;
|
---|
| 746 | -
|
---|
| 747 | - (void) time(&now);
|
---|
| 748 | - if (flags & ADDDATE)
|
---|
| 749 | - timestamp = ctime(&now) + 4;
|
---|
| 750 | - else {
|
---|
| 751 | - timestamp = msg;
|
---|
| 752 | + if (!(msglen < 16 || msg[3] != ' ' || msg[6] != ' ' ||
|
---|
| 753 | + msg[9] != ':' || msg[12] != ':' || msg[15] != ' ')) {
|
---|
| 754 | msg += 16;
|
---|
| 755 | msglen -= 16;
|
---|
| 756 | }
|
---|
| 757 |
|
---|
| 758 | + (void) time(&now);
|
---|
| 759 | + timestamp = ctime(&now) + 4;
|
---|
| 760 | +
|
---|
| 761 | /* extract facility and priority level */
|
---|
| 762 | if (flags & MARK)
|
---|
| 763 | fac = LOG_NFACILITIES;
|
---|
| 764 | @@ -1771,7 +1822,7 @@
|
---|
| 765 | dprintf("Not sending message to remote.\n");
|
---|
| 766 | else {
|
---|
| 767 | f->f_time = now;
|
---|
| 768 | - (void) snprintf(line, sizeof(line), "<%d>%s\n", f->f_prevpri, \
|
---|
| 769 | + (void) snprintf(line, sizeof(line), "<%d>%s", f->f_prevpri, \
|
---|
| 770 | (char *) iov[4].iov_base);
|
---|
| 771 | l = strlen(line);
|
---|
| 772 | if (l > MAXLINE)
|
---|
| 773 | @@ -1815,7 +1866,7 @@
|
---|
| 774 | v->iov_len = 1;
|
---|
| 775 | }
|
---|
| 776 | again:
|
---|
| 777 | - /* f->f_file == -1 is an indicator that the we couldn't
|
---|
| 778 | + /* f->f_file == -1 is an indicator that we couldn't
|
---|
| 779 | open the file at startup. */
|
---|
| 780 | if (f->f_file == -1)
|
---|
| 781 | break;
|
---|
| 782 | @@ -1852,7 +1903,7 @@
|
---|
| 783 | errno = e;
|
---|
| 784 | logerror(f->f_un.f_fname);
|
---|
| 785 | }
|
---|
| 786 | - } else if (f->f_flags & SYNC_FILE)
|
---|
| 787 | + } else if (f->f_type == F_FILE && (f->f_flags & SYNC_FILE))
|
---|
| 788 | (void) fsync(f->f_file);
|
---|
| 789 | break;
|
---|
| 790 |
|
---|
| 791 | @@ -1891,7 +1942,7 @@
|
---|
| 792 | register struct filed *f;
|
---|
| 793 | struct iovec *iov;
|
---|
| 794 | {
|
---|
| 795 | - char p[6 + UNAMESZ];
|
---|
| 796 | + char p[sizeof (_PATH_DEV) + UNAMESZ];
|
---|
| 797 | register int i;
|
---|
| 798 | int ttyf, len;
|
---|
| 799 | static int reenter = 0;
|
---|
| 800 | @@ -1899,6 +1950,8 @@
|
---|
| 801 | struct utmp *uptr;
|
---|
| 802 | char greetings[200];
|
---|
| 803 |
|
---|
| 804 | + (void) &len;
|
---|
| 805 | +
|
---|
| 806 | if (reenter++)
|
---|
| 807 | return;
|
---|
| 808 |
|
---|
| 809 | @@ -1913,7 +1966,6 @@
|
---|
| 810 | if (fork() == 0) {
|
---|
| 811 | (void) signal(SIGTERM, SIG_DFL);
|
---|
| 812 | (void) alarm(0);
|
---|
| 813 | - (void) signal(SIGALRM, endtty);
|
---|
| 814 | #ifndef SYSV
|
---|
| 815 | (void) signal(SIGTTOU, SIG_IGN);
|
---|
| 816 | (void) sigsetmask(0);
|
---|
| 817 | @@ -1929,7 +1981,7 @@
|
---|
| 818 | /* is this slot used? */
|
---|
| 819 | if (ut.ut_name[0] == '\0')
|
---|
| 820 | continue;
|
---|
| 821 | - if (ut.ut_type == LOGIN_PROCESS)
|
---|
| 822 | + if (ut.ut_type != USER_PROCESS)
|
---|
| 823 | continue;
|
---|
| 824 | if (!(strcmp (ut.ut_name,"LOGIN"))) /* paranoia */
|
---|
| 825 | continue;
|
---|
| 826 | @@ -1959,6 +2011,7 @@
|
---|
| 827 | iov[1].iov_len = 0;
|
---|
| 828 | }
|
---|
| 829 | if (setjmp(ttybuf) == 0) {
|
---|
| 830 | + (void) signal(SIGALRM, endtty);
|
---|
| 831 | (void) alarm(15);
|
---|
| 832 | /* open the terminal */
|
---|
| 833 | ttyf = open(p, O_WRONLY|O_NOCTTY);
|
---|