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
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;
}
}
}