summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2018-07-17 13:51:48 +0000
committerDamien Miller <djm@cvs.openbsd.org>2018-07-17 13:51:48 +0000
commit6d8e041848f613f7cef5f76200e387acf2e54d39 (patch)
treeee7afd83af8a6c36780178e07464da8cdc038013 /usr.sbin
parent860b7a9355dc4a16133e64f2047736ec442dd9cc (diff)
allow shell globs to match program and hostname selector tags via
fnmatch(3); ok sthen@ bluhm@
Diffstat (limited to 'usr.sbin')
-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))