CVS commit: src/usr.sbin/syslogd

2023-12-31 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Dec 31 23:39:27 UTC 2023

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
syslog.conf(5): add back .Pp lost in previous


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslog.conf.5
diff -u src/usr.sbin/syslogd/syslog.conf.5:1.27 src/usr.sbin/syslogd/syslog.conf.5:1.28
--- src/usr.sbin/syslogd/syslog.conf.5:1.27	Sun Dec 31 19:41:22 2023
+++ src/usr.sbin/syslogd/syslog.conf.5	Sun Dec 31 23:39:27 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslog.conf.5,v 1.27 2023/12/31 19:41:22 uwe Exp $
+.\"	$NetBSD: syslog.conf.5,v 1.28 2023/12/31 23:39:27 uwe Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -477,10 +477,11 @@ List of fingerprints of trusted client c
 .It Ic tls_allow_clientcerts
 List of filenames with trusted client certificates.
 .El
+.Pp
 One function of TLS is mutual authentication of client and server.
 Unless authentication is disabled by setting
 .Ql tls_verify=off
-the following rules are used:
+the following rules are used.
 .Ss "Client Authentication"
 A client can be configured not to check a server's certificate by
 setting the



CVS commit: src/usr.sbin/syslogd

2023-12-31 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Dec 31 23:39:27 UTC 2023

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
syslog.conf(5): add back .Pp lost in previous


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2023-12-31 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Dec 31 19:41:22 UTC 2023

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
syslog.conf(5): improve markup

Use tagged lists, mark up literals, be consistent about options
(global): vs parameters (of a TLS action), fold TLS authentication
description into the TLS options section.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslog.conf.5
diff -u src/usr.sbin/syslogd/syslog.conf.5:1.26 src/usr.sbin/syslogd/syslog.conf.5:1.27
--- src/usr.sbin/syslogd/syslog.conf.5:1.26	Wed Sep  1 13:44:02 2021
+++ src/usr.sbin/syslogd/syslog.conf.5	Sun Dec 31 19:41:22 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslog.conf.5,v 1.26 2021/09/01 13:44:02 andvar Exp $
+.\"	$NetBSD: syslog.conf.5,v 1.27 2023/12/31 19:41:22 uwe Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -43,7 +43,12 @@ The
 file is the configuration file for the
 .Xr syslogd 8
 program.
-It consists of extended options (lines with one key="value" assignment)
+It consists of extended options
+.Po
+lines with one
+.Ar key\^ Ns Li = Ns Ar value
+assignment
+.Pc
 and blocks of lines separated by
 .Em program
 and
@@ -62,15 +67,22 @@ field is separated from the
 .Em action
 field by one or more tab characters.
 .Pp
+Blank lines and lines whose first non-blank character is a hash
+.Pq Ql #
+character are ignored.
+.\"
+.Ss Selectors
+.Pp
 The
-.Em Selectors
+.Em selector Ns s
 function
 are encoded as a
 .Em facility ,
 a period
-.Pq Sq \&. ,
-an optional set of comparison flags
-.Pq Bo ! Bc Bq <=> ,
+.Pq Ql \&. ,
+an optional set of
+.Em comparison flags
+.Pq Oo Li \&! Oc Ns Op Li <=> ,
 and a
 .Em level ,
 with no intervening white-space.
@@ -83,11 +95,31 @@ are case insensitive.
 The
 .Em facility
 describes the part of the system generating the message, and is one of
-the following keywords: auth, authpriv, cron, ftp, daemon, kern, lpr,
-mail, mark, news, syslog, user, uucp and local0 through local7.
-These keywords (with the exception of mark) correspond to the
-similar
-.Dq Dv LOG_
+the following keywords:
+.Ic auth ,
+.Ic authpriv ,
+.Ic cron ,
+.Ic daemon ,
+.Ic ftp ,
+.Ic kern ,
+.Ic lpr ,
+.Ic mail ,
+.Ic mark ,
+.Ic news ,
+.Ic syslog ,
+.Ic user ,
+.Ic uucp ,
+and
+.Ic local0
+through
+.Ic local7 .
+These keywords
+.Po
+with the exception of
+.Ic mark
+.Pc
+correspond to the similar
+.Ql LOG_
 values specified to the
 .Xr openlog 3
 and
@@ -98,32 +130,40 @@ The
 .Em comparison flags
 may be used to specify exactly what levels are logged.
 If unspecified, the default comparison is
-.Sq >=
+.Ql >=
 .Pq greater than or equal to ,
 or, if the
 .Fl U
 option is passed to
 .Xr syslogd 8 ,
-.Sq =
+.Ql =
 .Pq equal to .
 Comparison flags beginning with
-.So ! Sc
+.Ql \&!
 will have their logical sense inverted.
 Thus,
-.Sq !=info
+.Ql !=info
 means all levels except info and
-.Sq !notice
+.Ql !notice
 has the same meaning as
-.Sq 

CVS commit: src/usr.sbin/syslogd

2023-12-31 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Dec 31 19:41:22 UTC 2023

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
syslog.conf(5): improve markup

Use tagged lists, mark up literals, be consistent about options
(global): vs parameters (of a TLS action), fold TLS authentication
description into the TLS options section.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2023-10-11 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Oct 11 23:22:14 UTC 2023

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
syslogd.c: fix a typo in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2023-10-11 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Oct 11 23:22:14 UTC 2023

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
syslogd.c: fix a typo in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.140 src/usr.sbin/syslogd/syslogd.c:1.141
--- src/usr.sbin/syslogd/syslogd.c:1.140	Tue Nov  8 01:43:09 2022
+++ src/usr.sbin/syslogd/syslogd.c	Wed Oct 11 23:22:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.140 2022/11/08 01:43:09 uwe Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.141 2023/10/11 23:22:13 uwe Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.140 2022/11/08 01:43:09 uwe Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.141 2023/10/11 23:22:13 uwe Exp $");
 #endif
 #endif /* not lint */
 
@@ -1777,7 +1777,7 @@ check_timestamp(unsigned char *from_buf,
 			 	 */
 *to_buf = strdup("-");
 			} else {
-/* with BSD Syslog the field is reqired
+/* with BSD Syslog the field is required
  * so replace it with current time
  */
 *to_buf = make_timestamp(NULL, false, 0);



CVS commit: src/usr.sbin/syslogd

2023-05-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May  9 20:10:07 UTC 2023

Modified Files:
src/usr.sbin/syslogd: Makefile

Log Message:
Handle OpenSSL-3.x


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/syslogd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/Makefile
diff -u src/usr.sbin/syslogd/Makefile:1.31 src/usr.sbin/syslogd/Makefile:1.32
--- src/usr.sbin/syslogd/Makefile:1.31	Sun Mar  7 10:09:12 2021
+++ src/usr.sbin/syslogd/Makefile	Tue May  9 16:10:07 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.31 2021/03/07 15:09:12 christos Exp $
+#	$NetBSD: Makefile,v 1.32 2023/05/09 20:10:07 christos Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
 .include 
 
@@ -32,5 +32,7 @@ LDADD+=	-lssl -lcrypto
 
 # Overflow that appears impossible
 COPTS.syslogd.c+=${GCC_NO_FORMAT_TRUNCATION} ${GCC_NO_STRINGOP_TRUNCATION}
+COPTS.tls.c+= -Wno-error=deprecated-declarations
+COPTS.sign.c+= -Wno-error=deprecated-declarations
 
 .include 



CVS commit: src/usr.sbin/syslogd

2023-05-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May  9 20:10:07 UTC 2023

Modified Files:
src/usr.sbin/syslogd: Makefile

Log Message:
Handle OpenSSL-3.x


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/syslogd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2023-05-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon May  1 11:57:53 UTC 2023

Modified Files:
src/usr.sbin/syslogd: sign.html

Log Message:
s/betwen/between/ and s/singed/signed/.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/syslogd/sign.html

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/sign.html
diff -u src/usr.sbin/syslogd/sign.html:1.1 src/usr.sbin/syslogd/sign.html:1.2
--- src/usr.sbin/syslogd/sign.html:1.1	Fri Oct 31 16:12:19 2008
+++ src/usr.sbin/syslogd/sign.html	Mon May  1 11:57:53 2023
@@ -9,7 +9,7 @@
 http://tools.ietf.org/html/draft-ietf-syslog-sign;>syslog-sign defines digital signatures for logfiles. This provides end-to-end authentication for network transports, enables the detection of lost UDP messages, and also makes it possible to check a log archive for later modifications (assuming the private key was kept safe).
 
 Signature Groups
-A basic concept of syslog-sign is the signature group which describes a set of messages that are grouped and signed together. Their purpose becomes clear with an example: assume you split your messages to two logservers serverA and serverB. Now if all messages were singed as one stream, then a) where do the signatures go to? and b) how could serverA, having only hashes and signatures, decide which message are missing and which are on serverB?
+A basic concept of syslog-sign is the signature group which describes a set of messages that are grouped and signed together. Their purpose becomes clear with an example: assume you split your messages to two logservers serverA and serverB. Now if all messages were signed as one stream, then a) where do the signatures go to? and b) how could serverA, having only hashes and signatures, decide which message are missing and which are on serverB?
 Thus the messages are selected into two signature groups containing all signatures for messages to serverA and serverB respectively. Then every server has its own messages and its own signatures to verify them.
 There are three predefined and one custom signature groups:
 
@@ -22,7 +22,7 @@ Thus the messages are selected into two 
 
 Configuration/Activation
 syslog-sign is enabled with the option "sign_sg" in syslog.conf. The value selects the signature group strategy, so for example the line "sign_sg=0" enables syslog-sign with one signature group.
-The SG="2" strategy is the only one that might require additional configuration. When selected (with "sign_sg=2") the default is to use one signature group per facility (kernel, user, mail, ...). To allow custom configuration there is an additional option "sign_sg2_delim" to specify the numerical SPRI values, i.e. the boundaries betwen the signature groups.
+The SG="2" strategy is the only one that might require additional configuration. When selected (with "sign_sg=2") the default is to use one signature group per facility (kernel, user, mail, ...). To allow custom configuration there is an additional option "sign_sg2_delim" to specify the numerical SPRI values, i.e. the boundaries between the signature groups.
 Example: With "sign_sg2_delim = 15 31" syslogd will set up three signature groups: one for all priorities x  15 (kernel.*,user.*), one for priorities 15  x  31 (mail.*), and one for all priorities x  31.
 
 Key, Signature, and Hash Types
@@ -137,7 +137,7 @@ messages without signature:
 
   
 Martin Schtte i...@mschuette.name  
-$Id: sign.html,v 1.1 2008/10/31 16:12:19 christos Exp $  
+$Id: sign.html,v 1.2 2023/05/01 11:57:53 andvar Exp $  
   
 
 



CVS commit: src/usr.sbin/syslogd

2023-05-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon May  1 11:57:53 UTC 2023

Modified Files:
src/usr.sbin/syslogd: sign.html

Log Message:
s/betwen/between/ and s/singed/signed/.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/syslogd/sign.html

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2022-11-07 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Nov  8 01:43:09 UTC 2022

Modified Files:
src/usr.sbin/syslogd: syslogd.8 syslogd.c

Log Message:
syslogd: make -d accept an optional argument

Make it possible to specify the debug message categories with an
optional numeric argument.  You'll have to read the fine source to
find out what they are.  The number can be specified as the usual
decimal, hex (0x), or octal (0) literal with an optional ~negation.

Since syslogd uses getopt(3), not getopt_long(3), do a bit of
gymnastics so that both -d42 and -d 42 are accepted (I'm not inventing
long names for all the existing options just to support an optional
argument to -d).

-d without an argument still uses the old D_DEFAULT selection just in
case someone really relies on that.  You can disable all debug
messages with -d0 but still get syslogd not daemonized.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/syslogd/syslogd.8
cvs rdiff -u -r1.139 -r1.140 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2022-11-07 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Nov  8 01:43:09 UTC 2022

Modified Files:
src/usr.sbin/syslogd: syslogd.8 syslogd.c

Log Message:
syslogd: make -d accept an optional argument

Make it possible to specify the debug message categories with an
optional numeric argument.  You'll have to read the fine source to
find out what they are.  The number can be specified as the usual
decimal, hex (0x), or octal (0) literal with an optional ~negation.

Since syslogd uses getopt(3), not getopt_long(3), do a bit of
gymnastics so that both -d42 and -d 42 are accepted (I'm not inventing
long names for all the existing options just to support an optional
argument to -d).

-d without an argument still uses the old D_DEFAULT selection just in
case someone really relies on that.  You can disable all debug
messages with -d0 but still get syslogd not daemonized.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/syslogd/syslogd.8
cvs rdiff -u -r1.139 -r1.140 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.8
diff -u src/usr.sbin/syslogd/syslogd.8:1.58 src/usr.sbin/syslogd/syslogd.8:1.59
--- src/usr.sbin/syslogd/syslogd.8:1.58	Mon Nov  5 09:22:30 2018
+++ src/usr.sbin/syslogd/syslogd.8	Tue Nov  8 01:43:09 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslogd.8,v 1.58 2018/11/05 09:22:30 wiz Exp $
+.\"	$NetBSD: syslogd.8,v 1.59 2022/11/08 01:43:09 uwe Exp $
 .\"
 .\" Copyright (c) 1983, 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" from: @(#)syslogd.8	8.1 (Berkeley) 6/6/93
 .\"
-.Dd November 4, 2018
+.Dd November 8, 2022
 .Dt SYSLOGD 8
 .Os
 .Sh NAME
@@ -37,9 +37,10 @@
 .Nd log systems messages
 .Sh SYNOPSIS
 .Nm
-.Op Fl dnrSsTUvX
+.Op Fl nrSsTUvX
 .Op Fl B Ar buffer_length
 .Op Fl b Ar bind_address
+.Op Fl d Op Oo Cm \&~ Oc Ns Ar what
 .Op Fl f Ar config_file
 .Op Fl g Ar group
 .Op Fl m Ar mark_interval
@@ -68,9 +69,20 @@ option.
 Specify one specific IP address or hostname to bind to.
 If a hostname is specified, the IPv4 or IPv6 address
 which corresponds to it is used.
-.It Fl d
-Enable debugging to the standard output,
-and do not disassociate from the controlling terminal.
+.It Fl d Op Oo Cm \&~ Oc Ns Ar what
+Do not disassociate from the controlling terminal and
+enable debugging to the standard output.
+The optional
+.Ar what
+argument is a number that selects which categories of the debug
+messages are to be enabled.
+A tilde
+.Pq Sq Cm \&~
+before
+.Ar what
+inverts its meaning so that all messages except those selected by
+.Ar what
+are enabled.
 .It Fl f Ar config_file
 Specify the pathname of an alternative configuration file;
 the default is

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.139 src/usr.sbin/syslogd/syslogd.c:1.140
--- src/usr.sbin/syslogd/syslogd.c:1.139	Fri May 20 19:34:23 2022
+++ src/usr.sbin/syslogd/syslogd.c	Tue Nov  8 01:43:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.139 2022/05/20 19:34:23 andvar Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.140 2022/11/08 01:43:09 uwe Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.139 2022/05/20 19:34:23 andvar Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.140 2022/11/08 01:43:09 uwe Exp $");
 #endif
 #endif /* not lint */
 
@@ -212,6 +212,7 @@ char	include_pid_buf[11];
 
 /* init and setup */
 void		usage(void) __attribute__((__noreturn__));
+void		set_debug(const char *);
 void		logpath_add(char ***, int *, int *, const char *);
 void		logpath_fileadd(char ***, int *, int *, const char *);
 void		init(int fd, short event, void *ev);  /* SIGHUP kevent dispatch routine */
@@ -318,7 +319,7 @@ main(int argc, char *argv[])
 	/* should we set LC_TIME="C" to ensure correct timestamps? */
 	(void)setlocale(LC_ALL, "");
 
-	while ((ch = getopt(argc, argv, "b:B:dnsSf:m:o:p:P:ru:g:t:TUvX")) != -1)
+	while ((ch = getopt(argc, argv, "b:B:d::nsSf:m:o:p:P:ru:g:t:TUvX")) != -1)
 		switch(ch) {
 		case 'b':
 			bindhostname = optarg;
@@ -329,9 +330,27 @@ main(int argc, char *argv[])
 buflen = RCVBUFLEN;
 			break;
 		case 'd':		/* debug */
-			Debug = D_DEFAULT;
-			/* is there a way to read the integer value
-			 * for Debug as an optional argument? */
+			if (optarg != NULL) {
+/*
+ * getopt passes as optarg everything
+ * after 'd' in -darg, manually accept
+ * -d=arg too.
+ */
+if (optarg[0] == '=')
+	++optarg;
+			} else if (optind < argc) {
+/*
+ * :: treats "-d ..." as missing
+ * optarg, so look ahead manually and
+ * pick up the next arg if it looks
+ * like one.
+ */
+if (argv[optind][0] != '-') {
+	optarg = argv[optind];
+	

CVS commit: src/usr.sbin/syslogd

2022-11-07 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Nov  8 01:05:10 UTC 2022

Modified Files:
src/usr.sbin/syslogd: tls.c

Log Message:
tls.c: wrap debug-only data in #ifndef NDEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2022-11-07 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Nov  8 01:05:10 UTC 2022

Modified Files:
src/usr.sbin/syslogd: tls.c

Log Message:
tls.c: wrap debug-only data in #ifndef NDEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/tls.c
diff -u src/usr.sbin/syslogd/tls.c:1.20 src/usr.sbin/syslogd/tls.c:1.21
--- src/usr.sbin/syslogd/tls.c:1.20	Sun May 15 20:37:51 2022
+++ src/usr.sbin/syslogd/tls.c	Tue Nov  8 01:05:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.c,v 1.20 2022/05/15 20:37:51 andvar Exp $	*/
+/*	$NetBSD: tls.c,v 1.21 2022/11/08 01:05:10 uwe Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: tls.c,v 1.20 2022/05/15 20:37:51 andvar Exp $");
+__RCSID("$NetBSD: tls.c,v 1.21 2022/11/08 01:05:10 uwe Exp $");
 
 #ifndef DISABLE_TLS
 #include 
@@ -57,6 +57,7 @@ __RCSID("$NetBSD: tls.c,v 1.20 2022/05/1
 
 static unsigned getVerifySetting(const char *x509verifystring);
 
+#ifndef NDEBUG
 /* to output SSL error codes */
 static const char *SSL_ERRCODE[] = {
 	"SSL_ERROR_NONE",
@@ -81,6 +82,7 @@ static const char *TLS_CONN_STATES[] = {
 	"ST_CLOSING0",
 	"ST_CLOSING1",
 	"ST_CLOSING2"};
+#endif	/* !NDEBUG */
 
 DH *get_dh1024(void);
 /* DH parameter precomputed with "openssl dhparam -C -2 1024" */



CVS commit: src/usr.sbin/syslogd

2022-11-07 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Nov  8 01:03:27 UTC 2022

Modified Files:
src/usr.sbin/syslogd: sign.c

Log Message:
sign.c: mark a variable used only in asserts as __diagused


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/syslogd/sign.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2022-11-07 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Nov  8 01:03:27 UTC 2022

Modified Files:
src/usr.sbin/syslogd: sign.c

Log Message:
sign.c: mark a variable used only in asserts as __diagused


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/syslogd/sign.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/sign.c
diff -u src/usr.sbin/syslogd/sign.c:1.8 src/usr.sbin/syslogd/sign.c:1.9
--- src/usr.sbin/syslogd/sign.c:1.8	Sat Nov 27 22:30:26 2021
+++ src/usr.sbin/syslogd/sign.c	Tue Nov  8 01:03:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sign.c,v 1.8 2021/11/27 22:30:26 rillig Exp $	*/
+/*	$NetBSD: sign.c,v 1.9 2022/11/08 01:03:27 uwe Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: sign.c,v 1.8 2021/11/27 22:30:26 rillig Exp $");
+__RCSID("$NetBSD: sign.c,v 1.9 2022/11/08 01:03:27 uwe Exp $");
 
 #ifndef DISABLE_SIGN
 #include "syslogd.h"
@@ -514,7 +514,7 @@ sign_send_certificate_block(struct signa
 	char *tstamp;
 	char payload[SIGN_MAX_PAYLOAD_LENGTH];
 	char sd[SIGN_MAX_SD_LENGTH];
-	size_t payload_len, sd_len, fragment_len;
+	size_t payload_len, fragment_len;
 	size_t payload_index = 0;
 
 	/* do nothing if CBs already sent or if there was no message in SG */
@@ -540,6 +540,7 @@ sign_send_certificate_block(struct signa
 			fragment_len = SIGN_MAX_FRAG_LENGTH;
 
 		/* format SD */
+		size_t sd_len __diagused;
 		sd_len = snprintf(sd, sizeof(sd), "[ssign-cert "
 		"VER=\"%s\" RSID=\"%" PRIuFAST64 "\" SG=\"%d\" "
 		"SPRI=\"%d\" TBPL=\"%zu\" INDEX=\"%zu\" "



CVS commit: src/usr.sbin/syslogd

2021-09-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Sep  1 13:44:02 UTC 2021

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
s/optons/options/


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslog.conf.5
diff -u src/usr.sbin/syslogd/syslog.conf.5:1.25 src/usr.sbin/syslogd/syslog.conf.5:1.26
--- src/usr.sbin/syslogd/syslog.conf.5:1.25	Mon Jul  3 21:35:32 2017
+++ src/usr.sbin/syslogd/syslog.conf.5	Wed Sep  1 13:44:02 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslog.conf.5,v 1.25 2017/07/03 21:35:32 wiz Exp $
+.\"	$NetBSD: syslog.conf.5,v 1.26 2021/09/01 13:44:02 andvar Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -477,7 +477,7 @@ On any match the client is authenticated
 .Sh BUFFERING
 .Xr syslogd 8
 is able to buffer temporary not writable messages in memory.
-To limit the memory consumed for this buffering the following optons may be
+To limit the memory consumed for this buffering the following options may be
 given:
 .Bl -ohang
 .It Em file_queue_length



CVS commit: src/usr.sbin/syslogd

2021-09-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Sep  1 13:44:02 UTC 2021

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
s/optons/options/


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Nov  8 01:12:46 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
syslogd: in die(), don't call die() again recursively.

Particularly not for something as immaterial as close failing.

PR 55795


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.135 src/usr.sbin/syslogd/syslogd.c:1.136
--- src/usr.sbin/syslogd/syslogd.c:1.135	Sat Nov  7 17:46:56 2020
+++ src/usr.sbin/syslogd/syslogd.c	Sun Nov  8 01:12:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.135 2020/11/07 17:46:56 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.136 2020/11/08 01:12:46 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.135 2020/11/07 17:46:56 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.136 2020/11/08 01:12:46 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -3012,10 +3012,7 @@ die(int fd, short event, void *ev)
 	 */
 	if (finet) {
 		for (i = 0; i < finet->fd; i++) {
-			if (close(finet[i+1].fd) < 0) {
-logerror("close() failed");
-die(0, 0, NULL);
-			}
+			(void)close(finet[i+1].fd);
 			DEL_EVENT(finet[i+1].ev);
 			FREEPTR(finet[i+1].ev);
 		}



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Nov  8 01:12:46 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
syslogd: in die(), don't call die() again recursively.

Particularly not for something as immaterial as close failing.

PR 55795


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  7 17:46:57 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
make the buffer fit any 32 bit number.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.134 src/usr.sbin/syslogd/syslogd.c:1.135
--- src/usr.sbin/syslogd/syslogd.c:1.134	Sat Nov  7 11:16:33 2020
+++ src/usr.sbin/syslogd/syslogd.c	Sat Nov  7 12:46:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.134 2020/11/07 16:16:33 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.135 2020/11/07 17:46:56 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.134 2020/11/07 16:16:33 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.135 2020/11/07 17:46:56 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -207,7 +207,7 @@ bool	BSDOutputFormat = true;	/* if true 
  */
 char	appname[]   = "syslogd";/* the APPNAME for own messages */
 char   *include_pid;		/* include PID in own messages */
-char	include_pid_buf[6];
+char	include_pid_buf[11];
 
 
 /* init and setup */



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  7 17:46:57 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
make the buffer fit any 32 bit number.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  7 16:16:33 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
PR/55794: Jan Schaumann: Eliminate unchecked malloc


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.133 src/usr.sbin/syslogd/syslogd.c:1.134
--- src/usr.sbin/syslogd/syslogd.c:1.133	Tue Sep 29 10:08:43 2020
+++ src/usr.sbin/syslogd/syslogd.c	Sat Nov  7 11:16:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.133 2020/09/29 14:08:43 gson Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.134 2020/11/07 16:16:33 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.133 2020/09/29 14:08:43 gson Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.134 2020/11/07 16:16:33 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -206,7 +206,8 @@ bool	BSDOutputFormat = true;	/* if true 
  * configurations (e.g. with SG="0").
  */
 char	appname[]   = "syslogd";/* the APPNAME for own messages */
-char   *include_pid = NULL;	/* include PID in own messages */
+char   *include_pid;		/* include PID in own messages */
+char	include_pid_buf[6];
 
 
 /* init and setup */
@@ -573,9 +574,8 @@ getgroup:
 #endif /* __NetBSD_Version__ */
 	}
 
-#define MAX_PID_LEN 5
-	include_pid = malloc(MAX_PID_LEN+1);
-	snprintf(include_pid, MAX_PID_LEN+1, "%d", getpid());
+	include_pid = include_pid_buf;
+	snprintf(include_pid_buf, sizeof(include_pid_buf), "%d", getpid());
 
 	/*
 	 * Create the global kernel event descriptor.



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  7 16:16:33 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
PR/55794: Jan Schaumann: Eliminate unchecked malloc


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2020-09-29 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Tue Sep 29 14:08:43 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
When reporting an error before daemonizing, prefix the error message
with the program name.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2020-09-29 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Tue Sep 29 14:08:43 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
When reporting an error before daemonizing, prefix the error message
with the program name.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.132 src/usr.sbin/syslogd/syslogd.c:1.133
--- src/usr.sbin/syslogd/syslogd.c:1.132	Thu Dec 26 04:53:12 2019
+++ src/usr.sbin/syslogd/syslogd.c	Tue Sep 29 14:08:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.132 2019/12/26 04:53:12 msaitoh Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.133 2020/09/29 14:08:43 gson Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.132 2019/12/26 04:53:12 msaitoh Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.133 2020/09/29 14:08:43 gson Exp $");
 #endif
 #endif /* not lint */
 
@@ -2881,7 +2881,7 @@ logerror(const char *fmt, ...)
 	if (!daemonized && Debug)
 		DPRINTF(D_MISC, "%s\n", outbuf);
 	if (!daemonized && !Debug)
-		printf("%s\n", outbuf);
+		printf("%s: %s\n", getprogname(), outbuf);
 
 	logerror_running = 0;
 }



CVS commit: src/usr.sbin/syslogd

2019-10-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu Oct 24 08:21:18 UTC 2019

Modified Files:
src/usr.sbin/syslogd: tls.c

Log Message:
With TLSv1.3 a client has to receive and process metadata.

Update dispatch_tls_eof() to check for metadata and
rearm on success.

Ok: christos@


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/tls.c
diff -u src/usr.sbin/syslogd/tls.c:1.16 src/usr.sbin/syslogd/tls.c:1.17
--- src/usr.sbin/syslogd/tls.c:1.16	Thu Feb  8 17:45:29 2018
+++ src/usr.sbin/syslogd/tls.c	Thu Oct 24 08:21:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.c,v 1.16 2018/02/08 17:45:29 christos Exp $	*/
+/*	$NetBSD: tls.c,v 1.17 2019/10/24 08:21:18 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: tls.c,v 1.16 2018/02/08 17:45:29 christos Exp $");
+__RCSID("$NetBSD: tls.c,v 1.17 2019/10/24 08:21:18 hannken Exp $");
 
 #ifndef DISABLE_TLS
 #include 
@@ -1450,7 +1450,7 @@ dispatch_socket_accept(int fd, short eve
  *
  * I do not know if libevent can tell us the difference
  * between available data and an EOF. But it does not matter
- * because there should not be any incoming data.
+ * because there should not be any incoming data beside metadata.
  * So we close the connection either because the peer closed its
  * side or because the peer broke the protocol by sending us stuff  ;-)
  */
@@ -1460,11 +1460,26 @@ dispatch_tls_eof(int fd, short event, vo
 	struct tls_conn_settings *conn_info = (struct tls_conn_settings *) arg;
 	sigset_t newmask, omask;
 	struct timeval tv;
+	int rc;
+	char buf[1];
 
 	BLOCK_SIGNALS(omask, newmask);
 	DPRINTF((D_TLS|D_EVENT|D_CALL), "dispatch_eof_tls(%d, %d, %p)\n",
 	fd, event, arg);
 	assert(conn_info->state == ST_TLS_EST);
+
+	/* First check for incoming metadata. */
+	ST_CHANGE(conn_info->state, ST_READING);
+	rc = SSL_read(conn_info->sslptr, buf, sizeof(buf));
+	ST_CHANGE(conn_info->state, ST_TLS_EST);
+	if (rc <= 0 && tls_examine_error("SSL_read()", conn_info->sslptr,
+	conn_info, rc) == TLS_RETRY_READ) {
+		/* Connection is still alive, rearm and return. */
+		EVENT_ADD(conn_info->event);
+		RESTORE_SIGNALS(omask);
+		return;
+	}
+
 	ST_CHANGE(conn_info->state, ST_EOF);
 	DEL_EVENT(conn_info->event);
 



CVS commit: src/usr.sbin/syslogd

2019-10-24 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu Oct 24 08:21:18 UTC 2019

Modified Files:
src/usr.sbin/syslogd: tls.c

Log Message:
With TLSv1.3 a client has to receive and process metadata.

Update dispatch_tls_eof() to check for metadata and
rearm on success.

Ok: christos@


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2019-02-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Feb 11 19:45:54 UTC 2019

Modified Files:
src/usr.sbin/syslogd: syslogd.h

Log Message:
add parens around defines with expressions that could expand poorly
depending on the usage.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/syslogd/syslogd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.h
diff -u src/usr.sbin/syslogd/syslogd.h:1.7 src/usr.sbin/syslogd/syslogd.h:1.8
--- src/usr.sbin/syslogd/syslogd.h:1.7	Tue Sep  8 18:33:12 2015
+++ src/usr.sbin/syslogd/syslogd.h	Mon Feb 11 19:45:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.h,v 1.7 2015/09/08 18:33:12 plunky Exp $	*/
+/*	$NetBSD: syslogd.h,v 1.8 2019/02/11 19:45:54 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -243,8 +243,8 @@ void dbprintf(const char *, const char *
 } while (/*CONSTCOND*/0)
 
 #define MAXUNAMES		20	/* maximum number of user names */
-#define BSD_TIMESTAMPLEN	14+1
-#define MAX_TIMESTAMPLEN	31+1
+#define BSD_TIMESTAMPLEN	(14+1)
+#define MAX_TIMESTAMPLEN	(31+1)
 
 /* maximum field lengths in syslog-protocol */
 #define PRI_MAX	  5



CVS commit: src/usr.sbin/syslogd

2019-02-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Feb 11 19:45:54 UTC 2019

Modified Files:
src/usr.sbin/syslogd: syslogd.h

Log Message:
add parens around defines with expressions that could expand poorly
depending on the usage.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/syslogd/syslogd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2018-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  5 10:27:06 UTC 2018

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
Revert previous - local merge mishap


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2018-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  5 10:27:06 UTC 2018

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
Revert previous - local merge mishap


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.129 src/usr.sbin/syslogd/syslogd.c:1.130
--- src/usr.sbin/syslogd/syslogd.c:1.129	Mon Nov  5 09:22:30 2018
+++ src/usr.sbin/syslogd/syslogd.c	Mon Nov  5 10:27:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.129 2018/11/05 09:22:30 wiz Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.130 2018/11/05 10:27:06 martin Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.129 2018/11/05 09:22:30 wiz Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.130 2018/11/05 10:27:06 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -75,9 +75,6 @@ __RCSID("$NetBSD: syslogd.c,v 1.129 2018
 #include "syslogd.h"
 #include "extern.h"
 
-/* Minimum size of the logpath socket buffer */
-#define	RCVBUFLEN		16384
-
 #ifndef DISABLE_SIGN
 #include "sign.h"
 struct sign_global_t GlobalSign = {
@@ -496,9 +493,6 @@ getgroup:
 		die(0, 0, NULL);
 	}
 	for (j = 0, pp = LogPaths; *pp; pp++, j++) {
-		int buf_len;
-		socklen_t socklen = sizeof(buf_len);
-
 		DPRINTF(D_NET, "Making unix dgram socket `%s'\n", *pp);
 		unlink(*pp);
 		memset(, 0, sizeof(sunx));
@@ -513,19 +507,6 @@ getgroup:
 		}
 		setsockbuf(funix[j], *pp);
 		DPRINTF(D_NET, "Listening on unix dgram socket `%s'\n", *pp);
-		if (getsockopt(funix[j], SOL_SOCKET, SO_RCVBUF,
-			   _len, ) == -1) {
-			logerror("getsockopt: SO_RCVBUF: `%s'", *pp);
-			continue;
-		}
-		if (buf_len >= RCVBUFLEN)
-			continue;
-		buf_len = RCVBUFLEN;
-		if (setsockopt(funix[j], SOL_SOCKET, SO_RCVBUF,
-			   _len, socklen) == -1) {
-			logerror("setsockopt: SO_RCVBUF: `%s'", *pp);
-			continue;
-		}
 	}
 
 	if ((fklog = open(_PATH_KLOG, O_RDONLY, 0)) < 0) {



CVS commit: src/usr.sbin/syslogd

2018-11-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Nov  5 09:22:30 UTC 2018

Modified Files:
src/usr.sbin/syslogd: syslogd.8 syslogd.c

Log Message:
Sort options.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/syslogd/syslogd.8
cvs rdiff -u -r1.128 -r1.129 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2018-11-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Nov  5 09:22:30 UTC 2018

Modified Files:
src/usr.sbin/syslogd: syslogd.8 syslogd.c

Log Message:
Sort options.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/syslogd/syslogd.8
cvs rdiff -u -r1.128 -r1.129 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.8
diff -u src/usr.sbin/syslogd/syslogd.8:1.57 src/usr.sbin/syslogd/syslogd.8:1.58
--- src/usr.sbin/syslogd/syslogd.8:1.57	Sun Nov  4 20:45:21 2018
+++ src/usr.sbin/syslogd/syslogd.8	Mon Nov  5 09:22:30 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslogd.8,v 1.57 2018/11/04 20:45:21 roy Exp $
+.\"	$NetBSD: syslogd.8,v 1.58 2018/11/05 09:22:30 wiz Exp $
 .\"
 .\" Copyright (c) 1983, 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -38,8 +38,8 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl dnrSsTUvX
-.Op Fl b Ar bind_address
 .Op Fl B Ar buffer_length
+.Op Fl b Ar bind_address
 .Op Fl f Ar config_file
 .Op Fl g Ar group
 .Op Fl m Ar mark_interval
@@ -57,10 +57,6 @@ reads and logs messages to the system co
 machines and/or users as specified by its configuration file.
 The options are as follows:
 .Bl -tag -width 15n
-.It Fl b Ar bind_address
-Specify one specific IP address or hostname to bind to.
-If a hostname is specified, the IPv4 or IPv6 address
-which corresponds to it is used.
 .It Fl B Ar buffer_length
 Sets the receiving buffer length.
 The default is 16384 bytes.
@@ -68,6 +64,10 @@ If syslogd reports buffer overflow, this
 If you don't care about it being reported, see the
 .Fl X
 option.
+.It Fl b Ar bind_address
+Specify one specific IP address or hostname to bind to.
+If a hostname is specified, the IPv4 or IPv6 address
+which corresponds to it is used.
 .It Fl d
 Enable debugging to the standard output,
 and do not disassociate from the controlling terminal.
@@ -126,20 +126,16 @@ which
 runs is subject to attack over the network and it is desired
 that the machine be protected from attempts to remotely fill logs
 and similar attacks.
-.It Fl t Ar chroot_dir
-.Xr chroot 2
-to
-.Ar chroot_dir
-after the sockets and log files have been opened.
 .It Fl T
 Always use the local time and date for messages received from the
 network, instead of the timestamp field supplied in the message
 by the remote host.
 This is useful if some of the originating hosts can't keep time
 properly or are unable to generate a correct timestamp.
-.It Fl u Ar user
-Set UID to
-.Ar user
+.It Fl t Ar chroot_dir
+.Xr chroot 2
+to
+.Ar chroot_dir
 after the sockets and log files have been opened.
 .It Fl U
 Unique priority logging.
@@ -151,6 +147,10 @@ This option changes the default priority
 .Sq >=
 to
 .Sq = .
+.It Fl u Ar user
+Set UID to
+.Ar user
+after the sockets and log files have been opened.
 .It Fl v
 Verbose logging.
 If specified once, the numeric facility and priority are logged with

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.128 src/usr.sbin/syslogd/syslogd.c:1.129
--- src/usr.sbin/syslogd/syslogd.c:1.128	Mon Nov  5 08:34:20 2018
+++ src/usr.sbin/syslogd/syslogd.c	Mon Nov  5 09:22:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.128 2018/11/05 08:34:20 martin Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.129 2018/11/05 09:22:30 wiz Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.128 2018/11/05 08:34:20 martin Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.129 2018/11/05 09:22:30 wiz Exp $");
 #endif
 #endif /* not lint */
 
@@ -686,7 +686,7 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-	"usage: %s [-dnrSsTUvX] [-b bind_address] [-B buffer_length]\n"
+	"usage: %s [-dnrSsTUvX] [-B buffer_length] [-b bind_address]\n"
 	"\t[-f config_file] [-g group]\n"
 	"\t[-m mark_interval] [-P file_list] [-p log_socket\n"
 	"\t[-p log_socket2 ...]] [-t chroot_dir] [-u user]\n",



CVS commit: src/usr.sbin/syslogd

2018-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  5 08:34:20 UTC 2018

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
Make it compilable with gcc


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2018-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  5 08:34:20 UTC 2018

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
Make it compilable with gcc


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.127 src/usr.sbin/syslogd/syslogd.c:1.128
--- src/usr.sbin/syslogd/syslogd.c:1.127	Sun Nov  4 20:45:21 2018
+++ src/usr.sbin/syslogd/syslogd.c	Mon Nov  5 08:34:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.127 2018/11/04 20:45:21 roy Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.128 2018/11/05 08:34:20 martin Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.127 2018/11/04 20:45:21 roy Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.128 2018/11/05 08:34:20 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -75,6 +75,9 @@ __RCSID("$NetBSD: syslogd.c,v 1.127 2018
 #include "syslogd.h"
 #include "extern.h"
 
+/* Minimum size of the logpath socket buffer */
+#define	RCVBUFLEN		16384
+
 #ifndef DISABLE_SIGN
 #include "sign.h"
 struct sign_global_t GlobalSign = {
@@ -493,6 +496,9 @@ getgroup:
 		die(0, 0, NULL);
 	}
 	for (j = 0, pp = LogPaths; *pp; pp++, j++) {
+		int buf_len;
+		socklen_t socklen = sizeof(buf_len);
+
 		DPRINTF(D_NET, "Making unix dgram socket `%s'\n", *pp);
 		unlink(*pp);
 		memset(, 0, sizeof(sunx));
@@ -507,6 +513,19 @@ getgroup:
 		}
 		setsockbuf(funix[j], *pp);
 		DPRINTF(D_NET, "Listening on unix dgram socket `%s'\n", *pp);
+		if (getsockopt(funix[j], SOL_SOCKET, SO_RCVBUF,
+			   _len, ) == -1) {
+			logerror("getsockopt: SO_RCVBUF: `%s'", *pp);
+			continue;
+		}
+		if (buf_len >= RCVBUFLEN)
+			continue;
+		buf_len = RCVBUFLEN;
+		if (setsockopt(funix[j], SOL_SOCKET, SO_RCVBUF,
+			   _len, socklen) == -1) {
+			logerror("setsockopt: SO_RCVBUF: `%s'", *pp);
+			continue;
+		}
 	}
 
 	if ((fklog = open(_PATH_KLOG, O_RDONLY, 0)) < 0) {



CVS commit: src/usr.sbin/syslogd

2018-11-04 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Nov  4 20:45:21 UTC 2018

Modified Files:
src/usr.sbin/syslogd: syslogd.8 syslogd.c

Log Message:
syslogd: allow the reporting of buffer overflows to be disabled.

This generally isn't a good thing, nothing should be discard silently.
However, for systems that don't want big syslogd buffers or are too slow
to log effectively this reporting can now be disabled.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/syslogd/syslogd.8
cvs rdiff -u -r1.126 -r1.127 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2018-11-04 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Nov  4 20:45:21 UTC 2018

Modified Files:
src/usr.sbin/syslogd: syslogd.8 syslogd.c

Log Message:
syslogd: allow the reporting of buffer overflows to be disabled.

This generally isn't a good thing, nothing should be discard silently.
However, for systems that don't want big syslogd buffers or are too slow
to log effectively this reporting can now be disabled.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/syslogd/syslogd.8
cvs rdiff -u -r1.126 -r1.127 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.8
diff -u src/usr.sbin/syslogd/syslogd.8:1.56 src/usr.sbin/syslogd/syslogd.8:1.57
--- src/usr.sbin/syslogd/syslogd.8:1.56	Sun Nov  4 20:23:08 2018
+++ src/usr.sbin/syslogd/syslogd.8	Sun Nov  4 20:45:21 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslogd.8,v 1.56 2018/11/04 20:23:08 roy Exp $
+.\"	$NetBSD: syslogd.8,v 1.57 2018/11/04 20:45:21 roy Exp $
 .\"
 .\" Copyright (c) 1983, 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -37,7 +37,7 @@
 .Nd log systems messages
 .Sh SYNOPSIS
 .Nm
-.Op Fl dnrSsTUv
+.Op Fl dnrSsTUvX
 .Op Fl b Ar bind_address
 .Op Fl B Ar buffer_length
 .Op Fl f Ar config_file
@@ -65,6 +65,9 @@ which corresponds to it is used.
 Sets the receiving buffer length.
 The default is 16384 bytes.
 If syslogd reports buffer overflow, this needs increasing.
+If you don't care about it being reported, see the
+.Fl X
+option.
 .It Fl d
 Enable debugging to the standard output,
 and do not disassociate from the controlling terminal.
@@ -154,6 +157,8 @@ If specified once, the numeric facility 
 each locally-written message.
 If specified more than once, the names of the facility and priority are
 logged with each locally-written message.
+.It Fl X
+Disable logging of buffer overflow.
 .El
 .Pp
 .Nm

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.126 src/usr.sbin/syslogd/syslogd.c:1.127
--- src/usr.sbin/syslogd/syslogd.c:1.126	Sun Nov  4 20:23:08 2018
+++ src/usr.sbin/syslogd/syslogd.c	Sun Nov  4 20:45:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.126 2018/11/04 20:23:08 roy Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.127 2018/11/04 20:45:21 roy Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.126 2018/11/04 20:23:08 roy Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.127 2018/11/04 20:45:21 roy Exp $");
 #endif
 #endif /* not lint */
 
@@ -193,6 +193,7 @@ int	SyncKernel = 0;		/* write kernel mes
 int	UniquePriority = 0;	/* only log specified priority */
 int	LogFacPri = 0;		/* put facility and priority in log messages: */
 /* 0=no, 1=numeric, 2=names */
+int	LogOverflow = 1;	/* 0=no, any other value = yes */
 bool	BSDOutputFormat = true;	/* if true emit traditional BSD Syslog lines,
  * otherwise new syslog-protocol lines
  *
@@ -316,7 +317,7 @@ main(int argc, char *argv[])
 	/* should we set LC_TIME="C" to ensure correct timestamps? */
 	(void)setlocale(LC_ALL, "");
 
-	while ((ch = getopt(argc, argv, "b:B:dnsSf:m:o:p:P:ru:g:t:TUv")) != -1)
+	while ((ch = getopt(argc, argv, "b:B:dnsSf:m:o:p:P:ru:g:t:TUvX")) != -1)
 		switch(ch) {
 		case 'b':
 			bindhostname = optarg;
@@ -395,6 +396,9 @@ main(int argc, char *argv[])
 			if (LogFacPri < 2)
 LogFacPri++;
 			break;
+		case 'X':
+			LogOverflow = 0;
+			break;
 		default:
 			usage();
 		}
@@ -663,7 +667,7 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-	"usage: %s [-dnrSsTUv] [-b bind_address] [-B buffer_length]\n"
+	"usage: %s [-dnrSsTUvX] [-b bind_address] [-B buffer_length]\n"
 	"\t[-f config_file] [-g group]\n"
 	"\t[-m mark_interval] [-P file_list] [-p log_socket\n"
 	"\t[-p log_socket2 ...]] [-t chroot_dir] [-u user]\n",
@@ -712,7 +716,10 @@ dispatch_read_klog(int fd, short event, 
 	if (rv > 0) {
 		klog_linebuf[klog_linebufoff + rv] = '\0';
 		printsys(klog_linebuf);
-	} else if (rv < 0 && errno != EINTR) {
+	} else if (rv < 0 &&
+	errno != EINTR &&
+	(errno != ENOBUFS || LogOverflow))
+	{
 		/*
 		 * /dev/klog has croaked.  Disable the event
 		 * so it won't bother us again.
@@ -756,7 +763,10 @@ dispatch_read_funix(int fd, short event,
 	if (rv > 0) {
 		linebuf[rv] = '\0';
 		printline(LocalFQDN, linebuf, 0);
-	} else if (rv < 0 && errno != EINTR) {
+	} else if (rv < 0 &&
+	errno != EINTR &&
+	(errno != ENOBUFS || LogOverflow))
+	{
 		logerror("recvfrom() unix `%.*s'",
 			(int)SUN_PATHLEN(), myname.sun_path);
 	}
@@ -791,7 +801,9 @@ dispatch_read_finet(int fd, short event,
 	len = sizeof(frominet);
 	rv = recvfrom(fd, linebuf, linebufsize-1, 0,
 	(struct sockaddr *), );
-	if (rv == 0 || (rv < 0 && errno == EINTR))
+	

CVS commit: src/usr.sbin/syslogd

2018-11-04 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Nov  4 20:23:08 UTC 2018

Modified Files:
src/usr.sbin/syslogd: syslogd.8 syslogd.c

Log Message:
syslogd: allow the receiving buffer size to be set.

This allows the admin to try and avoid buffer overflow when a log of
logging appears in bursts.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/syslogd/syslogd.8
cvs rdiff -u -r1.125 -r1.126 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.8
diff -u src/usr.sbin/syslogd/syslogd.8:1.55 src/usr.sbin/syslogd/syslogd.8:1.56
--- src/usr.sbin/syslogd/syslogd.8:1.55	Mon Jul  3 21:35:32 2017
+++ src/usr.sbin/syslogd/syslogd.8	Sun Nov  4 20:23:08 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslogd.8,v 1.55 2017/07/03 21:35:32 wiz Exp $
+.\"	$NetBSD: syslogd.8,v 1.56 2018/11/04 20:23:08 roy Exp $
 .\"
 .\" Copyright (c) 1983, 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" from: @(#)syslogd.8	8.1 (Berkeley) 6/6/93
 .\"
-.Dd March 28, 2012
+.Dd November 4, 2018
 .Dt SYSLOGD 8
 .Os
 .Sh NAME
@@ -39,6 +39,7 @@
 .Nm
 .Op Fl dnrSsTUv
 .Op Fl b Ar bind_address
+.Op Fl B Ar buffer_length
 .Op Fl f Ar config_file
 .Op Fl g Ar group
 .Op Fl m Ar mark_interval
@@ -60,6 +61,10 @@ The options are as follows:
 Specify one specific IP address or hostname to bind to.
 If a hostname is specified, the IPv4 or IPv6 address
 which corresponds to it is used.
+.It Fl B Ar buffer_length
+Sets the receiving buffer length.
+The default is 16384 bytes.
+If syslogd reports buffer overflow, this needs increasing.
 .It Fl d
 Enable debugging to the standard output,
 and do not disassociate from the controlling terminal.

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.125 src/usr.sbin/syslogd/syslogd.c:1.126
--- src/usr.sbin/syslogd/syslogd.c:1.125	Sun May  6 19:16:36 2018
+++ src/usr.sbin/syslogd/syslogd.c	Sun Nov  4 20:23:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.125 2018/05/06 19:16:36 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.126 2018/11/04 20:23:08 roy Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.125 2018/05/06 19:16:36 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.126 2018/11/04 20:23:08 roy Exp $");
 #endif
 #endif /* not lint */
 
@@ -114,6 +114,7 @@ typedef struct deadq_entry {
 #define DQ_TIMO_INIT	2
 
 #define	RCVBUFLEN	16384
+int	buflen = RCVBUFLEN;
 /*
  * Intervals at which we flush out "message repeated" messages,
  * in seconds after previous message is logged.	 After each flush,
@@ -315,11 +316,16 @@ main(int argc, char *argv[])
 	/* should we set LC_TIME="C" to ensure correct timestamps? */
 	(void)setlocale(LC_ALL, "");
 
-	while ((ch = getopt(argc, argv, "b:dnsSf:m:o:p:P:ru:g:t:TUv")) != -1)
+	while ((ch = getopt(argc, argv, "b:B:dnsSf:m:o:p:P:ru:g:t:TUv")) != -1)
 		switch(ch) {
 		case 'b':
 			bindhostname = optarg;
 			break;
+		case 'B':
+			buflen = atoi(optarg);
+			if (buflen < RCVBUFLEN)
+buflen = RCVBUFLEN;
+			break;
 		case 'd':		/* debug */
 			Debug = D_DEFAULT;
 			/* is there a way to read the integer value
@@ -657,7 +663,8 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-	"usage: %s [-dnrSsTUv] [-b bind_address] [-f config_file] [-g group]\n"
+	"usage: %s [-dnrSsTUv] [-b bind_address] [-B buffer_length]\n"
+	"\t[-f config_file] [-g group]\n"
 	"\t[-m mark_interval] [-P file_list] [-p log_socket\n"
 	"\t[-p log_socket2 ...]] [-t chroot_dir] [-u user]\n",
 	getprogname());
@@ -667,15 +674,15 @@ usage(void)
 static void
 setsockbuf(int fd, const char *name)
 {
-	int buflen;
+	int curbuflen;
 	socklen_t socklen = sizeof(buflen);
-	if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, , ) == -1) {
+
+	if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, , ) == -1) {
 		logerror("getsockopt: SO_RCVBUF: `%s'", name);
 		return;
 	}
-	if (buflen >= RCVBUFLEN)
+	if (curbuflen >= buflen)
 		return;
-	buflen = RCVBUFLEN;
 	if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, , socklen) == -1) {
 		logerror("setsockopt: SO_RCVBUF: `%s'", name);
 		return;



CVS commit: src/usr.sbin/syslogd

2018-11-04 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Nov  4 20:23:08 UTC 2018

Modified Files:
src/usr.sbin/syslogd: syslogd.8 syslogd.c

Log Message:
syslogd: allow the receiving buffer size to be set.

This allows the admin to try and avoid buffer overflow when a log of
logging appears in bursts.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/syslogd/syslogd.8
cvs rdiff -u -r1.125 -r1.126 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2018-05-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May  6 19:16:37 UTC 2018

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
grow AF_UNIX receive buffer size


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.124 src/usr.sbin/syslogd/syslogd.c:1.125
--- src/usr.sbin/syslogd/syslogd.c:1.124	Sun Sep 10 13:01:07 2017
+++ src/usr.sbin/syslogd/syslogd.c	Sun May  6 15:16:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.124 2017/09/10 17:01:07 ginsbach Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.125 2018/05/06 19:16:36 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.124 2017/09/10 17:01:07 ginsbach Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.125 2018/05/06 19:16:36 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -113,6 +113,7 @@ typedef struct deadq_entry {
  */
 #define DQ_TIMO_INIT	2
 
+#define	RCVBUFLEN	16384
 /*
  * Intervals at which we flush out "message repeated" messages,
  * in seconds after previous message is logged.	 After each flush,
@@ -272,6 +273,8 @@ static inline void
 #endif /* !DISABLE_TLS */
 static int writev1(int, struct iovec *, size_t);
 
+static void setsockbuf(int, const char *);
+
 /* for make_timestamp() */
 char	timestamp[MAX_TIMESTAMPLEN + 1];
 /*
@@ -492,6 +495,7 @@ getgroup:
 			logerror("Cannot create `%s'", *pp);
 			die(0, 0, NULL);
 		}
+		setsockbuf(funix[j], *pp);
 		DPRINTF(D_NET, "Listening on unix dgram socket `%s'\n", *pp);
 	}
 
@@ -660,6 +664,24 @@ usage(void)
 	exit(1);
 }
 
+static void
+setsockbuf(int fd, const char *name)
+{
+	int buflen;
+	socklen_t socklen = sizeof(buflen);
+	if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, , ) == -1) {
+		logerror("getsockopt: SO_RCVBUF: `%s'", name);
+		return;
+	}
+	if (buflen >= RCVBUFLEN)
+		return;
+	buflen = RCVBUFLEN;
+	if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, , socklen) == -1) {
+		logerror("setsockopt: SO_RCVBUF: `%s'", name);
+		return;
+	}
+}
+
 /*
  * Dispatch routine for reading /dev/klog
  *



CVS commit: src/usr.sbin/syslogd

2018-05-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May  6 19:16:37 UTC 2018

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
grow AF_UNIX receive buffer size


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2018-02-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  9 02:23:32 UTC 2018

Modified Files:
src/usr.sbin/syslogd: Makefile

Log Message:
only set api compat for 1.0


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/syslogd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2018-02-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  9 02:23:32 UTC 2018

Modified Files:
src/usr.sbin/syslogd: Makefile

Log Message:
only set api compat for 1.0


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/syslogd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/Makefile
diff -u src/usr.sbin/syslogd/Makefile:1.26 src/usr.sbin/syslogd/Makefile:1.27
--- src/usr.sbin/syslogd/Makefile:1.26	Thu Feb  8 13:28:42 2018
+++ src/usr.sbin/syslogd/Makefile	Thu Feb  8 21:23:32 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.26 2018/02/08 18:28:42 jakllsch Exp $
+#	$NetBSD: Makefile,v 1.27 2018/02/09 02:23:32 christos Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
 .include 
 
@@ -22,7 +22,9 @@ CPPFLAGS+=-DINET6
 .endif
 
 CPPFLAGS+=-DLIBWRAP
+.if ${HAVE_OPENSSL} < 11
 CPPFLAGS+=-DOPENSSL_API_COMPAT=0x1010L
+.endif
 LDADD+=	-lwrap
 DPADD+=	${LIBWRAP}
 



CVS commit: src/usr.sbin/syslogd

2018-02-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Feb  8 18:28:42 UTC 2018

Modified Files:
src/usr.sbin/syslogd: Makefile

Log Message:
define OPENSSL_API_COMPAT

(doesn't entirely unbreak build yet)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/syslogd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2018-02-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Feb  8 18:28:42 UTC 2018

Modified Files:
src/usr.sbin/syslogd: Makefile

Log Message:
define OPENSSL_API_COMPAT

(doesn't entirely unbreak build yet)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/syslogd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/Makefile
diff -u src/usr.sbin/syslogd/Makefile:1.25 src/usr.sbin/syslogd/Makefile:1.26
--- src/usr.sbin/syslogd/Makefile:1.25	Sun May 21 15:28:43 2017
+++ src/usr.sbin/syslogd/Makefile	Thu Feb  8 18:28:42 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.25 2017/05/21 15:28:43 riastradh Exp $
+#	$NetBSD: Makefile,v 1.26 2018/02/08 18:28:42 jakllsch Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
 .include 
 
@@ -22,6 +22,7 @@ CPPFLAGS+=-DINET6
 .endif
 
 CPPFLAGS+=-DLIBWRAP
+CPPFLAGS+=-DOPENSSL_API_COMPAT=0x1010L
 LDADD+=	-lwrap
 DPADD+=	${LIBWRAP}
 



CVS commit: src/usr.sbin/syslogd

2018-02-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb  8 17:45:30 UTC 2018

Modified Files:
src/usr.sbin/syslogd: tls.c tls.h

Log Message:
include dh.h in the right spot.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/syslogd/tls.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/syslogd/tls.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/tls.c
diff -u src/usr.sbin/syslogd/tls.c:1.15 src/usr.sbin/syslogd/tls.c:1.16
--- src/usr.sbin/syslogd/tls.c:1.15	Tue Feb  6 17:04:22 2018
+++ src/usr.sbin/syslogd/tls.c	Thu Feb  8 12:45:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.c,v 1.15 2018/02/06 22:04:22 maya Exp $	*/
+/*	$NetBSD: tls.c,v 1.16 2018/02/08 17:45:29 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: tls.c,v 1.15 2018/02/06 22:04:22 maya Exp $");
+__RCSID("$NetBSD: tls.c,v 1.16 2018/02/08 17:45:29 christos Exp $");
 
 #ifndef DISABLE_TLS
 #include 
@@ -84,9 +84,6 @@ static const char *TLS_CONN_STATES[] = {
 
 DH *get_dh1024(void);
 /* DH parameter precomputed with "openssl dhparam -C -2 1024" */
-#ifndef HEADER_DH_H
-#include 
-#endif
 DH *
 get_dh1024(void)
 {

Index: src/usr.sbin/syslogd/tls.h
diff -u src/usr.sbin/syslogd/tls.h:1.2 src/usr.sbin/syslogd/tls.h:1.3
--- src/usr.sbin/syslogd/tls.h:1.2	Fri Nov  7 02:36:38 2008
+++ src/usr.sbin/syslogd/tls.h	Thu Feb  8 12:45:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.h,v 1.2 2008/11/07 07:36:38 minskim Exp $	*/
+/*	$NetBSD: tls.h,v 1.3 2018/02/08 17:45:29 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* initial size for TLS inbuf, minimum prefix + linelength
  * guaranteed to be accepted */



CVS commit: src/usr.sbin/syslogd

2018-02-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb  8 17:45:30 UTC 2018

Modified Files:
src/usr.sbin/syslogd: tls.c tls.h

Log Message:
include dh.h in the right spot.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/syslogd/tls.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/syslogd/tls.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2018-02-06 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Feb  6 22:04:22 UTC 2018

Modified Files:
src/usr.sbin/syslogd: tls.c

Log Message:
Correct misleading indentation.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/tls.c
diff -u src/usr.sbin/syslogd/tls.c:1.14 src/usr.sbin/syslogd/tls.c:1.15
--- src/usr.sbin/syslogd/tls.c:1.14	Tue Feb  6 21:36:46 2018
+++ src/usr.sbin/syslogd/tls.c	Tue Feb  6 22:04:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.c,v 1.14 2018/02/06 21:36:46 christos Exp $	*/
+/*	$NetBSD: tls.c,v 1.15 2018/02/06 22:04:22 maya Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: tls.c,v 1.14 2018/02/06 21:36:46 christos Exp $");
+__RCSID("$NetBSD: tls.c,v 1.15 2018/02/06 22:04:22 maya Exp $");
 
 #ifndef DISABLE_TLS
 #include 
@@ -116,8 +116,8 @@ get_dh1024(void)
 		goto out;
 	return dh;
 out:
-		DH_free(dh);
-		return NULL;
+	DH_free(dh);
+	return NULL;
 }
 
 #define ST_CHANGE(x, y) do {	\



CVS commit: src/usr.sbin/syslogd

2018-02-06 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Feb  6 22:04:22 UTC 2018

Modified Files:
src/usr.sbin/syslogd: tls.c

Log Message:
Correct misleading indentation.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2018-02-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  6 21:36:47 UTC 2018

Modified Files:
src/usr.sbin/syslogd: sign.c tls.c

Log Message:
Adjust to OpenSSL-1.1


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/syslogd/sign.c
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/sign.c
diff -u src/usr.sbin/syslogd/sign.c:1.6 src/usr.sbin/syslogd/sign.c:1.7
--- src/usr.sbin/syslogd/sign.c:1.6	Tue Feb 10 15:38:15 2015
+++ src/usr.sbin/syslogd/sign.c	Tue Feb  6 16:36:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sign.c,v 1.6 2015/02/10 20:38:15 christos Exp $	*/
+/*	$NetBSD: sign.c,v 1.7 2018/02/06 21:36:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  * 1. check; next draft will be clearer and specify the format as implemented.
  * 2. check; definitely only DSA in this version.
  * 3. remains a problem, so far no statement from authors or WG.
- * 4. check; used EVP_dss1 method implements FIPS.
+ * 4. check; used EVP_sha1 method implements FIPS.
  */
 /*
  * Limitations of this implementation:
@@ -66,7 +66,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: sign.c,v 1.6 2015/02/10 20:38:15 christos Exp $");
+__RCSID("$NetBSD: sign.c,v 1.7 2018/02/06 21:36:46 christos Exp $");
 
 #ifndef DISABLE_SIGN
 #include "syslogd.h"
@@ -99,15 +99,19 @@ sign_global_init(struct filed *Files)
 	EVP_MD_CTX_init(GlobalSign.sigctx);
 
 	/* the signature algorithm depends on the type of key */
-	if (EVP_PKEY_DSA == EVP_PKEY_type(GlobalSign.pubkey->type)) {
-		GlobalSign.sig = EVP_dss1();
+	switch (EVP_PKEY_base_id(GlobalSign.pubkey)) {
+	case EVP_PKEY_DSA:
+		GlobalSign.sig = EVP_sha1();
 		GlobalSign.sig_len_b64 = SIGN_B64SIGLEN_DSS;
-/* this is the place to add non-DSA key types and algorithms
-	} else if (EVP_PKEY_RSA == EVP_PKEY_type(GlobalSign.pubkey->type)) {
+		break;
+#ifdef notyet
+	/* this is the place to add non-DSA key types and algorithms */
+	case EVP_PKEY_RSA:
 		GlobalSign.sig = EVP_sha1();
 		GlobalSign.sig_len_b64 = 28;
-*/
-	} else {
+		break;
+#endif
+	default:
 		logerror("key type not supported for syslog-sign");
 		return false;
 	}
@@ -115,7 +119,6 @@ sign_global_init(struct filed *Files)
 	assert(GlobalSign.keytype == 'C' || GlobalSign.keytype == 'K');
 	assert(GlobalSign.pubkey_b64 && GlobalSign.privkey &&
 	GlobalSign.pubkey);
-	assert(GlobalSign.privkey->pkey.dsa->priv_key);
 
 	GlobalSign.gbc = 0;
 	STAILQ_INIT();
@@ -126,7 +129,7 @@ sign_global_init(struct filed *Files)
 	EVP_MD_CTX_init(GlobalSign.mdctx);
 
 	/* values for SHA-1 */
-	GlobalSign.md = EVP_dss1();
+	GlobalSign.md = EVP_sha1();
 	GlobalSign.md_len_b64 = 28;
 	GlobalSign.ver = "0111";
 
@@ -191,7 +194,7 @@ sign_get_keys(void)
 		 */
 		FREE_SSL(ssl);
 
-		if (EVP_PKEY_DSA != EVP_PKEY_type(pubkey->type)) {
+		if (EVP_PKEY_DSA != EVP_PKEY_base_id(pubkey)) {
 			DPRINTF(D_SIGN, "X.509 cert has no DSA key\n");
 			EVP_PKEY_free(pubkey);
 			privkey = NULL;
@@ -234,8 +237,15 @@ sign_get_keys(void)
 			logerror("EVP_PKEY_new() failed");
 			return false;
 		}
-		dsa = DSA_generate_parameters(SIGN_GENCERT_BITS, NULL, 0,
-			NULL, NULL, NULL, NULL);
+		if ((dsa = DSA_new()) == NULL) {
+			logerror("DSA_new() failed");
+			return false;
+		}
+		if (!DSA_generate_parameters_ex(dsa, SIGN_GENCERT_BITS, NULL, 0,
+			NULL, NULL, NULL)) {
+			logerror("DSA_generate_parameters_ex() failed");
+			return false;
+		}
 		if (!DSA_generate_key(dsa)) {
 			logerror("DSA_generate_key() failed");
 			return false;

Index: src/usr.sbin/syslogd/tls.c
diff -u src/usr.sbin/syslogd/tls.c:1.13 src/usr.sbin/syslogd/tls.c:1.14
--- src/usr.sbin/syslogd/tls.c:1.13	Tue Jan 10 16:05:42 2017
+++ src/usr.sbin/syslogd/tls.c	Tue Feb  6 16:36:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.c,v 1.13 2017/01/10 21:05:42 christos Exp $	*/
+/*	$NetBSD: tls.c,v 1.14 2018/02/06 21:36:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: tls.c,v 1.13 2017/01/10 21:05:42 christos Exp $");
+__RCSID("$NetBSD: tls.c,v 1.14 2018/02/06 21:36:46 christos Exp $");
 
 #ifndef DISABLE_TLS
 #include 
@@ -104,16 +104,20 @@ get_dh1024(void)
 		0x88,0xEC,0xA6,0xBA,0x9F,0x4F,0x85,0x43 };
 	static const unsigned char dh1024_g[]={ 0x02 };
 	DH *dh;
+	BIGNUM *p, *g;
 
-	if ((dh=DH_new()) == NULL)
+	if ((dh = DH_new()) == NULL)
 		return NULL;
-	dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
-	dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
-	if ((dh->p == NULL) || (dh->g == NULL)) {
+	p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
+	g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
+	if (p == NULL || g == NULL)
+		goto out;
+	if (!DH_set0_pqg(dh, p, NULL, g))
+		goto out;
+	return dh;
+out:
 		DH_free(dh);
 		return NULL;
-	}
-	return dh;
 }
 
 #define ST_CHANGE(x, y) do {	

CVS commit: src/usr.sbin/syslogd

2018-02-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  6 21:36:47 UTC 2018

Modified Files:
src/usr.sbin/syslogd: sign.c tls.c

Log Message:
Adjust to OpenSSL-1.1


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/syslogd/sign.c
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2017-09-10 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sun Sep 10 17:01:07 UTC 2017

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
Use looked up remote host for remote message without a hostname

An incoming remote message may not necessarily have a hostname
between the timestamp and the message. The the source of the remote
sender is already looked up so use that hostname/IP address rather
than the local hostname.

XXX: pullup-8
XXX: pullup-7
XXX: pullup-6


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.123 src/usr.sbin/syslogd/syslogd.c:1.124
--- src/usr.sbin/syslogd/syslogd.c:1.123	Sat Jun 11 16:55:10 2016
+++ src/usr.sbin/syslogd/syslogd.c	Sun Sep 10 17:01:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.123 2016/06/11 16:55:10 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.124 2017/09/10 17:01:07 ginsbach Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.123 2016/06/11 16:55:10 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.124 2017/09/10 17:01:07 ginsbach Exp $");
 #endif
 #endif /* not lint */
 
@@ -1277,7 +1277,7 @@ printline_bsdsyslog(const char *hname, c
 		} else if (*p == '[' || (*p == ':'
 			&& (*(p+1) == ' ' || *(p+1) == '\0'))) {
 			/* no host in message */
-			buffer->host = LocalFQDN;
+			buffer->host = strdup(hname);
 			buffer->prog = strndup(start, p - start);
 			break;
 		} else {



CVS commit: src/usr.sbin/syslogd

2017-09-10 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sun Sep 10 17:01:07 UTC 2017

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
Use looked up remote host for remote message without a hostname

An incoming remote message may not necessarily have a hostname
between the timestamp and the message. The the source of the remote
sender is already looked up so use that hostname/IP address rather
than the local hostname.

XXX: pullup-8
XXX: pullup-7
XXX: pullup-6


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2017-02-21 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Tue Feb 21 18:36:39 UTC 2017

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
Remove duplicate word from the sentence.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslog.conf.5
diff -u src/usr.sbin/syslogd/syslog.conf.5:1.23 src/usr.sbin/syslogd/syslog.conf.5:1.24
--- src/usr.sbin/syslogd/syslog.conf.5:1.23	Tue Feb 21 18:28:28 2017
+++ src/usr.sbin/syslogd/syslog.conf.5	Tue Feb 21 18:36:39 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslog.conf.5,v 1.23 2017/02/21 18:28:28 abhinav Exp $
+.\"	$NetBSD: syslog.conf.5,v 1.24 2017/02/21 18:36:39 abhinav Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -511,7 +511,7 @@ message containing hashes of previous me
 .Pp
 To detect later manipulation one has to keep a copy of the key used for
 signing (otherwise an attacker could alter the logs and sign them with his
-his own key).
+own key).
 If TLS is used with a DSA key then the same key will be used for signing.
 This is the recommended setup because it makes it easy to have copies of
 the certificate (with the public key) in backups.



CVS commit: src/usr.sbin/syslogd

2017-02-21 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Tue Feb 21 18:36:39 UTC 2017

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
Remove duplicate word from the sentence.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2017-02-21 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Tue Feb 21 18:28:28 UTC 2017

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
Fix typos.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslog.conf.5
diff -u src/usr.sbin/syslogd/syslog.conf.5:1.22 src/usr.sbin/syslogd/syslog.conf.5:1.23
--- src/usr.sbin/syslogd/syslog.conf.5:1.22	Tue Jan  5 00:41:30 2016
+++ src/usr.sbin/syslogd/syslog.conf.5	Tue Feb 21 18:28:28 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslog.conf.5,v 1.22 2016/01/05 00:41:30 khorben Exp $
+.\"	$NetBSD: syslog.conf.5,v 1.23 2017/02/21 18:28:28 abhinav Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -330,7 +330,7 @@ program on the named host.
 After the closing bracket a colon
 .Pq Sq \&:
 and a port or service name may be appended.
-Additional options are configured in parantheses in the form of key="value".
+Additional options are configured in parentheses in the form of key="value".
 Recognized keywords are
 .Ar subject ,
 .Ar fingerprint ,
@@ -476,7 +476,7 @@ and the hashes of the certificates given
 On any match the client is authenticated.
 .Sh BUFFERING
 .Xr syslogd 8
-is able to buffer temporary not writeable messages in memory.
+is able to buffer temporary not writable messages in memory.
 To limit the memory consumed for this buffering the following optons may be
 given:
 .Bl -ohang
@@ -590,7 +590,7 @@ mail.*	/var/log/maillog
 
 # Log all messages of level info or higher to another
 # machine using TLS with an alternative portname and a
-# fingerprint for athentication
+# fingerprint for authentication
 *.info			@[logserver]:1234(fingerprint="SHA1:01:02:...")
 
 # Root and Eric get alert and higher messages.



CVS commit: src/usr.sbin/syslogd

2017-02-21 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Tue Feb 21 18:28:28 UTC 2017

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
Fix typos.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2017-01-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 10 21:05:42 UTC 2017

Modified Files:
src/usr.sbin/syslogd: tls.c

Log Message:
need 


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/tls.c
diff -u src/usr.sbin/syslogd/tls.c:1.12 src/usr.sbin/syslogd/tls.c:1.13
--- src/usr.sbin/syslogd/tls.c:1.12	Wed Feb  3 00:34:21 2016
+++ src/usr.sbin/syslogd/tls.c	Tue Jan 10 16:05:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.c,v 1.12 2016/02/03 05:34:21 christos Exp $	*/
+/*	$NetBSD: tls.c,v 1.13 2017/01/10 21:05:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -45,9 +45,10 @@
  */
 
 #include 
-__RCSID("$NetBSD: tls.c,v 1.12 2016/02/03 05:34:21 christos Exp $");
+__RCSID("$NetBSD: tls.c,v 1.13 2017/01/10 21:05:42 christos Exp $");
 
 #ifndef DISABLE_TLS
+#include 
 #include "syslogd.h"
 #include "tls.h"
 #include 



CVS commit: src/usr.sbin/syslogd

2017-01-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 10 21:05:42 UTC 2017

Modified Files:
src/usr.sbin/syslogd: tls.c

Log Message:
need 


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2016-06-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 11 16:55:10 UTC 2016

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
PR/51234: Onno van der Linden: syslogd sometimes incorrectly handles iso to
bsd time conversion


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2016-06-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 11 16:55:10 UTC 2016

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
PR/51234: Onno van der Linden: syslogd sometimes incorrectly handles iso to
bsd time conversion


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.122 src/usr.sbin/syslogd/syslogd.c:1.123
--- src/usr.sbin/syslogd/syslogd.c:1.122	Sat Sep  5 16:19:43 2015
+++ src/usr.sbin/syslogd/syslogd.c	Sat Jun 11 12:55:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.122 2015/09/05 20:19:43 dholland Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.123 2016/06/11 16:55:10 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.122 2015/09/05 20:19:43 dholland Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.123 2016/06/11 16:55:10 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1745,27 +1745,28 @@ check_timestamp(unsigned char *from_buf,
 		struct tm parsed;
 		time_t timeval;
 		char tsbuf[MAX_TIMESTAMPLEN];
-		int i = 0;
+		int i = 0, j;
 
 		DPRINTF(D_CALL, "check_timestamp(): convert ISO->BSD\n");
 		for(i = 0; i < MAX_TIMESTAMPLEN && from_buf[i] != '\0'
 		&& from_buf[i] != '.' && from_buf[i] != ' '; i++)
 			tsbuf[i] = from_buf[i]; /* copy date & time */
+		j = i;
 		for(; i < MAX_TIMESTAMPLEN && from_buf[i] != '\0'
 		&& from_buf[i] != '+' && from_buf[i] != '-'
 		&& from_buf[i] != 'Z' && from_buf[i] != ' '; i++)
 			;			   /* skip fraction digits */
 		for(; i < MAX_TIMESTAMPLEN && from_buf[i] != '\0'
-		&& from_buf[i] != ':' && from_buf[i] != ' ' ; i++)
-			tsbuf[i] = from_buf[i]; /* copy TZ */
+		&& from_buf[i] != ':' && from_buf[i] != ' ' ; i++, j++)
+			tsbuf[j] = from_buf[i]; /* copy TZ */
 		if (from_buf[i] == ':') i++;	/* skip colon */
 		for(; i < MAX_TIMESTAMPLEN && from_buf[i] != '\0'
-		&& from_buf[i] != ' ' ; i++)
-			tsbuf[i] = from_buf[i]; /* copy TZ */
+		&& from_buf[i] != ' ' ; i++, j++)
+			tsbuf[j] = from_buf[i]; /* copy TZ */
 
 		(void)memset(, 0, sizeof(parsed));
-		parsed.tm_isdst = -1;
 		(void)strptime(tsbuf, "%FT%T%z", );
+		parsed.tm_isdst = -1;
 		timeval = mktime();
 
 		*to_buf = make_timestamp(, false, BSD_TIMESTAMPLEN);



CVS commit: src/usr.sbin/syslogd

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  3 05:34:21 UTC 2016

Modified Files:
src/usr.sbin/syslogd: tls.c

Log Message:
PR/50751: David Binderman: check bounds before dereferencing.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/tls.c
diff -u src/usr.sbin/syslogd/tls.c:1.11 src/usr.sbin/syslogd/tls.c:1.12
--- src/usr.sbin/syslogd/tls.c:1.11	Mon May 27 19:15:51 2013
+++ src/usr.sbin/syslogd/tls.c	Wed Feb  3 00:34:21 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.c,v 1.11 2013/05/27 23:15:51 christos Exp $	*/
+/*	$NetBSD: tls.c,v 1.12 2016/02/03 05:34:21 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: tls.c,v 1.11 2013/05/27 23:15:51 christos Exp $");
+__RCSID("$NetBSD: tls.c,v 1.12 2016/02/03 05:34:21 christos Exp $");
 
 #ifndef DISABLE_TLS
 #include "syslogd.h"
@@ -1590,8 +1590,8 @@ tls_split_messages(struct TLS_Incoming_C
 	}
 
 	/* read length prefix, always at start of buffer */
-	while (isdigit((unsigned char)c->inbuf[offset])
-	&& offset < c->read_pos) {
+	while (offset < c->read_pos && isdigit((unsigned char)c->inbuf[offset]))
+	{
 		msglen *= 10;
 		msglen += c->inbuf[offset] - '0';
 		offset++;



CVS commit: src/usr.sbin/syslogd

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  3 05:34:21 UTC 2016

Modified Files:
src/usr.sbin/syslogd: tls.c

Log Message:
PR/50751: David Binderman: check bounds before dereferencing.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2016-01-04 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue Jan  5 00:41:30 UTC 2016

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslog.conf.5
diff -u src/usr.sbin/syslogd/syslog.conf.5:1.21 src/usr.sbin/syslogd/syslog.conf.5:1.22
--- src/usr.sbin/syslogd/syslog.conf.5:1.21	Sun Nov 10 00:13:50 2013
+++ src/usr.sbin/syslogd/syslog.conf.5	Tue Jan  5 00:41:30 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslog.conf.5,v 1.21 2013/11/10 00:13:50 wiz Exp $
+.\"	$NetBSD: syslog.conf.5,v 1.22 2016/01/05 00:41:30 khorben Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -297,7 +297,7 @@ To ensure that kernel messages are writt
 calls
 .Xr fsync 2
 after writing messages from the kernel.
-Other messages are not synced explcitly.
+Other messages are not synced explicitly.
 You may disable syncing of files specified to receive kernel messages
 by prefixing the pathname with a minus sign
 .Ql - .



CVS commit: src/usr.sbin/syslogd

2016-01-04 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue Jan  5 00:41:30 UTC 2016

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2015-09-08 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Tue Sep  8 18:33:12 UTC 2015

Modified Files:
src/usr.sbin/syslogd: syslogd.h

Log Message:
according to C99 6.5.15 in a conditional expression, both
operands should be of compatible types.

So, use ((void)0) here to match `void dbprintf()'


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/syslogd/syslogd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.h
diff -u src/usr.sbin/syslogd/syslogd.h:1.6 src/usr.sbin/syslogd/syslogd.h:1.7
--- src/usr.sbin/syslogd/syslogd.h:1.6	Sun Feb 15 14:51:57 2015
+++ src/usr.sbin/syslogd/syslogd.h	Tue Sep  8 18:33:12 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.h,v 1.6 2015/02/15 14:51:57 joerg Exp $	*/
+/*	$NetBSD: syslogd.h,v 1.7 2015/09/08 18:33:12 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -154,7 +154,7 @@ char *strndup(const char *str, size_t n)
 void dbprintf(const char *, const char *, size_t, const char *, ...)
 __printflike(4, 5);
 #define DPRINTF(x, ...) /*LINTED null effect */(void)(Debug & (x) \
-? dbprintf(__FILE__, __func__, __LINE__, __VA_ARGS__) : 0)
+? dbprintf(__FILE__, __func__, __LINE__, __VA_ARGS__) : ((void)0))
 #endif
 
 /* shortcuts for libevent */



CVS commit: src/usr.sbin/syslogd

2015-09-08 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Tue Sep  8 18:33:12 UTC 2015

Modified Files:
src/usr.sbin/syslogd: syslogd.h

Log Message:
according to C99 6.5.15 in a conditional expression, both
operands should be of compatible types.

So, use ((void)0) here to match `void dbprintf()'


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/syslogd/syslogd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2015-09-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Sep  5 20:19:43 UTC 2015

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
tidy/fix printing of paths from sockaddr_un


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.121 src/usr.sbin/syslogd/syslogd.c:1.122
--- src/usr.sbin/syslogd/syslogd.c:1.121	Tue Feb 10 20:38:15 2015
+++ src/usr.sbin/syslogd/syslogd.c	Sat Sep  5 20:19:43 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.121 2015/02/10 20:38:15 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.122 2015/09/05 20:19:43 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.121 2015/02/10 20:38:15 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.122 2015/09/05 20:19:43 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -714,9 +714,11 @@ dispatch_read_funix(int fd, short event,
 		return;
 	}
 
+#define SUN_PATHLEN(su) \
+	((su)->sun_len - (sizeof(*(su)) - sizeof((su)->sun_path)))
+
 	DPRINTF((D_CALL|D_EVENT|D_NET), "Unix socket (%.*s) active (%d, %d %p)"
-		" with linebuf@%p, size %zu)\n", (int)(myname.sun_len
-		- sizeof(myname.sun_len) - sizeof(myname.sun_family)),
+		" with linebuf@%p, size %zu)\n", (int)SUN_PATHLEN(),
 		myname.sun_path, fd, event, ev, linebuf, linebufsize-1);
 
 	sunlen = sizeof(fromunix);
@@ -727,7 +729,7 @@ dispatch_read_funix(int fd, short event,
 		printline(LocalFQDN, linebuf, 0);
 	} else if (rv < 0 && errno != EINTR) {
 		logerror("recvfrom() unix `%.*s'",
-			myname.sun_len, myname.sun_path);
+			(int)SUN_PATHLEN(), myname.sun_path);
 	}
 }
 



CVS commit: src/usr.sbin/syslogd

2015-09-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Sep  5 20:19:43 UTC 2015

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
tidy/fix printing of paths from sockaddr_un


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2015-02-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Feb 15 14:51:57 UTC 2015

Modified Files:
src/usr.sbin/syslogd: syslogd.h

Log Message:
Format string annotation.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/syslogd/syslogd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.h
diff -u src/usr.sbin/syslogd/syslogd.h:1.5 src/usr.sbin/syslogd/syslogd.h:1.6
--- src/usr.sbin/syslogd/syslogd.h:1.5	Tue Feb 10 20:38:15 2015
+++ src/usr.sbin/syslogd/syslogd.h	Sun Feb 15 14:51:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.h,v 1.5 2015/02/10 20:38:15 christos Exp $	*/
+/*	$NetBSD: syslogd.h,v 1.6 2015/02/15 14:51:57 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -151,7 +151,8 @@ char *strndup(const char *str, size_t n)
 #ifdef NDEBUG
 #define DPRINTF(x, ...) (void)0
 #else
-void dbprintf(const char *, const char *, size_t, const char *, ...);
+void dbprintf(const char *, const char *, size_t, const char *, ...)
+__printflike(4, 5);
 #define DPRINTF(x, ...) /*LINTED null effect */(void)(Debug  (x) \
 ? dbprintf(__FILE__, __func__, __LINE__, __VA_ARGS__) : 0)
 #endif



CVS commit: src/usr.sbin/syslogd

2015-02-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Feb 15 14:51:57 UTC 2015

Modified Files:
src/usr.sbin/syslogd: syslogd.h

Log Message:
Format string annotation.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/syslogd/syslogd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2015-02-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb 10 20:38:15 UTC 2015

Modified Files:
src/usr.sbin/syslogd: extern.h sign.c syslogd.c syslogd.h

Log Message:
- always set *to_buf to a timestamp, even if there was none reported/parseable
  (Frank Kardel).
- merge the timestamp copying code to one place.
- factor out the debugging printf function.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/syslogd/extern.h
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/syslogd/sign.c
cvs rdiff -u -r1.120 -r1.121 src/usr.sbin/syslogd/syslogd.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/syslogd/syslogd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/extern.h
diff -u src/usr.sbin/syslogd/extern.h:1.3 src/usr.sbin/syslogd/extern.h:1.4
--- src/usr.sbin/syslogd/extern.h:1.3	Wed Jun  9 17:55:42 2010
+++ src/usr.sbin/syslogd/extern.h	Tue Feb 10 15:38:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.3 2010/06/09 21:55:42 riz Exp $	*/
+/*	$NetBSD: extern.h,v 1.4 2015/02/10 20:38:15 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@ extern struct event *allocev(void);
 extern void	send_queue(int __unused, short __unused, void *);
 extern void	schedule_event(struct event **, struct timeval *,
 void (*)(int, short, void *), void *);
-extern char*make_timestamp(time_t *, bool);
+extern char*make_timestamp(time_t *, bool, size_t);
 #ifndef DISABLE_TLS
 extern struct filed *get_f_by_conninfo(struct tls_conn_settings *conn_info);
 #endif

Index: src/usr.sbin/syslogd/sign.c
diff -u src/usr.sbin/syslogd/sign.c:1.5 src/usr.sbin/syslogd/sign.c:1.6
--- src/usr.sbin/syslogd/sign.c:1.5	Tue Jun  5 20:33:45 2012
+++ src/usr.sbin/syslogd/sign.c	Tue Feb 10 15:38:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sign.c,v 1.5 2012/06/06 00:33:45 christos Exp $	*/
+/*	$NetBSD: sign.c,v 1.6 2015/02/10 20:38:15 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: sign.c,v 1.5 2012/06/06 00:33:45 christos Exp $);
+__RCSID($NetBSD: sign.c,v 1.6 2015/02/10 20:38:15 christos Exp $);
 
 #ifndef DISABLE_SIGN
 #include syslogd.h
@@ -514,7 +514,7 @@ sign_send_certificate_block(struct signa
 		return false;
 
 	DPRINTF((D_CALL|D_SIGN), sign_send_certificate_block(%p)\n, sg);
-	tstamp = make_timestamp(NULL, true);
+	tstamp = make_timestamp(NULL, true, (size_t)-1);
 
 	payload_len = snprintf(payload, sizeof(payload), %s %c %s, tstamp,
 		GlobalSign.keytype, GlobalSign.pubkey_b64);
@@ -801,7 +801,7 @@ sign_msg_sign(struct buf_msg **bufferptr
 
 	/* set up buffer */
 	buffer = buf_msg_new(0);
-	buffer-timestamp = strdup(make_timestamp(NULL, !BSDOutputFormat));
+	buffer-timestamp = make_timestamp(NULL, !BSDOutputFormat, 0);
 	buffer-prog = appname;
 	buffer-pid = include_pid;
 	buffer-recvhost = buffer-host = LocalFQDN;

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.120 src/usr.sbin/syslogd/syslogd.c:1.121
--- src/usr.sbin/syslogd/syslogd.c:1.120	Mon Aug 18 01:21:16 2014
+++ src/usr.sbin/syslogd/syslogd.c	Tue Feb 10 15:38:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.120 2014/08/18 05:21:16 jnemeth Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.121 2015/02/10 20:38:15 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)syslogd.c	8.3 (Berkeley) 4/4/94;
 #else
-__RCSID($NetBSD: syslogd.c,v 1.120 2014/08/18 05:21:16 jnemeth Exp $);
+__RCSID($NetBSD: syslogd.c,v 1.121 2015/02/10 20:38:15 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -273,9 +273,7 @@ static inline void
 static int writev1(int, struct iovec *, size_t);
 
 /* for make_timestamp() */
-#define TIMESTAMPBUFSIZE 35
-char timestamp[TIMESTAMPBUFSIZE];
-
+char	timestamp[MAX_TIMESTAMPLEN + 1];
 /*
  * Global line buffer.	Since we only process one event at a time,
  * a global one will do.  But for klog, we use own buffer so that
@@ -1045,8 +1043,7 @@ printline_syslogprotocol(const char *hna
 
 	if (flags  ADDDATE) {
 		FREEPTR(buffer-timestamp);
-		buffer-timestamp = strdup(make_timestamp(NULL,
-			!BSDOutputFormat));
+		buffer-timestamp = make_timestamp(NULL, !BSDOutputFormat, 0);
 	}
 
 	start = p;
@@ -1262,8 +1259,7 @@ printline_bsdsyslog(const char *hname, c
 
 	if (flags  ADDDATE || !buffer-timestamp) {
 		FREEPTR(buffer-timestamp);
-		buffer-timestamp = strdup(make_timestamp(NULL,
-			!BSDOutputFormat));
+		buffer-timestamp = make_timestamp(NULL, !BSDOutputFormat, 0);
 	}
 
 	if (*p == ' ') p++; /* SP */
@@ -1421,7 +1417,7 @@ printline_kernelprintf(const char *hname
 		\%s\, \%s\, %d, %d)\n, hname, msg, flags, pri);
 
 	buffer = buf_msg_new(0);
-	buffer-timestamp = strdup(make_timestamp(NULL, !BSDOutputFormat));
+	buffer-timestamp = make_timestamp(NULL, !BSDOutputFormat, 0);
 	buffer-pri = 

CVS commit: src/usr.sbin/syslogd

2015-02-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb 10 20:38:15 UTC 2015

Modified Files:
src/usr.sbin/syslogd: extern.h sign.c syslogd.c syslogd.h

Log Message:
- always set *to_buf to a timestamp, even if there was none reported/parseable
  (Frank Kardel).
- merge the timestamp copying code to one place.
- factor out the debugging printf function.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/syslogd/extern.h
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/syslogd/sign.c
cvs rdiff -u -r1.120 -r1.121 src/usr.sbin/syslogd/syslogd.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/syslogd/syslogd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2014-08-17 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon Aug 18 05:21:16 UTC 2014

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
- when checking hostname of incoming remote messages, fallback to checking
  remote host if the message doesn't contain a hostname
- don't truncate IP addresses when reading syslogd.conf


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.119 src/usr.sbin/syslogd/syslogd.c:1.120
--- src/usr.sbin/syslogd/syslogd.c:1.119	Wed Nov 27 20:48:28 2013
+++ src/usr.sbin/syslogd/syslogd.c	Mon Aug 18 05:21:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.119 2013/11/27 20:48:28 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.120 2014/08/18 05:21:16 jnemeth Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)syslogd.c	8.3 (Berkeley) 4/4/94;
 #else
-__RCSID($NetBSD: syslogd.c,v 1.119 2013/11/27 20:48:28 christos Exp $);
+__RCSID($NetBSD: syslogd.c,v 1.120 2014/08/18 05:21:16 jnemeth Exp $);
 #endif
 #endif /* not lint */
 
@@ -1854,21 +1854,22 @@ logmsg(struct buf_msg *buffer)
 	}
 
 	for (f = Files; f; f = f-f_next) {
+		char *h;	/* host to use for comparing */
+
 		/* skip messages that are incorrect priority */
 		if (!MATCH_PRI(f, fac, prilev)
 		|| f-f_pmask[fac] == INTERNAL_NOPRI)
 			continue;
 
 		/* skip messages with the incorrect host name */
-		/* do we compare with host (IMHO correct) or recvhost */
-		/* (compatible)? */
-		if (f-f_host != NULL  buffer-host != NULL) {
-			char shost[MAXHOSTNAMELEN + 1], *h;
-			if (!BSDOutputFormat) {
-h = buffer-host;
-			} else {
-(void)strlcpy(shost, buffer-host,
-sizeof(shost));
+		/* compare with host (which is supposedly more correct), */
+		/* but fallback to recvhost if host is NULL */
+		h = (buffer-host != NULL) ? buffer-host : buffer-recvhost;
+		if (f-f_host != NULL  h != NULL) {
+			char shost[MAXHOSTNAMELEN + 1];
+
+			if (BSDOutputFormat) {
+(void)strlcpy(shost, h, sizeof(shost));
 trim_anydomain(shost);
 h = shost;
 			}
@@ -3740,7 +3741,7 @@ cfline(size_t linenum, const char *line,
 		f-f_host = NULL;
 	else {
 		f-f_host = strdup(host);
-		trim_anydomain(f-f_host);
+		trim_anydomain(f-f_host[1]);	/* skip +/- at beginning */
 	}
 
 	/* save program name, if any */



CVS commit: src/usr.sbin/syslogd

2014-08-17 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon Aug 18 05:21:16 UTC 2014

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
- when checking hostname of incoming remote messages, fallback to checking
  remote host if the message doesn't contain a hostname
- don't truncate IP addresses when reading syslogd.conf


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2013-11-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 27 20:48:28 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
CID 1132759: Abort on dehumanize_number error on constant built-in string.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.118 src/usr.sbin/syslogd/syslogd.c:1.119
--- src/usr.sbin/syslogd/syslogd.c:1.118	Mon Nov 11 11:39:21 2013
+++ src/usr.sbin/syslogd/syslogd.c	Wed Nov 27 15:48:28 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.118 2013/11/11 16:39:21 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.119 2013/11/27 20:48:28 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)syslogd.c	8.3 (Berkeley) 4/4/94;
 #else
-__RCSID($NetBSD: syslogd.c,v 1.118 2013/11/11 16:39:21 christos Exp $);
+__RCSID($NetBSD: syslogd.c,v 1.119 2013/11/27 20:48:28 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -3207,13 +3207,15 @@ read_config_file(FILE *cf, struct filed 
 		if (!TypeInfo[i].queue_length_string
 		|| dehumanize_number(TypeInfo[i].queue_length_string,
 		TypeInfo[i].queue_length) == -1)
-			dehumanize_number(TypeInfo[i].default_length_string,
-	  TypeInfo[i].queue_length);
+			if (dehumanize_number(TypeInfo[i].default_length_string,
+			TypeInfo[i].queue_length) == -1)
+abort();
 		if (!TypeInfo[i].queue_size_string
 		|| dehumanize_number(TypeInfo[i].queue_size_string,
 		TypeInfo[i].queue_size) == -1)
-			dehumanize_number(TypeInfo[i].default_size_string,
-	  TypeInfo[i].queue_size);
+			if (dehumanize_number(TypeInfo[i].default_size_string,
+			TypeInfo[i].queue_size) == -1)
+abort();
 	}
 
 #ifndef DISABLE_SIGN



CVS commit: src/usr.sbin/syslogd

2013-11-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 27 20:48:28 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
CID 1132759: Abort on dehumanize_number error on constant built-in string.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2013-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 11 16:39:21 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
CID 1128379: Fix TOCTOU, always open the file first with non-blocking I/O,
do that stat later and leave the file as non-blocking because it does not
make a difference for plain files.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.117 src/usr.sbin/syslogd/syslogd.c:1.118
--- src/usr.sbin/syslogd/syslogd.c:1.117	Sat Nov  9 14:00:18 2013
+++ src/usr.sbin/syslogd/syslogd.c	Mon Nov 11 11:39:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.117 2013/11/09 19:00:18 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.118 2013/11/11 16:39:21 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)syslogd.c	8.3 (Berkeley) 4/4/94;
 #else
-__RCSID($NetBSD: syslogd.c,v 1.117 2013/11/09 19:00:18 christos Exp $);
+__RCSID($NetBSD: syslogd.c,v 1.118 2013/11/11 16:39:21 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -3898,26 +3898,25 @@ cfline(size_t linenum, const char *line,
 			f-f_flags |= FFLAG_SIGN;
 #endif /* !DISABLE_SIGN */
 		(void)strlcpy(f-f_un.f_fname, p, sizeof(f-f_un.f_fname));
-		if (!stat(p, sb)  S_ISFIFO(sb.st_mode)) {
+		if ((f-f_file = open(p, O_WRONLY|O_APPEND|O_NONBLOCK, 0))  0)
+		{
+			f-f_type = F_UNUSED;
+			logerror(%s, p);
+			break;
+		}
+		if (!fstat(f-f_file, sb)  S_ISFIFO(sb.st_mode)) {
 			f-f_file = -1;
 			f-f_type = F_FIFO;
 			break;
 		}
 
-		if ((f-f_file = open(p, O_WRONLY|O_APPEND, 0))  0) {
-			f-f_type = F_UNUSED;
-			logerror(%s, p);
-			break;
-		}
 		if (isatty(f-f_file)) {
 			f-f_type = F_TTY;
 			if (strcmp(p, ctty) == 0)
 f-f_type = F_CONSOLE;
-			if (fcntl(f-f_file, F_SETFL, O_NONBLOCK) == -1)
-logerror(Warning: cannot change tty fd for
- `%s' to non-blocking., p);
 		} else
 			f-f_type = F_FILE;
+
 		if (syncfile)
 			f-f_flags |= FFLAG_SYNC;
 		break;



CVS commit: src/usr.sbin/syslogd

2013-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  9 18:58:22 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
fix two bugs related to queues (Anthony Mallet)
- the default values are in humanized number form so strtol does not work
- fix reversed size tests


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.115 src/usr.sbin/syslogd/syslogd.c:1.116
--- src/usr.sbin/syslogd/syslogd.c:1.115	Mon May 27 19:15:51 2013
+++ src/usr.sbin/syslogd/syslogd.c	Sat Nov  9 13:58:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.115 2013/05/27 23:15:51 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.116 2013/11/09 18:58:22 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)syslogd.c	8.3 (Berkeley) 4/4/94;
 #else
-__RCSID($NetBSD: syslogd.c,v 1.115 2013/05/27 23:15:51 christos Exp $);
+__RCSID($NetBSD: syslogd.c,v 1.116 2013/11/09 18:58:22 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -3143,13 +3143,13 @@ read_config_file(FILE *cf, struct filed 
 		if (!TypeInfo[i].queue_length_string
 		|| dehumanize_number(TypeInfo[i].queue_length_string,
 		TypeInfo[i].queue_length) == -1)
-			TypeInfo[i].queue_length = strtol(
-			TypeInfo[i].default_length_string, NULL, 10);
+			dehumanize_number(TypeInfo[i].default_length_string,
+	  TypeInfo[i].queue_length);
 		if (!TypeInfo[i].queue_size_string
 		|| dehumanize_number(TypeInfo[i].queue_size_string,
 		TypeInfo[i].queue_size) == -1)
-			TypeInfo[i].queue_size = strtol(
-			TypeInfo[i].default_size_string, NULL, 10);
+			dehumanize_number(TypeInfo[i].default_size_string,
+	  TypeInfo[i].queue_size);
 	}
 
 #ifndef DISABLE_SIGN
@@ -4366,9 +4366,9 @@ message_queue_purge(struct filed *f, siz
 
 	while (removed  del_entries
 	|| (TypeInfo[f-f_type].queue_length != -1
-	 (size_t)TypeInfo[f-f_type].queue_length  f-f_qelements)
+	 (size_t)TypeInfo[f-f_type].queue_length = f-f_qelements)
 	|| (TypeInfo[f-f_type].queue_size != -1
-	 (size_t)TypeInfo[f-f_type].queue_size  f-f_qsize)) {
+	 (size_t)TypeInfo[f-f_type].queue_size = f-f_qsize)) {
 		qentry = find_qentry_to_delete(f-f_qhead, strategy, 0);
 		if (message_queue_remove(f, qentry))
 			removed++;



CVS commit: src/usr.sbin/syslogd

2013-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  9 19:00:18 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5 syslogd.c

Log Message:
add support for outputting to FIFO's (Anthony Mallet)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/syslogd/syslog.conf.5
cvs rdiff -u -r1.116 -r1.117 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslog.conf.5
diff -u src/usr.sbin/syslogd/syslog.conf.5:1.19 src/usr.sbin/syslogd/syslog.conf.5:1.20
--- src/usr.sbin/syslogd/syslog.conf.5:1.19	Fri Oct  5 12:15:45 2012
+++ src/usr.sbin/syslogd/syslog.conf.5	Sat Nov  9 14:00:18 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: syslog.conf.5,v 1.19 2012/10/05 16:15:45 msaitoh Exp $
+.\	$NetBSD: syslog.conf.5,v 1.20 2013/11/09 19:00:18 christos Exp $
 .\
 .\ Copyright (c) 1990, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -286,7 +286,11 @@ There are five forms:
 .Bl -bullet
 .It
 A pathname (beginning with a leading slash).
-Selected messages are appended to the file.
+Selected messages are appended to the file, unless
+pathname points to an existing FIFO special file.
+.Xr syslogd 8
+treats FIFO specially by opening them in non-blocking mode and
+discarding messages sent when no reader is listening on the other side.
 .Pp
 To ensure that kernel messages are written to disk promptly,
 .Xr syslogd 8

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.116 src/usr.sbin/syslogd/syslogd.c:1.117
--- src/usr.sbin/syslogd/syslogd.c:1.116	Sat Nov  9 13:58:22 2013
+++ src/usr.sbin/syslogd/syslogd.c	Sat Nov  9 14:00:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.116 2013/11/09 18:58:22 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.117 2013/11/09 19:00:18 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)syslogd.c	8.3 (Berkeley) 4/4/94;
 #else
-__RCSID($NetBSD: syslogd.c,v 1.116 2013/11/09 18:58:22 christos Exp $);
+__RCSID($NetBSD: syslogd.c,v 1.117 2013/11/09 19:00:18 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -70,6 +70,7 @@ __RCSID($NetBSD: syslogd.c,v 1.116 2013
  * TLS, syslog-protocol, and syslog-sign code by Martin Schuette.
  */
 #define SYSLOG_NAMES
+#include sys/stat.h
 #include poll.h
 #include syslogd.h
 #include extern.h
@@ -133,7 +134,8 @@ int	repeatinterval[] = { 30, 120, 600 };
 #define F_USERS		5		/* list of users */
 #define F_WALL		6		/* everyone logged on */
 #define F_PIPE		7		/* pipe to program */
-#define F_TLS		8
+#define F_FIFO		8		/* mkfifo(2) file */
+#define F_TLS		9
 
 struct TypeInfo {
 	const char *name;
@@ -155,6 +157,7 @@ struct TypeInfo {
 	{USERS,   NULL,0, NULL,	  0, 0, 0,  1024},
 	{WALL,NULL,0, NULL,	  0, 0, 0,  1024},
 	{PIPE,NULL, 1024, NULL,	 1M, 0, 0, 16384},
+	{FIFO,NULL, 1024, NULL,	 1M, 0, 0, 16384},
 #ifndef DISABLE_TLS
 	{TLS,	NULL,   -1, NULL, 16M, 0, 0, 16384}
 #endif /* !DISABLE_TLS */
@@ -2187,7 +2190,8 @@ fprintlog(struct filed *f, struct buf_ms
 	|| (f-f_type == F_TTY)
 	|| (f-f_type == F_CONSOLE)
 	|| (f-f_type == F_USERS)
-	|| (f-f_type == F_WALL))) {
+	|| (f-f_type == F_WALL)
+	|| (f-f_type == F_FIFO))) {
 		DELREF(buffer);
 		return;
 	}
@@ -2196,7 +2200,8 @@ fprintlog(struct filed *f, struct buf_ms
 	if (qentry
 	 (f-f_type != F_TLS)
 	 (f-f_type != F_PIPE)
-	 (f-f_type != F_FILE)) {
+	 (f-f_type != F_FILE)
+	 (f-f_type != F_FIFO)) {
 		errno = 0;
 		logerror(Warning: unexpected message type %d in buffer,
 		f-f_type);
@@ -2253,6 +2258,7 @@ fprintlog(struct filed *f, struct buf_ms
 		len = linelen - tlsprefixlen;
 		break;
 	case F_PIPE:
+	case F_FIFO:
 	case F_FILE:  /* fallthrough */
 		if (f-f_flags  FFLAG_FULL) {
 			v-iov_base = line + tlsprefixlen;
@@ -2453,6 +2459,60 @@ fprintlog(struct filed *f, struct buf_ms
 		}
 		break;
 
+	case F_FIFO:
+		DPRINTF(D_MISC, Logging to %s %s\n,
+			TypeInfo[f-f_type].name, f-f_un.f_fname);
+		if (f-f_file  0) {
+			f-f_file =
+			  open(f-f_un.f_fname, O_WRONLY|O_NONBLOCK, 0);
+			e = errno;
+			if (f-f_file  0  e == ENXIO) {
+/* Drop messages with no reader */
+if (qentry)
+	message_queue_remove(f, qentry);
+break;
+			}
+		}
+
+		if (f-f_file = 0  writev(f-f_file, iov, v - iov)  0) {
+			e = errno;
+
+			/* Enqueue if the fifo buffer is full */
+			if (e == EAGAIN) {
+if (f-f_lasterror != e)
+	logerror(%s, f-f_un.f_fname);
+f-f_lasterror = e;
+error = true;	/* enqueue on return */
+break;
+			}
+
+			close(f-f_file);
+			f-f_file = -1;
+
+			/* Drop messages with no reader */
+			if (e == EPIPE) {
+if (qentry)
+	message_queue_remove(f, qentry);
+break;
+			}
+		}
+
+		if (f-f_file  0) {
+			f-f_type = F_UNUSED;
+			errno = e;
+			f-f_lasterror 

CVS commit: src/usr.sbin/syslogd

2013-11-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Nov 10 00:13:50 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
Bump date for FIFO support.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslog.conf.5
diff -u src/usr.sbin/syslogd/syslog.conf.5:1.20 src/usr.sbin/syslogd/syslog.conf.5:1.21
--- src/usr.sbin/syslogd/syslog.conf.5:1.20	Sat Nov  9 19:00:18 2013
+++ src/usr.sbin/syslogd/syslog.conf.5	Sun Nov 10 00:13:50 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: syslog.conf.5,v 1.20 2013/11/09 19:00:18 christos Exp $
+.\	$NetBSD: syslog.conf.5,v 1.21 2013/11/10 00:13:50 wiz Exp $
 .\
 .\ Copyright (c) 1990, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ from: @(#)syslog.conf.5	8.1 (Berkeley) 6/9/93
 .\
-.Dd October 16, 2012
+.Dd November 9, 2013
 .Dt SYSLOG.CONF 5
 .Os
 .Sh NAME



CVS commit: src/usr.sbin/syslogd

2013-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  9 18:58:22 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
fix two bugs related to queues (Anthony Mallet)
- the default values are in humanized number form so strtol does not work
- fix reversed size tests


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2013-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  9 19:00:18 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5 syslogd.c

Log Message:
add support for outputting to FIFO's (Anthony Mallet)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/syslogd/syslog.conf.5
cvs rdiff -u -r1.116 -r1.117 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2013-11-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Nov 10 00:13:50 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
Bump date for FIFO support.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2013-05-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 27 23:15:51 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.c syslogd.h tls.c

Log Message:
PR/47861: Fredrik Pettai: keep track of the address family for each socket
opened and don't send the a message to the wrong family type.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/usr.sbin/syslogd/syslogd.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/syslogd/syslogd.h
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.114 src/usr.sbin/syslogd/syslogd.c:1.115
--- src/usr.sbin/syslogd/syslogd.c:1.114	Thu Jan 17 13:54:28 2013
+++ src/usr.sbin/syslogd/syslogd.c	Mon May 27 19:15:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.114 2013/01/17 18:54:28 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.115 2013/05/27 23:15:51 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)syslogd.c	8.3 (Berkeley) 4/4/94;
 #else
-__RCSID($NetBSD: syslogd.c,v 1.114 2013/01/17 18:54:28 christos Exp $);
+__RCSID($NetBSD: syslogd.c,v 1.115 2013/05/27 23:15:51 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -2496,6 +2496,8 @@ udp_send(struct filed *f, char *line, si
 	for (r = f-f_un.f_forw.f_addr; r; r = r-ai_next) {
 		retry = 0;
 		for (j = 0; j  finet-fd; j++) {
+			if (finet[j+1].af != r-ai_family)
+continue;
 sendagain:
 			lsent = sendto(finet[j+1].fd, line, len, 0,
 			r-ai_addr, r-ai_addrlen);
@@ -3994,6 +3996,7 @@ socksetup(int af, const char *hostname)
 			logerror(socket() failed);
 			continue;
 		}
+		s-af = r-ai_family;
 		if (r-ai_family == AF_INET6  setsockopt(s-fd, IPPROTO_IPV6,
 		IPV6_V6ONLY, on, sizeof(on))  0) {
 			logerror(setsockopt(IPV6_V6ONLY) failed);

Index: src/usr.sbin/syslogd/syslogd.h
diff -u src/usr.sbin/syslogd/syslogd.h:1.3 src/usr.sbin/syslogd/syslogd.h:1.4
--- src/usr.sbin/syslogd/syslogd.h:1.3	Mon Apr 20 05:56:08 2009
+++ src/usr.sbin/syslogd/syslogd.h	Mon May 27 19:15:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.h,v 1.3 2009/04/20 09:56:08 mschuett Exp $	*/
+/*	$NetBSD: syslogd.h,v 1.4 2013/05/27 23:15:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -302,6 +302,7 @@ STAILQ_HEAD(buf_queue_head, buf_queue);
 /* a pair of a socket and an associated event object */
 struct socketEvent {
 	int fd;
+	int af;
 	struct event *ev;
 };
 

Index: src/usr.sbin/syslogd/tls.c
diff -u src/usr.sbin/syslogd/tls.c:1.10 src/usr.sbin/syslogd/tls.c:1.11
--- src/usr.sbin/syslogd/tls.c:1.10	Tue Jun  5 20:33:45 2012
+++ src/usr.sbin/syslogd/tls.c	Mon May 27 19:15:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.c,v 1.10 2012/06/06 00:33:45 christos Exp $	*/
+/*	$NetBSD: tls.c,v 1.11 2013/05/27 23:15:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: tls.c,v 1.10 2012/06/06 00:33:45 christos Exp $);
+__RCSID($NetBSD: tls.c,v 1.11 2013/05/27 23:15:51 christos Exp $);
 
 #ifndef DISABLE_TLS
 #include syslogd.h
@@ -851,6 +851,7 @@ socksetup_tls(const int af, const char *
 			logerror(socket() failed: %s, strerror(errno));
 			continue;
 		}
+		s-af = r-ai_family;
 		if (r-ai_family == AF_INET6
 		  setsockopt(s-fd, IPPROTO_IPV6, IPV6_V6ONLY,
 			on, sizeof(on)) == -1) {



CVS commit: src/usr.sbin/syslogd

2013-05-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 27 23:15:51 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.c syslogd.h tls.c

Log Message:
PR/47861: Fredrik Pettai: keep track of the address family for each socket
opened and don't send the a message to the wrong family type.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/usr.sbin/syslogd/syslogd.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/syslogd/syslogd.h
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/syslogd/tls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2013-01-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 17 18:54:29 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
ut_line does not have /dev in front of it. Add it, from dholland@


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.113 src/usr.sbin/syslogd/syslogd.c:1.114
--- src/usr.sbin/syslogd/syslogd.c:1.113	Tue Jan 15 17:37:04 2013
+++ src/usr.sbin/syslogd/syslogd.c	Thu Jan 17 13:54:28 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.113 2013/01/15 22:37:04 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.114 2013/01/17 18:54:28 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)syslogd.c	8.3 (Berkeley) 4/4/94;
 #else
-__RCSID($NetBSD: syslogd.c,v 1.113 2013/01/15 22:37:04 christos Exp $);
+__RCSID($NetBSD: syslogd.c,v 1.114 2013/01/17 18:54:28 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -2563,8 +2563,10 @@ wallmsg(struct filed *f, struct iovec *i
 break;
 			if (strcmp(f-f_un.f_uname[i], ep-name) == 0) {
 struct stat st;
-
-if (stat(ep-line, st) != -1 
+char tty[MAXPATHLEN];
+snprintf(tty, sizeof(tty), %s/%s, _PATH_DEV,
+ep-line);
+if (stat(tty, st) != -1 
 (st.st_mode  S_IWGRP) == 0)
 	break;
 



CVS commit: src/usr.sbin/syslogd

2013-01-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 17 18:54:29 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
ut_line does not have /dev in front of it. Add it, from dholland@


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2013-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 15 22:37:04 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
PR/47449: David Holland: Don't log to terminals with mesg n, unless it is a
wall message.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.112 src/usr.sbin/syslogd/syslogd.c:1.113
--- src/usr.sbin/syslogd/syslogd.c:1.112	Tue Jun 19 21:39:34 2012
+++ src/usr.sbin/syslogd/syslogd.c	Tue Jan 15 17:37:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.112 2012/06/20 01:39:34 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.113 2013/01/15 22:37:04 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)syslogd.c	8.3 (Berkeley) 4/4/94;
 #else
-__RCSID($NetBSD: syslogd.c,v 1.112 2012/06/20 01:39:34 christos Exp $);
+__RCSID($NetBSD: syslogd.c,v 1.113 2013/01/15 22:37:04 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -2562,6 +2562,12 @@ wallmsg(struct filed *f, struct iovec *i
 			if (!f-f_un.f_uname[i][0])
 break;
 			if (strcmp(f-f_un.f_uname[i], ep-name) == 0) {
+struct stat st;
+
+if (stat(ep-line, st) != -1 
+(st.st_mode  S_IWGRP) == 0)
+	break;
+
 if ((p = ttymsg(iov, iovcnt, ep-line,
 TTYMSGTIME)) != NULL) {
 	errno = 0;	/* already in msg */



CVS commit: src/usr.sbin/syslogd

2013-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 15 22:37:04 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
PR/47449: David Holland: Don't log to terminals with mesg n, unless it is a
wall message.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/usr.sbin/syslogd/syslogd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2013-01-13 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan 14 03:05:41 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.8

Log Message:
fix thinko


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/syslogd/syslogd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.8
diff -u src/usr.sbin/syslogd/syslogd.8:1.53 src/usr.sbin/syslogd/syslogd.8:1.54
--- src/usr.sbin/syslogd/syslogd.8:1.53	Tue Oct 30 23:03:02 2012
+++ src/usr.sbin/syslogd/syslogd.8	Mon Jan 14 03:05:41 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: syslogd.8,v 1.53 2012/10/30 23:03:02 wiz Exp $
+.\	$NetBSD: syslogd.8,v 1.54 2013/01/14 03:05:41 dholland Exp $
 .\
 .\ Copyright (c) 1983, 1986, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -95,7 +95,7 @@ Multiple
 options create multiple log sockets.
 If no
 .Fl p
-arguments are created, the default socket of
+arguments are given, the default socket of
 .Pa /var/run/log
 is used.
 .It Fl r



CVS commit: src/usr.sbin/syslogd

2013-01-13 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan 14 03:05:41 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.8

Log Message:
fix thinko


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/syslogd/syslogd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2012-10-30 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Tue Oct 30 21:24:26 UTC 2012

Modified Files:
src/usr.sbin/syslogd: syslogd.8

Log Message:
Note enchancements that appeared in NetBSD 6.0.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/syslogd/syslogd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.8
diff -u src/usr.sbin/syslogd/syslogd.8:1.51 src/usr.sbin/syslogd/syslogd.8:1.52
--- src/usr.sbin/syslogd/syslogd.8:1.51	Sun Apr  8 22:00:41 2012
+++ src/usr.sbin/syslogd/syslogd.8	Tue Oct 30 21:24:26 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: syslogd.8,v 1.51 2012/04/08 22:00:41 wiz Exp $
+.\	$NetBSD: syslogd.8,v 1.52 2012/10/30 21:24:26 rkujawa Exp $
 .\
 .\ Copyright (c) 1983, 1986, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -267,3 +267,6 @@ Support for multiple log sockets appeare
 .Nx 1.4 .
 libwrap support appeared in
 .Nx 1.6 .
+Support for RFC 5424, TLS encryption and authentication, signed messages 
+appeared in
+.Nx 6.0 .



CVS commit: src/usr.sbin/syslogd

2012-10-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Oct 30 23:03:02 UTC 2012

Modified Files:
src/usr.sbin/syslogd: syslogd.8

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/syslogd/syslogd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslogd.8
diff -u src/usr.sbin/syslogd/syslogd.8:1.52 src/usr.sbin/syslogd/syslogd.8:1.53
--- src/usr.sbin/syslogd/syslogd.8:1.52	Tue Oct 30 21:24:26 2012
+++ src/usr.sbin/syslogd/syslogd.8	Tue Oct 30 23:03:02 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: syslogd.8,v 1.52 2012/10/30 21:24:26 rkujawa Exp $
+.\	$NetBSD: syslogd.8,v 1.53 2012/10/30 23:03:02 wiz Exp $
 .\
 .\ Copyright (c) 1983, 1986, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -267,6 +267,6 @@ Support for multiple log sockets appeare
 .Nx 1.4 .
 libwrap support appeared in
 .Nx 1.6 .
-Support for RFC 5424, TLS encryption and authentication, signed messages 
+Support for RFC 5424, TLS encryption and authentication, signed messages
 appeared in
 .Nx 6.0 .



CVS commit: src/usr.sbin/syslogd

2012-10-30 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Tue Oct 30 21:24:26 UTC 2012

Modified Files:
src/usr.sbin/syslogd: syslogd.8

Log Message:
Note enchancements that appeared in NetBSD 6.0.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/syslogd/syslogd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2012-10-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Oct 30 23:03:02 UTC 2012

Modified Files:
src/usr.sbin/syslogd: syslogd.8

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/syslogd/syslogd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/syslogd

2012-10-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct  5 16:15:45 UTC 2012

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
RFC 5848


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/syslogd/syslog.conf.5
diff -u src/usr.sbin/syslogd/syslog.conf.5:1.18 src/usr.sbin/syslogd/syslog.conf.5:1.19
--- src/usr.sbin/syslogd/syslog.conf.5:1.18	Fri Jan  1 21:44:07 2010
+++ src/usr.sbin/syslogd/syslog.conf.5	Fri Oct  5 16:15:45 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: syslog.conf.5,v 1.18 2010/01/01 21:44:07 wiz Exp $
+.\	$NetBSD: syslog.conf.5,v 1.19 2012/10/05 16:15:45 msaitoh Exp $
 .\
 .\ Copyright (c) 1990, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ from: @(#)syslog.conf.5	8.1 (Berkeley) 6/9/93
 .\
-.Dd January 1, 2010
+.Dd October 16, 2012
 .Dt SYSLOG.CONF 5
 .Os
 .Sh NAME
@@ -500,7 +500,7 @@ and
 .Sh SIGNING
 .Xr syslogd 8
 is able to digitally sign all processed messages.
-The used protocol is defined by RFC  (syslog-sign):
+The used protocol is defined by RFC 5848 (syslog-sign):
 at the start of a session the signing sender sends so called certificate
 blocks containing its public key; after that it periodically sends a signed
 message containing hashes of previous messages.



CVS commit: src/usr.sbin/syslogd

2012-10-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct  5 16:15:45 UTC 2012

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
RFC 5848


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/syslogd/syslog.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.sbin/syslogd

2012-06-19 Thread Valeriy E. Ushakov
On Tue, Jun 19, 2012 at 09:44:35 -0400, Christos Zoulas wrote:

 Module Name:  src
 Committed By: christos
 Date: Tue Jun 19 13:44:35 UTC 2012
 
 Modified Files:
   src/usr.sbin/syslogd: syslogd.c
 
 Log Message:
 - fix writev1() to pre-decrement count.
 - always open ttys with O_NDELAY.
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.110 -r1.111 src/usr.sbin/syslogd/syslogd.c

Hmm...  Why is this necessary:

f-f_file = open(f-f_un.f_fname,
-   O_WRONLY|O_APPEND|O_NDELAY, 0);
+   O_WRONLY|O_APPEND|O_NDELAY|O_NONBLOCK, 0);

given that O_NDELAY is a compat name for O_NONBLOCK (that is, modulo
whatever historic quirks O_NDELAY had that I totally forgot about, but
in our sys/fcntl.h it's just an alias).


Ditto here:

-   if ((f-f_file = open(p, O_WRONLY|O_APPEND, 0))  0) {
+   if ((f-f_file = open(p, O_WRONLY|O_APPEND|O_NDELAY, 0))  0) {

given that you still call fcntl afterwards.

-uwe


  1   2   >