summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2019-11-04 00:05:39 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2019-11-04 00:05:39 +0000
commitaa58f2883cd65af16d6e057f5c1d39313cb80c06 (patch)
tree24e1594bd5e9c562e3cec2136fb6b786e4a8309a
parent5810af19da64489b73b8be2459ec4f3a747fdf82 (diff)
fix a possible crash when combining "from rdns", nested virtual aliases and
a particular sequence of rules causing "from rdns" to be hit again from the expanded aliases. this requires crafting a specific configuration.
-rw-r--r--usr.sbin/smtpd/ruleset.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/ruleset.c b/usr.sbin/smtpd/ruleset.c
index 2e282367886..0468ddb3dc7 100644
--- a/usr.sbin/smtpd/ruleset.c
+++ b/usr.sbin/smtpd/ruleset.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ruleset.c,v 1.44 2019/08/11 17:23:12 gilles Exp $ */
+/* $OpenBSD: ruleset.c,v 1.45 2019/11/04 00:05:38 gilles Exp $ */
/*
* Copyright (c) 2009 Gilles Chehade <gilles@poolp.org>
@@ -66,8 +66,14 @@ ruleset_match_from(struct rule *r, const struct envelope *evp)
if (!r->flag_from)
return 1;
- if (evp->flags & EF_INTERNAL)
+ if (evp->flags & EF_INTERNAL) {
+ /* if expanded from an empty table_from, skip rule
+ * if no table
+ */
+ if (r->table_from == NULL)
+ return 0;
key = "local";
+ }
else if (r->flag_from_rdns) {
has_rdns = strcmp(evp->hostname, "<unknown>") != 0;
if (r->table_from == NULL)