diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-11-27 19:49:41 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-11-27 19:49:41 +0300 |
commit | e7d7418270fd17998e09017f013816788b32651d (patch) | |
tree | 4615fa9e3fd977828a3211a927bcba832475e021 /winsup | |
parent | db880b56427272aaea287a42541fe127dc5590a6 (diff) |
* mount.cc (mount_info::init): Take bool argument and allow to
initialize mount table in two steps, system and user, depending on
bool value.
* mount.h (class mount_info): Align declaration of init function to
above change.
* shared.cc (user_info::initialize): Initialize mount table in two
steps to allow internal_getpwsid to create valid POSIX paths from
DOS paths given in AD. Add comments.
* uinfo.cc (cygheap_pwdgrp::get_home): Allow DOS paths in
NSS_SCHEME_FREEATTR attributes.
(cygheap_pwdgrp::get_shell): Ditto.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 14 | ||||
-rw-r--r-- | winsup/cygwin/mount.cc | 12 | ||||
-rw-r--r-- | winsup/cygwin/mount.h | 4 | ||||
-rw-r--r-- | winsup/cygwin/shared.cc | 7 | ||||
-rw-r--r-- | winsup/cygwin/uinfo.cc | 14 |
5 files changed, 40 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ecb801b95..edafd57fa 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,19 @@ 2014-11-27 Corinna Vinschen <corinna@vinschen.de> + * mount.cc (mount_info::init): Take bool argument and allow to + initialize mount table in two steps, system and user, depending on + bool value. + * mount.h (class mount_info): Align declaration of init function to + above change. + * shared.cc (user_info::initialize): Initialize mount table in two + steps to allow internal_getpwsid to create valid POSIX paths from + DOS paths given in AD. Add comments. + * uinfo.cc (cygheap_pwdgrp::get_home): Allow DOS paths in + NSS_SCHEME_FREEATTR attributes. + (cygheap_pwdgrp::get_shell): Ditto. + +2014-11-27 Corinna Vinschen <corinna@vinschen.de> + * cygheap.cc (init_cygheap::find_tls): Allow to keep loop going after access to threadlist[ix] faulted. In case of an exception, remove threadlist[ix] from threadlist only. Add comment. diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index 94e305489..6cf3ddf46 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -468,19 +468,19 @@ mount_info::create_root_entry (const PWCHAR root) /* init: Initialize the mount table. */ void -mount_info::init () +mount_info::init (bool user_init) { PWCHAR pathend; WCHAR path[PATH_MAX]; pathend = wcpcpy (path, cygheap->installation_root); - create_root_entry (path); - pathend = wcpcpy (pathend, L"\\etc\\fstab"); + if (!user_init) + create_root_entry (path); - from_fstab (false, path, pathend); - from_fstab (true, path, pathend); + pathend = wcpcpy (pathend, L"\\etc\\fstab"); + from_fstab (user_init, path, pathend); - if (!got_usr_bin || !got_usr_lib) + if (!user_init && (!got_usr_bin || !got_usr_lib)) { char native[PATH_MAX]; if (root_idx < 0) diff --git a/winsup/cygwin/mount.h b/winsup/cygwin/mount.h index 203bfff33..e7d542683 100644 --- a/winsup/cygwin/mount.h +++ b/winsup/cygwin/mount.h @@ -1,7 +1,7 @@ /* mount.h: mount definitions. Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc. + 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc. This file is part of Cygwin. @@ -184,7 +184,7 @@ class mount_info int native_sorted[MAX_MOUNTS]; public: - void init (); + void init (bool); int add_item (const char *dev, const char *path, unsigned flags); int del_item (const char *path, unsigned flags); diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 4510d02ab..202d8ccfa 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -230,13 +230,18 @@ user_info::initialize () if (!sversion) { cb = sizeof (*user_shared); + /* Initialize mount table from system fstab prior to calling + internal_getpwsid. This allows to convert pw_dir and pw_shell + paths given in DOS notation to valid POSIX paths. */ + mountinfo.init (false); cygpsid sid (cygheap->user.sid ()); struct passwd *pw = internal_getpwsid (sid); /* Correct the user name with what's defined in /etc/passwd before loading the user fstab file. */ if (pw) cygheap->user.set_name (pw->pw_name); - mountinfo.init (); /* Initialize the mount table. */ + /* After fetching the user infos, add mount entries from user's fstab. */ + mountinfo.init (true); } else if (sversion != CURR_USER_MAGIC) sversion.multiple_cygwin_problem ("user shared memory version", version, diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index df2cde270..1401697a7 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -927,7 +927,12 @@ cygheap_pwdgrp::get_home (cyg_ldap *pldap, PCWSTR dom, PCWSTR name, case NSS_SCHEME_FREEATTR: val = pldap->get_string_attribute (home_scheme[idx].attrib); if (val && *val) - sys_wcstombs_alloc (&home, HEAP_NOTHEAP, val); + { + if (isdrive (val) || *val == '\\') + home = (char *) cygwin_create_path (CCP_WIN_W_TO_POSIX, val); + else + sys_wcstombs_alloc (&home, HEAP_NOTHEAP, val); + } break; } } @@ -1007,7 +1012,12 @@ cygheap_pwdgrp::get_shell (cyg_ldap *pldap, PCWSTR dom, PCWSTR name, case NSS_SCHEME_FREEATTR: val = pldap->get_string_attribute (shell_scheme[idx].attrib); if (val && *val) - sys_wcstombs_alloc (&shell, HEAP_NOTHEAP, val); + { + if (isdrive (val) || *val == '\\') + shell = (char *) cygwin_create_path (CCP_WIN_W_TO_POSIX, val); + else + sys_wcstombs_alloc (&shell, HEAP_NOTHEAP, val); + } break; } } |