The mingw make files build the umac source twice with different options.
Under visual studio, its easier if we just make a separate copy with
it's own build rules.
Missing a prototype can cause a problem if we are 64-bit and the
function is returning a pointer. Add a prototype to stop the return
value from being corrupted.
The sfds code blindly uses _get_osfhandle on values that may be file
descriptors, sockets or io handles. Under visual studio, _get_osfhandle
will call the invalid parameter handler for items that are not file
descriptors. Adding the handler allows us to call this in the same way
that mingw does. We will still get an assertion, but a prior change
sends those to stdiout instead of making the user click through a
dialog.
Functions not declared before use, are define as returning an int.
Under 64-bit this can result in corrupted pointers being returned.
Also, Visual studio doesn't like it when you use variables to declare
array sizes, static values always work though.
The original code had host file entries pointing to static memory. This
memory is freed in tilde_expand_paths. Better to xstrdup like the
original openssh code did.
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.
sshd server keeps count of characters typed on a line and will not send
backspace erase to the client if no character is there to erase on the
line even if the users is typing backspaces. This avoids erase of shell
prompt characters for visual user friendliness.
MS Win32 port & build date added in text part of version id ssh client
send to the remote sshd. sshd also shows this string via environment
variable "SSH_CLIENT_ID" . All these are allowed and encouraged by the
SSH RFC and improves usability and assists users to know what ssh
versions and vendor build they are running.
version.h file retains non win32 original code as it should; feature
added for win32 for ssh.exe to show build and date like sshd.exe rather
than a fixed date we had inserted before in version.h file.
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.
KeyObject for cipher symmetric key was being allocated improperly due to
an error in getting the key object size. Also added code to free
keyobject in the event of a key creation failure.
Problem was error data received were shown after output data. But order
should be kept to how it is received from the sshd server. Now we show
error and output data in the way we received from the sshd sever. Thus
typing "di" in place of "dir" in cmd shell will show the error message
correctly before the next shell prompt comes through.
Windows 7 improved the memory management in CNG. To support Vista we
need to manage memory for cryptographic objects ourselves. This change
adds a key object memory pointer to the cipher context and adds code to
allocate and free it along with the key handle.
ssh_digest_start was using a pointer to the algorithm handle instead of
the algorithm handle itself in the BCryptGetProperty call. It was also
querying for the hash length when it should have been querying for the
hash object length.
Typically LF is sent when Return key is hit. But for sshd servers that
sent us via ANSI escape sequence that CRLF is to be sent, ssh.exe client
will do so which is used commonly used by sshd servers in Windows - like
our own win32 port sshd.
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.
CAUTION: untested as my openssl installation has gone insane.
If the incoming "hScreen" parameter is NULL, a new PSCREEN_RECORD is
allocated to use in its place.
However, if the allocation of the "pScreenBuf" member variable fails,
the function returns, potentially leaking the newly allocated
PSCREEN_RECORD.
This fix first checks to see if the functions owns the "pScreenRec", and
if so, frees it before returning.
There shouldn't be any "*" when entering a password or passphrase for
better security. Linux/Unix openssh works the same way - without any
"*". Great suggestion by Mark Hahnel in comments of Issue #5
This was not implemented before in Win32. !takes to the windows shell
and !command runs the command in Windows shell. exit brings the user
back to sftp like in Linux/Unix shell.