diff options
-rw-r--r-- | usr.sbin/smtpd/aliases.c | 14 | ||||
-rw-r--r-- | usr.sbin/smtpd/lka.c | 9 | ||||
-rw-r--r-- | usr.sbin/smtpd/ruleset.c | 14 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 9 |
4 files changed, 23 insertions, 23 deletions
diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c index e12d788f6b1..965dfbd1006 100644 --- a/usr.sbin/smtpd/aliases.c +++ b/usr.sbin/smtpd/aliases.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aliases.c,v 1.23 2009/11/03 11:10:43 jacekm Exp $ */ +/* $OpenBSD: aliases.c,v 1.24 2009/11/03 19:13:34 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -136,14 +136,16 @@ aliases_get(struct smtpd *env, struct aliaseslist *aliases, char *username) } int -aliases_vdomain_exists(struct smtpd *env, struct map *map, char *hostname) +aliases_vdomain_exists(struct smtpd *env, objid_t mapid, char *hostname) { int ret; DBT key; DBT val; DB *vtable; + struct map *map; char strkey[MAX_LINE_SIZE]; + map = map_find(env, mapid); if (map == NULL) return 0; @@ -172,14 +174,16 @@ aliases_vdomain_exists(struct smtpd *env, struct map *map, char *hostname) } int -aliases_virtual_exist(struct smtpd *env, struct map *map, struct path *path) +aliases_virtual_exist(struct smtpd *env, objid_t mapid, struct path *path) { int ret; DBT key; DBT val; DB *aliasesdb; + struct map *map; char strkey[MAX_LINE_SIZE]; + map = map_find(env, mapid); if (map == NULL) return 0; @@ -224,7 +228,7 @@ aliases_virtual_exist(struct smtpd *env, struct map *map, struct path *path) } int -aliases_virtual_get(struct smtpd *env, struct map *map, +aliases_virtual_get(struct smtpd *env, objid_t mapid, struct aliaseslist *aliases, struct path *path) { int ret; @@ -235,8 +239,10 @@ aliases_virtual_get(struct smtpd *env, struct map *map, struct alias alias; struct alias *aliasp; struct alias *nextalias; + struct map *map; char strkey[MAX_LINE_SIZE]; + map = map_find(env, mapid); if (map == NULL) return 0; diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c index d7170930254..2a87304dc60 100644 --- a/usr.sbin/smtpd/lka.c +++ b/usr.sbin/smtpd/lka.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka.c,v 1.73 2009/11/03 10:56:51 nicm Exp $ */ +/* $OpenBSD: lka.c,v 1.74 2009/11/03 19:13:34 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -374,7 +374,7 @@ lka_dispatch_mfa(int sig, short event, void *p) } else if (lkasession->path.flags & F_PATH_VIRTUAL) { log_debug("F_PATH_VIRTUAL"); - ret = aliases_virtual_get(env, lkasession->path.cond->c_match, + ret = aliases_virtual_get(env, lkasession->path.cond->c_map, &lkasession->aliaseslist, &lkasession->path); log_debug("\tVIRTUAL RESOLVED: %d", ret); } @@ -959,7 +959,8 @@ lka_expand_rcpt_iteration(struct smtpd *env, struct aliaseslist *aliases, struct if (alias->type == ALIAS_ADDRESS) { lka_rcpt_action(env, lkasession->message.tag, &alias->u.path); - if (aliases_virtual_get(env, alias->u.path.cond->c_match, aliases, &alias->u.path)) { + lka_resolve_path(env, &alias->u.path); + if (aliases_virtual_get(env, alias->u.path.cond->c_map, aliases, &alias->u.path)) { rmalias = alias; done = 0; } @@ -1026,7 +1027,7 @@ lka_resolve_path(struct smtpd *env, struct path *path){ return 1; } case C_VDOM: { - if (aliases_virtual_exist(env, path->cond->c_match, path)) { + if (aliases_virtual_exist(env, path->cond->c_map, path)) { path->flags |= F_PATH_VIRTUAL; return 1; } diff --git a/usr.sbin/smtpd/ruleset.c b/usr.sbin/smtpd/ruleset.c index 83ad748efbd..5194d017abe 100644 --- a/usr.sbin/smtpd/ruleset.c +++ b/usr.sbin/smtpd/ruleset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ruleset.c,v 1.6 2009/11/03 17:50:13 gilles Exp $ */ +/* $OpenBSD: ruleset.c,v 1.7 2009/11/03 19:13:34 gilles Exp $ */ /* * Copyright (c) 2009 Gilles Chehade <gilles@openbsd.org> @@ -65,11 +65,10 @@ ruleset_match(struct smtpd *env, char *tag, struct path *path, struct sockaddr_s } if (cond->c_type == C_DOM) { - cond->c_match = map_find(env, cond->c_map); - if (cond->c_match == NULL) + map = map_find(env, cond->c_map); + if (map == NULL) fatal("failed to lookup map."); - map = cond->c_match; TAILQ_FOREACH(me, &map->m_contents, me_entry) { if (hostname_match(path->domain, me->me_key.med_string)) { path->cond = cond; @@ -79,12 +78,7 @@ ruleset_match(struct smtpd *env, char *tag, struct path *path, struct sockaddr_s } if (cond->c_type == C_VDOM) { - cond->c_match = map_find(env, cond->c_map); - if (cond->c_match == NULL) - fatal("failed to lookup map."); - - map = cond->c_match; - if (aliases_vdomain_exists(env, map, path->domain)) { + if (aliases_vdomain_exists(env, cond->c_map, path->domain)) { path->cond = cond; return r; } diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 90d517e9122..a6c2194e9a5 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.149 2009/10/19 20:48:13 gilles Exp $ */ +/* $OpenBSD: smtpd.h,v 1.150 2009/11/03 19:13:34 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -293,7 +293,6 @@ struct cond { TAILQ_ENTRY(cond) c_entry; objid_t c_map; enum cond_type c_type; - struct map *c_match; }; enum opt_type { @@ -775,9 +774,9 @@ struct mta_session { /* aliases.c */ int aliases_exist(struct smtpd *, char *); int aliases_get(struct smtpd *, struct aliaseslist *, char *); -int aliases_vdomain_exists(struct smtpd *, struct map *, char *); -int aliases_virtual_exist(struct smtpd *, struct map *, struct path *); -int aliases_virtual_get(struct smtpd *, struct map *, struct aliaseslist *, struct path *); +int aliases_vdomain_exists(struct smtpd *, objid_t, char *); +int aliases_virtual_exist(struct smtpd *, objid_t, struct path *); +int aliases_virtual_get(struct smtpd *, objid_t, struct aliaseslist *, struct path *); int alias_parse(struct alias *, char *); /* authenticate.c */ |