summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2008-12-10 23:04:25 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2008-12-10 23:04:25 +0000
commit3f312f920d16a47b2ffd5d0b0b9f5f581e7519aa (patch)
treee4b215fabbbb2503b11c6e5f96cb2522651e8265 /usr.sbin
parentd4b65c2b413dfe5d68842e1d160c270be28411b5 (diff)
That the "aliases" and "virtual" maps satisfy m_src == S_DB is checked
too late, ie. at alias resolution time, and it's only a log_info. Move the check to parse.y, and make daemon die if m_src != S_DB. ok gilles@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/aliases.c22
-rw-r--r--usr.sbin/smtpd/parse.y11
2 files changed, 11 insertions, 22 deletions
diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c
index 5c13c30764e..60bf90e2917 100644
--- a/usr.sbin/smtpd/aliases.c
+++ b/usr.sbin/smtpd/aliases.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aliases.c,v 1.9 2008/12/05 19:09:59 gilles Exp $ */
+/* $OpenBSD: aliases.c,v 1.10 2008/12/10 23:04:24 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -60,11 +60,6 @@ aliases_exist(struct smtpd *env, char *username)
if (map == NULL)
return 0;
- if (map->m_src != S_DB) {
- log_info("map source for \"aliases\" must be \"db\".");
- return 0;
- }
-
aliasesdb = dbopen(map->m_config, O_RDONLY, 0600, DB_HASH, NULL);
if (aliasesdb == NULL)
return 0;
@@ -98,11 +93,6 @@ aliases_get(struct smtpd *env, struct aliaseslist *aliases, char *username)
if (map == NULL)
return 0;
- if (map->m_src != S_DB) {
- log_info("map source for \"aliases\" must be \"db\".");
- return 0;
- }
-
aliasesdb = dbopen(map->m_config, O_RDONLY, 0600, DB_HASH, NULL);
if (aliasesdb == NULL)
return 0;
@@ -155,11 +145,6 @@ aliases_virtual_exist(struct smtpd *env, struct path *path)
if (map == NULL)
return 0;
- if (map->m_src != S_DB) {
- log_info("map source for \"virtual\" must be \"db\".");
- return 0;
- }
-
aliasesdb = dbopen(map->m_config, O_RDONLY, 0600, DB_HASH, NULL);
if (aliasesdb == NULL)
return 0;
@@ -214,11 +199,6 @@ aliases_virtual_get(struct smtpd *env, struct aliaseslist *aliases,
if (map == NULL)
return 0;
- if (map->m_src != S_DB) {
- log_info("map source for \"virtual\" must be \"db\".");
- return 0;
- }
-
aliasesdb = dbopen(map->m_config, O_RDONLY, 0600, DB_HASH, NULL);
if (aliasesdb == NULL)
return 0;
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index ac4835a1d4f..8bbcdd47d05 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.15 2008/12/06 14:23:47 jacekm Exp $ */
+/* $OpenBSD: parse.y,v 1.16 2008/12/10 23:04:24 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -349,6 +349,15 @@ map : MAP STRING {
map = NULL;
YYERROR;
}
+ if (strcmp(map->m_name, "aliases") == 0 ||
+ strcmp(map->m_name, "virtual") == 0) {
+ if (map->m_src != S_DB) {
+ yyerror("map source must be db");
+ free(map);
+ map = NULL;
+ YYERROR;
+ }
+ }
TAILQ_INSERT_TAIL(conf->sc_maps, map, m_entry);
map = NULL;
}