diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2002-11-25 15:11:39 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2002-11-25 15:11:39 +0000 |
commit | efcaf0426a406b43799cc899e3d6bd00d0f777e1 (patch) | |
tree | d09565e3f6bd5281ae5382ef1c580ddfc25b4ae7 | |
parent | f1da8a066438b2323253e11b10a4037205c1b3c2 (diff) | |
download | newlib-efcaf0426a406b43799cc899e3d6bd00d0f777e1.zip newlib-efcaf0426a406b43799cc899e3d6bd00d0f777e1.tar.gz newlib-efcaf0426a406b43799cc899e3d6bd00d0f777e1.tar.bz2 |
* passwd.cc (read_etc_passwd): Never add an entry when starting
on Win95/98/ME if a default entry is present.
* uinfo.cc (internal_getlogin): Look for the default uid if needed.
Always call user.set_name ().
-rw-r--r-- | winsup/cygwin/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/cygwin/passwd.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/uinfo.cc | 9 |
3 files changed, 14 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 53caea2..8c00bd3 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2002-11-25 Pierre Humblet <pierre.humblet@ieee.org> + + * passwd.cc (read_etc_passwd): Never add an entry when starting + on Win95/98/ME if a default entry is present. + * uinfo.cc (internal_getlogin): Look for the default uid if needed. + Always call user.set_name (). + 2002-11-25 Corinna Vinschen <corinna@vinschen.de> * sec_acl.cc (getacl): Set errno to ENOSPC if command is GETACL and diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index ae96282..3677f8d 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -198,6 +198,8 @@ read_etc_passwd () && (searchentry = !internal_getpwsid (tu))) default_uid = DEFAULT_UID_NT; } + else if (myself->uid == ILLEGAL_UID) + searchentry = !search_for (DEFAULT_UID, NULL); if (searchentry && (!(pw = search_for (0, cygheap->user.name ())) || (myself->uid != ILLEGAL_UID && diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index f445649..8dec58e 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -61,20 +61,21 @@ internal_getlogin (cygheap_user &user) from the Windows user name */ if (ret) { - if ((pw = internal_getpwsid (tu))) - user.set_name (pw->pw_name); + pw = internal_getpwsid (tu); /* Set token owner to the same value as token user */ if (!SetTokenInformation (ptok, TokenOwner, &tu, sizeof tu)) debug_printf ("SetTokenInformation(TokenOwner): %E"); } } - if (!pw && !(pw = getpwnam (user.name ()))) - debug_printf("user name not found in augmented /etc/passwd"); + if (!pw && !(pw = getpwnam (user.name ())) + && !(pw = getpwuid32 (DEFAULT_UID))) + debug_printf("user not found in augmented /etc/passwd"); else { myself->uid = pw->pw_uid; myself->gid = pw->pw_gid; + user.set_name (pw->pw_name); if (wincap.has_security ()) { cygsid gsid; |