[winpr,sspi] uppdercase on copy of string

This commit is contained in:
akallabeth 2023-10-23 15:48:50 +02:00 committed by akallabeth
parent a927bb8b6e
commit afc9ddd15f

View File

@ -221,19 +221,34 @@ static SECURITY_STATUS SEC_ENTRY kerberos_AcquireCredentialsHandleA(
if (domain)
{
CharUpperA(domain);
char* udomain = _strdup(domain);
if (!udomain)
goto cleanup;
CharUpperA(udomain);
/* Will use domain if realm is not specified in username */
if ((rv = krb5_set_default_realm(ctx, domain)))
rv = krb5_set_default_realm(ctx, udomain);
free(udomain);
if (rv)
goto cleanup;
}
if (pszPrincipal)
{
char* cpszPrincipal = _strdup(pszPrincipal);
if (!cpszPrincipal)
goto cleanup;
/* Find realm component if included and convert to uppercase */
char* p = strchr(pszPrincipal, '@');
char* p = strchr(cpszPrincipal, '@');
if (p)
CharUpperA(p);
if ((rv = krb5_parse_name(ctx, pszPrincipal, &principal)))
rv = krb5_parse_name(ctx, cpszPrincipal, &principal);
free(cpszPrincipal);
if (rv)
goto cleanup;
}