diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-10-11 17:40:50 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-10-11 17:40:50 +0000 |
commit | ac4fcac1a4ee0d67b58fae11859cb103d8785252 (patch) | |
tree | 3f489733493fd73de52728cd246b621dbbdb8242 /usr.sbin/smtpd/parse.y | |
parent | 09b79addbc2f9597ca0b01c274381ccab6c9e35f (diff) |
implement proper virtual domains instead of faking them on top of primary
domains. this means that:
- virtual domains no longer deliver to a local user when not told to
- they no longer attempt to resolve aliases when not told to
- they no longer need an explicit rule in smtpd.conf for EACH domain
- the "virtual" map is no longer hardcoded
- smtpd no longer needs a restart to support a new domain
instead we introduce the: accept for virtual map "mapname" [...] syntax
which refers to a map that can be manipulated at runtime.
idea discussed and okayd with jacekm@
Diffstat (limited to 'usr.sbin/smtpd/parse.y')
-rw-r--r-- | usr.sbin/smtpd/parse.y | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index f60d4719bd4..f6eaeb5de33 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.39 2009/09/16 20:22:18 jacekm Exp $ */ +/* $OpenBSD: parse.y,v 1.40 2009/10/11 17:40:49 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -119,7 +119,7 @@ typedef struct { %token DNS DB TFILE EXTERNAL DOMAIN CONFIG SOURCE %token RELAY VIA DELIVER TO MAILDIR MBOX HOSTNAME %token ACCEPT REJECT INCLUDE NETWORK ERROR MDA FROM FOR -%token ARROW ENABLE AUTH TLS LOCAL +%token ARROW ENABLE AUTH TLS LOCAL VIRTUAL %token <v.string> STRING %token <v.number> NUMBER %type <v.map> map @@ -641,6 +641,25 @@ condition : NETWORK mapref { c->c_map = $2; $$ = c; } + | VIRTUAL MAP STRING { + struct cond *c; + struct map *m; + + if ((m = map_findbyname(conf, $3)) == NULL) { + yyerror("no such map: %s", $3); + free($3); + YYERROR; + } + free($3); + m->m_flags |= F_USED; + + + if ((c = calloc(1, sizeof *c)) == NULL) + fatal("out of memory"); + c->c_type = C_VDOM; + c->c_map = m->m_id; + $$ = c; + } | LOCAL { struct cond *c; struct map *m; @@ -934,6 +953,7 @@ lookup(char *s) { "to", TO }, { "type", TYPE }, { "via", VIA }, + { "virtual", VIRTUAL }, }; const struct keywords *p; |