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
870f55fe
Commit
870f55fe
authored
Aug 13, 2004
by
Francois Gouget
Committed by
Alexandre Julliard
Aug 13, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the PSID and PSECURITY_DESCRIPTOR types.
Add PISID and PISECURITY_DESCRIPTOR.
parent
a9b4a471
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
40 deletions
+60
-40
security.c
dlls/advapi32/security.c
+32
-30
om.c
dlls/ntdll/om.c
+6
-6
sec.c
dlls/ntdll/sec.c
+0
-0
generated.c
dlls/ntdll/tests/generated.c
+16
-2
winnt.h
include/winnt.h
+4
-2
tests.dat
tools/winapi/tests.dat
+2
-0
No files found.
dlls/advapi32/security.c
View file @
870f55fe
...
...
@@ -48,7 +48,7 @@ static BYTE ParseAceStringType(LPCWSTR* StringAcl);
static
DWORD
ParseAceStringRights
(
LPCWSTR
*
StringAcl
);
static
BOOL
ParseStringSecurityDescriptorToSecurityDescriptor
(
LPCWSTR
StringSecurityDescriptor
,
PSECURITY_DESCRIPTOR
SecurityDescriptor
,
SECURITY_DESCRIPTOR
*
SecurityDescriptor
,
LPDWORD
cBytes
);
static
DWORD
ParseAclStringFlags
(
LPCWSTR
*
StringAcl
);
...
...
@@ -552,7 +552,7 @@ GetLengthSid (PSID pSid)
* revision []
*/
BOOL
WINAPI
InitializeSecurityDescriptor
(
SECURITY_DESCRIPTOR
*
pDescr
,
DWORD
revision
)
InitializeSecurityDescriptor
(
PSECURITY_DESCRIPTOR
pDescr
,
DWORD
revision
)
{
CallWin32ToNt
(
RtlCreateSecurityDescriptor
(
pDescr
,
revision
));
}
...
...
@@ -584,7 +584,7 @@ BOOL WINAPI MakeAbsoluteSD (
/******************************************************************************
* GetSecurityDescriptorLength [ADVAPI32.@]
*/
DWORD
WINAPI
GetSecurityDescriptorLength
(
SECURITY_DESCRIPTOR
*
pDescr
)
DWORD
WINAPI
GetSecurityDescriptorLength
(
PSECURITY_DESCRIPTOR
pDescr
)
{
return
(
RtlLengthSecurityDescriptor
(
pDescr
));
}
...
...
@@ -597,7 +597,7 @@ DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr)
* lpbOwnerDefaulted []
*/
BOOL
WINAPI
GetSecurityDescriptorOwner
(
SECURITY_DESCRIPTOR
*
pDescr
,
PSID
*
pOwner
,
GetSecurityDescriptorOwner
(
PSECURITY_DESCRIPTOR
pDescr
,
PSID
*
pOwner
,
LPBOOL
lpbOwnerDefaulted
)
{
CallWin32ToNt
(
RtlGetOwnerSecurityDescriptor
(
pDescr
,
pOwner
,
(
PBOOLEAN
)
lpbOwnerDefaulted
));
...
...
@@ -1887,7 +1887,7 @@ lerr:
*/
static
BOOL
ParseStringSecurityDescriptorToSecurityDescriptor
(
LPCWSTR
StringSecurityDescriptor
,
PSECURITY_DESCRIPTOR
SecurityDescriptor
,
SECURITY_DESCRIPTOR
*
SecurityDescriptor
,
LPDWORD
cBytes
)
{
BOOL
bret
=
FALSE
;
...
...
@@ -2031,7 +2031,7 @@ BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW(
PULONG
SecurityDescriptorSize
)
{
DWORD
cBytes
;
PSECURITY_DESCRIPTOR
psd
;
SECURITY_DESCRIPTOR
*
psd
;
BOOL
bret
=
FALSE
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
StringSecurityDescriptor
));
...
...
@@ -2052,7 +2052,7 @@ BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW(
NULL
,
&
cBytes
))
goto
lend
;
psd
=
*
SecurityDescriptor
=
(
PSECURITY_DESCRIPTOR
)
LocalAlloc
(
psd
=
*
SecurityDescriptor
=
(
SECURITY_DESCRIPTOR
*
)
LocalAlloc
(
GMEM_ZEROINIT
,
cBytes
);
psd
->
Revision
=
SID_REVISION
;
...
...
@@ -2114,26 +2114,27 @@ BOOL WINAPI ConvertSidToStringSidW( PSID pSid, LPWSTR *pstr )
WCHAR
fmt
[]
=
{
'S'
,
'-'
,
'%'
,
'u'
,
'-'
,
'%'
,
'2'
,
'X'
,
'%'
,
'2'
,
'X'
,
'%'
,
'X'
,
'%'
,
'X'
,
'%'
,
'X'
,
'%'
,
'X'
,
0
};
WCHAR
subauthfmt
[]
=
{
'-'
,
'%'
,
'u'
,
0
};
SID
*
pisid
=
pSid
;
TRACE
(
"%p %p
\n
"
,
pSid
,
pstr
);
if
(
!
IsValidSid
(
pSid
)
)
return
FALSE
;
if
(
p
S
id
->
Revision
!=
SDDL_REVISION
)
if
(
p
is
id
->
Revision
!=
SDDL_REVISION
)
return
FALSE
;
sz
=
14
+
p
S
id
->
SubAuthorityCount
*
11
;
sz
=
14
+
p
is
id
->
SubAuthorityCount
*
11
;
str
=
LocalAlloc
(
0
,
sz
*
sizeof
(
WCHAR
)
);
sprintfW
(
str
,
fmt
,
p
Sid
->
Revision
,
p
S
id
->
IdentifierAuthority
.
Value
[
2
],
p
S
id
->
IdentifierAuthority
.
Value
[
3
],
p
S
id
->
IdentifierAuthority
.
Value
[
0
]
&
0x0f
,
p
S
id
->
IdentifierAuthority
.
Value
[
4
]
&
0x0f
,
p
S
id
->
IdentifierAuthority
.
Value
[
1
]
&
0x0f
,
p
S
id
->
IdentifierAuthority
.
Value
[
5
]
&
0x0f
);
for
(
i
=
0
;
i
<
p
S
id
->
SubAuthorityCount
;
i
++
)
sprintfW
(
str
+
strlenW
(
str
),
subauthfmt
,
p
S
id
->
SubAuthority
[
i
]
);
sprintfW
(
str
,
fmt
,
p
isid
->
Revision
,
p
is
id
->
IdentifierAuthority
.
Value
[
2
],
p
is
id
->
IdentifierAuthority
.
Value
[
3
],
p
is
id
->
IdentifierAuthority
.
Value
[
0
]
&
0x0f
,
p
is
id
->
IdentifierAuthority
.
Value
[
4
]
&
0x0f
,
p
is
id
->
IdentifierAuthority
.
Value
[
1
]
&
0x0f
,
p
is
id
->
IdentifierAuthority
.
Value
[
5
]
&
0x0f
);
for
(
i
=
0
;
i
<
p
is
id
->
SubAuthorityCount
;
i
++
)
sprintfW
(
str
+
strlenW
(
str
),
subauthfmt
,
p
is
id
->
SubAuthority
[
i
]
);
*
pstr
=
str
;
return
TRUE
;
...
...
@@ -2190,6 +2191,7 @@ static DWORD ComputeStringSidSize(LPCWSTR StringSid)
static
BOOL
ParseStringSidToSid
(
LPCWSTR
StringSid
,
PSID
pSid
,
LPDWORD
cBytes
)
{
BOOL
bret
=
FALSE
;
SID
*
pisid
=
pSid
;
if
(
!
StringSid
)
{
...
...
@@ -2198,7 +2200,7 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
}
*
cBytes
=
ComputeStringSidSize
(
StringSid
);
if
(
!
p
S
id
)
/* Simply compute the size */
if
(
!
p
is
id
)
/* Simply compute the size */
return
TRUE
;
if
(
*
StringSid
!=
'S'
||
*
StringSid
!=
'-'
)
/* S-R-I-S-S */
...
...
@@ -2207,19 +2209,19 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
int
csubauth
=
((
*
cBytes
-
sizeof
(
SID
))
/
sizeof
(
DWORD
))
+
1
;
StringSid
+=
2
;
/* Advance to Revision */
p
S
id
->
Revision
=
atoiW
(
StringSid
);
p
is
id
->
Revision
=
atoiW
(
StringSid
);
if
(
p
S
id
->
Revision
!=
SDDL_REVISION
)
if
(
p
is
id
->
Revision
!=
SDDL_REVISION
)
goto
lend
;
/* ERROR_INVALID_SID */
p
S
id
->
SubAuthorityCount
=
csubauth
;
p
is
id
->
SubAuthorityCount
=
csubauth
;
while
(
*
StringSid
&&
*
StringSid
!=
'-'
)
StringSid
++
;
/* Advance to identifier authority */
p
S
id
->
IdentifierAuthority
.
Value
[
5
]
=
atoiW
(
StringSid
);
p
is
id
->
IdentifierAuthority
.
Value
[
5
]
=
atoiW
(
StringSid
);
if
(
p
S
id
->
IdentifierAuthority
.
Value
[
5
]
>
5
)
if
(
p
is
id
->
IdentifierAuthority
.
Value
[
5
]
>
5
)
goto
lend
;
/* ERROR_INVALID_SID */
while
(
*
StringSid
)
...
...
@@ -2227,24 +2229,24 @@ static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
while
(
*
StringSid
&&
*
StringSid
!=
'-'
)
StringSid
++
;
p
S
id
->
SubAuthority
[
i
++
]
=
atoiW
(
StringSid
);
p
is
id
->
SubAuthority
[
i
++
]
=
atoiW
(
StringSid
);
}
if
(
i
!=
p
S
id
->
SubAuthorityCount
)
if
(
i
!=
p
is
id
->
SubAuthorityCount
)
goto
lend
;
/* ERROR_INVALID_SID */
bret
=
TRUE
;
}
else
/* String constant format - Only available in winxp and above */
{
p
S
id
->
Revision
=
SDDL_REVISION
;
p
S
id
->
SubAuthorityCount
=
1
;
p
is
id
->
Revision
=
SDDL_REVISION
;
p
is
id
->
SubAuthorityCount
=
1
;
FIXME
(
"String constant not supported: %s
\n
"
,
debugstr_wn
(
StringSid
,
2
));
/* TODO: Lookup string of well-known SIDs in table */
p
S
id
->
IdentifierAuthority
.
Value
[
5
]
=
0
;
p
S
id
->
SubAuthority
[
0
]
=
0
;
p
is
id
->
IdentifierAuthority
.
Value
[
5
]
=
0
;
p
is
id
->
SubAuthority
[
0
]
=
0
;
bret
=
TRUE
;
}
...
...
dlls/ntdll/om.c
View file @
870f55fe
...
...
@@ -179,7 +179,7 @@ NtQuerySecurityObject(
/* owner: administrator S-1-5-20-220*/
if
(
OWNER_SECURITY_INFORMATION
&
RequestedInformation
)
{
PSID
psid
=
(
PSID
)
&
(
Buffer
[
BufferIndex
]);
SID
*
psid
=
(
SID
*
)
&
(
Buffer
[
BufferIndex
]);
psd
->
Owner
=
BufferIndex
;
BufferIndex
+=
RtlLengthRequiredSid
(
2
);
...
...
@@ -194,7 +194,7 @@ NtQuerySecurityObject(
/* group: built in domain S-1-5-12 */
if
(
GROUP_SECURITY_INFORMATION
&
RequestedInformation
)
{
PSID
psid
=
(
PSID
)
&
(
Buffer
[
BufferIndex
]);
SID
*
psid
=
(
SID
*
)
&
(
Buffer
[
BufferIndex
]);
psd
->
Group
=
BufferIndex
;
BufferIndex
+=
RtlLengthRequiredSid
(
1
);
...
...
@@ -211,7 +211,7 @@ NtQuerySecurityObject(
/* acl header */
PACL
pacl
=
(
PACL
)
&
(
Buffer
[
BufferIndex
]);
PACCESS_ALLOWED_ACE
pace
;
PSID
psid
;
SID
*
psid
;
psd
->
Dacl
=
BufferIndex
;
...
...
@@ -232,7 +232,7 @@ NtQuerySecurityObject(
pace
->
SidStart
=
BufferIndex
;
/* SID S-1-5-12 (System) */
psid
=
(
PSID
)
&
(
Buffer
[
BufferIndex
]);
psid
=
(
SID
*
)
&
(
Buffer
[
BufferIndex
]);
BufferIndex
+=
RtlLengthRequiredSid
(
1
);
...
...
@@ -252,7 +252,7 @@ NtQuerySecurityObject(
pace
->
SidStart
=
BufferIndex
;
/* S-1-5-12 (Administrators) */
psid
=
(
PSID
)
&
(
Buffer
[
BufferIndex
]);
psid
=
(
SID
*
)
&
(
Buffer
[
BufferIndex
]);
BufferIndex
+=
RtlLengthRequiredSid
(
2
);
...
...
@@ -273,7 +273,7 @@ NtQuerySecurityObject(
pace
->
SidStart
=
BufferIndex
;
/* SID S-1-1-0 (Everyone) */
psid
=
(
PSID
)
&
(
Buffer
[
BufferIndex
]);
psid
=
(
SID
*
)
&
(
Buffer
[
BufferIndex
]);
BufferIndex
+=
RtlLengthRequiredSid
(
1
);
...
...
dlls/ntdll/sec.c
View file @
870f55fe
This diff is collapsed.
Click to expand it.
dlls/ntdll/tests/generated.c
View file @
870f55fe
...
...
@@ -1280,6 +1280,13 @@ static void test_pack_PIMAGE_VXD_HEADER(void)
TEST_TYPE_POINTER
(
PIMAGE_VXD_HEADER
,
196
,
2
);
}
static
void
test_pack_PISECURITY_DESCRIPTOR
(
void
)
{
/* PISECURITY_DESCRIPTOR */
TEST_TYPE
(
PISECURITY_DESCRIPTOR
,
4
,
4
);
TEST_TYPE_POINTER
(
PISECURITY_DESCRIPTOR
,
20
,
4
);
}
static
void
test_pack_PISECURITY_DESCRIPTOR_RELATIVE
(
void
)
{
/* PISECURITY_DESCRIPTOR_RELATIVE */
...
...
@@ -1287,6 +1294,13 @@ static void test_pack_PISECURITY_DESCRIPTOR_RELATIVE(void)
TEST_TYPE_POINTER
(
PISECURITY_DESCRIPTOR_RELATIVE
,
20
,
4
);
}
static
void
test_pack_PISID
(
void
)
{
/* PISID */
TEST_TYPE
(
PISID
,
4
,
4
);
TEST_TYPE_POINTER
(
PISID
,
12
,
4
);
}
static
void
test_pack_PLARGE_INTEGER
(
void
)
{
/* PLARGE_INTEGER */
...
...
@@ -1411,14 +1425,12 @@ static void test_pack_PSECURITY_DESCRIPTOR(void)
{
/* PSECURITY_DESCRIPTOR */
TEST_TYPE
(
PSECURITY_DESCRIPTOR
,
4
,
4
);
TEST_TYPE_POINTER
(
PSECURITY_DESCRIPTOR
,
20
,
4
);
}
static
void
test_pack_PSID
(
void
)
{
/* PSID */
TEST_TYPE
(
PSID
,
4
,
4
);
TEST_TYPE_POINTER
(
PSID
,
12
,
4
);
}
static
void
test_pack_PSID_IDENTIFIER_AUTHORITY
(
void
)
...
...
@@ -2217,7 +2229,9 @@ static void test_pack(void)
test_pack_PIMAGE_TLS_CALLBACK
();
test_pack_PIMAGE_TLS_DIRECTORY
();
test_pack_PIMAGE_VXD_HEADER
();
test_pack_PISECURITY_DESCRIPTOR
();
test_pack_PISECURITY_DESCRIPTOR_RELATIVE
();
test_pack_PISID
();
test_pack_PLARGE_INTEGER
();
test_pack_PLIST_ENTRY
();
test_pack_PLUID
();
...
...
include/winnt.h
View file @
870f55fe
...
...
@@ -2616,6 +2616,8 @@ typedef struct tagMESSAGE_RESOURCE_DATA {
/* FIXME: Orphan. What does it point to? */
typedef
PVOID
PACCESS_TOKEN
;
typedef
PVOID
PSECURITY_DESCRIPTOR
;
typedef
PVOID
PSID
;
/*
* TOKEN_INFORMATION_CLASS
...
...
@@ -2693,7 +2695,7 @@ typedef struct _SID {
BYTE
SubAuthorityCount
;
SID_IDENTIFIER_AUTHORITY
IdentifierAuthority
;
DWORD
SubAuthority
[
1
];
}
SID
,
*
PSID
;
}
SID
,
*
P
I
SID
;
#endif
/* !defined(SID_DEFINED) */
#define SID_REVISION (1)
/* Current revision */
...
...
@@ -2825,7 +2827,7 @@ typedef struct {
PSID
Group
;
PACL
Sacl
;
PACL
Dacl
;
}
SECURITY_DESCRIPTOR
,
*
PSECURITY_DESCRIPTOR
;
}
SECURITY_DESCRIPTOR
,
*
P
I
SECURITY_DESCRIPTOR
;
#define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
...
...
tools/winapi/tests.dat
View file @
870f55fe
...
...
@@ -806,7 +806,9 @@ PIMAGE_TLS_CALLBACK
PIMAGE_TLS_DIRECTORY
PIMAGE_VXD_HEADER
!PIO_COUNTERS
PISECURITY_DESCRIPTOR
PISECURITY_DESCRIPTOR_RELATIVE
PISID
PLARGE_INTEGER
PLIST_ENTRY
PLUID
...
...
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