From 70249d5687c6020064b70431e115fe1c0161cfa3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 30 Jun 2003 13:07:36 +0000 Subject: * cygheap.h (enum impersonation): New enum. (cygheap_user::token): Delete. (cygheap_user::impersonated): Delete. (cygheap_user::external_token): New member. (cygheap_user::internal_token): New member. (cygheap_user::impersonation_state): New member. (cygheap_user::issetuid): Modify. (cygheap_user::token): New method. (cygheap_user::deimpersonate): New method. (cygheap_user::reimpersonate): New method. (cygheap_user::has_impersonation_tokens): New method. (cygheap_user::close_impersonation_tokens): New method. * dtable.cc (dtable::vfork_child_dup): Use new cygheap_user methods. * fhandler_socket.cc (fhandler_socket::dup): Ditto. * fork.cc (fork_child): Ditto. (fork_parent): Ditto. * grp.cc (internal_getgroups): Ditto. * security.cc (verify_token): Ditto. (check_file_access): Ditto. (cygwin_set_impersonation_token): Detect conflicts. Set user.external_token. * spawn.cc (spawn_guts): Use new cygheap_user methods. * syscalls.cc (seteuid32): Rearrange to use the two tokens in cygheap_user. (setegid32): Use new cygheap_user methods. * uinfo.cc: (internal_getlogin): Ditto. --- winsup/cygwin/dtable.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'winsup/cygwin/dtable.cc') diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index 315505b14..973b3c429 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -634,8 +634,7 @@ dtable::vfork_child_dup () int res = 1; /* Remove impersonation */ - if (cygheap->user.issetuid ()) - RevertToSelf (); + cygheap->user.deimpersonate (); for (size_t i = 0; i < size; i++) if (not_open (i)) @@ -654,8 +653,7 @@ dtable::vfork_child_dup () out: /* Restore impersonation */ - if (cygheap->user.issetuid ()) - ImpersonateLoggedOnUser (cygheap->user.token); + cygheap->user.reimpersonate (); ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "dup"); return 1; -- cgit v1.2.3