Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
f56fe2c1
Commit
f56fe2c1
authored
Jul 18, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Jul 19, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Fix ComputeStringSidSize to work with SIDs with one sub authority.
Use GetSidLengthRequired instead of computing the length in a way that won't always be correct.
parent
3f2d93b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
security.c
dlls/advapi32/security.c
+6
-8
No files found.
dlls/advapi32/security.c
View file @
f56fe2c1
...
@@ -3743,9 +3743,7 @@ BOOL WINAPI EnumDependentServicesW(
...
@@ -3743,9 +3743,7 @@ BOOL WINAPI EnumDependentServicesW(
*/
*/
static
DWORD
ComputeStringSidSize
(
LPCWSTR
StringSid
)
static
DWORD
ComputeStringSidSize
(
LPCWSTR
StringSid
)
{
{
DWORD
size
=
sizeof
(
SID
);
if
(
StringSid
[
0
]
==
'S'
&&
StringSid
[
1
]
==
'-'
)
/* S-R-I(-S)+ */
if
(
StringSid
[
0
]
==
'S'
&&
StringSid
[
1
]
==
'-'
)
/* S-R-I-S-S */
{
{
int
ctok
=
0
;
int
ctok
=
0
;
while
(
*
StringSid
)
while
(
*
StringSid
)
...
@@ -3755,8 +3753,8 @@ static DWORD ComputeStringSidSize(LPCWSTR StringSid)
...
@@ -3755,8 +3753,8 @@ static DWORD ComputeStringSidSize(LPCWSTR StringSid)
StringSid
++
;
StringSid
++
;
}
}
if
(
ctok
>
3
)
if
(
ctok
>
=
3
)
size
+=
(
ctok
-
3
)
*
sizeof
(
DWORD
);
return
GetSidLengthRequired
(
ctok
-
2
);
}
}
else
/* String constant format - Only available in winxp and above */
else
/* String constant format - Only available in winxp and above */
{
{
...
@@ -3764,10 +3762,10 @@ static DWORD ComputeStringSidSize(LPCWSTR StringSid)
...
@@ -3764,10 +3762,10 @@ static DWORD ComputeStringSidSize(LPCWSTR StringSid)
for
(
i
=
0
;
i
<
sizeof
(
WellKnownSids
)
/
sizeof
(
WellKnownSids
[
0
]);
i
++
)
for
(
i
=
0
;
i
<
sizeof
(
WellKnownSids
)
/
sizeof
(
WellKnownSids
[
0
]);
i
++
)
if
(
!
strncmpW
(
WellKnownSids
[
i
].
wstr
,
StringSid
,
2
))
if
(
!
strncmpW
(
WellKnownSids
[
i
].
wstr
,
StringSid
,
2
))
size
+=
(
WellKnownSids
[
i
].
Sid
.
SubAuthorityCount
-
1
)
*
sizeof
(
DWORD
);
return
GetSidLengthRequired
(
WellKnownSids
[
i
].
Sid
.
SubAuthorityCount
);
}
}
return
size
;
return
GetSidLengthRequired
(
0
)
;
}
}
/******************************************************************************
/******************************************************************************
...
@@ -3796,7 +3794,7 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
...
@@ -3796,7 +3794,7 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
if
(
StringSid
[
0
]
==
'S'
&&
StringSid
[
1
]
==
'-'
)
/* S-R-I-S-S */
if
(
StringSid
[
0
]
==
'S'
&&
StringSid
[
1
]
==
'-'
)
/* S-R-I-S-S */
{
{
DWORD
i
=
0
,
identAuth
;
DWORD
i
=
0
,
identAuth
;
DWORD
csubauth
=
((
*
cBytes
-
sizeof
(
SID
))
/
sizeof
(
DWORD
))
+
1
;
DWORD
csubauth
=
((
*
cBytes
-
GetSidLengthRequired
(
0
))
/
sizeof
(
DWORD
))
;
StringSid
+=
2
;
/* Advance to Revision */
StringSid
+=
2
;
/* Advance to Revision */
pisid
->
Revision
=
atoiW
(
StringSid
);
pisid
->
Revision
=
atoiW
(
StringSid
);
...
...
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