Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: binary MIME-Version: 1.0 X-Mailer: MIME-tools 5.420 (Entity 5.420) RT-Send-CC: X-RT-Original-Encoding: iso-8859-1 Content-Length: 2122 Revised patch. UnicodeToANSI() could have failed and still returned success. Index: cc_mslsa.c =================================================================== --- cc_mslsa.c (revision 19964) +++ cc_mslsa.c (working copy) @@ -312,15 +312,23 @@ { return FALSE; } else { - WideCharToMultiByte(CP_ACP, 0, (LPCWSTR) lpInputString, -1, - lpszOutputString, nOutStringLen, NULL, NULL); + if (WideCharToMultiByte(CP_ACP, + WC_NO_BEST_FIT_CHARS | WC_COMPOSITECHECK, + (LPCWSTR) lpInputString, -1, + lpszOutputString, + nOutStringLen, NULL, NULL) == 0) + return FALSE; } } else if (((LPBYTE) lpInputString)[1] == '\0') { // Looks like unicode, better translate it - WideCharToMultiByte(CP_ACP, 0, (LPCWSTR) lpInputString, -1, - lpszOutputString, nOutStringLen, NULL, NULL); + if (WideCharToMultiByte(CP_ACP, + WC_NO_BEST_FIT_CHARS | WC_COMPOSITECHECK, + (LPCWSTR) lpInputString, -1, + lpszOutputString, + nOutStringLen, NULL, NULL) == 0) + return FALSE; } else lstrcpyA(lpszOutputString, (LPSTR) lpInputString); @@ -378,8 +386,8 @@ wcscat(princbuf, L"@"); wcscat(princbuf, realm); if (UnicodeToANSI(princbuf, aname, sizeof(aname))) { - krb5_parse_name(context, aname, principal); - return TRUE; + if (krb5_parse_name(context, aname, principal) == 0) + return TRUE; } return FALSE; } @@ -404,8 +412,8 @@ wcscat(princbuf, L"@"); wcscat(princbuf, realm); if (UnicodeToANSI(princbuf, aname, sizeof(aname))) { - krb5_parse_name(context, aname, principal); - return TRUE; + if (krb5_parse_name(context, aname, principal) == 0) + return TRUE; } return FALSE; }