Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f04804f4
Commit
f04804f4
authored
Oct 18, 2008
by
Paul Bryan Roberts
Committed by
Alexandre Julliard
Oct 21, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: LookupAccountNameW() - only first user account and well known SIDs accepted.
parent
29816504
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
9 deletions
+55
-9
security.c
dlls/advapi32/security.c
+31
-1
security.c
dlls/advapi32/tests/security.c
+24
-8
No files found.
dlls/advapi32/security.c
View file @
f04804f4
...
...
@@ -2027,7 +2027,7 @@ LookupAccountSidW(
if
(
!
ADVAPI_IsLocalComputer
(
system
))
{
FIXME
(
"Only local computer supported!
\n
"
);
SetLastError
(
ERROR_NONE_MAPPED
);
SetLastError
(
RPC_S_SERVER_UNAVAILABLE
);
return
FALSE
;
}
...
...
@@ -2535,16 +2535,25 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI
static
const
WCHAR
dm
[]
=
{
'D'
,
'O'
,
'M'
,
'A'
,
'I'
,
'N'
,
0
};
unsigned
int
i
;
DWORD
nameLen
;
LPWSTR
userName
=
NULL
;
LPCWSTR
domainName
;
FIXME
(
"%s %s %p %p %p %p %p - stub
\n
"
,
debugstr_w
(
lpSystemName
),
debugstr_w
(
lpAccountName
),
Sid
,
cbSid
,
ReferencedDomainName
,
cchReferencedDomainName
,
peUse
);
if
(
!
ADVAPI_IsLocalComputer
(
lpSystemName
))
{
SetLastError
(
RPC_S_SERVER_UNAVAILABLE
);
return
FALSE
;
}
if
(
!
lpAccountName
||
!
strcmpW
(
lpAccountName
,
Blank
))
{
lpAccountName
=
BUILTIN
;
}
/* Check well known SIDs first */
for
(
i
=
0
;
i
<
(
sizeof
(
ACCOUNT_SIDS
)
/
sizeof
(
ACCOUNT_SIDS
[
0
]));
i
++
)
{
if
(
!
strcmpW
(
lpAccountName
,
ACCOUNT_SIDS
[
i
].
account
))
...
...
@@ -2597,6 +2606,27 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI
}
}
/* Let the current Unix user id masquerade as first Windows user account */
nameLen
=
UNLEN
+
1
;
userName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
nameLen
);
ret
=
GetUserNameW
(
userName
,
&
nameLen
);
if
(
ret
&&
strcmpW
(
lpAccountName
,
userName
)
!=
0
)
{
SetLastError
(
ERROR_NONE_MAPPED
);
ret
=
FALSE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
userName
);
if
(
!
ret
)
{
return
ret
;
}
ret
=
AllocateAndInitializeSid
(
&
identifierAuthority
,
2
,
SECURITY_BUILTIN_DOMAIN_RID
,
...
...
dlls/advapi32/tests/security.c
View file @
f04804f4
...
...
@@ -1314,6 +1314,14 @@ static void test_LookupAccountSid(void)
ret
=
LookupAccountSidW
(
NULL
,
pUsersSid
,
accountW
,
&
real_acc_sizeW
,
domainW
,
&
real_dom_sizeW
,
&
use
);
ok
(
ret
,
"LookupAccountSidW() Expected TRUE, got FALSE
\n
"
);
/* try an invalid system name */
real_acc_sizeA
=
MAX_PATH
;
real_dom_sizeA
=
MAX_PATH
;
ret
=
LookupAccountSidA
(
"deepthought"
,
pUsersSid
,
accountA
,
&
real_acc_sizeA
,
domainA
,
&
real_dom_sizeA
,
&
use
);
ok
(
!
ret
,
"LookupAccountSidA() Expected FALSE got TRUE
\n
"
);
ok
(
GetLastError
()
==
RPC_S_SERVER_UNAVAILABLE
,
"LookupAccountSidA() Expected RPC_S_SERVER_UNAVAILABLE, got %u
\n
"
,
GetLastError
());
/* native windows crashes if domainW or accountW is NULL */
/* try a small account buffer */
...
...
@@ -1644,14 +1652,22 @@ static void test_LookupAccountName(void)
domain_size
=
0
;
ret
=
LookupAccountNameA
(
NULL
,
"oogabooga"
,
NULL
,
&
sid_size
,
NULL
,
&
domain_size
,
&
sid_use
);
ok
(
!
ret
,
"Expected 0, got %d
\n
"
,
ret
);
todo_wine
{
ok
(
GetLastError
()
==
ERROR_NONE_MAPPED
||
broken
(
GetLastError
()
==
ERROR_TRUSTED_RELATIONSHIP_FAILURE
),
"Expected ERROR_NONE_MAPPED, got %d
\n
"
,
GetLastError
());
ok
(
sid_size
==
0
,
"Expected 0, got %d
\n
"
,
sid_size
);
ok
(
domain_size
==
0
,
"Expected 0, got %d
\n
"
,
domain_size
);
}
ok
(
GetLastError
()
==
ERROR_NONE_MAPPED
||
broken
(
GetLastError
()
==
ERROR_TRUSTED_RELATIONSHIP_FAILURE
),
"Expected ERROR_NONE_MAPPED, got %d
\n
"
,
GetLastError
());
ok
(
sid_size
==
0
,
"Expected 0, got %d
\n
"
,
sid_size
);
ok
(
domain_size
==
0
,
"Expected 0, got %d
\n
"
,
domain_size
);
/* try an invalid system name */
SetLastError
(
0xdeadbeef
);
sid_size
=
0
;
domain_size
=
0
;
ret
=
LookupAccountNameA
(
"deepthought"
,
NULL
,
NULL
,
&
sid_size
,
NULL
,
&
domain_size
,
&
sid_use
);
ok
(
!
ret
,
"Expected 0, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
RPC_S_SERVER_UNAVAILABLE
,
"Expected RPC_S_SERVER_UNAVAILABLE, got %d
\n
"
,
GetLastError
());
ok
(
sid_size
==
0
,
"Expected 0, got %d
\n
"
,
sid_size
);
ok
(
domain_size
==
0
,
"Expected 0, got %d
\n
"
,
domain_size
);
HeapFree
(
GetProcessHeap
(),
0
,
psid
);
HeapFree
(
GetProcessHeap
(),
0
,
domain
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment