winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
June 2024
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
613 discussions
Start a n
N
ew thread
Paul Gofman : ntdll: Add a special handling for .. in match_filename().
by Alexandre Julliard
07 Jun '24
07 Jun '24
Module: wine Branch: master Commit: bcc266b35cab4de9260ea40d958c1a9428f9b1c3 URL:
https://gitlab.winehq.org/wine/wine/-/commit/bcc266b35cab4de9260ea40d958c1a…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Wed Jun 5 18:02:55 2024 -0600 ntdll: Add a special handling for .. in match_filename(). --- dlls/ntdll/tests/directory.c | 9 +++++++++ dlls/ntdll/unix/file.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c index 702e348b234..d4028a92519 100644 --- a/dlls/ntdll/tests/directory.c +++ b/dlls/ntdll/tests/directory.c @@ -470,7 +470,16 @@ static void test_NtQueryDirectoryFile(void) {L"*.**", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, {L"*", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, {L"**", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, + {L"?", {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0}}, + {L"?.", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}}, + {L"?..", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}, + {L"??", {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0}}, + {L"??.", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}, {L"??.???", {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, + {L"..*", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}}, + {L"*..*", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1}}, + {L"*..", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}, + {L"..?", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}}, }; OBJECT_ATTRIBUTES attr; diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 724a9d99b00..ab567a63d19 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1474,6 +1474,9 @@ static BOOLEAN match_filename_part( const WCHAR *name, const WCHAR *name_end, co */ static BOOLEAN match_filename( const WCHAR *name, int length, const UNICODE_STRING *mask_str ) { + /* Special handling for parent directory. */ + if (length == 2 && name[0] == '.' && name[1] == '.') --length; + return match_filename_part( name, name + length, mask_str->Buffer, mask_str->Buffer + mask_str->Length / sizeof(WCHAR)); }
1
0
0
0
Paul Gofman : ntdll: Match wildcard recursively in match_filename().
by Alexandre Julliard
07 Jun '24
07 Jun '24
Module: wine Branch: master Commit: 5f31aacbe8c86f431e8bd7fcf962e829dce74e38 URL:
https://gitlab.winehq.org/wine/wine/-/commit/5f31aacbe8c86f431e8bd7fcf962e8…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Wed Jun 5 17:34:48 2024 -0600 ntdll: Match wildcard recursively in match_filename(). --- dlls/ntdll/unix/file.c | 82 ++++++++++++++++++-------------------------------- 1 file changed, 29 insertions(+), 53 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index b5bf6f9801d..724a9d99b00 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1421,30 +1421,13 @@ static ULONG hash_short_file_name( const WCHAR *name, int length, LPWSTR buffer /*********************************************************************** - * match_filename + * match_filename_part * - * Check a long file name against a mask. + * Recursive helper for match_filename(). * - * Tests (done in W95 DOS shell - case insensitive): - * *.txt test1.test.txt * - * *st1* test1.txt * - * *.t??????.t* test1.ta.tornado.txt * - * *tornado* test1.ta.tornado.txt * - * t*t test1.ta.tornado.txt * - * ?est* test1.txt * - * ?est??? test1.txt - - * *test1.txt* test1.txt * - * h?l?o*t.dat hellothisisatest.dat * */ -static BOOLEAN match_filename( const WCHAR *name, int length, const UNICODE_STRING *mask_str ) +static BOOLEAN match_filename_part( const WCHAR *name, const WCHAR *name_end, const WCHAR *mask, const WCHAR *mask_end ) { - BOOL mismatch; - const WCHAR *mask = mask_str->Buffer; - const WCHAR *name_end = name + length; - const WCHAR *mask_end = mask + mask_str->Length / sizeof(WCHAR); - const WCHAR *lastjoker = NULL; - const WCHAR *next_to_retry = NULL; - while (name < name_end && mask < mask_end) { switch(*mask) @@ -1453,14 +1436,16 @@ static BOOLEAN match_filename( const WCHAR *name, int length, const UNICODE_STRI mask++; while (mask < mask_end && *mask == '*') mask++; /* Skip consecutive '*' */ if (mask == mask_end) return TRUE; /* end of mask is all '*', so match */ - lastjoker = mask; - /* skip to the next match after the joker(s) */ - if (is_case_sensitive) - while (name < name_end && (*name != *mask)) name++; - else - while (name < name_end && (towupper(*name) != towupper(*mask))) name++; - next_to_retry = name; + while (name < name_end) + { + if (is_case_sensitive) + while (name < name_end && (*name != *mask)) name++; + else + while (name < name_end && (towupper(*name) != towupper(*mask))) name++; + if (match_filename_part( name, name_end, mask, mask_end )) return TRUE; + ++name; + } break; case '?': case '>': @@ -1468,32 +1453,10 @@ static BOOLEAN match_filename( const WCHAR *name, int length, const UNICODE_STRI name++; break; default: - if (is_case_sensitive) mismatch = (*mask != *name); - else mismatch = (towupper(*mask) != towupper(*name)); - - if (!mismatch) - { - mask++; - name++; - if (mask == mask_end) - { - if (name == name_end) return TRUE; - if (lastjoker) mask = lastjoker; - } - } - else /* mismatch ! */ - { - if (lastjoker) /* we had an '*', so we can try unlimitedly */ - { - mask = lastjoker; - - /* this scan sequence was a mismatch, so restart - * 1 char after the first char we checked last time */ - next_to_retry++; - name = next_to_retry; - } - else return FALSE; /* bad luck */ - } + if (is_case_sensitive && *mask != *name) return FALSE; + if (!is_case_sensitive && towupper(*mask) != towupper(*name)) return FALSE; + mask++; + name++; break; } } @@ -1503,6 +1466,19 @@ static BOOLEAN match_filename( const WCHAR *name, int length, const UNICODE_STRI } +/*********************************************************************** + * match_filename + * + * Check a file name against a mask. + * + */ +static BOOLEAN match_filename( const WCHAR *name, int length, const UNICODE_STRING *mask_str ) +{ + return match_filename_part( name, name + length, mask_str->Buffer, + mask_str->Buffer + mask_str->Length / sizeof(WCHAR)); +} + + /*********************************************************************** * is_legal_8dot3_name *
1
0
0
0
Paul Gofman : ntdll: Mind all the wildcards in has_wildcard().
by Alexandre Julliard
07 Jun '24
07 Jun '24
Module: wine Branch: master Commit: 6edcd67775503169974bf9432b2f8d5f9a60da44 URL:
https://gitlab.winehq.org/wine/wine/-/commit/6edcd67775503169974bf9432b2f8d…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Tue Jun 4 11:48:20 2024 -0600 ntdll: Mind all the wildcards in has_wildcard(). --- dlls/ntdll/unix/file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 89fd942ea3b..b5bf6f9801d 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -320,13 +320,19 @@ static inline unsigned int dir_info_size( FILE_INFORMATION_CLASS class, unsigned } } +static BOOL is_wildcard( WCHAR c ) +{ + return c == '*' || c == '?' || c == '>' || c == '<' || c == '\"'; +} + static inline BOOL has_wildcard( const UNICODE_STRING *mask ) { int i; if (!mask) return TRUE; for (i = 0; i < mask->Length / sizeof(WCHAR); i++) - if (mask->Buffer[i] == '*' || mask->Buffer[i] == '?') return TRUE; + if (is_wildcard( mask->Buffer[i] )) return TRUE; + return FALSE; }
1
0
0
0
Paul Gofman : ntdll: Ignore leading dots in hash_short_file_name().
by Alexandre Julliard
07 Jun '24
07 Jun '24
Module: wine Branch: master Commit: 0a2ebadf243d7cf53d04c1dd0cae6f22f78bdcc5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/0a2ebadf243d7cf53d04c1dd0cae6f…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Jun 3 19:41:55 2024 -0600 ntdll: Ignore leading dots in hash_short_file_name(). --- dlls/kernel32/tests/file.c | 6 ++---- dlls/ntdll/unix/file.c | 8 ++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c index 940b1441e19..dc9f67e2f03 100644 --- a/dlls/kernel32/tests/file.c +++ b/dlls/kernel32/tests/file.c @@ -3063,11 +3063,9 @@ static void test_FindFirstFile_wildcards(void) {0, "* ..", ", '.', '..', 'a', '.a', '..a', 'aa', 'aaa', 'aaaa', '.aaa'"}, {0, " *..", ""}, {0, "..* ", ", '.', '..', '..a', '..a.a'"}, - {1, "a*.", ", '..a', '.a', '.aaa', 'a', 'aa', 'aaa', 'aaaa'"}, + {0, "a*.", ", '..a', '.a', '.aaa', 'a', 'aa', 'aaa', 'aaaa'"}, {0, "*a ", ", '..a', '..a.a', '.a', '.a..a', '.a.a', '.aaa', 'a', 'a..a', 'a.a', 'a.a.a', 'aa', 'aaa', 'aaaa', ' .a'"}, - - /* a.a.a not found due to short name mismatch, a.a.a -> "AA6BF5~1.A on Windows. */ - {1, "*aa*", ", '.aaa', 'a.a.a', 'aa', 'aaa', 'aaaa'"}, + {0, "*aa*", ", '.aaa', 'a.a.a', 'aa', 'aaa', 'aaaa'"}, {1, "<.<.<", ", '..a', '..a.a', '.a..a', '.a.a', 'a..a', 'a.a.a'"}, {1, "<.<.", ", '.', '..', '..a', '..a.a', '.a', '.a..a', '.a.a', '.aaa', 'a..a', 'a.a', 'a.a.a', ' .a'"}, diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index ce3bc24c5f4..89fd942ea3b 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1383,13 +1383,17 @@ static ULONG hash_short_file_name( const WCHAR *name, int length, LPWSTR buffer } /* Find last dot for start of the extension */ - for (p = name + 1, ext = NULL; p < end - 1; p++) if (*p == '.') ext = p; + p = name; + while (*p == '.') ++p; + for (p = p + 1, ext = NULL; p < end - 1; p++) if (*p == '.') ext = p; /* Copy first 4 chars, replacing invalid chars with '_' */ - for (i = 4, p = name, dst = buffer; i > 0; i--, p++) + for (i = 4, p = name, dst = buffer; i > 0; p++) { if (p == end || p == ext) break; + if (*p == '.') continue; *dst++ = is_invalid_dos_char(*p) ? '_' : *p; + i--; } /* Pad to 5 chars with '~' */ while (i-- >= 0) *dst++ = '~';
1
0
0
0
Paul Gofman : ntdll/tests: Test NtQueryDirectoryFile() masks with more files.
by Alexandre Julliard
07 Jun '24
07 Jun '24
Module: wine Branch: master Commit: 6300beb28cc5a6b4c76abe102c5bdd18b48c0d8a URL:
https://gitlab.winehq.org/wine/wine/-/commit/6300beb28cc5a6b4c76abe102c5bdd…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Wed Jun 5 16:57:02 2024 -0600 ntdll/tests: Test NtQueryDirectoryFile() masks with more files. --- dlls/ntdll/tests/directory.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c index f02a95bc391..702e348b234 100644 --- a/dlls/ntdll/tests/directory.c +++ b/dlls/ntdll/tests/directory.c @@ -72,7 +72,14 @@ static struct testfile_s { { 0, FILE_ATTRIBUTE_NORMAL, {'e','a','.','t','m','p'}, "normal" }, { 0, FILE_ATTRIBUTE_NORMAL, {'e','a'}, "normal" }, { 0, FILE_ATTRIBUTE_DIRECTORY, {'.'}, ". directory" }, - { 0, FILE_ATTRIBUTE_DIRECTORY, {'.','.'}, ".. directory" } + { 0, FILE_ATTRIBUTE_DIRECTORY, {'.','.'}, ".. directory" }, + { 0, FILE_ATTRIBUTE_NORMAL, {'e','a','.','t','m','p','.','t','m','p'}, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, {'.','a'}, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, {'.','a','.','a'}, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, {'a','.'}, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, {'.','.','a'}, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, {'.','a','a'}, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, {'a','.', '.'}, "normal" }, }; static const int test_dir_count = ARRAY_SIZE(testfiles); static const int max_test_dir_size = ARRAY_SIZE(testfiles) + 5; /* size of above plus some for .. etc */ @@ -96,7 +103,8 @@ static void set_up_attribute_test(const WCHAR *testdir) if (lstrcmpW(testfiles[i].name, dotW) == 0 || lstrcmpW(testfiles[i].name, dotdotW) == 0) continue; - lstrcpyW( buf, testdir ); + lstrcpyW( buf, L"\\\\?\\" ); + lstrcatW( buf, testdir ); lstrcatW( buf, backslashW ); lstrcatW( buf, testfiles[i].name ); if (testfiles[i].attr & FILE_ATTRIBUTE_DIRECTORY) { @@ -131,7 +139,8 @@ static void tear_down_attribute_test(const WCHAR *testdir) WCHAR buf[MAX_PATH]; if (lstrcmpW(testfiles[i].name, dotW) == 0 || lstrcmpW(testfiles[i].name, dotdotW) == 0) continue; - lstrcpyW( buf, testdir ); + lstrcpyW( buf, L"\\\\?\\" ); + lstrcatW( buf, testdir ); lstrcatW( buf, backslashW ); lstrcatW( buf, testfiles[i].name ); if (testfiles[i].attr & FILE_ATTRIBUTE_DIRECTORY) { @@ -456,12 +465,12 @@ static void test_NtQueryDirectoryFile(void) } mask_tests[] = { - {L"*.", {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}}, - {L"*.*", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}}, - {L"*.**", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}}, - {L"*", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, - {L"**", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, - {L"??.???", {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}}, + {L"*.", {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1}}, + {L"*.*", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, + {L"*.**", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, + {L"*", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, + {L"**", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, + {L"??.???", {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, }; OBJECT_ATTRIBUTES attr;
1
0
0
0
Paul Gofman : ntdll: Do not ignore trailing dots in match_filename().
by Alexandre Julliard
07 Jun '24
07 Jun '24
Module: wine Branch: master Commit: 31ab5ec2d7ea977e2649b8402822776c2e1540c9 URL:
https://gitlab.winehq.org/wine/wine/-/commit/31ab5ec2d7ea977e2649b840282277…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Jun 3 16:46:51 2024 -0600 ntdll: Do not ignore trailing dots in match_filename(). --- dlls/ntdll/tests/directory.c | 10 +++------- dlls/ntdll/unix/file.c | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c index b2484609689..f02a95bc391 100644 --- a/dlls/ntdll/tests/directory.c +++ b/dlls/ntdll/tests/directory.c @@ -453,13 +453,12 @@ static void test_NtQueryDirectoryFile(void) { const WCHAR *mask; int found[ARRAY_SIZE(testfiles)]; - BOOL todo_missing; } mask_tests[] = { - {L"*.", {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, TRUE}, - {L"*.*", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}, TRUE}, - {L"*.**", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}, TRUE}, + {L"*.", {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}}, + {L"*.*", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}}, + {L"*.**", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}}, {L"*", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, {L"**", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, {L"??.???", {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}}, @@ -517,10 +516,7 @@ static void test_NtQueryDirectoryFile(void) RtlInitUnicodeString(&mask, mask_tests[i].mask); test_flags_NtQueryDirectoryFile(&attr, testdirA, &mask, FALSE, TRUE); for (j = 0; j < test_dir_count; j++) - { - todo_wine_if(mask_tests[i].todo_missing && !mask_tests[i].found[j]) ok(testfiles[j].nfound == mask_tests[i].found[j], "%S, got %d.\n", testfiles[j].name, testfiles[j].nfound); - } winetest_pop_context(); } diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 1cafe7aa8b7..ce3bc24c5f4 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1487,8 +1487,8 @@ static BOOLEAN match_filename( const WCHAR *name, int length, const UNICODE_STRI break; } } - while (mask < mask_end && ((*mask == '.') || (*mask == '*'))) - mask++; /* Ignore trailing '.' or '*' in mask */ + while (mask < mask_end && *mask == '*') + mask++; return (name == name_end && mask == mask_end); }
1
0
0
0
Paul Gofman : ntdll: Fix test_NtQueryDirectoryFile() on Win11.
by Alexandre Julliard
07 Jun '24
07 Jun '24
Module: wine Branch: master Commit: 5b061122f38eae96d4586314b1a8df385ffc4245 URL:
https://gitlab.winehq.org/wine/wine/-/commit/5b061122f38eae96d4586314b1a8df…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Jun 3 16:44:57 2024 -0600 ntdll: Fix test_NtQueryDirectoryFile() on Win11. --- dlls/ntdll/tests/directory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c index 0ace8097352..b2484609689 100644 --- a/dlls/ntdll/tests/directory.c +++ b/dlls/ntdll/tests/directory.c @@ -683,7 +683,7 @@ static void test_NtQueryDirectoryFile(void) memset( data, 0x55, data_size ); io.Status = 0xdeadbeef; io.Information = 0xdeadbeef; - status = pNtQueryDirectoryFile( dirh, 0, NULL, NULL, &io, data, data_size + 16, + status = pNtQueryDirectoryFile( dirh, 0, NULL, NULL, &io, data, data_size + 32, FileBothDirectoryInformation, FALSE, NULL, TRUE ); ok( status == STATUS_SUCCESS, "wrong status %lx\n", status ); ok( io.Status == STATUS_SUCCESS, "wrong status %lx\n", io.Status );
1
0
0
0
Elizabeth Figura : advapi32/tests: Test token label inheritance.
by Alexandre Julliard
06 Jun '24
06 Jun '24
Module: wine Branch: master Commit: 9f6e44fd9ca7d39258f2772c3f44013142702ca4 URL:
https://gitlab.winehq.org/wine/wine/-/commit/9f6e44fd9ca7d39258f2772c3f4401…
Author: Elizabeth Figura <zfigura(a)codeweavers.com> Date: Tue Jun 4 19:27:24 2024 -0500 advapi32/tests: Test token label inheritance. --- dlls/advapi32/tests/security.c | 104 +++++++++++++++++++++++++++++++++++------ 1 file changed, 91 insertions(+), 13 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 43709352560..77a6c747916 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -7198,7 +7198,7 @@ static void test_maximum_allowed(void) CloseHandle(handle); } -static void test_token_label(void) +static void check_token_label(HANDLE token, DWORD *level, BOOL sacl_inherited) { static SID medium_sid = {SID_REVISION, 1, {SECURITY_MANDATORY_LABEL_AUTHORITY}, {SECURITY_MANDATORY_MEDIUM_RID}}; @@ -7210,19 +7210,9 @@ static void test_token_label(void) SECURITY_DESCRIPTOR *sd; ACL *sacl = NULL, *dacl; DWORD size, revision; - HANDLE token; char *str; SID *sid; - if (!pAddMandatoryAce) - { - win_skip("Mandatory integrity control is not supported.\n"); - return; - } - - ret = OpenProcessToken(GetCurrentProcess(), READ_CONTROL | WRITE_OWNER, &token); - ok(ret, "OpenProcessToken failed with error %lu\n", GetLastError()); - ret = GetKernelObjectSecurity(token, LABEL_SECURITY_INFORMATION, NULL, 0, &size); ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected GetKernelObjectSecurity return value %d, error %lu\n", ret, GetLastError()); @@ -7233,8 +7223,12 @@ static void test_token_label(void) ret = GetSecurityDescriptorControl(sd, &control, &revision); ok(ret, "GetSecurityDescriptorControl failed with error %lu\n", GetLastError()); - todo_wine ok(control == (SE_SELF_RELATIVE | SE_SACL_AUTO_INHERITED | SE_SACL_PRESENT), - "Unexpected security descriptor control %#x\n", control); + if (sacl_inherited) + todo_wine ok(control == (SE_SELF_RELATIVE | SE_SACL_AUTO_INHERITED | SE_SACL_PRESENT), + "Unexpected security descriptor control %#x\n", control); + else + todo_wine ok(control == (SE_SELF_RELATIVE | SE_SACL_PRESENT), + "Unexpected security descriptor control %#x\n", control); ok(revision == 1, "Unexpected security descriptor revision %lu\n", revision); sid = (void *)0xdeadbeef; @@ -7270,6 +7264,7 @@ static void test_token_label(void) sid = (SID *)&ace->SidStart; ConvertSidToStringSidA(sid, &str); ok(EqualSid(sid, &medium_sid) || EqualSid(sid, &high_sid), "Got unexpected SID %s\n", str); + *level = sid->SubAuthority[0]; LocalFree(str); ret = GetSecurityDescriptorDacl(sd, &present, &dacl, &defaulted); @@ -7277,6 +7272,89 @@ static void test_token_label(void) todo_wine ok(!present, "DACL present\n"); free(sd); +} + +static void test_token_label(void) +{ + SID low_sid = {SID_REVISION, 1, {SECURITY_MANDATORY_LABEL_AUTHORITY}, + {SECURITY_MANDATORY_LOW_RID}}; + char sacl_buffer[50]; + SECURITY_ATTRIBUTES attr = {.nLength = sizeof(SECURITY_ATTRIBUTES)}; + ACL *sacl = (ACL *)sacl_buffer; + TOKEN_LINKED_TOKEN linked; + DWORD level, level2, size; + PSECURITY_DESCRIPTOR sd; + HANDLE token, token2; + BOOL ret; + + if (!pAddMandatoryAce) + { + win_skip("Mandatory integrity control is not supported.\n"); + return; + } + + ret = OpenProcessToken(GetCurrentProcess(), READ_CONTROL | TOKEN_QUERY | TOKEN_DUPLICATE, &token); + ok(ret, "OpenProcessToken failed with error %lu\n", GetLastError()); + + check_token_label(token, &level, TRUE); + + ret = DuplicateTokenEx(token, READ_CONTROL, NULL, SecurityAnonymous, TokenPrimary, &token2); + ok(ret, "Failed to duplicate token, error %lu\n", GetLastError()); + + check_token_label(token2, &level2, TRUE); + ok(level2 == level, "Expected level %#lx, got %#lx.\n", level, level2); + + CloseHandle(token2); + + ret = DuplicateTokenEx(token, READ_CONTROL, NULL, SecurityImpersonation, TokenImpersonation, &token2); + ok(ret, "Failed to duplicate token, error %lu\n", GetLastError()); + + check_token_label(token2, &level2, TRUE); + ok(level2 == level, "Expected level %#lx, got %#lx.\n", level, level2); + + CloseHandle(token2); + + /* Any label set in the SD when calling DuplicateTokenEx() is ignored. */ + + ret = GetKernelObjectSecurity(token, LABEL_SECURITY_INFORMATION, NULL, 0, &size); + ok(!ret, "expected failure\n"); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got error %lu\n", GetLastError()); + + sd = malloc(size); + ret = GetKernelObjectSecurity(token, LABEL_SECURITY_INFORMATION, sd, size, &size); + ok(ret, "GetKernelObjectSecurity failed with error %lu\n", GetLastError()); + + InitializeAcl(sacl, sizeof(sacl_buffer), ACL_REVISION); + AddMandatoryAce(sacl, ACL_REVISION, 0, SYSTEM_MANDATORY_LABEL_NO_WRITE_UP, &low_sid); + SetSecurityDescriptorSacl(sd, TRUE, sacl, FALSE); + + attr.lpSecurityDescriptor = sd; + ret = DuplicateTokenEx(token, TOKEN_ALL_ACCESS, &attr, SecurityImpersonation, TokenImpersonation, &token2); + ok(ret, "Failed to duplicate token, error %lu\n", GetLastError()); + + check_token_label(token2, &level2, TRUE); + ok(level2 == level, "Expected level %#lx, got %#lx.\n", level, level2); + + /* Trying to set a SD on the token also claims success but has no effect. */ + + ret = SetKernelObjectSecurity(token2, LABEL_SECURITY_INFORMATION, sd); + ok(ret, "Failed to set SD, error %lu\n", GetLastError()); + + check_token_label(token2, &level2, FALSE); + ok(level2 == level, "Expected level %#lx, got %#lx.\n", level, level2); + + free(sd); + + /* Test the linked token. */ + + ret = GetTokenInformation(token, TokenLinkedToken, &linked, sizeof(linked), &size); + ok(ret, "Failed to get linked token, error %lu\n", GetLastError()); + + check_token_label(linked.LinkedToken, &level2, TRUE); + ok(level2 == level, "Expected level %#lx, got %#lx.\n", level, level2); + + CloseHandle(linked.LinkedToken); + CloseHandle(token); }
1
0
0
0
Elizabeth Figura : server: Inherit the source token's label in token_duplicate().
by Alexandre Julliard
06 Jun '24
06 Jun '24
Module: wine Branch: master Commit: ed297ecba5e3e379df0edfbfbc8afaed7bb88dba URL:
https://gitlab.winehq.org/wine/wine/-/commit/ed297ecba5e3e379df0edfbfbc8afa…
Author: Elizabeth Figura <zfigura(a)codeweavers.com> Date: Tue Jun 4 19:25:45 2024 -0500 server: Inherit the source token's label in token_duplicate(). And assign it in token_create_admin(). Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=56640
--- dlls/advapi32/tests/security.c | 22 +++++++++------------- server/process.c | 6 ------ server/security.h | 1 - server/token.c | 29 ++++++++++++++++++++++++++++- 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 2669c13748b..43709352560 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -7376,23 +7376,19 @@ static void test_token_security_descriptor(void) defaulted = TRUE; ret = GetSecurityDescriptorDacl(sd2, &present, &acl2, &defaulted); ok(ret, "GetSecurityDescriptorDacl failed with error %lu\n", GetLastError()); - todo_wine ok(present, "DACL not present\n"); - if (present) - { - ok(acl2 != (void *)0xdeadbeef, "DACL not set\n"); - ok(!defaulted, "DACL defaulted\n"); + ok(acl2 != (void *)0xdeadbeef, "DACL not set\n"); + ok(!defaulted, "DACL defaulted\n"); - index = 0; - found = FALSE; - while (GetAce(acl2, index++, (void **)&ace)) - { - if (ace->Header.AceType == ACCESS_ALLOWED_ACE_TYPE && EqualSid(&ace->SidStart, psid)) - found = TRUE; - } - ok(!found, "Access allowed ACE was inherited\n"); + index = 0; + found = FALSE; + while (GetAce(acl2, index++, (void **)&ace)) + { + if (ace->Header.AceType == ACCESS_ALLOWED_ACE_TYPE && EqualSid(&ace->SidStart, psid)) + found = TRUE; } + ok(!found, "Access allowed ACE was inherited\n"); free(sd2); diff --git a/server/process.c b/server/process.c index 733b0288f72..66f90fb80c4 100644 --- a/server/process.c +++ b/server/process.c @@ -735,12 +735,6 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla if (!process->handles || !process->token) goto error; process->session_id = token_get_session_id( process->token ); - /* Assign a high security label to the token. The default would be medium - * but Wine provides admin access to all applications right now so high - * makes more sense for the time being. */ - if (!token_assign_label( process->token, &high_label_sid )) - goto error; - set_fd_events( process->msg_fd, POLLIN ); /* start listening to events */ return process; diff --git a/server/security.h b/server/security.h index 58ab1594eae..f4dff679179 100644 --- a/server/security.h +++ b/server/security.h @@ -50,7 +50,6 @@ extern const struct sid local_system_sid; extern const struct sid builtin_users_sid; extern const struct sid builtin_admins_sid; extern const struct sid domain_users_sid; -extern const struct sid high_label_sid; struct ace { diff --git a/server/token.c b/server/token.c index f23013103dd..da7f0bb7ff2 100644 --- a/server/token.c +++ b/server/token.c @@ -72,7 +72,6 @@ struct sid_attrs const struct sid world_sid = { SID_REVISION, 1, SECURITY_WORLD_SID_AUTHORITY, { SECURITY_WORLD_RID } }; const struct sid local_system_sid = { SID_REVISION, 1, SECURITY_NT_AUTHORITY, { SECURITY_LOCAL_SYSTEM_RID } }; -const struct sid high_label_sid = { SID_REVISION, 1, SECURITY_MANDATORY_LABEL_AUTHORITY, { SECURITY_MANDATORY_HIGH_RID } }; const struct sid local_user_sid = { SID_REVISION, 5, SECURITY_NT_AUTHORITY, { SECURITY_NT_NON_UNIQUE, 0, 0, 0, 1000 } }; const struct sid builtin_admins_sid = { SID_REVISION, 2, SECURITY_NT_AUTHORITY, { SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS } }; const struct sid builtin_users_sid = { SID_REVISION, 2, SECURITY_NT_AUTHORITY, { SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_USERS } }; @@ -82,6 +81,7 @@ static const struct sid local_sid = { SID_REVISION, 1, SECURITY_LOCAL_SID_AUTHOR static const struct sid interactive_sid = { SID_REVISION, 1, SECURITY_NT_AUTHORITY, { SECURITY_INTERACTIVE_RID } }; static const struct sid anonymous_logon_sid = { SID_REVISION, 1, SECURITY_NT_AUTHORITY, { SECURITY_ANONYMOUS_LOGON_RID } }; static const struct sid authenticated_user_sid = { SID_REVISION, 1, SECURITY_NT_AUTHORITY, { SECURITY_AUTHENTICATED_USER_RID } }; +static const struct sid high_label_sid = { SID_REVISION, 1, SECURITY_MANDATORY_LABEL_AUTHORITY, { SECURITY_MANDATORY_HIGH_RID } }; static struct luid prev_luid_value = { 1000, 0 }; @@ -649,6 +649,24 @@ struct token *token_duplicate( struct token *src_token, unsigned primary, if (sd) default_set_sd( &token->obj, sd, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION ); + if (src_token->obj.sd) + { + const struct acl *sacl; + const struct ace *ace; + unsigned int i; + int present; + + sacl = sd_get_sacl( src_token->obj.sd, &present ); + if (present) + { + for (i = 0, ace = ace_first( sacl ); i < sacl->count; i++, ace = ace_next( ace )) + { + if (ace->type != SYSTEM_MANDATORY_LABEL_ACE_TYPE) continue; + token_assign_label( token, (const struct sid *)(ace + 1) ); + } + } + } + return token; } @@ -785,6 +803,15 @@ struct token *token_create_admin( unsigned primary, int impersonation_level, int /* we really need a primary group */ assert( token->primary_group ); + /* Assign a high security label to the token. The default would be medium + * but Wine provides admin access to all applications right now so high + * makes more sense for the time being. */ + if (!token_assign_label( token, &high_label_sid )) + { + release_object( token ); + return NULL; + } + free( default_dacl ); return token; }
1
0
0
0
Elizabeth Figura : server: Ignore attempts to set a mandatory label on a token.
by Alexandre Julliard
06 Jun '24
06 Jun '24
Module: wine Branch: master Commit: 524b43112371d5c5b6323a1d66fd57da98986cd2 URL:
https://gitlab.winehq.org/wine/wine/-/commit/524b43112371d5c5b6323a1d66fd57…
Author: Elizabeth Figura <zfigura(a)codeweavers.com> Date: Tue Jun 4 20:42:56 2024 -0500 server: Ignore attempts to set a mandatory label on a token. --- server/token.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/token.c b/server/token.c index 4df8d2e0c6e..f23013103dd 100644 --- a/server/token.c +++ b/server/token.c @@ -134,6 +134,8 @@ struct group static void token_dump( struct object *obj, int verbose ); static void token_destroy( struct object *obj ); +static int token_set_sd( struct object *obj, const struct security_descriptor *sd, + unsigned int set_info ); static const struct object_ops token_ops = { @@ -148,7 +150,7 @@ static const struct object_ops token_ops = no_get_fd, /* get_fd */ default_map_access, /* map_access */ default_get_sd, /* get_sd */ - default_set_sd, /* set_sd */ + token_set_sd, /* set_sd */ no_get_full_name, /* get_full_name */ no_lookup_name, /* lookup_name */ no_link_name, /* link_name */ @@ -167,6 +169,12 @@ static void token_dump( struct object *obj, int verbose ) token->token_id.low_part, token->primary, token->impersonation_level ); } +static int token_set_sd( struct object *obj, const struct security_descriptor *sd, + unsigned int set_info ) +{ + return default_set_sd( obj, sd, set_info & ~LABEL_SECURITY_INFORMATION ); +} + void security_set_thread_token( struct thread *thread, obj_handle_t handle ) { if (!handle)
1
0
0
0
← Newer
1
...
46
47
48
49
50
51
52
...
62
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Results per page:
10
25
50
100
200