summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2012-10-08 19:45:12 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2012-10-08 19:45:12 +0000
commit80651c1b2a7bb27a12461fcbeedf60f9e8002079 (patch)
treee66171e971a381ce7177ed49b4068ea9908f8cbb /usr.sbin/smtpd
parentf4c749cef82e1deae9dd0c7231799ffaaf36e47f (diff)
when building a db map, always lowercase the key before a lookup in makemap
smtpd already does it, but this allows spotting a cycle at makemap time, so user isn't surprised at runtime. while at it, be more tolerant when user specifies /etc/mail/aliases instead of /etc/mail/aliases.db
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/makemap.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c
index 4f890bed538..3651875be93 100644
--- a/usr.sbin/smtpd/makemap.c
+++ b/usr.sbin/smtpd/makemap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: makemap.c,v 1.38 2012/10/07 16:57:14 gilles Exp $ */
+/* $OpenBSD: makemap.c,v 1.39 2012/10/08 19:45:11 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -292,6 +292,8 @@ parse_mapentry(char *line, size_t len, size_t lineno)
/* Check for dups. */
key.data = keyp;
key.size = strlen(keyp) + 1;
+
+ xlowercase(key.data, key.data, strlen(key.data) + 1);
if (db->get(db, &key, &val, 0) == 0) {
warnx("%s:%zd: duplicate entry for %s", source, lineno, keyp);
return 0;
@@ -302,7 +304,6 @@ parse_mapentry(char *line, size_t len, size_t lineno)
goto bad;
}
else if (type == T_ALIASES) {
- xlowercase(key.data, key.data, strlen(key.data) + 1);
if (! make_aliases(&val, valp))
goto bad;
}
@@ -342,6 +343,7 @@ parse_setentry(char *line, size_t len, size_t lineno)
/* Check for dups. */
key.data = keyp;
key.size = strlen(keyp) + 1;
+ xlowercase(key.data, key.data, strlen(key.data) + 1);
if (db->get(db, &key, &val, 0) == 0) {
warnx("%s:%zd: duplicate entry for %s", source, lineno, keyp);
return 0;
@@ -421,10 +423,10 @@ conf_aliases(char *cfgpath)
path = xstrdup(map->m_config, "conf_aliases");
p = strstr(path, ".db");
- if (p == NULL || p[3] != '\0')
- errx(1, "%s: %s: no .db suffix present", cfgpath, path);
+ if (p == NULL || strcmp(p, ".db") != 0) {
+ return (path);
+ }
*p = '\0';
-
return (path);
}