[2/2](try 2)advapi: handle fully qualified account names for well known sids in LookupAccountName
Alexandre Julliard
julliard at winehq.org
Mon Mar 30 10:50:24 CDT 2009
Aric Stewart <aric at 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 at winehq.org
More information about the wine-devel
mailing list