IPC env var and handle used by sshd is made unavailable to shell/subsystem

sshd.exe uses SSHD_REMSOC env var as private IPC for remote socket
handle passing. The env var is deleted and the handle is made not
inheritable by sshd so that shell and subsystem do not see it or have
access to the handle.
This commit is contained in:
quamrulmina 2015-10-31 17:07:07 -05:00
parent 3ab9c8f055
commit e918f7c731

4
sshd.c
View File

@ -2809,6 +2809,10 @@ main(int ac, char **av)
remotesochandle = atoi( getenv("SSHD_REMSOC") );
sock_in = sock_out = newsock = allocate_sfd(remotesochandle) ; //si.hStdInput);
// we have the socket handle, delete it for child processes we create like shell
SetEnvironmentVariable("SSHD_REMSOC", NULL);
SetHandleInformation(remotesochandle, HANDLE_FLAG_INHERIT, 0); // make the handle not to be inherited
/*
* We don't have a startup_pipe