From root@news3.sirius.com  Thu Jan 30 12:35:15 1997
Received: from news3.sirius.com (news3.sirius.com [205.134.226.201])
          by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id MAA29541
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 30 Jan 1997 12:35:14 -0800 (PST)
Received: (from root@localhost)
	by news3.sirius.com (8.8.5/Sirius-97.01.23) id MAA19289;
	Thu, 30 Jan 1997 12:37:58 -0800 (PST)
Message-Id: <199701302037.MAA19289@news3.sirius.com>
Date: Thu, 30 Jan 1997 12:37:58 -0800 (PST)
From: dlowe@sirius.com
Reply-To: dlowe@sirius.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: syslogd '-s' behavior either broken or poorly documented
X-Send-Pr-Version: 3.2

>Number:         2622
>Category:       bin
>Synopsis:       syslogd '-s' behavior either broken or poorly documented
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 30 12:40:02 PST 1997
>Closed-Date:    Sat Apr 26 10:15:38 PDT 1997
>Last-Modified:  Sat Apr 26 10:16:33 PDT 1997
>Originator:     David Lowe
>Release:        FreeBSD 2.2-BETA_A i386
>Organization:
Sirius Communications
>Environment:

FreeBSD 2.2-BETA running 'syslogd -s' and attempting to log to a Solaris
2.5.1 machine.

>Description:

This may be either a problem with syslogd, or a problem with the syslogd
man page.  Running syslogd with the '-s' switch disables incoming *and*
outgoing network syslogs, whereas the man page says:

---
 -s	Operate in secure mode.  Do not open a UDP socket to listen for
	log message from remote machines.
---

When run with this switch, however, syslogd also won't open a UDP socket to
send log messages, and (as far as I could tell) generates no explanation or
debugging output.

>How-To-Repeat:

on client machine:

	run syslogd with -s
	add a 'facility.level		@loghost' line to your /etc/syslog.conf
	logger -p user.crit testing syslogd -s

on log host:

	syslogd should be running (without -s)
	check logs.. nothing!

>Fix:
	
Workaround by running syslogd without -s on client machines.

Fix by either updating the man page so I don't tear my hair out all morning
trying to figure out why it's broken, or updating the code so -s does what
it says it's going to.

>Release-Note:
>Audit-Trail:

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 ---------------------------------------------------
 
 

From: John-Mark Gurney <jmg@hydrogen.nike.efn.org>
To: David Lowe <dlowe@sirius.com>
Cc: freebsd-bugs@freefall.freebsd.org,
        FreeBSD Current <freebsd-current@freebsd.org>,
        freebsd-gnats-submit@freebsd.org
Subject: Re: bin/2622: syslogd '-s' behavior either broken or poorly documented
Date: Sun, 9 Mar 1997 13:33:24 -0800

 I believe David Lowe scribbled this message on Mar 6:
 > The following reply was made to PR bin/2622; it has been noted by GNATS.
 > 
 > From: David Lowe <dlowe@sirius.com>
 > 
 >  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 :)
 
 hmm... I don't think we should change the behavior of -s...  it should be kept
 the same for compatibilty reasons... but we should add the new "send only"
 flag as something else...  I'm thinking -o (output only)...  but comments
 welcome...
 
 I'm actually interested in this patch as I have a couple diskless machines
 that log over the network... and I don't want them "recieving network" log
 messages...
 
 [patch that makes syslogd do what the man pages say deleted]
 
 -- 
 John-Mark
 
 gurney_j@efn.org
 http://resnet.uoregon.edu/~gurney_j/
 Modem/FAX: (541) 683-6954   (FreeBSD Box)
 
 Live in Peace, destroy Micro$oft, support free software, run FreeBSD (unix)
State-Changed-From-To: open->closed 
State-Changed-By: pst 
State-Changed-When: Sat Apr 26 10:15:38 PDT 1997 
State-Changed-Why:  
Fixed via a similar patch. 
>Unformatted:
