summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2008-12-13 19:18:51 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2008-12-13 19:18:51 +0000
commitcaf1cfff6a85891992305e63b4a70b68f15f3a60 (patch)
tree47ccc03a6fa51994a4868c17e4fe657973bdd0aa
parentbbe55850a77ad1e12fd29ddb9e8739c454a2e069 (diff)
Detect alias duplicates.
ok gilles@
-rw-r--r--usr.sbin/smtpd/newaliases.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/usr.sbin/smtpd/newaliases.c b/usr.sbin/smtpd/newaliases.c
index 80db57127c5..5634541074a 100644
--- a/usr.sbin/smtpd/newaliases.c
+++ b/usr.sbin/smtpd/newaliases.c
@@ -147,6 +147,15 @@ parse_entry(char *line, size_t len, size_t lineno)
while (name < endp && isspace(*endp))
*endp-- = '\0';
+ /* Check for dups. */
+ key.data = name;
+ key.size = strlen(name) + 1;
+ if (db->get(db, &key, &val, 0) == 0) {
+ warnx("%s:%zd: duplicate entry for %s", PATH_ALIASES, lineno,
+ key.data);
+ return 0;
+ }
+
/* At this point name and rcpt are non-zero nul-terminated strings. */
while ((subrcpt = strsep(&rcpt, ",")) != NULL) {
struct alias alias;