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
837fc836
Commit
837fc836
authored
Mar 02, 2011
by
Hans Leidekker
Committed by
Alexandre Julliard
Mar 02, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Use a fixed computer SID that matches local user SIDs.
parent
c65bcce5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
55 deletions
+10
-55
lsa.c
dlls/advapi32/lsa.c
+0
-1
security.c
dlls/advapi32/security.c
+10
-54
No files found.
dlls/advapi32/lsa.c
View file @
837fc836
...
...
@@ -656,7 +656,6 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
xdi
->
info
.
DomainSid
=
&
xdi
->
sid
;
/* read the computer SID from the registry */
if
(
!
ADVAPI_GetComputerSid
(
&
xdi
->
sid
))
{
HeapFree
(
GetProcessHeap
(),
0
,
xdi
);
...
...
dlls/advapi32/security.c
View file @
837fc836
...
...
@@ -446,64 +446,20 @@ BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
/************************************************************
* ADVAPI_GetComputerSid
*
* Reads the computer SID from the registry.
*/
BOOL
ADVAPI_GetComputerSid
(
PSID
sid
)
{
HKEY
key
;
LONG
ret
;
BOOL
retval
=
FALSE
;
static
const
WCHAR
Account
[]
=
{
'S'
,
'E'
,
'C'
,
'U'
,
'R'
,
'I'
,
'T'
,
'Y'
,
'\\'
,
'S'
,
'A'
,
'M'
,
'\\'
,
'D'
,
'o'
,
'm'
,
'a'
,
'i'
,
'n'
,
's'
,
'\\'
,
'A'
,
'c'
,
'c'
,
'o'
,
'u'
,
'n'
,
't'
,
0
};
static
const
WCHAR
V
[]
=
{
'V'
,
0
};
if
((
ret
=
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
Account
,
0
,
KEY_READ
,
&
key
))
==
ERROR_SUCCESS
)
static
const
struct
/* same fields as struct SID */
{
DWORD
size
=
0
;
ret
=
RegQueryValueExW
(
key
,
V
,
NULL
,
NULL
,
NULL
,
&
size
);
if
(
ret
==
ERROR_MORE_DATA
||
ret
==
ERROR_SUCCESS
)
{
BYTE
*
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
data
)
{
if
((
ret
=
RegQueryValueExW
(
key
,
V
,
NULL
,
NULL
,
data
,
&
size
))
==
ERROR_SUCCESS
)
{
/* the SID is in the last 24 bytes of the binary data */
CopyMemory
(
sid
,
&
data
[
size
-
24
],
24
);
retval
=
TRUE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
data
);
}
}
RegCloseKey
(
key
);
}
if
(
retval
==
TRUE
)
return
retval
;
/* create a new random SID */
if
(
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
Account
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
key
,
NULL
)
==
ERROR_SUCCESS
)
{
PSID
new_sid
;
SID_IDENTIFIER_AUTHORITY
identifierAuthority
=
{
SECURITY_NT_AUTHORITY
};
DWORD
id
[
3
];
if
(
RtlGenRandom
(
id
,
sizeof
(
id
)))
{
if
(
AllocateAndInitializeSid
(
&
identifierAuthority
,
4
,
SECURITY_NT_NON_UNIQUE
,
id
[
0
],
id
[
1
],
id
[
2
],
0
,
0
,
0
,
0
,
&
new_sid
))
{
if
(
RegSetValueExW
(
key
,
V
,
0
,
REG_BINARY
,
new_sid
,
GetLengthSid
(
new_sid
))
==
ERROR_SUCCESS
)
retval
=
CopySid
(
GetLengthSid
(
new_sid
),
sid
,
new_sid
);
FreeSid
(
new_sid
);
}
}
RegCloseKey
(
key
);
}
return
retval
;
BYTE
Revision
;
BYTE
SubAuthorityCount
;
SID_IDENTIFIER_AUTHORITY
IdentifierAuthority
;
DWORD
SubAuthority
[
4
];
}
computer_sid
=
{
SID_REVISION
,
4
,
{
SECURITY_NT_AUTHORITY
},
{
SECURITY_NT_NON_UNIQUE
,
0
,
0
,
0
}
};
memcpy
(
sid
,
&
computer_sid
,
sizeof
(
computer_sid
)
);
return
TRUE
;
}
/* ##############################
...
...
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