OSDN Git Service

Revert accidental previous login.
authorcorinna <corinna>
Tue, 28 Sep 2010 14:49:31 +0000 (14:49 +0000)
committercorinna <corinna>
Tue, 28 Sep 2010 14:49:31 +0000 (14:49 +0000)
winsup/cygwin/ChangeLog
winsup/cygwin/Makefile.in
winsup/cygwin/autoload.cc
winsup/cygwin/mount.cc
winsup/cygwin/passwd.cc
winsup/cygwin/shared.cc
winsup/cygwin/uinfo.cc

index 4802201..d260e2d 100644 (file)
@@ -1,5 +1,9 @@
 2010-09-28  Corinna Vinschen  <corinna@vinschen.de>
 
+       Revert accidental previous login.
+
+2010-09-28  Corinna Vinschen  <corinna@vinschen.de>
+
        * 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
index 558b8f1..10743ea 100644 (file)
@@ -130,7 +130,7 @@ EXTRA_OFILES:=
 
 MALLOC_OFILES:=@MALLOC_OFILES@
 
-DLL_IMPORTS:=$(w32api_lib)/libkernel32.a $(w32api_lib)/libntdll.a
+DLL_IMPORTS:=$(w32api_lib)/libadvapi32.a $(w32api_lib)/libkernel32.a $(w32api_lib)/libntdll.a
 
 MT_SAFE_OBJECTS:=
 # Please maintain this list in sorted order, with maximum files per 86 col line
index c03e4cd..c034db5 100644 (file)
@@ -305,77 +305,6 @@ wsock_init ()
 
 LoadDLLprime (ws2_32, _wsock_init)
 
-LoadDLLfunc (AccessCheck, 32, advapi32)
-LoadDLLfunc (AddAccessAllowedAce, 16, advapi32)
-LoadDLLfunc (AddAccessDeniedAce, 16, advapi32)
-LoadDLLfunc (AddAce, 20, advapi32)
-LoadDLLfunc (AllocateLocallyUniqueId, 4, advapi32)
-LoadDLLfunc (CopySid, 12, advapi32)
-LoadDLLfunc (CreateProcessAsUserW, 44, advapi32)
-LoadDLLfunc (CryptAcquireContextA, 20, advapi32)
-LoadDLLfunc (CryptGenRandom, 12, advapi32)
-LoadDLLfunc (CryptReleaseContext, 8, advapi32)
-LoadDLLfunc (DeregisterEventSource, 4, advapi32)
-LoadDLLfunc (DuplicateTokenEx, 24, advapi32)
-LoadDLLfunc (EqualPrefixSid, 8, advapi32)
-LoadDLLfunc (EqualSid, 8, advapi32)
-LoadDLLfunc (FindFirstFreeAce, 8, advapi32)
-LoadDLLfunc (GetAce, 12, advapi32)
-LoadDLLfunc (GetKernelObjectSecurity, 20, advapi32)
-LoadDLLfunc (GetLengthSid, 4, advapi32)
-LoadDLLfunc (GetSecurityDescriptorDacl, 16, advapi32)
-LoadDLLfunc (GetSecurityDescriptorGroup, 12, advapi32)
-LoadDLLfunc (GetSecurityDescriptorOwner, 12, advapi32)
-LoadDLLfunc (GetSecurityInfo, 32, advapi32)
-LoadDLLfunc (GetSidIdentifierAuthority, 4, advapi32)
-LoadDLLfunc (GetSidSubAuthority, 8, advapi32)
-LoadDLLfunc (GetSidSubAuthorityCount, 4, advapi32)
-LoadDLLfunc (GetTokenInformation, 20, advapi32)
-LoadDLLfunc (GetUserNameW, 8, advapi32)
-LoadDLLfunc (ImpersonateLoggedOnUser, 4, advapi32)
-LoadDLLfunc (ImpersonateNamedPipeClient, 4, advapi32)
-LoadDLLfunc (InitializeAcl, 12, advapi32)
-LoadDLLfunc (InitializeSecurityDescriptor, 8, advapi32)
-LoadDLLfunc (InitializeSid, 12, advapi32)
-LoadDLLfunc (LogonUserW, 24, advapi32)
-LoadDLLfunc (LookupAccountNameW, 28, advapi32)
-LoadDLLfunc (LookupAccountSidA, 28, advapi32)
-LoadDLLfunc (LookupAccountSidW, 28, advapi32)
-LoadDLLfunc (LsaClose, 4, advapi32)
-LoadDLLfunc (LsaEnumerateAccountRights, 16, advapi32)
-LoadDLLfunc (LsaFreeMemory, 4, advapi32)
-LoadDLLfunc (LsaNtStatusToWinError, 4, advapi32)
-LoadDLLfunc (LsaOpenPolicy, 16, advapi32)
-LoadDLLfunc (LsaRetrievePrivateData, 12, advapi32)
-LoadDLLfunc (LsaStorePrivateData, 12, advapi32)
-LoadDLLfunc (MakeSelfRelativeSD, 12, advapi32)
-LoadDLLfunc (OpenProcessToken, 12, advapi32)
-LoadDLLfunc (OpenThreadToken, 16, advapi32)
-LoadDLLfunc (PrivilegeCheck, 12, advapi32)
-LoadDLLfunc (RegCloseKey, 4, advapi32)
-LoadDLLfunc (RegCreateKeyExA, 36, advapi32)
-LoadDLLfunc (RegCreateKeyExW, 36, advapi32)
-LoadDLLfunc (RegDeleteKeyA, 8, advapi32)
-LoadDLLfunc (RegDeleteValueA, 8, advapi32)
-LoadDLLfunc (RegEnumKeyExW, 32, advapi32)
-LoadDLLfunc (RegEnumValueW, 32, advapi32)
-LoadDLLfunc (RegGetKeySecurity, 16, advapi32)
-LoadDLLfunc (RegLoadKeyW, 12, advapi32)
-LoadDLLfunc (RegOpenKeyExA, 20, advapi32)
-LoadDLLfunc (RegOpenKeyExW, 20, advapi32)
-LoadDLLfunc (RegQueryInfoKeyA, 48, advapi32)
-LoadDLLfunc (RegQueryValueExA, 24, advapi32)
-LoadDLLfunc (RegQueryValueExW, 24, advapi32)
-LoadDLLfunc (RegSetValueExA, 24, advapi32)
-LoadDLLfunc (RegSetValueExW, 24, advapi32)
-LoadDLLfunc (RegisterEventSourceA, 8, advapi32)
-LoadDLLfunc (ReportEventA, 36, advapi32)
-LoadDLLfunc (RevertToSelf, 0, advapi32)
-LoadDLLfunc (SetSecurityDescriptorDacl, 16, advapi32)
-LoadDLLfunc (SetSecurityDescriptorGroup, 12, advapi32)
-LoadDLLfunc (SetSecurityDescriptorOwner, 12, advapi32)
-LoadDLLfunc (SetTokenInformation, 16, advapi32)
-
 LoadDLLfuncEx2 (DnsQuery_A, 24, dnsapi, 1, 127) // ERROR_PROC_NOT_FOUND
 LoadDLLfuncEx (DnsRecordListFree, 8, dnsapi, 1)
 
index 95494c5..b862b5b 100644 (file)
@@ -467,8 +467,7 @@ mount_info::init ()
   pathend = wcpcpy (pathend, L"\\etc\\fstab");
 
   from_fstab (false, path, pathend);
-  if (cygheap->user.name () && *cygheap->user.name ())
-    from_fstab (true, path, pathend);
+  from_fstab (true, path, pathend);
 
   if (!got_usr_bin || !got_usr_lib)
     {
index 2375624..8c51c22 100644 (file)
@@ -66,8 +66,7 @@ pwdgrp::read_passwd ()
   if (!user_shared->cb || myself->uid == ILLEGAL_UID)
     searchentry = !internal_getpwsid (tu);
   if (searchentry
-      && (!cygheap->user.name ()
-         || !(pw = internal_getpwnam (cygheap->user.name ()))
+      && (!(pw = internal_getpwnam (cygheap->user.name ()))
          || !user_shared->cb
          || (myself->uid != ILLEGAL_UID
              && myself->uid != (__uid32_t) pw->pw_uid
@@ -76,7 +75,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,
index 5118b43..10d03b0 100644 (file)
@@ -312,6 +312,7 @@ user_info::initialize ()
   spinlock sversion (version, CURR_USER_MAGIC);
   if (!sversion)
     {
+      cb =  sizeof (*user_shared);
       cygpsid sid (cygheap->user.sid ());
       struct passwd *pw = internal_getpwsid (sid);
       /* Correct the user name with what's defined in /etc/passwd before
@@ -319,7 +320,6 @@ user_info::initialize ()
       if (pw)
        cygheap->user.set_name (pw->pw_name);
       mountinfo.init ();       /* Initialize the mount table.  */
-      cb = sizeof (*user_shared);
     }
   else if (sversion != CURR_USER_MAGIC)
     sversion.multiple_cygwin_problem ("user shared memory version", version,
index 8ea3e1a..60db38e 100644 (file)
@@ -38,16 +38,14 @@ void
 cygheap_user::init ()
 {
   WCHAR user_name[UNLEN + 1];
-  DWORD user_name_len;
+  DWORD user_name_len = UNLEN + 1;
 
-  user_name_len = GetEnvironmentVariableW (L"USERNAME", user_name, UNLEN + 1);
-  if (user_name_len)
-    {
-      user_name[UNLEN] = L'\0';
-      char mb_user_name[user_name_len = sys_wcstombs (NULL, 0, user_name)];
-      sys_wcstombs (mb_user_name, user_name_len, user_name);
-      set_name (mb_user_name);
-    }
+  if (!GetUserNameW (user_name, &user_name_len))
+    wcpcpy (user_name, L"unknown");
+
+  char mb_user_name[user_name_len = sys_wcstombs (NULL, 0, user_name)];
+  sys_wcstombs (mb_user_name, user_name_len, user_name);
+  set_name (mb_user_name);
 
   DWORD siz;
   PSECURITY_DESCRIPTOR psd;
@@ -98,29 +96,10 @@ internal_getlogin (cygheap_user &user)
 {
   struct passwd *pw = NULL;
 
-  /* Handle a border case.  If neither $USERNAME, nor /etc/passwd exists,
-     we tryto fetch the username from the system now. */
-  if (!user.name () || !*user.name ())
-    {
-      WCHAR user_name[UNLEN + 1];
-      DWORD user_name_len = UNLEN + 1;
-
-      if (GetUserNameW (user_name, &user_name_len))
-       {
-         char mb_user_name[user_name_len = sys_wcstombs (NULL, 0, user_name)];
-         sys_wcstombs (mb_user_name, user_name_len, user_name);
-         user.set_name (mb_user_name);
-       }
-      else
-       user.set_name ("unknown");
-    }
-  else
-    {
-      cygpsid psid = user.sid ();
-      pw = internal_getpwsid (psid);
-    }
+  cygpsid psid = user.sid ();
+  pw = internal_getpwsid (psid);
 
-  if (!pw && !(pw = internal_getpwnam (user.name (), true))
+  if (!pw && !(pw = internal_getpwnam (user.name ()))
       && !(pw = internal_getpwuid (DEFAULT_UID)))
     debug_printf ("user not found in augmented /etc/passwd");
   else