From: Alan T. DeKok Date: Mon, 5 Sep 2011 14:05:21 +0000 (-0400) Subject: Complain if password is !UTF-8 X-Git-Tag: release_2_1_12~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0368ad3b4987d2fda84bd28b20b6e39d5f611d22;p=thirdparty%2Ffreeradius-server.git Complain if password is !UTF-8 for the "shared secret is incorrect" check. The old code checked for "printable" characters. Changing it to a check for !UTF-8 is more general, and likely more robust with fewer false positives --- diff --git a/src/main/auth.c b/src/main/auth.c index e6adeee8fbe..e9ced05b3fe 100644 --- a/src/main/auth.c +++ b/src/main/auth.c @@ -696,12 +696,15 @@ autz_redo: char *p; p = auth_item->vp_strvalue; - while (*p != '\0') { - if (!isprint((int) *p)) { - log_debug(" WARNING: Unprintable characters in the password.\n\t Double-check the shared secret on the server and the NAS!"); + while (*p) { + int size; + + size = fr_utf8_char(p); + if (!size) { + log_debug(" WARNING: Unprintable characters in the password. Double-check the shared secret on the server and the NAS!"); break; } - p++; + p += size; } } }