diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2012-05-12 21:49:32 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2012-05-12 21:49:32 +0000 |
commit | 68a7c9ca39a9e884b201871e3dde49ca22e1cf7c (patch) | |
tree | b6d3e6436e093ce7f055e23c4d0fd3b372113267 | |
parent | 88398091c2870742e25736ce29abbb3c04ae3c0d (diff) |
- remove unused sources S_EXT, S_DYN and S_EXT from enum map_src
- continue simplification of parse.y
- remove "for network", if we ever need it we can reimport, probably no
one knows of that undocumented strange feature ;-)
- change syntax for virtual domains configuration:
accept for virtual vmap [...] <- wrong
accept for virtual map vmap [...] <- right
the reason for this change is that we will soon implement relay rules
through maps and that keeping that syntax would make it inconsistent
with the other rules.
- update man pages for makemap and smtpd.conf to reflect changes
ok eric@, looks ok chl@
-rw-r--r-- | usr.sbin/smtpd/makemap.8 | 8 | ||||
-rw-r--r-- | usr.sbin/smtpd/parse.y | 31 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.conf.5 | 29 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 7 |
4 files changed, 38 insertions, 37 deletions
diff --git a/usr.sbin/smtpd/makemap.8 b/usr.sbin/smtpd/makemap.8 index 1810e9a3d54..25fa0692bbf 100644 --- a/usr.sbin/smtpd/makemap.8 +++ b/usr.sbin/smtpd/makemap.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: makemap.8,v 1.15 2011/10/10 21:06:06 gilles Exp $ +.\" $OpenBSD: makemap.8,v 1.16 2012/05/12 21:49:31 gilles Exp $ .\" .\" Copyright (c) 2009 Jacek Masiulaniec <jacekm@openbsd.org> .\" Copyright (c) 2008-2009 Gilles Chechade <gilles@openbsd.org> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: October 10 2011 $ +.Dd $Mdocdate: May 12 2012 $ .Dt MAKEMAP 8 .Os .Sh NAME @@ -104,8 +104,8 @@ In addition to adding an entry to the virtual map, one must add a filter rule that accepts mail for virtual domains, for example: .Bd -literal -offset indent -map "vdomains" { source db "/etc/mail/vdomains.db" } -accept for virtual "vdomains" deliver to mbox +map "vdomains" source db "/etc/mail/vdomains.db" +accept for virtual map "vdomains" deliver to mbox .Ed .Sh FILES .Bl -tag -width "/etc/mail/aliasesXXX" -compact diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index a27c515378b..dcebfcd5663 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.86 2012/05/12 18:41:10 gilles Exp $ */ +/* $OpenBSD: parse.y,v 1.87 2012/05/12 21:49:31 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -123,9 +123,9 @@ typedef struct { %token AS QUEUE INTERVAL SIZE LISTEN ON ALL PORT EXPIRE %token MAP HASH LIST SINGLE SSL SMTPS CERTIFICATE -%token DB PLAIN EXTERNAL DOMAIN SOURCE +%token DB PLAIN DOMAIN SOURCE %token RELAY VIA DELIVER TO MAILDIR MBOX HOSTNAME -%token ACCEPT REJECT INCLUDE NETWORK ERROR MDA FROM FOR +%token ACCEPT REJECT INCLUDE ERROR MDA FROM FOR %token ARROW ENABLE AUTH TLS LOCAL VIRTUAL TAG ALIAS FILTER %token <v.string> STRING %token <v.number> NUMBER @@ -436,7 +436,6 @@ mapsource : PLAIN STRING { >= sizeof(map->m_config)) err(1, "pathname too long"); } - | EXTERNAL { map->m_src = S_EXT; } ; mapopt : SOURCE mapsource { } @@ -729,16 +728,7 @@ alias : ALIAS STRING { $$ = $2; } | /* empty */ { $$ = NULL; } ; -condition : NETWORK mapref { - struct cond *c; - - if ((c = calloc(1, sizeof *c)) == NULL) - fatal("out of memory"); - c->c_type = C_NET; - c->c_map = $2; - $$ = c; - } - | DOMAIN mapref alias { +condition : DOMAIN mapref alias { struct cond *c; struct map *m; @@ -757,21 +747,20 @@ condition : NETWORK mapref { c->c_map = $2; $$ = c; } - | VIRTUAL STRING { + | VIRTUAL mapref { struct cond *c; struct map *m; - if ((m = map_findbyname($2)) == NULL) { - yyerror("no such map: %s", $2); - free($2); + m = map_find($2); + if (m->m_src == S_NONE) { + yyerror("virtual parameter MUST be a map"); YYERROR; } - free($2); if ((c = calloc(1, sizeof *c)) == NULL) fatal("out of memory"); c->c_type = C_VDOM; - c->c_map = m->m_id; + c->c_map = $2; $$ = c; } | LOCAL alias { @@ -1209,7 +1198,6 @@ lookup(char *s) { "domain", DOMAIN }, { "enable", ENABLE }, { "expire", EXPIRE }, - { "external", EXTERNAL }, { "filter", FILTER }, { "for", FOR }, { "from", FROM }, @@ -1224,7 +1212,6 @@ lookup(char *s) { "map", MAP }, { "mbox", MBOX }, { "mda", MDA }, - { "network", NETWORK }, { "on", ON }, { "plain", PLAIN }, { "port", PORT }, diff --git a/usr.sbin/smtpd/smtpd.conf.5 b/usr.sbin/smtpd/smtpd.conf.5 index 944d3f118b3..d88df7166b0 100644 --- a/usr.sbin/smtpd/smtpd.conf.5 +++ b/usr.sbin/smtpd/smtpd.conf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: smtpd.conf.5,v 1.50 2012/05/12 18:41:10 gilles Exp $ +.\" $OpenBSD: smtpd.conf.5,v 1.51 2012/05/12 21:49:31 gilles Exp $ .\" .\" Copyright (c) 2008 Janne Johansson <jj@openbsd.org> .\" Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net> @@ -222,11 +222,17 @@ specified in CIDR notation. .Pp Next comes the selection based on the domain the message is sent to: .Bl -tag -width Ds -.It Ic for all +.It Xo +.Ic for all +.Op Ic alias Ar aliases +.Xc Make the rule match regardless of the domain it is sent to. +If specified, +.Ar aliases +is used for looking up alternative destinations for all addresses. .It Xo .Ic for domain Ar domain -.Op Ic alias Ar map +.Op Ic alias Ar aliases .Xc This rule applies to mail destined for the specified .Ar domain . @@ -239,10 +245,21 @@ accept for domain "*.example.com" deliver to mbox .Ed .Pp If specified, -.Ar map +.Ar aliases is used for looking up alternative destinations for addresses in this .Ar domain . .It Xo +.Ic for domain map Ar domains +.Op Ic alias Ar aliases +.Xc +This rule applies to mail destined to domains part of the map +.Ar domains . +.Pp +If specified, +.Ar aliases +is used for looking up alternative destinations for addresses in these +.Ar domains . +.It Xo .Ic for local .Op Ic alias Ar map .Xc @@ -251,10 +268,10 @@ This rule applies to mail destined to and to the server's fully qualified domain name, as returned by .Xr hostname 1 . -.It Ic for virtual Ar map +.It Ic for virtual map Ar vmap This rule applies to mail destined for the virtual domains specified in the map -.Ar map . +.Ar vmap . For an example of how to configure a virtual map, see .Xr makemap 8 . .El diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 6b0b605cce2..98483b7256a 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.291 2012/05/12 18:41:10 gilles Exp $ */ +/* $OpenBSD: smtpd.h,v 1.292 2012/05/12 21:49:31 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -233,11 +233,8 @@ struct peer { enum map_src { S_NONE, - S_DYN, - S_DNS, S_PLAIN, - S_DB, - S_EXT + S_DB }; enum map_kind { |