From: James Yonan Date: Sat, 6 Aug 2011 20:06:31 +0000 (+0000) Subject: Changed CC_PRINT character class to allow UTF-8 chars. X-Git-Tag: v2.3-alpha1~208 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eca430d5506b31ad6c069115b2974f21995a9610;p=thirdparty%2Fopenvpn.git Changed CC_PRINT character class to allow UTF-8 chars. This allows usernames, common names, etc. to be UTF-8. Version 2.1.9 git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@7518 e7ae566f-a301-0410-adde-c780ea21d3b5 --- diff --git a/buffer.c b/buffer.c index cff261667..ce28cb002 100644 --- a/buffer.c +++ b/buffer.c @@ -720,7 +720,7 @@ char_class (const unsigned char c, const unsigned int flags) return true; if ((flags & CC_DIGIT) && isdigit (c)) return true; - if ((flags & CC_PRINT) && isprint (c)) + if ((flags & CC_PRINT) && (isprint (c) || c >= 0x7f)) /* allow UTF-8 */ return true; if ((flags & CC_PUNCT) && ispunct (c)) return true; diff --git a/manage.c b/manage.c index 7a888e896..c6632cdb6 100644 --- a/manage.c +++ b/manage.c @@ -3173,7 +3173,7 @@ command_line_add (struct command_line *cl, const unsigned char *buf, const int l int i; for (i = 0; i < len; ++i) { - if (buf[i] && (isprint(buf[i]) || buf[i] == '\n')) + if (buf[i] && char_class(buf[i], (CC_PRINT|CC_NEWLINE))) { if (!buf_write_u8 (&cl->buf, buf[i])) buf_clear (&cl->buf);