diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2018-12-13 14:43:32 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2018-12-13 14:43:32 +0000 |
commit | 3d4212dae69e5feb6eb917aa6aebf66e59ff25b0 (patch) | |
tree | b89d1087b47fc2183459a150d3c3ebae407e8785 /usr.sbin/smtpd | |
parent | e1eee0a4554199db2f461c42d8b6bdcaf6a3b337 (diff) |
only allow builtin filters to declare which hook they listen to in the conf
since proc filters are going to register themselves through the protocol.
this will allow us to plug proc filters that deal with multiple hooks w/out
having to declare each and every hook, and without risking to forget one.
discussed with eric@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/parse.y | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index 5edb3fbb322..dbf8c21b634 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.236 2018/12/11 14:52:50 gilles Exp $ */ +/* $OpenBSD: parse.y,v 1.237 2018/12/13 14:43:31 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -1114,18 +1114,6 @@ MATCH { } ; -filter_action_proc: -ON STRING { - filter_rule->proc = $2; - if (! dict_get(conf->sc_processors_dict, $2)) { - yyerror("no processor exist with that name: %s", $2); - free($2); - YYERROR; - } - dict_set(conf->sc_smtp_reporters_dict, $2, (void *)~0); -} -; - filter_action_builtin: REJECT STRING { filter_rule->reject = $2; @@ -1170,9 +1158,6 @@ filter_phase_connect: CONNECT { filter_rule->phase = FILTER_CONNECTED; } filter_phase_connect_options filter_action_builtin -| CONNECT { - filter_rule->phase = FILTER_CONNECTED; -} filter_action_proc ; filter_phase_helo_options: @@ -1182,18 +1167,12 @@ filter_phase_helo: HELO { filter_rule->phase = FILTER_HELO; } filter_phase_helo_options filter_action_builtin -| HELO { - filter_rule->phase = FILTER_HELO; -} filter_action_proc ; filter_phase_ehlo: EHLO { filter_rule->phase = FILTER_EHLO; } filter_phase_helo_options filter_action_builtin -| EHLO { - filter_rule->phase = FILTER_EHLO; -} filter_action_proc ; filter_phase_mail_from_options: @@ -1203,9 +1182,6 @@ filter_phase_mail_from: MAIL_FROM { filter_rule->phase = FILTER_MAIL_FROM; } filter_phase_mail_from_options filter_action_builtin -| MAIL_FROM { - filter_rule->phase = FILTER_MAIL_FROM; -} filter_action_proc ; filter_phase_rcpt_to_options: @@ -1215,63 +1191,42 @@ filter_phase_rcpt_to: RCPT_TO { filter_rule->phase = FILTER_RCPT_TO; } filter_phase_rcpt_to_options filter_action_builtin -| RCPT_TO { - filter_rule->phase = FILTER_RCPT_TO; -} filter_action_proc ; filter_phase_data: DATA { filter_rule->phase = FILTER_DATA; } filter_action_builtin -| DATA { - filter_rule->phase = FILTER_DATA; -} filter_action_proc ; filter_phase_data_line: DATA_LINE { filter_rule->phase = FILTER_DATA_LINE; } filter_action_builtin -| DATA_LINE { - filter_rule->phase = FILTER_DATA_LINE; -} filter_action_proc ; filter_phase_quit: QUIT { filter_rule->phase = FILTER_QUIT; } filter_action_builtin -| QUIT { - filter_rule->phase = FILTER_QUIT; -} filter_action_proc ; filter_phase_rset: RSET { filter_rule->phase = FILTER_RSET; } filter_action_builtin -| RSET { - filter_rule->phase = FILTER_RSET; -} filter_action_proc ; filter_phase_noop: NOOP { filter_rule->phase = FILTER_NOOP; } filter_action_builtin -| NOOP { - filter_rule->phase = FILTER_NOOP; -} filter_action_proc ; filter_phase_commit: COMMIT { filter_rule->phase = FILTER_COMMIT; } filter_action_builtin -| COMMIT { - filter_rule->phase = FILTER_COMMIT; -} filter_action_proc ; @@ -1297,21 +1252,11 @@ FILTER SMTP_IN { filter_rule = NULL; } | FILTER SMTP_IN ON STRING { - int phase; - if (! dict_get(conf->sc_processors_dict, $4)) { yyerror("no processor exist with that name: %s", $4); free($4); YYERROR; } - for (phase = 0; phase < FILTER_PHASES_COUNT; phase++) { - filter_rule = xcalloc(1, sizeof *filter_rule); - filter_rule->phase = phase; - filter_rule->proc = $4; - TAILQ_INSERT_TAIL(&conf->sc_filter_rules[filter_rule->phase], filter_rule, entry); - filter_rule = NULL; - } - dict_set(conf->sc_smtp_reporters_dict, $4, (void *)~0); } | FILTER SMTP_OUT ON STRING { |