summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/smtpd')
-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;
}