diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2015-12-12 12:22:27 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2015-12-12 12:22:27 +0000 |
commit | 03a8fe95f061c0cb80ded058f98ae5459032fce3 (patch) | |
tree | 3dfa02472f38d1f56344808bf97f96f9b3814083 | |
parent | 3b701985760d489427cd827efafe0b2cfacc9897 (diff) |
add bits so local enqueuer can run filters when they are enabled
-rw-r--r-- | usr.sbin/smtpd/parse.y | 16 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 4 |
3 files changed, 21 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index fa8bc4c4987..338830b8851 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.168 2015/12/12 11:31:29 sunil Exp $ */ +/* $OpenBSD: parse.y,v 1.169 2015/12/12 12:22:25 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -840,6 +840,20 @@ main : BOUNCEWARN { listen_opts.ifx = $4; create_listener(conf->sc_listeners, &listen_opts); } + | ENQUEUER FILTER STRING { + if (dict_get(&conf->sc_filters, $3) == NULL) { + yyerror("undefined filter \"%s\"", $3); + free($3); + YYERROR; + } + if (strlcpy(conf->sc_enqueue_filter, $3, + sizeof conf->sc_enqueue_filter) + >= sizeof conf->sc_enqueue_filter) { + free($3); + YYERROR; + } + free($3); + } | FILTER STRING STRING { if (!strcmp($3, "chain")) { free($3); diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c index a61a678b0f9..550ae4b7dac 100644 --- a/usr.sbin/smtpd/smtp.c +++ b/usr.sbin/smtpd/smtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp.c,v 1.147 2015/12/12 11:31:29 sunil Exp $ */ +/* $OpenBSD: smtp.c,v 1.148 2015/12/12 12:22:25 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -228,6 +228,8 @@ smtp_enqueue(uid_t *euid) listener->ss.ss_len = sizeof(struct sockaddr *); (void)strlcpy(listener->hostname, env->sc_hostname, sizeof(listener->hostname)); + (void)strlcpy(listener->filter, env->sc_enqueue_filter, + sizeof listener->filter); } /* diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 5616ee336d0..3d0efbe995d 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.504 2015/12/12 10:52:22 gilles Exp $ */ +/* $OpenBSD: smtpd.h,v 1.505 2015/12/12 12:22:26 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -623,6 +623,8 @@ struct smtpd { struct dict sc_filters; uint32_t filtermask; + + char sc_enqueue_filter[PATH_MAX]; }; #define TRACE_DEBUG 0x0001 |