From 372f34631b1ff121b61a45ea95897d3caf8e470d Mon Sep 17 00:00:00 2001 From: Gilles Chehade Date: Sun, 29 Jul 2012 17:21:44 +0000 Subject: - introduce xlowercase() and allow lowercase() to fail gracefully - replace all calls to lowercase() with calls to xlowercase() - in the format string expansion, lowercase() all formats we will have to reassess all calls to xlowercase() even though it has never triggered as far as I know, we can probably gracefully fail some of them. right now we're just keeping former behaviour. this commit fixes issue reported by Hugo Osvaldo Barrera where a %u format could lead to a delivery failure (ie: GILLES@openbsd.org should be expanded to gilles, not GILLES ... only for local deliveries). ok chl@ on the idea, ok eric@ on the diff --- usr.sbin/smtpd/aliases.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'usr.sbin/smtpd/aliases.c') diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c index 7995ecaa1a1..09b6605cab6 100644 --- a/usr.sbin/smtpd/aliases.c +++ b/usr.sbin/smtpd/aliases.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aliases.c,v 1.47 2012/04/21 12:45:05 gilles Exp $ */ +/* $OpenBSD: aliases.c,v 1.48 2012/07/29 17:21:43 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -46,7 +46,7 @@ aliases_exist(objid_t mapid, char *username) struct map_alias *map_alias; char buf[MAX_LOCALPART_SIZE]; - lowercase(buf, username, sizeof(buf)); + xlowercase(buf, username, sizeof(buf)); map_alias = map_lookup(mapid, buf, K_ALIAS); if (map_alias == NULL) return 0; @@ -69,7 +69,7 @@ aliases_get(objid_t mapid, struct expandtree *expandtree, char *username) char buf[MAX_LOCALPART_SIZE]; size_t nbaliases; - lowercase(buf, username, sizeof(buf)); + xlowercase(buf, username, sizeof(buf)); map_alias = map_lookup(mapid, buf, K_ALIAS); if (map_alias == NULL) return 0; @@ -99,7 +99,7 @@ aliases_vdomain_exists(objid_t mapid, char *hostname) struct map_virtual *map_virtual; char buf[MAXHOSTNAMELEN]; - lowercase(buf, hostname, sizeof(buf)); + xlowercase(buf, hostname, sizeof(buf)); map_virtual = map_lookup(mapid, buf, K_VIRTUAL); if (map_virtual == NULL) return 0; @@ -122,7 +122,7 @@ aliases_virtual_exist(objid_t mapid, struct mailaddr *maddr) if (! bsnprintf(buf, sizeof(buf), "%s@%s", maddr->user, maddr->domain)) return 0; - lowercase(buf, buf, sizeof(buf)); + xlowercase(buf, buf, sizeof(buf)); map_virtual = map_lookup(mapid, buf, K_VIRTUAL); if (map_virtual == NULL) { @@ -152,7 +152,7 @@ aliases_virtual_get(objid_t mapid, struct expandtree *expandtree, if (! bsnprintf(buf, sizeof(buf), "%s@%s", maddr->user, maddr->domain)) return 0; - lowercase(buf, buf, sizeof(buf)); + xlowercase(buf, buf, sizeof(buf)); map_virtual = map_lookup(mapid, buf, K_VIRTUAL); if (map_virtual == NULL) { -- cgit v1.2.3