From c071be698efadef1ad01fd3d329d1b486a372927 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 26 Feb 2015 18:16:45 +0100 Subject: gpg: Lowercase mailbox for PKA lookups. * common/stringhelp.c (ascii_strlwr): New. * common/mbox-util.c (mailbox_from_userid): Downcase result. -- Signed-off-by: Werner Koch --- common/stringhelp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'common/stringhelp.c') diff --git a/common/stringhelp.c b/common/stringhelp.c index 7128de5fc..42e1bcbbb 100644 --- a/common/stringhelp.c +++ b/common/stringhelp.c @@ -804,6 +804,18 @@ ascii_tolower (int c) return c; } +/* Lowercase all ASCII characters in S. */ +char * +ascii_strlwr (char *s) +{ + char *p = s; + + for (p=s; *p; p++ ) + if (isascii (*p) && *p >= 'A' && *p <= 'Z') + *p |= 0x20; + + return s; +} int ascii_strcasecmp( const char *a, const char *b ) -- cgit v1.2.3