summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2015-12-11 08:19:03 +0000
committergilles <gilles@openbsd.org>2015-12-11 08:19:03 +0000
commit2cada13a076e46bc4addecfa0f42d719536323d5 (patch)
tree3981c0956c5d7ab7a2b46b9e474d4c8b33e22b3b
parentadd filter.c prototypes, unused for now (diff)
downloadwireguard-openbsd-2cada13a076e46bc4addecfa0f42d719536323d5.tar.xz
wireguard-openbsd-2cada13a076e46bc4addecfa0f42d719536323d5.zip
in add_filter_arg() do not allow the same filter twice in same chain
unused for now
-rw-r--r--usr.sbin/smtpd/parse.y9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index bbf1005bc61..d2b30ddf371 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.164 2015/12/03 21:11:33 jung Exp $ */
+/* $OpenBSD: parse.y,v 1.165 2015/12/11 08:19:03 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -2465,6 +2465,8 @@ create_filter_chain(char *name)
static int
add_filter_arg(struct filter_conf *f, char *arg)
{
+ int i;
+
if (f->argc == MAX_FILTER_ARGS) {
yyerror("filter \"%s\" is full", f->name);
return (0);
@@ -2479,6 +2481,11 @@ add_filter_arg(struct filter_conf *f, char *arg)
yyerror("filter chain cannot contain itself");
return (0);
}
+ for (i = 0; i < f->argc; ++i)
+ if (strcasecmp(f->argv[i], arg) == 0) {
+ yyerror("filter chain cannot contain twice the same filter instance");
+ return (0);
+ }
}
f->argv[f->argc++] = arg;