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
c0a5671d
Commit
c0a5671d
authored
Feb 27, 2007
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Feb 28, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: More error checking. Properly handle NULL ACLs.
parent
1780ca67
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
security.c
dlls/advapi32/tests/security.c
+7
-0
sec.c
dlls/ntdll/sec.c
+12
-7
No files found.
dlls/advapi32/tests/security.c
View file @
c0a5671d
...
...
@@ -1477,10 +1477,17 @@ static void test_process_security(void)
event
=
CreateEvent
(
NULL
,
TRUE
,
TRUE
,
"test_event"
);
ok
(
event
!=
NULL
,
"CreateEvent %d
\n
"
,
GetLastError
());
SecurityDescriptor
->
Revision
=
0
;
CHECK_SET_SECURITY
(
event
,
OWNER_SECURITY_INFORMATION
,
ERROR_UNKNOWN_REVISION
);
SecurityDescriptor
->
Revision
=
SECURITY_DESCRIPTOR_REVISION
;
CHECK_SET_SECURITY
(
event
,
OWNER_SECURITY_INFORMATION
,
ERROR_INVALID_SECURITY_DESCR
);
CHECK_SET_SECURITY
(
event
,
GROUP_SECURITY_INFORMATION
,
ERROR_INVALID_SECURITY_DESCR
);
CHECK_SET_SECURITY
(
event
,
SACL_SECURITY_INFORMATION
,
ERROR_ACCESS_DENIED
);
CHECK_SET_SECURITY
(
event
,
DACL_SECURITY_INFORMATION
,
ERROR_SUCCESS
);
/* NULL DACL is valid and means default DACL from token */
SecurityDescriptor
->
Control
|=
SE_DACL_PRESENT
;
CHECK_SET_SECURITY
(
event
,
DACL_SECURITY_INFORMATION
,
ERROR_SUCCESS
);
/* Set owner and group and dacl */
res
=
SetSecurityDescriptorOwner
(
SecurityDescriptor
,
AdminSid
,
FALSE
);
...
...
dlls/ntdll/sec.c
View file @
c0a5671d
...
...
@@ -1569,34 +1569,39 @@ NTSTATUS WINAPI NtSetSecurityObject(HANDLE Handle,
if
(
!
SecurityDescriptor
)
return
STATUS_ACCESS_VIOLATION
;
memset
(
&
sd
,
0
,
sizeof
(
sd
)
);
RtlGetControlSecurityDescriptor
(
SecurityDescriptor
,
&
control
,
&
revision
);
status
=
RtlGetControlSecurityDescriptor
(
SecurityDescriptor
,
&
control
,
&
revision
);
if
(
status
!=
STATUS_SUCCESS
)
return
status
;
sd
.
control
=
control
&
~
SE_SELF_RELATIVE
;
if
(
SecurityInformation
&
OWNER_SECURITY_INFORMATION
)
{
RtlGetOwnerSecurityDescriptor
(
SecurityDescriptor
,
&
owner
,
&
defaulted
);
status
=
RtlGetOwnerSecurityDescriptor
(
SecurityDescriptor
,
&
owner
,
&
defaulted
);
if
(
status
!=
STATUS_SUCCESS
)
return
status
;
if
(
!
(
sd
.
owner_len
=
RtlLengthSid
(
owner
)))
return
STATUS_INVALID_SECURITY_DESCR
;
}
if
(
SecurityInformation
&
GROUP_SECURITY_INFORMATION
)
{
RtlGetGroupSecurityDescriptor
(
SecurityDescriptor
,
&
group
,
&
defaulted
);
status
=
RtlGetGroupSecurityDescriptor
(
SecurityDescriptor
,
&
group
,
&
defaulted
);
if
(
status
!=
STATUS_SUCCESS
)
return
status
;
if
(
!
(
sd
.
group_len
=
RtlLengthSid
(
group
)))
return
STATUS_INVALID_SECURITY_DESCR
;
}
if
(
SecurityInformation
&
SACL_SECURITY_INFORMATION
)
{
RtlGetSaclSecurityDescriptor
(
SecurityDescriptor
,
&
present
,
&
sacl
,
&
defaulted
);
sd
.
sacl_len
=
present
?
sacl
->
AclSize
:
0
;
status
=
RtlGetSaclSecurityDescriptor
(
SecurityDescriptor
,
&
present
,
&
sacl
,
&
defaulted
);
if
(
status
!=
STATUS_SUCCESS
)
return
status
;
sd
.
sacl_len
=
(
sacl
&&
present
)
?
sacl
->
AclSize
:
0
;
sd
.
control
|=
SE_SACL_PRESENT
;
}
if
(
SecurityInformation
&
DACL_SECURITY_INFORMATION
)
{
RtlGetDaclSecurityDescriptor
(
SecurityDescriptor
,
&
present
,
&
dacl
,
&
defaulted
);
sd
.
dacl_len
=
present
?
dacl
->
AclSize
:
0
;
status
=
RtlGetDaclSecurityDescriptor
(
SecurityDescriptor
,
&
present
,
&
dacl
,
&
defaulted
);
if
(
status
!=
STATUS_SUCCESS
)
return
status
;
sd
.
dacl_len
=
(
dacl
&&
present
)
?
dacl
->
AclSize
:
0
;
sd
.
control
|=
SE_DACL_PRESENT
;
}
...
...
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