This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Win98/ME home directory


Corinna

This fixes the Win98 home directory issue reported on the cygwin
list. It affects most Win98/ME users that don't have a passwd entry
for their Windows username, so it may be worth making a special
release. Sorry about that.
There is a related fix: cygheap->user.name is now set properly
on Win98/Me when the Windows and Cygwin usernames differ.

Also, looking at the output of mkpasswd on Win9X made me think
it would be more secure to set the passwd field to *.

Pierre

2002-11-24  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 ().
	


--- passwd.cc.orig      2002-11-24 11:40:44.000000000 -0500
+++ passwd.cc   2002-11-24 15:48:24.000000000 -0500
@@ -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 &&
--- uinfo.cc.orig       2002-11-24 09:31:20.000000000 -0500
+++ uinfo.cc    2002-11-24 16:08:04.000000000 -0500
@@ -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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]