* uinfo.cc (internal_getlogin): Return pointer to struct passwd.
(uinfo_init): Accommodate the above change. * syscalls.cc (seteuid): Ditto.
This commit is contained in:
parent
d551169a9f
commit
feae8d0eab
@ -1,3 +1,9 @@
|
||||
2001-04-25 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
|
||||
|
||||
* uinfo.cc (internal_getlogin): Return pointer to struct passwd.
|
||||
(uinfo_init): Accommodate the above change.
|
||||
* syscalls.cc (seteuid): Ditto.
|
||||
|
||||
Tue Apr 25 11:08:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* autoload.cc: Add LoadDLLfunc statements for SetTokenInformation@16.
|
||||
|
@ -1945,7 +1945,7 @@ setuid (uid_t uid)
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern const char *internal_getlogin (cygheap_user &user);
|
||||
extern struct passwd *internal_getlogin (cygheap_user &user);
|
||||
|
||||
/* seteuid: standards? */
|
||||
extern "C" int
|
||||
@ -2015,7 +2015,7 @@ seteuid (uid_t uid)
|
||||
retrieving user's SID. */
|
||||
user.token = cygheap->user.impersonated ? cygheap->user.token
|
||||
: INVALID_HANDLE_VALUE;
|
||||
struct passwd *pw_cur = getpwnam (internal_getlogin (user));
|
||||
struct passwd *pw_cur = internal_getlogin (user);
|
||||
if (pw_cur != pw_new)
|
||||
{
|
||||
debug_printf ("Diffs!!! token: %d, cur: %d, new: %d, orig: %d",
|
||||
|
@ -26,11 +26,12 @@ details. */
|
||||
#include "registry.h"
|
||||
#include "security.h"
|
||||
|
||||
const char *
|
||||
struct passwd *
|
||||
internal_getlogin (cygheap_user &user)
|
||||
{
|
||||
char username[MAX_USER_NAME];
|
||||
DWORD username_len = MAX_USER_NAME;
|
||||
struct passwd *pw = NULL;
|
||||
|
||||
if (!user.name ())
|
||||
if (!GetUserName (username, &username_len))
|
||||
@ -153,7 +154,6 @@ internal_getlogin (cygheap_user &user)
|
||||
cygsid gsid (NULL);
|
||||
if (ret)
|
||||
{
|
||||
struct passwd *pw;
|
||||
cygsid psid;
|
||||
|
||||
if (!strcasematch (user.name (), "SYSTEM")
|
||||
@ -194,7 +194,7 @@ internal_getlogin (cygheap_user &user)
|
||||
}
|
||||
}
|
||||
debug_printf ("Cygwins Username: %s", user.name ());
|
||||
return user.name ();
|
||||
return pw ?: getpwnam(user.name ());
|
||||
}
|
||||
|
||||
void
|
||||
@ -212,7 +212,7 @@ uinfo_init ()
|
||||
/* If uid is USHRT_MAX, the process is started from a non cygwin
|
||||
process or the user context was changed in spawn.cc */
|
||||
if (myself->uid == USHRT_MAX)
|
||||
if ((p = getpwnam (internal_getlogin (cygheap->user))) != NULL)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user