* 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.
This commit is contained in:
Corinna Vinschen 2014-11-27 16:49:41 +00:00
parent db880b5642
commit e7d7418270
5 changed files with 40 additions and 11 deletions

View File

@ -1,3 +1,17 @@
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

View File

@ -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);
if (!user_init)
create_root_entry (path);
pathend = wcpcpy (pathend, L"\\etc\\fstab");
from_fstab (user_init, path, pathend);
from_fstab (false, path, pathend);
from_fstab (true, 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)

View File

@ -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);

View File

@ -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,

View File

@ -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;
}
}