From a2029046fd37f119149458a0d85ab5393a41c494 Mon Sep 17 00:00:00 2001 From: Garrett Wollman Date: Thu, 12 Oct 1995 17:18:39 +0000 Subject: [PATCH] Add a command-line option `-I' to disable logging from UDP. Document `-d' and `-I'. Add a BUGS section noting that logging from UDP is an unauthenticated remote disk-filling service, and probably should be disabled by default in the absence of some sort of authentication. --- usr.sbin/syslogd/syslogd.8 | 18 +++++++++++++++++- usr.sbin/syslogd/syslogd.c | 34 +++++++++++++++++++++------------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/usr.sbin/syslogd/syslogd.8 b/usr.sbin/syslogd/syslogd.8 index 09f3ddb58d91..72b6f77012ff 100644 --- a/usr.sbin/syslogd/syslogd.8 +++ b/usr.sbin/syslogd/syslogd.8 @@ -30,8 +30,9 @@ .\" SUCH DAMAGE. .\" .\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93 +.\" $Id$ .\" -.Dd June 6, 1993 +.Dd October 12, 1995 .Dt SYSLOGD 8 .Os BSD 4.2 .Sh NAME @@ -39,6 +40,7 @@ .Nd log systems messages .Sh SYNOPSIS .Nm syslogd +.Op Fl dI .Op Fl f Ar config_file .Op Fl m Ar mark_interval .Op Fl p Ar log_socket @@ -48,10 +50,17 @@ reads and logs messages to the system console, log files, other machines and/or users as specified by its configuration file. The options are as follows: .Bl -tag -width Ds +.It Fl d +Put +.Nm syslogd +into debugging mode. This is probably only of use to developers working on +.Nm syslogd . .It Fl f Specify the pathname of an alternate configuration file; the default is .Pa /etc/syslog.conf . +.It Fl I +Do not log messages received in UDP packets. .It Fl m Select the number of minutes between ``mark'' messages; the default is 20 minutes. @@ -120,3 +129,10 @@ The .Nm command appeared in .Bx 4.3 . +.Sh BUGS +The ability to log messages received in UDP packets is equivalent to +an unauthenticated remote disk-filling service, and should probably be +disabled by default. Some sort of +.No inter- Ns Nm syslogd +authentication mechanism ought to be worked out. + diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 03d95b6fc742..355c9f1c6c01 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -32,13 +32,14 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1983, 1988, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint +/* static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; +*/ +static const char rcsid[] = + "$Id$"; #endif /* not lint */ /* @@ -103,10 +104,10 @@ static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; #define SYSLOG_NAMES #include -char *LogName = _PATH_LOG; -char *ConfFile = _PATH_LOGCONF; -char *PidFile = _PATH_LOGPID; -char ctty[] = _PATH_CONSOLE; +const char *LogName = _PATH_LOG; +const char *ConfFile = _PATH_LOGCONF; +const char *PidFile = _PATH_LOGPID; +const char ctty[] = _PATH_CONSOLE; #define FDMASK(fd) (1 << (fd)) @@ -213,13 +214,15 @@ main(argc, argv) int argc; char *argv[]; { - int ch, funix, i, inetm, fklog, klogm, len; + int ch, funix, i, inetm, fklog, klogm, len, noudp; struct sockaddr_un sunx, fromunix; struct sockaddr_in sin, frominet; FILE *fp; char *p, line[MSG_BSIZE + 1]; - while ((ch = getopt(argc, argv, "df:m:p:")) != EOF) + noudp = 0; + + while ((ch = getopt(argc, argv, "df:Im:p:")) != EOF) switch(ch) { case 'd': /* debug */ Debug++; @@ -227,6 +230,9 @@ main(argc, argv) case 'f': /* configuration file */ ConfFile = optarg; break; + case 'I': /* disable logging from UDP packets */ + noudp = 1; + break; case 'm': /* mark interval */ MarkInterval = atoi(optarg) * 60; break; @@ -276,7 +282,8 @@ main(argc, argv) die(0); } else created_lsock = 1; - finet = socket(AF_INET, SOCK_DGRAM, 0); + + finet = noudp ? -1 : socket(AF_INET, SOCK_DGRAM, 0); inetm = 0; if (finet >= 0) { struct servent *sp; @@ -370,8 +377,9 @@ void usage() { - (void)fprintf(stderr, - "usage: syslogd [-f conffile] [-m markinterval] [-p logpath]\n"); + fprintf(stderr, + "usage: syslogd [-di] [-f conffile] [-m markinterval]" + " [-p logpath]\n"); exit(1); }