diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2010-10-28 21:15:51 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2010-10-28 21:15:51 +0000 |
commit | 312478c402d1c5266d32265b73443a7b981fd641 (patch) | |
tree | 0c489eed3399dbf601e18fddf8818fe154e181ad /usr.sbin/smtpd/parse.y | |
parent | 5e30fca37df71f1d578eade942af05b34dbdb781 (diff) |
teach smtpd how to handle per-rule delays for message expiry, this allows
some rules to have a longer expiry delay than the default:
accept for [...] relay expire 8d # will stay 8 days in queue
I added the man page bits so I don't forget but I need to reword it a bit
Diffstat (limited to 'usr.sbin/smtpd/parse.y')
-rw-r--r-- | usr.sbin/smtpd/parse.y | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index c5c6748f8b7..eebf471f02a 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.68 2010/10/18 13:28:00 sthen Exp $ */ +/* $OpenBSD: parse.y,v 1.69 2010/10/28 21:15:50 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -126,7 +126,7 @@ typedef struct { %token <v.string> STRING %token <v.number> NUMBER %type <v.map> map -%type <v.number> quantifier decision port from auth ssl size +%type <v.number> quantifier decision port from auth ssl size expire %type <v.cond> condition %type <v.tv> interval %type <v.object> mapref @@ -269,6 +269,17 @@ tag : TAG STRING { | /* empty */ { $$ = NULL; } ; +expire : EXPIRE STRING { + $$ = delaytonum($2); + if ($$ == -1) { + yyerror("invalid expire delay: %s", $2); + YYERROR; + } + free($2); + } + | /* empty */ { $$ = conf->sc_qexpire; } + ; + main : QUEUE INTERVAL interval { conf->sc_qintval = $3; } @@ -997,7 +1008,7 @@ rule : decision on from { TAILQ_INIT(conditions); - } FOR conditions action tag { + } FOR conditions action tag expire { struct rule *subr; struct cond *cond; @@ -1005,6 +1016,8 @@ rule : decision on from { (void)strlcpy(rule->r_tag, $8, sizeof(rule->r_tag)); free($8); + rule->r_qexpire = $9; + while ((cond = TAILQ_FIRST(conditions)) != NULL) { if ((subr = calloc(1, sizeof(*subr))) == NULL) |