summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2010-04-21 19:53:17 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2010-04-21 19:53:17 +0000
commit478d2f807269d4a1dc2066ed302f9716adb8b3f9 (patch)
tree7fc9ae985dde1a2a8dd7c607939ca2476138a570
parentfd61b69b0ae66552b57201d46c1bfaa0d75cb766 (diff)
map_lookup() takes an additionnal parameter of type enum map_kind which
will be used to select the appropriate map parser. make sure every call to map_lookup() is updated. map_lookup() currently ignores the value.
-rw-r--r--usr.sbin/smtpd/lka.c4
-rw-r--r--usr.sbin/smtpd/map.c7
-rw-r--r--usr.sbin/smtpd/ruleset.c4
-rw-r--r--usr.sbin/smtpd/smtpd.h7
4 files changed, 12 insertions, 10 deletions
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c
index 27a31a16d18..0d5376f6125 100644
--- a/usr.sbin/smtpd/lka.c
+++ b/usr.sbin/smtpd/lka.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka.c,v 1.104 2010/04/21 18:54:43 jacekm Exp $ */
+/* $OpenBSD: lka.c,v 1.105 2010/04/21 19:53:15 gilles Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -132,7 +132,7 @@ lka_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
map = map_findbyname(env, "secrets");
if (map == NULL)
fatalx("lka: secrets map not found");
- tmp = map_lookup(env, map->m_id, secret->host);
+ tmp = map_lookup(env, map->m_id, secret->host, K_SECRETS);
log_debug("lka: %s secret lookup (%d)", secret->host,
tmp != NULL);
secret->secret[0] = '\0';
diff --git a/usr.sbin/smtpd/map.c b/usr.sbin/smtpd/map.c
index 3b159c77ca4..3f99281affb 100644
--- a/usr.sbin/smtpd/map.c
+++ b/usr.sbin/smtpd/map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: map.c,v 1.11 2010/04/21 19:45:07 gilles Exp $ */
+/* $OpenBSD: map.c,v 1.12 2010/04/21 19:53:16 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -69,7 +69,8 @@ struct map_parser {
} map_parsers[] = {
{ K_NONE, NULL },
{ K_ALIASES, NULL },
- { K_CREDENTIALS, NULL }
+ { K_VIRTUAL, NULL },
+ { K_SECRETS, NULL }
};
struct map *
@@ -97,7 +98,7 @@ map_find(struct smtpd *env, objid_t id)
}
char *
-map_lookup(struct smtpd *env, objid_t mapid, char *key)
+map_lookup(struct smtpd *env, objid_t mapid, char *key, enum map_kind kind)
{
void *hdl = NULL;
char *result = NULL;
diff --git a/usr.sbin/smtpd/ruleset.c b/usr.sbin/smtpd/ruleset.c
index 39f5581f9c2..16d850f9222 100644
--- a/usr.sbin/smtpd/ruleset.c
+++ b/usr.sbin/smtpd/ruleset.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ruleset.c,v 1.11 2010/02/28 12:23:12 gilles Exp $ */
+/* $OpenBSD: ruleset.c,v 1.12 2010/04/21 19:53:16 gilles Exp $ */
/*
* Copyright (c) 2009 Gilles Chehade <gilles@openbsd.org>
@@ -80,7 +80,7 @@ ruleset_match(struct smtpd *env, char *tag, struct path *path, struct sockaddr_s
}
break;
case S_DB:
- if (map_lookup(env, map->m_id, path->domain) != NULL) {
+ if (map_lookup(env, map->m_id, path->domain, K_VIRTUAL) != NULL) {
path->cond = cond;
return r;
}
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index eb4aed746fb..c4ba75f3846 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.176 2010/04/21 19:45:07 gilles Exp $ */
+/* $OpenBSD: smtpd.h,v 1.177 2010/04/21 19:53:16 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -252,7 +252,8 @@ enum map_src {
enum map_kind {
K_NONE,
K_ALIASES,
- K_CREDENTIALS
+ K_VIRTUAL,
+ K_SECRETS
};
enum mapel_type {
@@ -937,7 +938,7 @@ void show_queue(char *, int);
u_int16_t queue_hash(char *);
/* map.c */
-char *map_lookup(struct smtpd *, objid_t, char *);
+char *map_lookup(struct smtpd *, objid_t, char *, enum map_kind);
/* mda.c */
pid_t mda(struct smtpd *);