* Makefile.in (DLL_IMPORTS): Remove libadvapi32.a.

* autoload.cc: Add all advapi32 entry points.
	* mount.cc (mount_info::init): Read user fstab only if we have a
	username.
	* passwd.cc (pwdgrp::read_passwd): Only use username if we have one.
	* shared.cc (user_info::initialize): Set cb last so as not to override
	planned behaviour in pwdgrp::read_passwd.
	* uinfo.cc (cygheap_user::init): Fetch Windows username from environment
	variable $USERNAME.  Don't set name in cygheap if variable is empty.
	(internal_getlogin): If we still have no username, try GetUserNameW.
This commit is contained in:
Corinna Vinschen
2010-09-28 14:40:18 +00:00
parent 91e0b943a0
commit 2f1f8815c0
7 changed files with 122 additions and 15 deletions

View File

@@ -66,7 +66,8 @@ pwdgrp::read_passwd ()
if (!user_shared->cb || myself->uid == ILLEGAL_UID)
searchentry = !internal_getpwsid (tu);
if (searchentry
&& (!(pw = internal_getpwnam (cygheap->user.name ()))
&& (!cygheap->user.name ()
|| !(pw = internal_getpwnam (cygheap->user.name ()))
|| !user_shared->cb
|| (myself->uid != ILLEGAL_UID
&& myself->uid != (__uid32_t) pw->pw_uid
@@ -75,7 +76,7 @@ pwdgrp::read_passwd ()
static char linebuf[1024]; // must be static and
// should not be NO_COPY
snprintf (linebuf, sizeof (linebuf), "%s:*:%lu:%lu:,%s:%s:/bin/sh",
cygheap->user.name (),
cygheap->user.name () ?: "",
(!user_shared->cb || myself->uid == ILLEGAL_UID)
? UNKNOWN_UID : myself->uid,
!user_shared->cb ? UNKNOWN_GID : myself->gid,