summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syslogd
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2018-07-17 13:51:47 +0000
committerdjm <djm@openbsd.org>2018-07-17 13:51:47 +0000
commitdce36526c4baa9e522b9e616cd41a07542404ead (patch)
tree0be6942c0b33677b54cf4a4cf38cb9fab1b412d3 /usr.sbin/syslogd
parentvmd(8): fix vmctl -b option for i386 kernels. (diff)
downloadwireguard-openbsd-dce36526c4baa9e522b9e616cd41a07542404ead.tar.xz
wireguard-openbsd-dce36526c4baa9e522b9e616cd41a07542404ead.zip
allow shell globs to match program and hostname selector tags via
fnmatch(3); ok sthen@ bluhm@
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r--usr.sbin/syslogd/syslog.conf.56
-rw-r--r--usr.sbin/syslogd/syslogd.c7
2 files changed, 7 insertions, 6 deletions
diff --git a/usr.sbin/syslogd/syslog.conf.5 b/usr.sbin/syslogd/syslog.conf.5
index 488d6e3023f..b444a6556a9 100644
--- a/usr.sbin/syslogd/syslog.conf.5
+++ b/usr.sbin/syslogd/syslog.conf.5
@@ -26,10 +26,10 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)syslog.conf.5 8.1 (Berkeley) 6/9/93
-.\" $OpenBSD: syslog.conf.5,v 1.36 2018/02/02 10:53:44 jmc Exp $
+.\" $OpenBSD: syslog.conf.5,v 1.37 2018/07/17 13:51:47 djm Exp $
.\" $NetBSD: syslog.conf.5,v 1.4 1996/01/02 17:41:46 perry Exp $
.\"
-.Dd $Mdocdate: February 2 2018 $
+.Dd $Mdocdate: July 17 2018 $
.Dt SYSLOG.CONF 5
.Os
.Sh NAME
@@ -102,7 +102,7 @@ Each block of lines is separated from the previous block by a tag.
The tag is a line beginning with
.Em !prog
and each block will be associated with calls to syslog from that specific
-program.
+program (matched using shell globbing rules).
When a message matches multiple blocks, the action of each matching
block is taken.
If no tag is specified at the beginning of the file,
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 3323a5523d2..da02de04b21 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.254 2017/11/24 23:11:42 bluhm Exp $ */
+/* $OpenBSD: syslogd.c,v 1.255 2018/07/17 13:51:47 djm Exp $ */
/*
* Copyright (c) 2014-2017 Alexander Bluhm <bluhm@genua.de>
@@ -98,6 +98,7 @@
#include <errno.h>
#include <event.h>
#include <fcntl.h>
+#include <fnmatch.h>
#include <limits.h>
#include <paths.h>
#include <signal.h>
@@ -1823,9 +1824,9 @@ logline(int pri, int flags, char *from, char *msg)
continue;
/* skip messages with the incorrect program or hostname */
- if (f->f_program && strcmp(prog, f->f_program) != 0)
+ if (f->f_program && fnmatch(f->f_program, prog, 0) != 0)
continue;
- if (f->f_hostname && strcmp(from, f->f_hostname) != 0)
+ if (f->f_hostname && fnmatch(f->f_hostname, from, 0) != 0)
continue;
if (f->f_type == F_CONSOLE && (flags & IGN_CONS))