Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-06-30 17:07:36 +0400
committerCorinna Vinschen <corinna@vinschen.de>2003-06-30 17:07:36 +0400
commit70249d5687c6020064b70431e115fe1c0161cfa3 (patch)
tree64e9bd4e8db6308fd1c748266a00901b5e45b8d3 /winsup/cygwin/uinfo.cc
parent3fbdb70ec68d30d36bda2dd186b9a1ce8b4d579b (diff)
* 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.
Diffstat (limited to 'winsup/cygwin/uinfo.cc')
-rw-r--r--winsup/cygwin/uinfo.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index 4e688a3fa..f63230d0a 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -102,7 +102,7 @@ internal_getlogin (cygheap_user &user)
void
uinfo_init ()
{
- if (child_proc_info && cygheap->user.token == INVALID_HANDLE_VALUE)
+ if (child_proc_info && !cygheap->user.has_impersonation_tokens ())
return;
if (!child_proc_info)
@@ -114,17 +114,16 @@ uinfo_init ()
&& cygheap->user.orig_gid == cygheap->user.real_gid
&& !cygheap->user.groups.issetgroups ())
{
- if (!ImpersonateLoggedOnUser (cygheap->user.token))
- system_printf ("ImpersonateLoggedOnUser: %E");
+ cygheap->user.reimpersonate ();
return;
}
else
- CloseHandle (cygheap->user.token);
+ cygheap->user.close_impersonation_tokens ();
cygheap->user.orig_uid = cygheap->user.real_uid = myself->uid;
cygheap->user.orig_gid = cygheap->user.real_gid = myself->gid;
+ cygheap->user.impersonation_state = IMP_NONE;
cygheap->user.set_orig_sid (); /* Update the original sid */
- cygheap->user.token = INVALID_HANDLE_VALUE; /* No token present */
}
extern "C" char *