diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2008-12-13 19:18:51 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2008-12-13 19:18:51 +0000 |
commit | caf1cfff6a85891992305e63b4a70b68f15f3a60 (patch) | |
tree | 47ccc03a6fa51994a4868c17e4fe657973bdd0aa /usr.sbin/smtpd | |
parent | bbe55850a77ad1e12fd29ddb9e8739c454a2e069 (diff) |
Detect alias duplicates.
ok gilles@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/newaliases.c | 9 |
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; |