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_3_0_0_beta0~651 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22391c522830ac82a61c6e2bc4faa8020dac1f47;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 1c323e71be3..79a3e80b751 100644 --- a/src/main/auth.c +++ b/src/main/auth.c @@ -692,12 +692,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; } } }