From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75341 invoked by alias); 23 Feb 2019 20:06:33 -0000 Mailing-List: contact cygwin-cvs-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-cvs-owner@cygwin.com Received: (qmail 75307 invoked by uid 9078); 23 Feb 2019 20:06:32 -0000 Date: Sat, 23 Feb 2019 20:06:00 -0000 Message-ID: <20190223200632.75306.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: seteuid: allow inheriting impersonation user profile handle X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 8eee25241e86fc596acde25c7c53723b75afee30 X-Git-Newrev: dd3730ed9c1c78176f1aab1b429bb5a105d90a44 X-SW-Source: 2019-q1/txt/msg00187.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=dd3730ed9c1c78176f1aab1b429bb5a105d90a44 commit dd3730ed9c1c78176f1aab1b429bb5a105d90a44 Author: Corinna Vinschen Date: Sat Feb 23 20:48:59 2019 +0100 Cygwin: seteuid: allow inheriting impersonation user profile handle The child process needs access to the handle to be able to unload it when switching user context. Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/syscalls.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index b103976..a73af67 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -3612,7 +3612,11 @@ seteuid32 (uid_t uid) cygheap->user.imp_profile = load_user_profile (new_token, pw_new, usersid); if (cygheap->user.imp_profile) - cygheap->user.imp_profile_token = new_token; + { + cygheap->user.imp_profile_token = new_token; + SetHandleInformation (cygheap->user.imp_profile, + HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); + } } /* Try setting owner to same value as user. */