diff options
-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; |