Alexandre Julliard : ntdll: Move the FSCTL_PIPE_IMPERSONATE semi-stub to the server.

Alexandre Julliard julliard at winehq.org
Fri Jul 10 16:30:30 CDT 2020


Module: wine
Branch: master
Commit: 9ac3f24f744bf76c252fafb2c2e254bbbf38ed1e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9ac3f24f744bf76c252fafb2c2e254bbbf38ed1e

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Jul 10 07:57:07 2020 +0200

ntdll: Move the FSCTL_PIPE_IMPERSONATE semi-stub to the server.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/file.c |  4 ++--
 server/named_pipe.c    | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index b4c9b75b3e..070aac3083 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -5665,8 +5665,8 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
 
     case FSCTL_PIPE_IMPERSONATE:
         FIXME("FSCTL_PIPE_IMPERSONATE: impersonating self\n");
-        status = RtlImpersonateSelf( SecurityImpersonation );
-        break;
+        return server_ioctl_file( handle, event, apc, apc_context, io, code,
+                                  in_buffer, in_size, out_buffer, out_size );
 
     case FSCTL_IS_VOLUME_MOUNTED:
     case FSCTL_LOCK_VOLUME:
diff --git a/server/named_pipe.c b/server/named_pipe.c
index f97b141641..b259abb8de 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -1138,6 +1138,17 @@ static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
         pipe_end_disconnect( &server->pipe_end, STATUS_PIPE_DISCONNECTED );
         return 1;
 
+    case FSCTL_PIPE_IMPERSONATE:
+        if (current->process->token) /* FIXME: use the client token */
+        {
+            struct token *token;
+            if (!(token = token_duplicate( current->process->token, 0, SecurityImpersonation, NULL )))
+                return 0;
+            if (current->token) release_object( current->token );
+            current->token = token;
+        }
+        return 1;
+
     default:
         return pipe_end_ioctl( &server->pipe_end, code, async );
     }




More information about the wine-cvs mailing list