LookupAccountNameW() correct call in SetEntriesInAclW()

Paul Bryan Roberts pbronline-wine at yahoo.co.uk
Fri Sep 26 05:53:38 CDT 2008


LookupAccountNameW() has a stubbed but non-empty, incomplete, buggy 
implementation.  It fails a number of unit tests but Wine code relies on 
this.

This is the FIFTH of a series of NINE patches that provide what may be a 
reasonable first pass implementation of LookupAccountNameA() and 
LookupAccountNameW() that:

    - works for well known SIDs
    - works for 'first user account'
    - adds handling of 'first user account' to LookupAccountSid
    - passes existing units tests for LookupAccountName
    - corrects knock-on regression failures in the advapit32/security.c 
unit tests (there may be others elsewhere)
    - allows progress towards the resolution of Bug 14334

This patch fixes a regression before it happens.

The implementation of SetEntriresInAclW() (in this source file, namely 
dlls/advapi32/security.c) passes NULL for the domain name parameter and 
0 as its length because it does not want to know about domains.

However, the unit tests in test_LookupAccountName (in 
dlls/advapi32/tests/security.c) include a case that passes NULL and 0 in 
this way and expects the call to fail with ERROR_INSUFFICIENT_BUFFER.
Therefore, fixing this unit test would break some other unit test.

So, this patch fixes SetEntriesInAclW() before it is broken.  It does 
not fix any units tests (for advapi security) and it does not break any.

Why use MAX_COMPUTERNAME_LENGTH + 1 ?  Originally, I implemented the 
ninth patch before this one.  In that patch, the computer name is used 
as the domain name so this seemed like a sensible upper bound.  Perhaps 
I should have put a comment in the code to this effect but I am not good 
at taciturn comments of the brevity that adorn Wine code.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0008-LookupAccountNameW-correct-call-in-SetEntriesInAclW.txt
Url: http://www.winehq.org/pipermail/wine-patches/attachments/20080926/8ed03d98/attachment-0001.txt 


More information about the wine-patches mailing list