* uinfo.cc (internal_getlogin): Change parameter list to reflect
that `token' is member of cygheap_user now. (uinfo_init): Use modified internal_getlogin. * syscalls.cc (seteuid): Ditto.
This commit is contained in:
parent
66c161baac
commit
cb6f4dbd0c
|
@ -1,3 +1,10 @@
|
|||
Wed Nov 15 22:08:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* uinfo.cc (internal_getlogin): Change parameter list to reflect
|
||||
that `token' is member of cygheap_user now.
|
||||
(uinfo_init): Use modified internal_getlogin.
|
||||
* syscalls.cc (seteuid): Ditto.
|
||||
|
||||
Wed Nov 15 21:56:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* cygheap.h: Move `token' and `impersonated' from class _pinfo
|
||||
|
|
|
@ -1811,7 +1811,7 @@ setuid (uid_t uid)
|
|||
return ret;
|
||||
}
|
||||
|
||||
extern const char *internal_getlogin (cygheap_user &user, HANDLE token);
|
||||
extern const char *internal_getlogin (cygheap_user &user);
|
||||
|
||||
/* seteuid: standards? */
|
||||
extern "C" int
|
||||
|
@ -1851,12 +1851,12 @@ seteuid (uid_t uid)
|
|||
}
|
||||
|
||||
cygheap_user user;
|
||||
/* token is used in internal_getlogin() to determine if
|
||||
/* user.token is used in internal_getlogin() to determine if
|
||||
impersonation is active. If so, the token is used for
|
||||
retrieving user's SID. */
|
||||
HANDLE token = cygheap->user.impersonated ? cygheap->user.token
|
||||
: INVALID_HANDLE_VALUE;
|
||||
struct passwd *pw_cur = getpwnam (internal_getlogin (user, token));
|
||||
user.token = cygheap->user.impersonated ? cygheap->user.token
|
||||
: INVALID_HANDLE_VALUE;
|
||||
struct passwd *pw_cur = getpwnam (internal_getlogin (user));
|
||||
if (pw_cur != pw_new)
|
||||
{
|
||||
debug_printf ("Diffs!!! token: %d, cur: %d, new: %d, orig: %d",
|
||||
|
|
|
@ -25,7 +25,7 @@ details. */
|
|||
#include "security.h"
|
||||
|
||||
const char *
|
||||
internal_getlogin (cygheap_user &user, HANDLE token)
|
||||
internal_getlogin (cygheap_user &user)
|
||||
{
|
||||
char username[MAX_USER_NAME];
|
||||
DWORD username_len = MAX_USER_NAME;
|
||||
|
@ -108,8 +108,8 @@ internal_getlogin (cygheap_user &user, HANDLE token)
|
|||
}
|
||||
if (allow_ntsec)
|
||||
{
|
||||
HANDLE ptok = token; /* Which is INVALID_HANDLE_VALUE if no
|
||||
impersonation took place. */
|
||||
HANDLE ptok = user.token; /* Which is INVALID_HANDLE_VALUE if no
|
||||
impersonation took place. */
|
||||
DWORD siz;
|
||||
char tu[1024];
|
||||
int ret = 0;
|
||||
|
@ -127,7 +127,8 @@ internal_getlogin (cygheap_user &user, HANDLE token)
|
|||
else if (!(ret = user.set_sid (((TOKEN_USER *) &tu)->User.Sid)))
|
||||
debug_printf ("Couldn't retrieve SID from access token!");
|
||||
/* Close token only if it's a result from OpenProcessToken(). */
|
||||
if (ptok != INVALID_HANDLE_VALUE && token == INVALID_HANDLE_VALUE)
|
||||
if (ptok != INVALID_HANDLE_VALUE
|
||||
&& user.token == INVALID_HANDLE_VALUE)
|
||||
CloseHandle (ptok);
|
||||
|
||||
/* If that failes, try to get the SID from localhost. This can only
|
||||
|
@ -190,8 +191,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,
|
||||
INVALID_HANDLE_VALUE))) != NULL)
|
||||
if ((p = getpwnam (internal_getlogin (cygheap->user))) != NULL)
|
||||
{
|
||||
myself->uid = p->pw_uid;
|
||||
myself->gid = p->pw_gid;
|
||||
|
|
Loading…
Reference in New Issue