* uinfo.cc (internal_getlogin): Try evaluating user by SID even if

ntsec is off.
	(uinfo_init): Set primary group even if ntsec is off.
This commit is contained in:
Corinna Vinschen 2002-02-10 11:15:56 +00:00
parent ba2ca6ae2b
commit 39b553b8f0
2 changed files with 90 additions and 84 deletions

View File

@ -1,3 +1,10 @@
2002-02-10 Corinna Vinschen <corinna@vinschen.de>
Patch suggested by Pierre A. Humblet <Pierre.Humblet@ieee.org>:
* uinfo.cc (internal_getlogin): Try evaluating user by SID even if
ntsec is off.
(uinfo_init): Set primary group even if ntsec is off.
2002-02-09 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/grp.h: New file.

View File

@ -127,13 +127,11 @@ internal_getlogin (cygheap_user &user)
NetApiBufferFree (ui);
}
if (allow_ntsec)
{
HANDLE ptok = user.token; /* Which is INVALID_HANDLE_VALUE if no
impersonation took place. */
DWORD siz;
cygsid tu;
int ret = 0;
ret = 0;
/* Try to get the SID either from already impersonated token
or from current process first. To differ that two cases is
@ -210,8 +208,9 @@ internal_getlogin (cygheap_user &user)
&& user.token == INVALID_HANDLE_VALUE)
CloseHandle (ptok);
}
}
debug_printf ("Cygwins Username: %s", user.name ());
if (!pw)
pw = getpwnam(user.name ());
if (!getenv ("HOME"))
@ -256,9 +255,9 @@ uinfo_init ()
if ((p = internal_getlogin (cygheap->user)) != NULL)
{
myself->uid = p->pw_uid;
/* Set primary group only if ntsec is off or the process has been
started from a non cygwin process. */
if (!allow_ntsec || myself->ppid == 1)
/* Set primary group only if process has been started from a
non cygwin process. */
if (myself->ppid == 1)
myself->gid = p->pw_gid;
}
else