diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-10-12 22:34:38 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-10-12 22:34:38 +0000 |
commit | 11a490dfe715accf249fca3104c0877bf992fe31 (patch) | |
tree | 3ac843f343d7eb168ecfe6defffc9e0b2afdf36f /usr.sbin/smtpd/aliases.c | |
parent | c484c66780b875208f5cad3ba1de53083fa16019 (diff) |
- fix a null deref which could happen after a couple iterations of the
aliases/virtual domains resolution code.
- fix a logic bug which caused virtual domains not to be correctly
handled after one iteration of the aliases resolution code.
- introduce a few helper functions to help clean up and simplify the
lka code.
- simplify the IS_EXT/IS_MAILBOX/IS_RELAY macros so they manipulate a
struct path * instead of the mess of dereferences we were passing them.
Diffstat (limited to 'usr.sbin/smtpd/aliases.c')
-rw-r--r-- | usr.sbin/smtpd/aliases.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c index 99aa40b03af..076d7ef7099 100644 --- a/usr.sbin/smtpd/aliases.c +++ b/usr.sbin/smtpd/aliases.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aliases.c,v 1.20 2009/10/11 17:40:49 gilles Exp $ */ +/* $OpenBSD: aliases.c,v 1.21 2009/10/12 22:34:37 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -144,6 +144,9 @@ aliases_vdomain_exists(struct smtpd *env, struct map *map, char *hostname) DB *vtable; char strkey[MAX_LINE_SIZE]; + if (map == NULL) + return 0; + vtable = dbopen(map->m_config, O_RDONLY, 0600, DB_HASH, NULL); if (vtable == NULL) { log_warn("aliases_vdomain_exists: dbopen"); @@ -177,6 +180,9 @@ aliases_virtual_exist(struct smtpd *env, struct map *map, struct path *path) DB *aliasesdb; char strkey[MAX_LINE_SIZE]; + if (map == NULL) + return 0; + aliasesdb = dbopen(map->m_config, O_RDONLY, 0600, DB_HASH, NULL); if (aliasesdb == NULL) { log_warn("aliases_virtual_exist: dbopen"); @@ -231,6 +237,9 @@ aliases_virtual_get(struct smtpd *env, struct map *map, struct alias *nextalias; char strkey[MAX_LINE_SIZE]; + if (map == NULL) + return 0; + aliasesdb = dbopen(map->m_config, O_RDONLY, 0600, DB_HASH, NULL); if (aliasesdb == NULL) { log_warn("aliases_virtual_get: dbopen"); |