diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-11-03 22:57:42 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-11-03 22:57:42 +0000 |
commit | abf341a30a6fbed3284cce7b9c03141e93de7a24 (patch) | |
tree | 69d9a0e31eb4300131679b509ccf66f22f8c591f /usr.sbin/smtpd/ruleset.c | |
parent | d6962539bf43face70c48f1e28dce06b287b841b (diff) |
teach makemap how to build a set, which is a map containing only keys.
smtpd is now capable of looking primary domains at runtime in a set, which
means that the following becomes possible:
map "primary" { source db "/etc/mail/primary.db" }
accept for domain map "primary" deliver to mbox
while at it fix a couple bugs in the aliases resolution path which caused
recipients to bounce if a ruleset did not have an "accept for local" rule
"diff reads good" jacekm@, flush queue & make clean
Diffstat (limited to 'usr.sbin/smtpd/ruleset.c')
-rw-r--r-- | usr.sbin/smtpd/ruleset.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/ruleset.c b/usr.sbin/smtpd/ruleset.c index 5194d017abe..acfb6214f1b 100644 --- a/usr.sbin/smtpd/ruleset.c +++ b/usr.sbin/smtpd/ruleset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ruleset.c,v 1.7 2009/11/03 19:13:34 gilles Exp $ */ +/* $OpenBSD: ruleset.c,v 1.8 2009/11/03 22:57:41 gilles Exp $ */ /* * Copyright (c) 2009 Gilles Chehade <gilles@openbsd.org> @@ -69,11 +69,24 @@ ruleset_match(struct smtpd *env, char *tag, struct path *path, struct sockaddr_s if (map == NULL) fatal("failed to lookup map."); - TAILQ_FOREACH(me, &map->m_contents, me_entry) { - if (hostname_match(path->domain, me->me_key.med_string)) { + switch (map->m_src) { + case S_NONE: + TAILQ_FOREACH(me, &map->m_contents, me_entry) { + if (hostname_match(path->domain, me->me_key.med_string)) { + path->cond = cond; + return r; + } + } + break; + case S_DB: + if (map_dblookup(env, map->m_id, path->domain) != NULL) { path->cond = cond; return r; } + break; + default: + log_info("unsupported map source for domain map"); + continue; } } |