summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorPierre Humblet <phumblet@phumblet.no-ip.org>2004-10-28 01:46:01 +0000
committerPierre Humblet <phumblet@phumblet.no-ip.org>2004-10-28 01:46:01 +0000
commit531979231dd850a920af0a65bc70d5178ae14fec (patch)
treecedf7460fe072dba7976a95693dd5aab3ca4fc5f /winsup/cygwin/path.cc
parent39055108341fae0ca71ef503267d8f619e59a047 (diff)
downloadcygnal-531979231dd850a920af0a65bc70d5178ae14fec.tar.gz
cygnal-531979231dd850a920af0a65bc70d5178ae14fec.tar.bz2
cygnal-531979231dd850a920af0a65bc70d5178ae14fec.zip
2004-10-28 Pierre Humblet <pierre.humblet@ieee.org>
* path.cc (mount_info::from_registry): Deimpersonate while accessing HKLM. (mount_info::read_cygdrive_info_from_registry): Ditto. * cygheap.h: Define NO_IMPERSONATION. (cygheap_user::issetuid): Replace INVALID_HANDLE_VALUE by NO_IMPERSONATION. (cygheap_user::has_impersonation_tokens): Ditto. (cygheap_user::close_impersonation_tokens): Ditto. * uinfo.cc (uinfo_init): Ditto. * syscalls.cc (seteuid32): Ditto. * security.cc (set_impersonation_token): Ditto.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 22818839a..893e47d7f 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1802,11 +1802,13 @@ mount_info::from_registry ()
read_mounts (r);
/* Then read mounts from system-wide mount table. */
+ cygheap->user.deimpersonate ();
reg_key r1 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME,
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
NULL);
read_mounts (r1);
+ cygheap->user.reimpersonate ();
}
/* add_reg_mount: Add mount item to registry. Return zero on success,
@@ -1922,16 +1924,16 @@ mount_info::read_cygdrive_info_from_registry ()
{
/* reg_key for user path prefix in HKEY_CURRENT_USER. */
reg_key r;
-
+ /* First read cygdrive from user's registry. */
if (r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive, sizeof (cygdrive), "") != 0)
{
- /* Didn't find the user path prefix so check the system path prefix. */
-
- /* reg_key for system path prefix in HKEY_LOCAL_MACHINE. */
+ /* Then read cygdrive from system-wide registry. */
+ cygheap->user.deimpersonate ();
reg_key r2 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME,
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
NULL);
+ cygheap->user.reimpersonate ();
if (r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive,
sizeof (cygdrive), ""))