From 87fd81b9d8b29a45ae092b982aa063c9a79f0594 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Mon, 13 Jan 2014 18:34:28 -0700 Subject: [PATCH] Fix a path length bug in the ACL inheritance patch. --- ...-return-security-attributes-with-ext.patch | 24 +++++++-------- ...curity-attributes-from-parent-direct.patch | 30 +++++++++---------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/patches/02-ACL_Extended_Attributes/0001-server-Store-and-return-security-attributes-with-ext.patch b/patches/02-ACL_Extended_Attributes/0001-server-Store-and-return-security-attributes-with-ext.patch index a3bcadae..fe749c1a 100644 --- a/patches/02-ACL_Extended_Attributes/0001-server-Store-and-return-security-attributes-with-ext.patch +++ b/patches/02-ACL_Extended_Attributes/0001-server-Store-and-return-security-attributes-with-ext.patch @@ -1,6 +1,6 @@ -From 78a5ebb94f3717bedd77f7c096e8fce1e9a640d1 Mon Sep 17 00:00:00 2001 +From acc6aac3356b0ec9024362488016945b76f67111 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" -Date: Mon, 18 Nov 2013 18:12:05 -0700 +Date: Sat, 11 Jan 2014 09:18:16 -0700 Subject: server: Store and return security attributes with extended file attributes. @@ -14,10 +14,10 @@ Subject: server: Store and return security attributes with extended file 6 files changed, 269 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac -index 98a73f2..bb03667 100644 +index dcabb55..fc8bd5c 100644 --- a/configure.ac +++ b/configure.ac -@@ -71,6 +71,7 @@ AC_ARG_WITH(pthread, AS_HELP_STRING([--without-pthread],[do not use the pthrea +@@ -73,6 +73,7 @@ AC_ARG_WITH(pthread, AS_HELP_STRING([--without-pthread],[do not use the pthrea AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner support)])) AC_ARG_WITH(tiff, AS_HELP_STRING([--without-tiff],[do not use TIFF])) AC_ARG_WITH(v4l, AS_HELP_STRING([--without-v4l],[do not use v4l1 (v4l support)])) @@ -25,7 +25,7 @@ index 98a73f2..bb03667 100644 AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]), [if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi]) AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]), -@@ -666,6 +667,11 @@ AC_CHECK_HEADERS([libprocstat.h],,, +@@ -665,6 +666,11 @@ AC_CHECK_HEADERS([libprocstat.h],,, #include #endif]) @@ -38,10 +38,10 @@ index 98a73f2..bb03667 100644 AC_SUBST(dlldir,"\${libdir}/wine") diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c -index fe31b5c..7d28c05 100644 +index 2efe80e..297cf96 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c -@@ -3088,10 +3088,10 @@ static void test_CreateDirectoryA(void) +@@ -3105,10 +3105,10 @@ static void test_CreateDirectoryA(void) bret = pGetAce(pDacl, 0, (VOID **)&ace); ok(bret, "Failed to get Current User ACE.\n"); bret = EqualSid(&ace->SidStart, user_sid); @@ -56,7 +56,7 @@ index fe31b5c..7d28c05 100644 ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask); } -@@ -3100,10 +3100,10 @@ static void test_CreateDirectoryA(void) +@@ -3117,10 +3117,10 @@ static void test_CreateDirectoryA(void) bret = pGetAce(pDacl, 1, (VOID **)&ace); ok(bret, "Failed to get Administators Group ACE.\n"); bret = EqualSid(&ace->SidStart, admin_sid); @@ -71,7 +71,7 @@ index fe31b5c..7d28c05 100644 ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%x != 0x1f01ff)\n", ace->Mask); } -@@ -3277,7 +3277,7 @@ static void test_GetNamedSecurityInfoA(void) +@@ -3294,7 +3294,7 @@ static void test_GetNamedSecurityInfoA(void) bret = pGetAce(pDacl, 0, (VOID **)&ace); ok(bret, "Failed to get Current User ACE.\n"); bret = EqualSid(&ace->SidStart, user_sid); @@ -80,7 +80,7 @@ index fe31b5c..7d28c05 100644 ok(((ACE_HEADER *)ace)->AceFlags == 0, "Current User ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags); ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n", -@@ -3288,8 +3288,7 @@ static void test_GetNamedSecurityInfoA(void) +@@ -3305,8 +3305,7 @@ static void test_GetNamedSecurityInfoA(void) bret = pGetAce(pDacl, 1, (VOID **)&ace); ok(bret, "Failed to get Administators Group ACE.\n"); bret = EqualSid(&ace->SidStart, admin_sid); @@ -90,7 +90,7 @@ index fe31b5c..7d28c05 100644 ok(((ACE_HEADER *)ace)->AceFlags == 0, "Administators Group ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags); ok(ace->Mask == 0x1f01ff || broken(ace->Mask == GENERIC_ALL) /* win2k */, -@@ -3943,7 +3942,7 @@ static void test_GetSecurityInfo(void) +@@ -3960,7 +3959,7 @@ static void test_GetSecurityInfo(void) bret = pGetAce(pDacl, 0, (VOID **)&ace); ok(bret, "Failed to get Current User ACE.\n"); bret = EqualSid(&ace->SidStart, user_sid); @@ -99,7 +99,7 @@ index fe31b5c..7d28c05 100644 ok(((ACE_HEADER *)ace)->AceFlags == 0, "Current User ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags); ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%x != 0x1f01ff)\n", -@@ -3954,7 +3953,7 @@ static void test_GetSecurityInfo(void) +@@ -3971,7 +3970,7 @@ static void test_GetSecurityInfo(void) bret = pGetAce(pDacl, 1, (VOID **)&ace); ok(bret, "Failed to get Administators Group ACE.\n"); bret = EqualSid(&ace->SidStart, admin_sid); diff --git a/patches/02-ACL_Extended_Attributes/0002-ntdll-Inherit-security-attributes-from-parent-direct.patch b/patches/02-ACL_Extended_Attributes/0002-ntdll-Inherit-security-attributes-from-parent-direct.patch index 5f4365dc..4d84fce2 100644 --- a/patches/02-ACL_Extended_Attributes/0002-ntdll-Inherit-security-attributes-from-parent-direct.patch +++ b/patches/02-ACL_Extended_Attributes/0002-ntdll-Inherit-security-attributes-from-parent-direct.patch @@ -1,18 +1,18 @@ -From 5e49f53a4bd591e67c9b7c4fdaf46933e319f9aa Mon Sep 17 00:00:00 2001 +From b5efc991444e6539adf73f42b44e333b8aa7de2f Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" -Date: Mon, 18 Nov 2013 18:15:20 -0700 +Date: Mon, 13 Jan 2014 18:32:05 -0700 Subject: ntdll: Inherit security attributes from parent directories. --- dlls/advapi32/tests/security.c | 40 ++++++++++++++++++- - dlls/ntdll/file.c | 85 +++++++++++++++++++++++++++++++++++++++- - 2 files changed, 123 insertions(+), 2 deletions(-) + dlls/ntdll/file.c | 83 +++++++++++++++++++++++++++++++++++++++- + 2 files changed, 121 insertions(+), 2 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c -index 7d28c05..a8d136b 100644 +index 297cf96..4b1c5a2 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c -@@ -3013,10 +3013,11 @@ static void test_CreateDirectoryA(void) +@@ -3030,10 +3030,11 @@ static void test_CreateDirectoryA(void) ACL_SIZE_INFORMATION acl_size; ACCESS_ALLOWED_ACE *ace; SECURITY_ATTRIBUTES sa; @@ -25,7 +25,7 @@ index 7d28c05..a8d136b 100644 DWORD error; PACL pDacl; -@@ -3108,6 +3109,43 @@ static void test_CreateDirectoryA(void) +@@ -3125,6 +3126,43 @@ static void test_CreateDirectoryA(void) ace->Mask); } @@ -70,10 +70,10 @@ index 7d28c05..a8d136b 100644 HeapFree(GetProcessHeap(), 0, user); bret = RemoveDirectoryA(tmpdir); diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 1de2c61..8948bb7 100644 +index d2efcc1..bdcaab4 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -103,6 +103,81 @@ mode_t FILE_umask = 0; +@@ -103,6 +103,79 @@ mode_t FILE_umask = 0; static const WCHAR ntfsW[] = {'N','T','F','S'}; @@ -86,10 +86,10 @@ index 1de2c61..8948bb7 100644 +{ + SECURITY_INFORMATION info = OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION + |DACL_SECURITY_INFORMATION|SACL_SECURITY_INFORMATION; ++ WCHAR *p, parent[UNICODE_STRING_MAX_CHARS]; + PSECURITY_DESCRIPTOR parentsd = NULL; + ACL_SIZE_INFORMATION acl_size; + BOOLEAN present, defaulted; -+ WCHAR *p, parent[MAX_PATH]; + OBJECT_ATTRIBUTES pattr; + UNICODE_STRING parentW; + IO_STATUS_BLOCK io; @@ -102,11 +102,9 @@ index 1de2c61..8948bb7 100644 + parentW.Buffer = parent; + parentW.Length = filenameW->Length; + memcpy(parentW.Buffer, filenameW->Buffer, filenameW->Length); -+ if ((p = strrchrW(parent, '\\')) != NULL) -+ { -+ p[0] = 0; -+ parentW.Length = (p-parent)*sizeof(WCHAR); -+ } ++ if ((p = strrchrW(parent, '\\')) == NULL) return NULL; ++ p[0] = 0; ++ parentW.Length = (p-parent)*sizeof(WCHAR); + memset(&pattr, 0x0, sizeof(pattr)); + pattr.Length = sizeof(pattr); + pattr.Attributes = OBJ_CASE_INSENSITIVE; @@ -155,7 +153,7 @@ index 1de2c61..8948bb7 100644 /************************************************************************** * FILE_CreateFile (internal) * Open a file. -@@ -161,10 +236,18 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT +@@ -161,10 +234,18 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT { struct security_descriptor *sd; struct object_attributes objattr;