From 81ee7ad18a7d6671c8a33be5796924da9193f464 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 22 Dec 2015 03:07:15 +0100 Subject: [PATCH] Rebase against a0b8f178df8ed704fc732f5aef3b2e1f623512fc. --- README.md | 2 +- ...storing-DOS-attributes-in-NtCreateFi.patch | 30 +++-- ...ugFlags-should-return-debug_children.patch | 125 ------------------ patches/ntdll-ProcessDebugFlags/definition | 1 - patches/patchinstall.sh | 31 +---- ...d-test-for-process-object-destructi.patch} | 0 ...emove-unnecessary-call-to-GetExitCod.patch | 33 ----- ...ize-of-PID-table-to-512-to-reduce-r.patch} | 0 ...ot-hold-reference-on-parent-process.patch} | 0 ...licate-should-not-reference-the-orig.patch | 36 ----- 10 files changed, 22 insertions(+), 236 deletions(-) delete mode 100644 patches/ntdll-ProcessDebugFlags/0001-ntdll-ProcessDebugFlags-should-return-debug_children.patch delete mode 100644 patches/ntdll-ProcessDebugFlags/definition rename patches/server-Parent_Process/{0002-kernel32-tests-Add-test-for-process-object-destructi.patch => 0001-kernel32-tests-Add-test-for-process-object-destructi.patch} (100%) delete mode 100644 patches/server-Parent_Process/0001-kernel32-tests-Remove-unnecessary-call-to-GetExitCod.patch rename patches/server-Parent_Process/{0004-server-Increase-size-of-PID-table-to-512-to-reduce-r.patch => 0002-server-Increase-size-of-PID-table-to-512-to-reduce-r.patch} (100%) rename patches/server-Parent_Process/{0005-server-Do-not-hold-reference-on-parent-process.patch => 0003-server-Do-not-hold-reference-on-parent-process.patch} (100%) delete mode 100644 patches/server-Parent_Process/0003-server-token_duplicate-should-not-reference-the-orig.patch diff --git a/README.md b/README.md index a00f58fc..57fa83d3 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ for more details.* * Fix handling of empty section and key name for profile files. ([Wine Bug #8036](https://bugs.winehq.org/show_bug.cgi?id=8036)) * Fix handling of invert_y in DrawTextExW ([Wine Bug #22109](https://bugs.winehq.org/show_bug.cgi?id=22109)) * Fix handling of window attributes for WS_EX_LAYERED | WS_EX_COMPOSITED ([Wine Bug #37876](https://bugs.winehq.org/show_bug.cgi?id=37876)) -* Fix implementation of NtQueryInformationProcess for ProcessDebugFlags +* ~~Fix implementation of NtQueryInformationProcess for ProcessDebugFlags~~ * Fix implementation of msvcrt.close when stdout == stderr * Fix issue causing applications to report magic loopback address instead of real IP ([Wine Bug #37271](https://bugs.winehq.org/show_bug.cgi?id=37271)) * Fix issues with dragging layers between images in Adobe Photoshop 7.0 ([Wine Bug #12007](https://bugs.winehq.org/show_bug.cgi?id=12007)) diff --git a/patches/ntdll-DOS_Attributes/0004-ntdll-Implement-storing-DOS-attributes-in-NtCreateFi.patch b/patches/ntdll-DOS_Attributes/0004-ntdll-Implement-storing-DOS-attributes-in-NtCreateFi.patch index 407d2fb2..b92ab160 100644 --- a/patches/ntdll-DOS_Attributes/0004-ntdll-Implement-storing-DOS-attributes-in-NtCreateFi.patch +++ b/patches/ntdll-DOS_Attributes/0004-ntdll-Implement-storing-DOS-attributes-in-NtCreateFi.patch @@ -1,20 +1,20 @@ -From ac9076b71ddda6d430fe80fcfe62a47c2dcc9dc9 Mon Sep 17 00:00:00 2001 +From e3b53e0794d83fc9eb39d78ca673c9144dd9873d Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 20 Aug 2014 15:28:00 -0600 Subject: ntdll: Implement storing DOS attributes in NtCreateFile. --- dlls/ntdll/file.c | 79 ++++++++++++++++++++++++++++---------------- - dlls/ntdll/tests/directory.c | 22 +++++------- + dlls/ntdll/tests/directory.c | 24 +++++--------- include/wine/port.h | 2 ++ libs/port/xattr.c | 20 +++++++++++ - 4 files changed, 80 insertions(+), 43 deletions(-) + 4 files changed, 81 insertions(+), 44 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c -index 521ab64..b4187d4 100644 +index 7e32087..dd38995 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c -@@ -205,6 +205,21 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr ) +@@ -219,6 +219,21 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr ) return ret; } @@ -36,7 +36,7 @@ index 521ab64..b4187d4 100644 /************************************************************************** * FILE_CreateFile (internal) * Open a file. -@@ -216,6 +231,8 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT +@@ -230,6 +245,8 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT ULONG attributes, ULONG sharing, ULONG disposition, ULONG options, PVOID ea_buffer, ULONG ea_length ) { @@ -45,7 +45,7 @@ index 521ab64..b4187d4 100644 ANSI_STRING unix_name; BOOL created = FALSE; -@@ -259,39 +276,37 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT +@@ -273,39 +290,37 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT io->u.Status = STATUS_SUCCESS; } @@ -112,7 +112,7 @@ index 521ab64..b4187d4 100644 if (io->u.Status == STATUS_SUCCESS) { -@@ -313,6 +328,11 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT +@@ -327,6 +342,11 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT io->Information = FILE_OVERWRITTEN; break; } @@ -124,7 +124,7 @@ index 521ab64..b4187d4 100644 } else if (io->u.Status == STATUS_TOO_MANY_OPENED_FILES) { -@@ -320,6 +340,7 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT +@@ -334,6 +354,7 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT if (!once++) ERR_(winediag)( "Too many open files, ulimit -n probably needs to be increased\n" ); } @@ -133,7 +133,7 @@ index 521ab64..b4187d4 100644 } diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c -index f190ff4..68b5406 100644 +index 7b1002a..aa8e97f 100644 --- a/dlls/ntdll/tests/directory.c +++ b/dlls/ntdll/tests/directory.c @@ -51,7 +51,6 @@ static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirectionEx)( ULONG disable, ULONG * @@ -144,10 +144,11 @@ index f190ff4..68b5406 100644 BOOL attr_done; /* set if attributes were tested for this file already */ const DWORD attr; /* desired attribute */ const char *name; /* filename to use */ -@@ -60,13 +59,13 @@ static struct testfile_s { +@@ -60,14 +59,14 @@ static struct testfile_s { int nfound; /* How many were found (expect 1) */ WCHAR nameW[20]; /* unicode version of name (filled in later) */ } testfiles[] = { +- { 0, 0, FILE_ATTRIBUTE_NORMAL, "longfilename.tmp", NULL, "normal" }, - { 0, 0, FILE_ATTRIBUTE_NORMAL, "n.tmp", NULL, "normal" }, - { 1, 0, FILE_ATTRIBUTE_HIDDEN, "h.tmp", NULL, "hidden" }, - { 1, 0, FILE_ATTRIBUTE_SYSTEM, "s.tmp", NULL, "system" }, @@ -155,6 +156,7 @@ index f190ff4..68b5406 100644 - { 0, 0, FILE_ATTRIBUTE_DIRECTORY, ".", NULL, ". directory" }, - { 0, 0, FILE_ATTRIBUTE_DIRECTORY, "..", NULL, ".. directory" }, - { 0, 0, 0, NULL } ++ { 0, FILE_ATTRIBUTE_NORMAL, "longfilename.tmp", NULL, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, "n.tmp", NULL, "normal" }, + { 0, FILE_ATTRIBUTE_HIDDEN, "h.tmp", NULL, "hidden" }, + { 0, FILE_ATTRIBUTE_SYSTEM, "s.tmp", NULL, "system" }, @@ -165,7 +167,7 @@ index f190ff4..68b5406 100644 }; static const int max_test_dir_size = 20; /* size of above plus some for .. etc */ -@@ -147,12 +146,7 @@ static void tally_test_file(FILE_BOTH_DIRECTORY_INFORMATION *dir_info) +@@ -148,12 +147,7 @@ static void tally_test_file(FILE_BOTH_DIRECTORY_INFORMATION *dir_info) if (namelen != len || memcmp(nameW, testfiles[i].nameW, len*sizeof(WCHAR))) continue; if (!testfiles[i].attr_done) { @@ -180,7 +182,7 @@ index f190ff4..68b5406 100644 } testfiles[i].nfound++; diff --git a/include/wine/port.h b/include/wine/port.h -index cc572f3..9e2b8165 100644 +index 445a25e..04ae7a6 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -373,6 +373,8 @@ extern int xattr_fget( int filedes, const char *name, void *value, size_t size ) @@ -221,5 +223,5 @@ index 6918c99..683e7a6 100644 +#endif +} -- -1.9.1 +2.6.4 diff --git a/patches/ntdll-ProcessDebugFlags/0001-ntdll-ProcessDebugFlags-should-return-debug_children.patch b/patches/ntdll-ProcessDebugFlags/0001-ntdll-ProcessDebugFlags-should-return-debug_children.patch deleted file mode 100644 index d1d0eef6..00000000 --- a/patches/ntdll-ProcessDebugFlags/0001-ntdll-ProcessDebugFlags-should-return-debug_children.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 682c8d52bbec194245ce03428ab1678a28d6acf5 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Thu, 10 Dec 2015 03:11:25 +0100 -Subject: ntdll: ProcessDebugFlags should return debug_children flag instead of - !debugger_present. - -Signed-off-by: Sebastian Lackner ---- - dlls/ntdll/process.c | 2 +- - dlls/ntdll/tests/info.c | 12 ++---------- - server/debugger.c | 2 +- - server/process.c | 5 +++-- - server/protocol.def | 3 ++- - 5 files changed, 9 insertions(+), 15 deletions(-) - -diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c -index ca9462a..5a5c3ef 100644 ---- a/dlls/ntdll/process.c -+++ b/dlls/ntdll/process.c -@@ -339,7 +339,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( - req->handle = wine_server_obj_handle( ProcessHandle ); - if ((ret = wine_server_call( req )) == STATUS_SUCCESS) - { -- *(DWORD *)ProcessInformation = !reply->debugger_present; -+ *(DWORD *)ProcessInformation = reply->debug_children; - } - } - SERVER_END_REQ; -diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c -index 88d0417..a521447 100644 ---- a/dlls/ntdll/tests/info.c -+++ b/dlls/ntdll/tests/info.c -@@ -1345,11 +1345,7 @@ static void test_query_process_debug_flags(int argc, char **argv) - status = pNtQueryInformationProcess(pi.hProcess, ProcessDebugFlags, - &debug_flags, sizeof(debug_flags), NULL); - ok(!status, "NtQueryInformationProcess failed, status %#x.\n", status); -- if (!expected_flags) -- ok(debug_flags == expected_flags, "Expected flag %x, got %x.\n", expected_flags, debug_flags); -- else -- todo_wine -- ok(debug_flags == expected_flags, "Expected flag %x, got %x.\n", expected_flags, debug_flags); -+ ok(debug_flags == expected_flags, "Expected flag %x, got %x.\n", expected_flags, debug_flags); - - if (!(test_flags[i] & CREATE_SUSPENDED)) - { -@@ -1379,11 +1375,7 @@ static void test_query_process_debug_flags(int argc, char **argv) - status = pNtQueryInformationProcess(pi.hProcess, ProcessDebugFlags, - &debug_flags, sizeof(debug_flags), NULL); - ok(!status, "NtQueryInformationProcess failed, status %#x.\n", status); -- if (expected_flags) -- ok(debug_flags == expected_flags, "Expected flag %x, got %x.\n", expected_flags, debug_flags); -- else -- todo_wine -- ok(debug_flags == expected_flags, "Expected flag %x, got %x.\n", expected_flags, debug_flags); -+ ok(debug_flags == expected_flags, "Expected flag %x, got %x.\n", expected_flags, debug_flags); - - ret = DebugActiveProcess(pi.dwProcessId); - ok(ret, "DebugActiveProcess failed, last error %#x.\n", GetLastError()); -diff --git a/server/debugger.c b/server/debugger.c -index 374f2ad..810e8d3 100644 ---- a/server/debugger.c -+++ b/server/debugger.c -@@ -443,6 +443,7 @@ static int debugger_attach( struct process *process, struct thread *debugger ) - resume_process( process ); - return 0; - } -+ process->debug_children = 0; - return 1; - - error: -@@ -483,7 +484,6 @@ int debugger_detach( struct process *process, struct thread *debugger ) - - /* remove relationships between process and its debugger */ - process->debugger = NULL; -- process->debug_children = 0; - if (!set_process_debug_flag( process, 0 )) clear_error(); /* ignore error */ - - /* from this function */ -diff --git a/server/process.c b/server/process.c -index e00b429..8433002 100644 ---- a/server/process.c -+++ b/server/process.c -@@ -513,7 +513,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit - process->priority = PROCESS_PRIOCLASS_NORMAL; - process->suspend = 0; - process->is_system = 0; -- process->debug_children = 0; -+ process->debug_children = 1; - process->is_terminating = 0; - process->job = NULL; - process->console = NULL; -@@ -1228,7 +1228,7 @@ DECL_HANDLER(new_process) - else if (parent->debugger && parent->debug_children) - { - set_process_debugger( process, parent->debugger ); -- process->debug_children = 1; -+ /* debug_children is set to 1 by default */ - } - - if (!(req->create_flags & CREATE_NEW_PROCESS_GROUP)) -@@ -1359,6 +1359,7 @@ DECL_HANDLER(get_process_info) - reply->end_time = process->end_time; - reply->cpu = process->cpu; - reply->debugger_present = !!process->debugger; -+ reply->debug_children = process->debug_children; - release_object( process ); - } - } -diff --git a/server/protocol.def b/server/protocol.def -index 04814c9..bfb9089 100644 ---- a/server/protocol.def -+++ b/server/protocol.def -@@ -818,7 +818,8 @@ struct rawinput_device - int exit_code; /* process exit code */ - int priority; /* priority class */ - cpu_type_t cpu; /* CPU that this process is running on */ -- int debugger_present; /* process is being debugged */ -+ short int debugger_present; /* process is being debugged */ -+ short int debug_children; /* inherit debugger to child processes */ - @END - - --- -2.6.2 - diff --git a/patches/ntdll-ProcessDebugFlags/definition b/patches/ntdll-ProcessDebugFlags/definition deleted file mode 100644 index 78e1744c..00000000 --- a/patches/ntdll-ProcessDebugFlags/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: Fix implementation of NtQueryInformationProcess for ProcessDebugFlags diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 0538eed7..a66f47de 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "a981d3738014339cd0fae1e7f5aa9429222ee03d" + echo "a0b8f178df8ed704fc732f5aef3b2e1f623512fc" } # Show version information @@ -204,7 +204,6 @@ patch_enable_all () enable_ntdll_NtQuerySection="$1" enable_ntdll_NtSetLdtEntries="$1" enable_ntdll_Pipe_SpecialCharacters="$1" - enable_ntdll_ProcessDebugFlags="$1" enable_ntdll_ProcessQuotaLimits="$1" enable_ntdll_Purist_Mode="$1" enable_ntdll_RtlIpStringToAddress="$1" @@ -726,9 +725,6 @@ patch_enable () ntdll-Pipe_SpecialCharacters) enable_ntdll_Pipe_SpecialCharacters="$2" ;; - ntdll-ProcessDebugFlags) - enable_ntdll_ProcessDebugFlags="$2" - ;; ntdll-ProcessQuotaLimits) enable_ntdll_ProcessQuotaLimits="$2" ;; @@ -4361,18 +4357,6 @@ if test "$enable_ntdll_Pipe_SpecialCharacters" -eq 1; then ) >> "$patchlist" fi -# Patchset ntdll-ProcessDebugFlags -# | -# | Modified files: -# | * dlls/ntdll/process.c, dlls/ntdll/tests/info.c, server/debugger.c, server/process.c, server/protocol.def -# | -if test "$enable_ntdll_ProcessDebugFlags" -eq 1; then - patch_apply ntdll-ProcessDebugFlags/0001-ntdll-ProcessDebugFlags-should-return-debug_children.patch - ( - echo '+ { "Sebastian Lackner", "ntdll: ProcessDebugFlags should return debug_children flag instead of !debugger_present.", 1 },'; - ) >> "$patchlist" -fi - # Patchset ntdll-ProcessQuotaLimits # | # | Modified files: @@ -5006,19 +4990,14 @@ fi # | * [#37087] Do not hold reference on parent process in wineserver # | # | Modified files: -# | * dlls/kernel32/tests/process.c, server/console.c, server/process.c, server/process.h, server/snapshot.c, server/thread.c, -# | server/token.c +# | * dlls/kernel32/tests/process.c, server/console.c, server/process.c, server/process.h, server/snapshot.c, server/thread.c # | if test "$enable_server_Parent_Process" -eq 1; then - patch_apply server-Parent_Process/0001-kernel32-tests-Remove-unnecessary-call-to-GetExitCod.patch - patch_apply server-Parent_Process/0002-kernel32-tests-Add-test-for-process-object-destructi.patch - patch_apply server-Parent_Process/0003-server-token_duplicate-should-not-reference-the-orig.patch - patch_apply server-Parent_Process/0004-server-Increase-size-of-PID-table-to-512-to-reduce-r.patch - patch_apply server-Parent_Process/0005-server-Do-not-hold-reference-on-parent-process.patch + patch_apply server-Parent_Process/0001-kernel32-tests-Add-test-for-process-object-destructi.patch + patch_apply server-Parent_Process/0002-server-Increase-size-of-PID-table-to-512-to-reduce-r.patch + patch_apply server-Parent_Process/0003-server-Do-not-hold-reference-on-parent-process.patch ( - echo '+ { "Sebastian Lackner", "kernel32/tests: Remove unnecessary call to GetExitCodeProcess in process tests.", 1 },'; echo '+ { "Sebastian Lackner", "kernel32/tests: Add test for process object destruction.", 1 },'; - echo '+ { "Sebastian Lackner", "server: Token_duplicate should not reference the original token, which will get destroyed on process exit.", 1 },'; echo '+ { "Sebastian Lackner", "server: Increase size of PID table to 512 to reduce risk of collisions.", 1 },'; echo '+ { "Sebastian Lackner", "server: Do not hold reference on parent process.", 1 },'; ) >> "$patchlist" diff --git a/patches/server-Parent_Process/0002-kernel32-tests-Add-test-for-process-object-destructi.patch b/patches/server-Parent_Process/0001-kernel32-tests-Add-test-for-process-object-destructi.patch similarity index 100% rename from patches/server-Parent_Process/0002-kernel32-tests-Add-test-for-process-object-destructi.patch rename to patches/server-Parent_Process/0001-kernel32-tests-Add-test-for-process-object-destructi.patch diff --git a/patches/server-Parent_Process/0001-kernel32-tests-Remove-unnecessary-call-to-GetExitCod.patch b/patches/server-Parent_Process/0001-kernel32-tests-Remove-unnecessary-call-to-GetExitCod.patch deleted file mode 100644 index 281150be..00000000 --- a/patches/server-Parent_Process/0001-kernel32-tests-Remove-unnecessary-call-to-GetExitCod.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 3b2e19cfcb3d5d1a901fee4bcdeba7b424d128ed Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sat, 12 Dec 2015 06:53:57 +0100 -Subject: kernel32/tests: Remove unnecessary call to GetExitCodeProcess in - process tests. - ---- - dlls/kernel32/tests/process.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c -index 6dc1f5e..f186c94 100644 ---- a/dlls/kernel32/tests/process.c -+++ b/dlls/kernel32/tests/process.c -@@ -2729,7 +2729,6 @@ static void test_StartupNoConsole(void) - char buffer[MAX_PATH]; - STARTUPINFOA startup; - PROCESS_INFORMATION info; -- DWORD code; - - if (!pNtCurrentTeb) - { -@@ -2746,7 +2745,6 @@ static void test_StartupNoConsole(void) - ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &startup, - &info), "CreateProcess\n"); - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); -- ok(GetExitCodeProcess(info.hProcess, &code), "Getting exit code\n"); - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - okChildInt("StartupInfoA", "hStdInput", (UINT)INVALID_HANDLE_VALUE); - okChildInt("StartupInfoA", "hStdOutput", (UINT)INVALID_HANDLE_VALUE); --- -2.6.2 - diff --git a/patches/server-Parent_Process/0004-server-Increase-size-of-PID-table-to-512-to-reduce-r.patch b/patches/server-Parent_Process/0002-server-Increase-size-of-PID-table-to-512-to-reduce-r.patch similarity index 100% rename from patches/server-Parent_Process/0004-server-Increase-size-of-PID-table-to-512-to-reduce-r.patch rename to patches/server-Parent_Process/0002-server-Increase-size-of-PID-table-to-512-to-reduce-r.patch diff --git a/patches/server-Parent_Process/0005-server-Do-not-hold-reference-on-parent-process.patch b/patches/server-Parent_Process/0003-server-Do-not-hold-reference-on-parent-process.patch similarity index 100% rename from patches/server-Parent_Process/0005-server-Do-not-hold-reference-on-parent-process.patch rename to patches/server-Parent_Process/0003-server-Do-not-hold-reference-on-parent-process.patch diff --git a/patches/server-Parent_Process/0003-server-token_duplicate-should-not-reference-the-orig.patch b/patches/server-Parent_Process/0003-server-token_duplicate-should-not-reference-the-orig.patch deleted file mode 100644 index eb0f0cae..00000000 --- a/patches/server-Parent_Process/0003-server-token_duplicate-should-not-reference-the-orig.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 852441b8d71ffc4fe095a331cd8a7dcc2fdac1c2 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Thu, 10 Dec 2015 16:40:01 +0100 -Subject: server: token_duplicate should not reference the original token, - which will get destroyed on process exit. - ---- - server/token.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/server/token.c b/server/token.c -index 001261d..9edfbf0 100644 ---- a/server/token.c -+++ b/server/token.c -@@ -568,6 +568,7 @@ struct token *token_duplicate( struct token *src_token, unsigned primary, - if (!token) return token; - - /* copy groups */ -+ token->primary_group = NULL; - LIST_FOR_EACH_ENTRY( group, &src_token->groups, struct group, entry ) - { - size_t size = FIELD_OFFSET( struct group, sid.SubAuthority[group->sid.SubAuthorityCount] ); -@@ -579,8 +580,9 @@ struct token *token_duplicate( struct token *src_token, unsigned primary, - } - memcpy( newgroup, group, size ); - list_add_tail( &token->groups, &newgroup->entry ); -+ if (src_token->primary_group == &group->sid) -+ token->primary_group = &newgroup->sid; - } -- token->primary_group = src_token->primary_group; - assert( token->primary_group ); - - /* copy privileges */ --- -2.6.2 -