For now we avoid sending the 4 arrow keys to the shell or echo it to the
remote side. as cmd.exe or powershell does not process it correctly in
stream output device mode we run win32 sshd server.
This is needed so that sftp running after a ssh session from a Linux
client does not see two lines for each line typed. CRLF is set by win32
sshd server but we have to set mode to the previous way in the client
when an interactive session has ended.
Add a utility upon which every other project is dependent, to copy the
config.h.vs file to the source root config.h. Because the target may
have changed outside of visual studio, I have disabled the dependency
check so the file will be copied with every build..
Doing so will allow sshd.exe to be launched from any directory - thereby
enabling sshd to be launched from SCM. With this change - following
works:
- sshd.exe install
- net start sshd
- net stop sshd
- sshd.exe uninstall
Use new compile flag WIN32_VS to add/change logic of sftp client and
sftp server codes so that MS Visual Studio 2015 compiler and runtime can
be used. opendir(), readdir(), closedir() directory APIs and basename()
API of Unix/Linux are implemented in Windows as they are not available
in Windows/VisualStudio C-runtime. win32_dirent.c and win32_dirent.h
files added as dirent.c and dirent.h are not available in Windows and we
do not want to affect mingW/gcc builds for Windows which have those
files available.
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.