diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2019-11-12 20:21:47 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2019-11-12 20:21:47 +0000 |
commit | d6da03304b053a2aa36fbd1ac7f7f63c90021840 (patch) | |
tree | d9ded9fb69da1dc09ca4c2d69523e0157b5f5b67 /usr.sbin/smtpd/ruleset.c | |
parent | bd1290f15e5d46d955c776a2ae8cad2707372f4c (diff) |
fix a logic bug in ruleset matching that makes `from socket` rules possibly
crash depending on how the ruleset is crafted.
Diffstat (limited to 'usr.sbin/smtpd/ruleset.c')
-rw-r--r-- | usr.sbin/smtpd/ruleset.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/ruleset.c b/usr.sbin/smtpd/ruleset.c index 0468ddb3dc7..db9d1aa57fe 100644 --- a/usr.sbin/smtpd/ruleset.c +++ b/usr.sbin/smtpd/ruleset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ruleset.c,v 1.45 2019/11/04 00:05:38 gilles Exp $ */ +/* $OpenBSD: ruleset.c,v 1.46 2019/11/12 20:21:46 gilles Exp $ */ /* * Copyright (c) 2009 Gilles Chehade <gilles@poolp.org> @@ -84,9 +84,12 @@ ruleset_match_from(struct rule *r, const struct envelope *evp) } else { key = ss_to_text(&evp->ss); - if (strcmp(key, "local") == 0) - if (r->flag_from_socket) + if (r->flag_from_socket) { + if (strcmp(key, "local") == 0) return MATCH_RESULT(1, r->flag_from); + else + return r->flag_from < 0 ? 1 : 0; + } } if (r->flag_from_regex) service = K_REGEX; |