From: Piotr Caban <piotr@codeweavers.com> --- dlls/secur32/lsa.c | 28 ---------------------------- dlls/secur32/tests/ntlm.c | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/dlls/secur32/lsa.c b/dlls/secur32/lsa.c index 2741a07adf8..1d1e249c9f2 100644 --- a/dlls/secur32/lsa.c +++ b/dlls/secur32/lsa.c @@ -453,8 +453,6 @@ static SECURITY_STATUS WINAPI lsa_AcquireCredentialsHandleA( { SECURITY_STATUS status = SEC_E_INSUFFICIENT_MEMORY; SEC_WCHAR *principalW = NULL, *packageW = NULL; - SEC_WINNT_AUTH_IDENTITY_A *id = auth_data; - SEC_WINNT_AUTH_IDENTITY_W idW = {}; TRACE("%s %s %#lx %p %p %p %p %p\n", debugstr_a(principal), debugstr_a(package), credentials_use, auth_data, get_key_fn, get_key_arg, credential, ts_expiry); @@ -471,38 +469,12 @@ static SECURITY_STATUS WINAPI lsa_AcquireCredentialsHandleA( if (!(packageW = malloc( len * sizeof(SEC_WCHAR) ))) goto done; MultiByteToWideChar( CP_ACP, 0, package, -1, packageW, len ); } - if (id && (id->Flags == SEC_WINNT_AUTH_IDENTITY_ANSI)) - { - if (id->UserLength) - { - idW.UserLength = MultiByteToWideChar( CP_ACP, 0, (char *)id->User, id->UserLength, NULL, 0 ); - if (!(idW.User = malloc( idW.UserLength * sizeof(SEC_WCHAR) ))) goto done; - MultiByteToWideChar( CP_ACP, 0, (char *)id->User, id->UserLength, idW.User, idW.UserLength ); - } - if (id->DomainLength) - { - idW.DomainLength = MultiByteToWideChar( CP_ACP, 0, (char *)id->Domain, id->DomainLength, NULL, 0 ); - if (!(idW.Domain = malloc( idW.DomainLength * sizeof(SEC_WCHAR) ))) goto done; - MultiByteToWideChar( CP_ACP, 0, (char *)id->Domain, id->DomainLength, idW.Domain, idW.DomainLength ); - } - if (id->PasswordLength) - { - idW.PasswordLength = MultiByteToWideChar( CP_ACP, 0, (char *)id->Password, id->PasswordLength, NULL, 0 ); - if (!(idW.Password = malloc( idW.PasswordLength * sizeof(SEC_WCHAR) ))) goto done; - MultiByteToWideChar( CP_ACP, 0, (char *)id->Password, id->PasswordLength, idW.Password, idW.PasswordLength ); - } - idW.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE; - auth_data = &idW; - } status = lsa_AcquireCredentialsHandleW( principalW, packageW, credentials_use, logon_id, auth_data, get_key_fn, get_key_arg, credential, ts_expiry ); done: free( packageW ); free( principalW ); - free( idW.User ); - free( idW.Domain ); - free( idW.Password ); return status; } diff --git a/dlls/secur32/tests/ntlm.c b/dlls/secur32/tests/ntlm.c index db04948587c..dd134b385f3 100644 --- a/dlls/secur32/tests/ntlm.c +++ b/dlls/secur32/tests/ntlm.c @@ -1222,6 +1222,7 @@ static void testAcquireCredentialsHandle(void) TimeStamp ttl; SECURITY_STATUS ret; SEC_WINNT_AUTH_IDENTITY_A id; + SEC_WINNT_AUTH_IDENTITY_EXA idex; PSecPkgInfoA pkg_info = NULL; if(QuerySecurityPackageInfoA(sec_pkg_name, &pkg_info) != SEC_E_OK) @@ -1245,6 +1246,24 @@ static void testAcquireCredentialsHandle(void) getSecError(ret)); FreeCredentialsHandle(&cred); + idex.Version = SEC_WINNT_AUTH_IDENTITY_VERSION; + idex.Length = sizeof(idex); + idex.User = id.User; + idex.UserLength = id.UserLength; + idex.Domain = id.Domain; + idex.DomainLength = id.DomainLength; + idex.Password = id.Password; + idex.PasswordLength = id.PasswordLength; + idex.Flags = id.Flags; + idex.PackageList = NULL; + idex.PackageListLength = 0; + + ret = AcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND, + NULL, &idex, NULL, NULL, &cred, &ttl); + ok(ret == SEC_E_OK, "AcquireCredentialsHandle() returned %s\n", + getSecError(ret)); + FreeCredentialsHandle(&cred); + id.DomainLength = 0; ret = AcquireCredentialsHandleA(NULL, sec_pkg_name, SECPKG_CRED_OUTBOUND, NULL, &id, NULL, NULL, &cred, &ttl); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11653