]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Changed CC_PRINT character class to allow UTF-8 chars.
authorJames Yonan <james@openvpn.net>
Sat, 6 Aug 2011 20:06:31 +0000 (20:06 +0000)
committerDavid Sommerseth <davids@redhat.com>
Wed, 24 Aug 2011 11:32:00 +0000 (13:32 +0200)
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

buffer.c
manage.c

index cff261667e42d77884de22e59f6bb6c94223c51c..ce28cb002160da789924dcc0023831b9d12e9227 100644 (file)
--- 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;    
index 7a888e8966f974ec0b7887b153bed16d425eb55d..c6632cdb634efec8298451886a851bd166004e0a 100644 (file)
--- 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);