From 216e9f611a9242e3a04edbe3acc376022f1f85cd Mon Sep 17 00:00:00 2001 From: Gilles Chehade Date: Mon, 12 Oct 2009 23:57:45 +0000 Subject: 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 --- usr.sbin/smtpd/aliases.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'usr.sbin/smtpd/aliases.c') 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 @@ -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)); -- cgit v1.2.3