Date: Thu, 6 Mar 1997 18:10:08 -0800 (PST) From: David Lowe <dlowe@sirius.com> To: freebsd-bugs Subject: Re: bin/2622: syslogd '-s' behavior either broken or poorly documented Message-ID: <199703070210.SAA02342@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/2622; it has been noted by GNATS.
From: David Lowe <dlowe@sirius.com>
To: freebsd-gnats-submit@freebsd.org
Cc: Subject: Re: bin/2622: syslogd '-s' behavior either broken or poorly documented
Date: Thu, 6 Mar 1997 18:02:29 -0800 (PST)
Came up with some patches to fix this (changes -s behavior and adds -n to
replace the old -s behavior)...
use at your own risk, of course :)
----------------- snip ---------------------------------------------------
*** syslogd.c 1997/03/07 00:44:00 1.1
--- syslogd.c 1997/03/07 01:32:01 1.2
***************
*** 40,44 ****
*/
static const char rcsid[] =
! "$Id: syslogd.c,v 1.1 1997/03/07 00:44:00 dlowe Exp $";
#endif /* not lint */
--- 40,44 ----
*/
static const char rcsid[] =
! "$Id: syslogd.c,v 1.2 1997/03/07 01:32:01 dlowe Exp $";
#endif /* not lint */
***************
*** 193,197 ****
int MarkInterval = 20 * 60; /* interval between marks in seconds */
int MarkSeq = 0; /* mark sequence number */
! int SecureMode = 0; /* when true, speak only unix domain socks */
int created_lsock = 0; /* Flag if local socket created */
--- 193,198 ----
int MarkInterval = 20 * 60; /* interval between marks in seconds */
int MarkSeq = 0; /* mark sequence number */
! int SecureMode = 0; /* when true, discard incoming network logs */
! int NoNetworkMode = 0; /* when true, speak only unix domain socks */
int created_lsock = 0; /* Flag if local socket created */
***************
*** 229,233 ****
pid_t ppid;
! while ((ch = getopt(argc, argv, "dsf:Im:p:")) != EOF)
switch(ch) {
case 'd': /* debug */
--- 230,234 ----
pid_t ppid;
! while ((ch = getopt(argc, argv, "dsnf:Im:p:")) != EOF)
switch(ch) {
case 'd': /* debug */
***************
*** 243,250 ****
LogName = optarg;
break;
- case 'I': /* backwards compatible w/FreeBSD */
case 's': /* no network mode */
SecureMode++;
break;
case '?':
default:
--- 244,255 ----
LogName = optarg;
break;
case 's': /* no network mode */
SecureMode++;
break;
+ case 'I': /* backwards compatible w/FreeBSD */
+ /* Switch -n behaves as -s used to */
+ case 'n':
+ NoNetworkMode++;
+ break;
case '?':
default:
***************
*** 294,298 ****
--- 299,307 ----
created_lsock = 1;
+
+ /*
if (!SecureMode)
+ */
+ if (!NoNetworkMode)
finet = socket(AF_INET, SOCK_DGRAM, 0);
else
***************
*** 388,396 ****
i = recvfrom(finet, line, MAXLINE, 0,
(struct sockaddr *)&frominet, &len);
! if (i > 0) {
! line[i] = '\0';
! printline(cvthname(&frominet), line);
! } else if (i < 0 && errno != EINTR)
! logerror("recvfrom inet");
}
}
--- 397,408 ----
i = recvfrom(finet, line, MAXLINE, 0,
(struct sockaddr *)&frominet, &len);
! /* don't do anything with the log if SecureMode is on */
! if (!SecureMode) {
! if (i > 0) {
! line[i] = '\0';
! printline(cvthname(&frominet), line);
! } else if (i < 0 && errno != EINTR)
! logerror("recvfrom inet");
! }
}
}
***************
*** 402,406 ****
fprintf(stderr,
! "usage: syslogd [-ds] [-f conffile] [-m markinterval]"
" [-p logpath]\n");
exit(1);
--- 414,418 ----
fprintf(stderr,
! "usage: syslogd [-dsn] [-f conffile] [-m markinterval]"
" [-p logpath]\n");
exit(1);
----------------- snip ---------------------------------------------------
and to the man page:
----------------- snip ---------------------------------------------------
*** syslogd.8 1997/03/07 00:43:45 1.1
--- syslogd.8 1997/03/07 01:54:47 1.2
***************
*** 31,35 ****
.\"
.\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93
! .\" $Id: syslogd.8,v 1.1 1997/03/07 00:43:45 dlowe Exp $
.\"
.Dd October 12, 1995
--- 31,35 ----
.\"
.\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93
! .\" $Id: syslogd.8,v 1.2 1997/03/07 01:54:47 dlowe Exp $
.\"
.Dd October 12, 1995
***************
*** 41,45 ****
.Sh SYNOPSIS
.Nm syslogd
! .Op Fl \&dI
.Op Fl f Ar config_file
.Op Fl m Ar mark_interval
--- 41,45 ----
.Sh SYNOPSIS
.Nm syslogd
! ..Op Fl \&dsn
.Op Fl f Ar config_file
.Op Fl m Ar mark_interval
***************
*** 61,66 ****
.Pa /etc/syslog.conf .
.It Fl s
! Operate in secure mode. Do not open a UDP socket to listen for log message
! from remote machines.
.It Fl m
Select the number of minutes between ``mark'' messages;
--- 61,68 ----
.Pa /etc/syslog.conf .
.It Fl s
! Operate in secure mode. Open UDP socket, but discard all incoming network
! log messages.
! .It Fl n
! Operate in non-network mode. Do not open a UDP socket at all.
.It Fl m
Select the number of minutes between ``mark'' messages;
----------------- snip ---------------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703070210.SAA02342>
