summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/aliases.c
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2012-07-29 17:21:44 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2012-07-29 17:21:44 +0000
commit372f34631b1ff121b61a45ea95897d3caf8e470d (patch)
treec6e4cde8818fe20fd2b8f819c0a4745eb028c165 /usr.sbin/smtpd/aliases.c
parent04da5a8af0f210ddec600baed1f0ddcb32e36172 (diff)
- 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
Diffstat (limited to 'usr.sbin/smtpd/aliases.c')
-rw-r--r--usr.sbin/smtpd/aliases.c12
1 files changed, 6 insertions, 6 deletions
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 <gilles@openbsd.org>
@@ -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) {