fhandler_pty_master::pty_master_thread: Always check for correct pid
This commit is contained in:
parent
ceab4452f1
commit
f4aaa21441
|
@ -1517,10 +1517,8 @@ fhandler_pty_slave::fixup_after_exec ()
|
||||||
|
|
||||||
A special case is when the master side of the tty is about to be closed.
|
A special case is when the master side of the tty is about to be closed.
|
||||||
The client side is the fhandler_pty_master::close function and it sends
|
The client side is the fhandler_pty_master::close function and it sends
|
||||||
a PID -1 in that case. On Vista and later a check is performed that the
|
a PID -1 in that case. A check is performed that the request to leave
|
||||||
request to leave really comes from the master process itself. On earlier
|
really comes from the master process itself.
|
||||||
OSes there's no function to check for the PID of the client process so
|
|
||||||
we have to trust the client side.
|
|
||||||
|
|
||||||
Since there's always only one pipe instance, there's a chance that clients
|
Since there's always only one pipe instance, there's a chance that clients
|
||||||
have to wait to connect to the master control pipe. Therefore the client
|
have to wait to connect to the master control pipe. Therefore the client
|
||||||
|
@ -1595,10 +1593,8 @@ fhandler_pty_master::pty_master_thread ()
|
||||||
}
|
}
|
||||||
if (req.pid == (DWORD) -1) /* Request to finish thread. */
|
if (req.pid == (DWORD) -1) /* Request to finish thread. */
|
||||||
{
|
{
|
||||||
/* Pre-Vista: Just believe in the good of the client process.
|
/* Check if the requesting process is the master process itself. */
|
||||||
Post-Vista: Check if the requesting process is the master
|
if (pid == GetCurrentProcessId ())
|
||||||
process itself. */
|
|
||||||
if (pid == (DWORD) -1 || pid == GetCurrentProcessId ())
|
|
||||||
exit = true;
|
exit = true;
|
||||||
goto reply;
|
goto reply;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue