summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2009-10-12 18:19:46 +0000
committergilles <gilles@openbsd.org>2009-10-12 18:19:46 +0000
commit2d460f1ef9a2638b3df275c316930f2a23ceedc9 (patch)
treed23d314c1bd87179cc77cb4dc04a3a696ec0f4b6
parentfix a bug where matching a "for all" rule with multiple condition will not (diff)
downloadwireguard-openbsd-2d460f1ef9a2638b3df275c316930f2a23ceedc9.tar.xz
wireguard-openbsd-2d460f1ef9a2638b3df275c316930f2a23ceedc9.zip
to support virtual domains properly, smtpd needed to have the domain stored
as a key in the virtual map, which means that to support virtual domain for openbsd.org I would do: openbsd.org whatevervalue gilles@openbsd.org gilles this commit teaches makemap how to deduce the special domain keys based on the entries for that domain, so that only the second line is needed now.
-rw-r--r--usr.sbin/smtpd/makemap.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c
index bb940aff167..4291d5033f3 100644
--- a/usr.sbin/smtpd/makemap.c
+++ b/usr.sbin/smtpd/makemap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: makemap.c,v 1.20 2009/08/08 00:02:22 gilles Exp $ */
+/* $OpenBSD: makemap.c,v 1.21 2009/10/12 18:19:46 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -221,8 +221,11 @@ parse_entry(char *line, size_t len, size_t lineno)
{
DBT key;
DBT val;
+ DBT domkey;
+ DBT domval;
char *keyp;
char *valp;
+ char *domp;
keyp = line;
while (isspace((int)*keyp))
@@ -259,6 +262,22 @@ parse_entry(char *line, size_t len, size_t lineno)
warn("dbput");
return 0;
}
+
+ /* add key for domain */
+ if ((domp = strrchr(key.data, '@')) != NULL) {
+ domkey.data = domp + 1;
+ domkey.size = strlen(domkey.data) + 1;
+
+ domval.data = "<empty>";
+ domval.size = strlen(domval.data) + 1;
+
+ if (db->put(db, &domkey, &domval, 0) == -1) {
+ warn("dbput");
+ return 0;
+ }
+ }
+
+
dbputs++;
free(val.data);