From fe30b79d72fbb51b1789be0792df6615ec4166a0 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Mon, 18 May 2009 14:47:36 -0500 Subject: [PATCH] advapi32: Handle well qualified names in LookupAccountNameW for account names. --- dlls/advapi32/security.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index 65e68ff53c6..efe34f42653 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -2753,13 +2753,23 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI userName = HeapAlloc(GetProcessHeap(), 0, nameLen*sizeof(WCHAR)); - if (GetUserNameW(userName, &nameLen) && !strcmpW(lpAccountName, userName)) + if (lpDomainNamePtr) + { + /* check to make sure this account is on this computer */ + if (GetComputerNameW(userName, &nameLen) && strcmpW(lpDomainNamePtr, userName)) + { + SetLastError(ERROR_NONE_MAPPED); + ret = FALSE; + } + } + + if (GetUserNameW(userName, &nameLen) && !strcmpW(lpAccountNamePtr, userName)) ret = lookup_user_account_name(Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse); else { nameLen = UNLEN + 1; - if (GetComputerNameW(userName, &nameLen) && !strcmpW(lpAccountName, userName)) + if (GetComputerNameW(userName, &nameLen) && !strcmpW(lpAccountNamePtr, userName)) ret = lookup_computer_account_name(Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse); else