* 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:
parent
ba2ca6ae2b
commit
39b553b8f0
|
@ -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>
|
2002-02-09 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* include/cygwin/grp.h: New file.
|
* include/cygwin/grp.h: New file.
|
||||||
|
|
|
@ -127,13 +127,11 @@ internal_getlogin (cygheap_user &user)
|
||||||
NetApiBufferFree (ui);
|
NetApiBufferFree (ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allow_ntsec)
|
|
||||||
{
|
|
||||||
HANDLE ptok = user.token; /* Which is INVALID_HANDLE_VALUE if no
|
HANDLE ptok = user.token; /* Which is INVALID_HANDLE_VALUE if no
|
||||||
impersonation took place. */
|
impersonation took place. */
|
||||||
DWORD siz;
|
DWORD siz;
|
||||||
cygsid tu;
|
cygsid tu;
|
||||||
int ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
/* Try to get the SID either from already impersonated token
|
/* Try to get the SID either from already impersonated token
|
||||||
or from current process first. To differ that two cases is
|
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)
|
&& user.token == INVALID_HANDLE_VALUE)
|
||||||
CloseHandle (ptok);
|
CloseHandle (ptok);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
debug_printf ("Cygwins Username: %s", user.name ());
|
debug_printf ("Cygwins Username: %s", user.name ());
|
||||||
|
|
||||||
if (!pw)
|
if (!pw)
|
||||||
pw = getpwnam(user.name ());
|
pw = getpwnam(user.name ());
|
||||||
if (!getenv ("HOME"))
|
if (!getenv ("HOME"))
|
||||||
|
@ -256,9 +255,9 @@ uinfo_init ()
|
||||||
if ((p = internal_getlogin (cygheap->user)) != NULL)
|
if ((p = internal_getlogin (cygheap->user)) != NULL)
|
||||||
{
|
{
|
||||||
myself->uid = p->pw_uid;
|
myself->uid = p->pw_uid;
|
||||||
/* Set primary group only if ntsec is off or the process has been
|
/* Set primary group only if process has been started from a
|
||||||
started from a non cygwin process. */
|
non cygwin process. */
|
||||||
if (!allow_ntsec || myself->ppid == 1)
|
if (myself->ppid == 1)
|
||||||
myself->gid = p->pw_gid;
|
myself->gid = p->pw_gid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue