diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2012-08-21 20:19:47 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2012-08-21 20:19:47 +0000 |
commit | 567cbc2bb44ed7a2c477b0787d4ccd50e8ebecf2 (patch) | |
tree | 8e02dd4f4d744ae5e98f189efaab025969f857a8 /usr.sbin/smtpd/parse.y | |
parent | aeaaf85fa9a03d459d328e8f93992b1f1d1043b4 (diff) |
Allow smtpd to work as a backup MX, relaying only to MXs with higher
priority in the DNS record. For example:
accept for domain "foo.org" relay backup "mx3.foo.org"
will relay mails for "foo.org" using only hosts with higher priority
(i.e. lower value) than "mx3.foo.org", which is supposed to be the
current server.
If the specified backup MX is not found in the DNS record, relaying
works as normal.
ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/parse.y')
-rw-r--r-- | usr.sbin/smtpd/parse.y | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index 1a2e6c11165..aee31596a91 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.90 2012/08/19 14:16:58 chl Exp $ */ +/* $OpenBSD: parse.y,v 1.91 2012/08/21 20:19:46 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -124,7 +124,7 @@ typedef struct { %token AS QUEUE INTERVAL SIZE LISTEN ON ALL PORT EXPIRE %token MAP HASH LIST SINGLE SSL SMTPS CERTIFICATE %token DB PLAIN DOMAIN SOURCE -%token RELAY VIA DELIVER TO MAILDIR MBOX HOSTNAME +%token RELAY BACKUP VIA DELIVER TO MAILDIR MBOX HOSTNAME %token ACCEPT REJECT INCLUDE ERROR MDA FROM FOR %token ARROW ENABLE AUTH TLS LOCAL VIRTUAL TAG ALIAS FILTER %token <v.string> STRING @@ -887,6 +887,14 @@ action : DELIVER TO MAILDIR user { rule->r_action = A_RELAY; rule->r_as = $2; } + | RELAY BACKUP STRING relay_as { + rule->r_action = A_RELAY; + rule->r_as = $4; + rule->r_value.relayhost.flags |= F_BACKUP; + strlcpy(rule->r_value.relayhost.hostname, $3, + sizeof (rule->r_value.relayhost.hostname)); + free($3); + } | RELAY VIA STRING certname credentials relay_as { rule->r_action = A_RELAYVIA; rule->r_as = $6; @@ -1093,6 +1101,7 @@ lookup(char *s) { "all", ALL }, { "as", AS }, { "auth", AUTH }, + { "backup", BACKUP }, { "certificate", CERTIFICATE }, { "db", DB }, { "deliver", DELIVER }, |