[7/7] server: Properly set the default security descriptor values if the given security descriptor parameter is NULL
Joris van der Wel
joris at jorisvanderwel.com
Wed Jun 25 18:17:14 CDT 2014
server: Properly set the default security descriptor values if the
given security descriptor parameter is NULL. Currently only an non-null but
empty security descriptor causes this.
---
dlls/advapi32/tests/security.c | 34 +++++++++++++++++-----------------
server/event.c | 16 ++++++++--------
server/mapping.c | 8 ++++----
server/mutex.c | 8 ++++----
server/semaphore.c | 8 ++++----
5 files changed, 37 insertions(+), 37 deletions(-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20140626/8421c8b8/attachment.html>
-------------- next part --------------
From 23d937b77f38843cd6c0a0a0cde771a93f8d2297 Mon Sep 17 00:00:00 2001
From: Joris van der Wel <joris at jorisvanderwel.com>
Date: Thu, 26 Jun 2014 00:48:23 +0200
Subject: server: Properly set the default security descriptor values if the
given security descriptor parameter is NULL. Currently only an non-null but
empty security descriptor causes this.
---
dlls/advapi32/tests/security.c | 34 +++++++++++++++++-----------------
server/event.c | 16 ++++++++--------
server/mapping.c | 8 ++++----
server/mutex.c | 8 ++++----
server/semaphore.c | 8 ++++----
5 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 684f32f..9c8ebc0 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -4516,7 +4516,7 @@ static void test_CreateRestrictedToken(void)
CloseHandle(process_token);
}
-static void validate_default_security_descriptor(SECURITY_DESCRIPTOR *sd)
+static void validate_default_security_descriptor(SECURITY_DESCRIPTOR *sd, const char *todo_platform)
{
BOOL ret, present, defaulted;
ACL *acl;
@@ -4531,9 +4531,9 @@ static void validate_default_security_descriptor(SECURITY_DESCRIPTOR *sd)
SetLastError(0xdeadbeef);
ret = GetSecurityDescriptorDacl(sd, &present, &acl, &defaulted);
ok(ret, "GetSecurityDescriptorDacl error %d\n", GetLastError());
-todo_wine
+todo(todo_platform)
ok(present == 1, "acl is not present\n");
-todo_wine
+todo(todo_platform)
ok(acl != (void *)0xdeadbeef && acl != NULL, "acl pointer is not set\n");
ok(defaulted == 0, "defaulted is set to TRUE\n");
@@ -4542,7 +4542,7 @@ todo_wine
SetLastError(0xdeadbeef);
ret = GetSecurityDescriptorOwner(sd, &sid, &defaulted);
ok(ret, "GetSecurityDescriptorOwner error %d\n", GetLastError());
-todo_wine
+todo(todo_platform)
ok(sid != (void *)0xdeadbeef && sid != NULL, "sid pointer is not set\n");
ok(defaulted == 0, "defaulted is set to TRUE\n");
@@ -4551,12 +4551,12 @@ todo_wine
SetLastError(0xdeadbeef);
ret = GetSecurityDescriptorGroup(sd, &sid, &defaulted);
ok(ret, "GetSecurityDescriptorGroup error %d\n", GetLastError());
-todo_wine
+todo(todo_platform)
ok(sid != (void *)0xdeadbeef && sid != NULL, "sid pointer is not set\n");
ok(defaulted == 0, "defaulted is set to TRUE\n");
}
-static void test_default_handle_security(HANDLE token, HANDLE handle, GENERIC_MAPPING *mapping)
+static void test_default_handle_security(HANDLE token, HANDLE handle, GENERIC_MAPPING *mapping, const char *todo_platform)
{
DWORD ret, granted, priv_set_len;
BOOL status;
@@ -4564,14 +4564,14 @@ static void test_default_handle_security(HANDLE token, HANDLE handle, GENERIC_MA
SECURITY_DESCRIPTOR *sd;
sd = test_get_security_descriptor(handle, __LINE__);
- validate_default_security_descriptor(sd);
+ validate_default_security_descriptor(sd, todo_platform);
priv_set_len = sizeof(priv_set);
granted = 0xdeadbeef;
status = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = AccessCheck(sd, token, MAXIMUM_ALLOWED, mapping, &priv_set, &priv_set_len, &granted, &status);
-todo_wine {
+todo(todo_platform) {
ok(ret, "AccessCheck error %d\n", GetLastError());
ok(status == 1, "expected 1, got %d\n", status);
ok(granted == mapping->GenericAll, "expected all access %#x, got %#x\n", mapping->GenericAll, granted);
@@ -4581,7 +4581,7 @@ todo_wine {
status = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = AccessCheck(sd, token, 0, mapping, &priv_set, &priv_set_len, &granted, &status);
-todo_wine {
+todo(todo_platform) {
ok(ret, "AccessCheck error %d\n", GetLastError());
ok(status == 0 || broken(status == 1) /* NT4 */, "expected 0, got %d\n", status);
ok(granted == 0 || broken(granted == mapping->GenericRead) /* NT4 */, "expected 0, got %#x\n", granted);
@@ -4591,7 +4591,7 @@ todo_wine {
status = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = AccessCheck(sd, token, ACCESS_SYSTEM_SECURITY, mapping, &priv_set, &priv_set_len, &granted, &status);
-todo_wine {
+todo(todo_platform) {
ok(ret, "AccessCheck error %d\n", GetLastError());
ok(status == 0, "expected 0, got %d\n", status);
ok(granted == 0, "expected 0, got %#x\n", granted);
@@ -4601,7 +4601,7 @@ todo_wine {
status = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = AccessCheck(sd, token, mapping->GenericRead, mapping, &priv_set, &priv_set_len, &granted, &status);
-todo_wine {
+todo(todo_platform) {
ok(ret, "AccessCheck error %d\n", GetLastError());
ok(status == 1, "expected 1, got %d\n", status);
ok(granted == mapping->GenericRead, "expected read access %#x, got %#x\n", mapping->GenericRead, granted);
@@ -4611,7 +4611,7 @@ todo_wine {
status = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = AccessCheck(sd, token, mapping->GenericWrite, mapping, &priv_set, &priv_set_len, &granted, &status);
-todo_wine {
+todo(todo_platform) {
ok(ret, "AccessCheck error %d\n", GetLastError());
ok(status == 1, "expected 1, got %d\n", status);
ok(granted == mapping->GenericWrite, "expected write access %#x, got %#x\n", mapping->GenericWrite, granted);
@@ -4621,7 +4621,7 @@ todo_wine {
status = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = AccessCheck(sd, token, mapping->GenericExecute, mapping, &priv_set, &priv_set_len, &granted, &status);
-todo_wine {
+todo(todo_platform) {
ok(ret, "AccessCheck error %d\n", GetLastError());
ok(status == 1, "expected 1, got %d\n", status);
ok(granted == mapping->GenericExecute, "expected execute access %#x, got %#x\n", mapping->GenericExecute, granted);
@@ -4694,7 +4694,7 @@ todo_wine
ok(GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError());
}
- test_default_handle_security(token, mutex, &mapping);
+ test_default_handle_security(token, mutex, &mapping, "none");
CloseHandle (mutex);
}
@@ -4751,7 +4751,7 @@ todo_wine
ok(GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError());
}
- test_default_handle_security(token, event, &mapping);
+ test_default_handle_security(token, event, &mapping, "none");
CloseHandle(event);
}
@@ -4801,7 +4801,7 @@ static void test_semaphore_security(HANDLE token)
CloseHandle(dup);
}
- test_default_handle_security(token, sem, &mapping);
+ test_default_handle_security(token, sem, &mapping, "none");
CloseHandle(sem);
}
@@ -4862,7 +4862,7 @@ static void test_named_pipe_security(HANDLE token)
0, 0, NMPWAIT_USE_DEFAULT_WAIT, NULL);
ok(pipe != INVALID_HANDLE_VALUE, "CreateNamedPipe error %d\n", GetLastError());
- test_default_handle_security(token, pipe, &mapping);
+ test_default_handle_security(token, pipe, &mapping, "wine");
SetLastError(0xdeadbeef);
file = CreateFileA(WINE_TEST_PIPE, FILE_ALL_ACCESS, 0, NULL, OPEN_EXISTING, 0, 0);
diff --git a/server/event.c b/server/event.c
index 4d3c562..4d2246e 100644
--- a/server/event.c
+++ b/server/event.c
@@ -115,10 +115,10 @@ struct event *create_event( struct directory *root, const struct unicode_str *na
/* initialize it if it didn't already exist */
event->manual_reset = manual_reset;
event->signaled = initial_state;
- if (sd) default_set_sd( &event->obj, sd, OWNER_SECURITY_INFORMATION|
- GROUP_SECURITY_INFORMATION|
- DACL_SECURITY_INFORMATION|
- SACL_SECURITY_INFORMATION );
+ default_set_sd( &event->obj, sd, OWNER_SECURITY_INFORMATION|
+ GROUP_SECURITY_INFORMATION|
+ DACL_SECURITY_INFORMATION|
+ SACL_SECURITY_INFORMATION );
}
}
return event;
@@ -214,10 +214,10 @@ struct keyed_event *create_keyed_event( struct directory *root, const struct uni
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
{
/* initialize it if it didn't already exist */
- if (sd) default_set_sd( &event->obj, sd, OWNER_SECURITY_INFORMATION|
- GROUP_SECURITY_INFORMATION|
- DACL_SECURITY_INFORMATION|
- SACL_SECURITY_INFORMATION );
+ default_set_sd( &event->obj, sd, OWNER_SECURITY_INFORMATION|
+ GROUP_SECURITY_INFORMATION|
+ DACL_SECURITY_INFORMATION|
+ SACL_SECURITY_INFORMATION );
}
}
return event;
diff --git a/server/mapping.c b/server/mapping.c
index 64b3003..4efb92a 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -484,10 +484,10 @@ static struct object *create_mapping( struct directory *root, const struct unico
if (get_error() == STATUS_OBJECT_NAME_EXISTS)
return &mapping->obj; /* Nothing else to do */
- if (sd) default_set_sd( &mapping->obj, sd, OWNER_SECURITY_INFORMATION|
- GROUP_SECURITY_INFORMATION|
- DACL_SECURITY_INFORMATION|
- SACL_SECURITY_INFORMATION );
+ default_set_sd( &mapping->obj, sd, OWNER_SECURITY_INFORMATION|
+ GROUP_SECURITY_INFORMATION|
+ DACL_SECURITY_INFORMATION|
+ SACL_SECURITY_INFORMATION );
mapping->header_size = 0;
mapping->base = 0;
mapping->fd = NULL;
diff --git a/server/mutex.c b/server/mutex.c
index 910fbca..86cbc56 100644
--- a/server/mutex.c
+++ b/server/mutex.c
@@ -111,10 +111,10 @@ static struct mutex *create_mutex( struct directory *root, const struct unicode_
mutex->owner = NULL;
mutex->abandoned = 0;
if (owned) do_grab( mutex, current );
- if (sd) default_set_sd( &mutex->obj, sd, OWNER_SECURITY_INFORMATION|
- GROUP_SECURITY_INFORMATION|
- DACL_SECURITY_INFORMATION|
- SACL_SECURITY_INFORMATION );
+ default_set_sd( &mutex->obj, sd, OWNER_SECURITY_INFORMATION|
+ GROUP_SECURITY_INFORMATION|
+ DACL_SECURITY_INFORMATION|
+ SACL_SECURITY_INFORMATION );
}
}
return mutex;
diff --git a/server/semaphore.c b/server/semaphore.c
index d87325c..49b1651 100644
--- a/server/semaphore.c
+++ b/server/semaphore.c
@@ -89,10 +89,10 @@ static struct semaphore *create_semaphore( struct directory *root, const struct
/* initialize it if it didn't already exist */
sem->count = initial;
sem->max = max;
- if (sd) default_set_sd( &sem->obj, sd, OWNER_SECURITY_INFORMATION|
- GROUP_SECURITY_INFORMATION|
- DACL_SECURITY_INFORMATION|
- SACL_SECURITY_INFORMATION );
+ default_set_sd( &sem->obj, sd, OWNER_SECURITY_INFORMATION|
+ GROUP_SECURITY_INFORMATION|
+ DACL_SECURITY_INFORMATION|
+ SACL_SECURITY_INFORMATION );
}
}
return sem;
--
1.8.1.msysgit.1
More information about the wine-patches
mailing list