ssh-agent.exe and ssh-add.exe code updated and fixed to work in Windows.
For convenience of users, ssh-agent.exe starts a cmd shell with the
"SSH_AUTH_SOCK" and "SSH_AGENT_PID" environment variables set.
ssh-add.exe can be run immediately from the cmd shell. 'ssh-add -L" and
"ssh-add id_rsa" and "ssh-add -d id_rsa" are 3 useful commands to list,
add and delete keys from ssh-agent cache.
Changed the code to bring back assertion popups for everyone, but turn
off assertions around the _get_osfhandle() call in allocate_sfd(). The
original port code was designed knowing that some of the passed
parameters would be invalid, but was expecting that the call would just
fail instead of generating an assert dialog. Turning off Asserts around
this call results in behavior similar to mingw.
Also, turn off Incremental Linking for ssh.exe since half the time, the
linker would trap on this project.
Lot of code had to be redone as scp.exe contains both the scp client and
scp server in the same binary working in Windows needs various file
system access related changes. sshd_config file needs to add "scp"
subsystem path like we do for sftp server.
Negative of an unsigned value should just be the two's complement. Add
code to change code with negative unsigned values to two's compliment
values if compiling under visual studio.
Console API is now used for interactive tty mode. Thus ssh.exe client
can now pass each character to remote side as one types so that programs
like more works correctly. Control-c now will stop the remote program
instead of exiting the ssh.exe.
Fixes issues like cmd.exe shell not handling backspace, control-c.
Control-c is still a work in progress and will be fixed but backspace
processing works. This work when complete will make cmd.exe shell and
powershell work better for interactive users.
Pty mode code added so that sshd server can do remote echo, backspace
processing. etc and ssh.exe client does not have to do local echo. We
can enrich it in future for more features and allowing programs like
powershell to run interactive. Pty mode is central for interactive use
and will be built using Windows console instead of termios that
Linux/Unix uses.
pty and tty support was not enabled or working in the code. Without pty
support, ssh client was very non functional - e.g. openssh linux server
prompt would not come through. Now ssh client works much better in
interactive mode ( uses pty).
NoMachine did not finish coding child process ending detection logic.
Added the needed code so that child process handle is added to the
handles that WaitForMultipleObjects() waits for in nomachine select()
implementation in socket.c. Otherwise select() would be stuck in
read/write dectection even when the process of interest has exited.
ssh.exe client invoked underneath was not able to send password prompt
and read password from user as stdin and stdout handles were redirected
to sockets by sftp.exe ; stderr which is not redirected is used to show
prompt to users and data is read from console