diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2011-05-21 16:58:05 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2011-05-21 16:58:05 +0000 |
commit | a8e1395ba0d83eeecedeb4098f2f16fb117432f4 (patch) | |
tree | baf9192f337ebbf6f57d7e2cf6a641a9e06867ad | |
parent | 9d73e2d0fca8dd5b0b79cfd3b5fa85318623e73c (diff) |
"for all" does not necessary apply to relay rules, so do not forget to look
for an alias map.
fixes "accept from all for all alias myaliases deliver to mbox" and makes
thib "super happy"
ok thib@
-rw-r--r-- | usr.sbin/smtpd/parse.y | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index 8bf87d1874b..450476bbe61 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.73 2011/05/01 12:57:11 eric Exp $ */ +/* $OpenBSD: parse.y,v 1.74 2011/05/21 16:58:04 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -808,12 +808,22 @@ condition : NETWORK mapref { $$ = c; } - | ALL { + | ALL alias { struct cond *c; + struct map *m; if ((c = calloc(1, sizeof *c)) == NULL) fatal("out of memory"); c->c_type = C_ALL; + + if ($2) { + if ((m = map_findbyname($2)) == NULL) { + yyerror("no such map: %s", $2); + free($2); + YYERROR; + } + rule->r_amap = m->m_id; + } $$ = c; } ; @@ -1046,6 +1056,16 @@ rule : decision on from { free(cond); } + if (rule->r_amap) { + if (rule->r_action == A_RELAY || + rule->r_action == A_RELAYVIA) { + yyerror("aliases set on a relay rule"); + free(conditions); + free(rule); + YYERROR; + } + } + free(conditions); free(rule); conditions = NULL; |