mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-03-01 12:35:44 +08:00
* spawn.cc (spawn_guts): More hToken removal cleanup.
This commit is contained in:
parent
2fbf4a7f36
commit
077d8b23c8
@ -1,3 +1,7 @@
|
|||||||
|
2002-06-11 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* spawn.cc (spawn_guts): More hToken removal cleanup.
|
||||||
|
|
||||||
2002-06-09 Pierre Humblet <pierre.humblet@ieee.org>
|
2002-06-09 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
* spawn.cc (spawn_guts): Define sec_attribs and call sec_user_nih()
|
* spawn.cc (spawn_guts): Define sec_attribs and call sec_user_nih()
|
||||||
|
@ -654,10 +654,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
since it's value is needed by `sec_user'. */
|
since it's value is needed by `sec_user'. */
|
||||||
PSECURITY_ATTRIBUTES sec_attribs = sec_user_nih (sa_buf, sid);
|
PSECURITY_ATTRIBUTES sec_attribs = sec_user_nih (sa_buf, sid);
|
||||||
|
|
||||||
/* Remove impersonation */
|
RevertToSelf ();
|
||||||
if (cygheap->user.impersonated
|
|
||||||
&& cygheap->user.token != INVALID_HANDLE_VALUE)
|
|
||||||
RevertToSelf ();
|
|
||||||
|
|
||||||
/* Load users registry hive. */
|
/* Load users registry hive. */
|
||||||
load_registry_hive (sid);
|
load_registry_hive (sid);
|
||||||
@ -694,9 +691,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
|||||||
&pi);
|
&pi);
|
||||||
/* Restore impersonation. In case of _P_OVERLAY this isn't
|
/* Restore impersonation. In case of _P_OVERLAY this isn't
|
||||||
allowed since it would overwrite child data. */
|
allowed since it would overwrite child data. */
|
||||||
if (mode != _P_OVERLAY
|
if (mode != _P_OVERLAY)
|
||||||
&& cygheap->user.impersonated
|
|
||||||
&& cygheap->user.token != INVALID_HANDLE_VALUE)
|
|
||||||
ImpersonateLoggedOnUser (cygheap->user.token);
|
ImpersonateLoggedOnUser (cygheap->user.token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1189,45 +1189,45 @@ access (const char *fn, int flags)
|
|||||||
{
|
{
|
||||||
if (st.st_uid == myself->uid)
|
if (st.st_uid == myself->uid)
|
||||||
{
|
{
|
||||||
if (! (st.st_mode & S_IRUSR))
|
if (!(st.st_mode & S_IRUSR))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
else if (st.st_gid == myself->gid)
|
else if (st.st_gid == myself->gid)
|
||||||
{
|
{
|
||||||
if (! (st.st_mode & S_IRGRP))
|
if (!(st.st_mode & S_IRGRP))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
else if (! (st.st_mode & S_IROTH))
|
else if (!(st.st_mode & S_IROTH))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (flags & W_OK)
|
if (flags & W_OK)
|
||||||
{
|
{
|
||||||
if (st.st_uid == myself->uid)
|
if (st.st_uid == myself->uid)
|
||||||
{
|
{
|
||||||
if (! (st.st_mode & S_IWUSR))
|
if (!(st.st_mode & S_IWUSR))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
else if (st.st_gid == myself->gid)
|
else if (st.st_gid == myself->gid)
|
||||||
{
|
{
|
||||||
if (! (st.st_mode & S_IWGRP))
|
if (!(st.st_mode & S_IWGRP))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
else if (! (st.st_mode & S_IWOTH))
|
else if (!(st.st_mode & S_IWOTH))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (flags & X_OK)
|
if (flags & X_OK)
|
||||||
{
|
{
|
||||||
if (st.st_uid == myself->uid)
|
if (st.st_uid == myself->uid)
|
||||||
{
|
{
|
||||||
if (! (st.st_mode & S_IXUSR))
|
if (!(st.st_mode & S_IXUSR))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
else if (st.st_gid == myself->gid)
|
else if (st.st_gid == myself->gid)
|
||||||
{
|
{
|
||||||
if (! (st.st_mode & S_IXGRP))
|
if (!(st.st_mode & S_IXGRP))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
else if (! (st.st_mode & S_IXOTH))
|
else if (!(st.st_mode & S_IXOTH))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
r = 0;
|
r = 0;
|
||||||
@ -2006,7 +2006,7 @@ seteuid32 (__uid32_t uid)
|
|||||||
if (process_ok)
|
if (process_ok)
|
||||||
{
|
{
|
||||||
if (cygheap->user.token == INVALID_HANDLE_VALUE ||
|
if (cygheap->user.token == INVALID_HANDLE_VALUE ||
|
||||||
! cygheap->user.impersonated )
|
!cygheap->user.impersonated)
|
||||||
{
|
{
|
||||||
CloseHandle (ptok);
|
CloseHandle (ptok);
|
||||||
return 0; /* No change */
|
return 0; /* No change */
|
||||||
@ -2025,12 +2025,12 @@ seteuid32 (__uid32_t uid)
|
|||||||
{
|
{
|
||||||
/* Return if current token is valid */
|
/* Return if current token is valid */
|
||||||
if (cygheap->user.impersonated)
|
if (cygheap->user.impersonated)
|
||||||
{
|
{
|
||||||
CloseHandle (ptok);
|
CloseHandle (ptok);
|
||||||
if (!ImpersonateLoggedOnUser (cygheap->user.token))
|
if (!ImpersonateLoggedOnUser (cygheap->user.token))
|
||||||
system_printf ("Impersonating in seteuid failed: %E");
|
system_printf ("Impersonating in seteuid failed: %E");
|
||||||
return 0; /* No change */
|
return 0; /* No change */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else cygheap->user.token = INVALID_HANDLE_VALUE;
|
else cygheap->user.token = INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
@ -2076,7 +2076,7 @@ seteuid32 (__uid32_t uid)
|
|||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
/* If using the token, set info and impersonate */
|
/* If using the token, set info and impersonate */
|
||||||
if (! process_ok )
|
if (!process_ok)
|
||||||
{
|
{
|
||||||
/* If the token was explicitly created, all information has
|
/* If the token was explicitly created, all information has
|
||||||
already been set correctly. */
|
already been set correctly. */
|
||||||
|
@ -302,7 +302,7 @@ private:
|
|||||||
friend void __pthread_exit (void *value_ptr);
|
friend void __pthread_exit (void *value_ptr);
|
||||||
friend int __pthread_join (pthread_t * thread, void **return_val);
|
friend int __pthread_join (pthread_t * thread, void **return_val);
|
||||||
friend int __pthread_detach (pthread_t * thread);
|
friend int __pthread_detach (pthread_t * thread);
|
||||||
|
|
||||||
void pop_all_cleanup_handlers (void);
|
void pop_all_cleanup_handlers (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -395,12 +395,12 @@ public:
|
|||||||
void Init (int);
|
void Init (int);
|
||||||
void fixup_after_fork (void);
|
void fixup_after_fork (void);
|
||||||
|
|
||||||
MTinterface ():reent_index (0), indexallocated (0), threadcount (1)
|
MTinterface ():reent_index (0), indexallocated (0), threadcount (1)
|
||||||
{
|
{
|
||||||
pthread_prepare = NULL;
|
pthread_prepare = NULL;
|
||||||
pthread_child = NULL;
|
pthread_child = NULL;
|
||||||
pthread_parent = NULL;
|
pthread_parent = NULL;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void __pthread_atforkprepare(void);
|
void __pthread_atforkprepare(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user