Re: [2/2](try 2)advapi: handle fully qualified account names for well known sids in LookupAccountName
Aric Stewart <aric(a)codeweavers.com> writes:
@@ -2667,11 +2669,23 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI }
/* Check well known SIDs first */ + if (strchrW(lpAccountName,'\\')) + { + lpAccountNamePtr = strrchrW(lpAccountName,'\\'); + lpAccountNamePtr++; + lpDomainNamePtr = lpAccountName; + } + else + lpAccountNamePtr = lpAccountName;
for (i = 0; i < (sizeof(ACCOUNT_SIDS) / sizeof(ACCOUNT_SIDS[0])); i++) { - if (!strcmpiW(lpAccountName, ACCOUNT_SIDS[i].account) || - (ACCOUNT_SIDS[i].alias && !strcmpiW(lpAccountName, ACCOUNT_SIDS[i].alias))) + /* check domain first */ + if (lpDomainNamePtr && strncmpiW(lpDomainNamePtr, ACCOUNT_SIDS[i].domain, strlenW(ACCOUNT_SIDS[i].domain))) + continue;
You always need to check that the next char is a terminator when using functions like strncmpiW. -- Alexandre Julliard julliard(a)winehq.org
participants (1)
-
Alexandre Julliard