summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2009-10-12 23:57:45 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2009-10-12 23:57:45 +0000
commit216e9f611a9242e3a04edbe3acc376022f1f85cd (patch)
tree2b553c53d5c7d7edb19e696e2c5b369afb3ccf24
parentfaf6bceaf35a41f9eed9ca72f0fa5b5a4ecb1f0e (diff)
trim ending whitespaces in aliases files otherwhise makemap will fail to
parse values correctly when ran in aliases mode, and smtpd will fail to parse values correctly when reading an include file
-rw-r--r--usr.sbin/smtpd/aliases.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c
index 076d7ef7099..16db574246d 100644
--- a/usr.sbin/smtpd/aliases.c
+++ b/usr.sbin/smtpd/aliases.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aliases.c,v 1.21 2009/10/12 22:34:37 gilles Exp $ */
+/* $OpenBSD: aliases.c,v 1.22 2009/10/12 23:57:44 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -359,6 +359,15 @@ alias_parse(struct alias *alias, char *line)
alias_is_address,
alias_is_username
};
+ char *wsp;
+
+ /* remove ending whitespaces */
+ wsp = line + strlen(line);
+ while (wsp != line) {
+ if (*wsp != '\0' && !isspace((int)*wsp))
+ break;
+ *wsp-- = '\0';
+ }
for (i = 0; i < sizeof(f) / sizeof(void *); ++i) {
bzero(alias, sizeof(struct alias));