Commit Graph

96 Commits

Author SHA1 Message Date
dkulwin 2367dca1e9 Disable invalid parameter handler use under mingw
Mingw doesn't support the invalid parameter handler function in the same
way as visual studio.  Shouldn't be needed under mingw anyway.
2015-11-05 15:01:12 -06:00
manojampalam 9fa44f0777 Merge pull request #22 from noshbar/L1
Fix potential memory leak in win32/console.c
2015-11-05 12:26:22 -08:00
dkulwin 44510dc67e Back out kerberos prototype changes
Looks like the changes work for visual studio, but broke mingw.
2015-11-05 14:03:33 -06:00
dkulwin 99a38147f7 Updated Readme
Updated with new paths
2015-11-05 13:16:02 -06:00
dkulwin 095ae850aa path updates for visual studio solution
Added specific paths for different configurations of OpenSSL instead of
assuming a tree with all four.
2015-11-05 13:03:03 -06:00
dkulwin 7bd7008792 Add Visual Studio 2015 solution and projects
Add the solution, projects and filter files for building Win32-OpenSSH
binaries under visual studio 2015.
2015-11-04 19:34:21 -06:00
dkulwin ea18785a19 Add a copy of umac for 128 bit variant
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.
2015-11-04 19:34:20 -06:00
dkulwin 3bc857c8fe Function prototype to support 64-bit
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.
2015-11-04 19:34:19 -06:00
dkulwin 3bbefb6078 Add #ifdefs around #defines
In order to avoid redefinition warnings, check before we define.
2015-11-04 19:34:19 -06:00
dkulwin 5fd03ec459 Add some missing headers and defines to support visual studio
Visual studio compatibility changes.
2015-11-04 19:34:18 -06:00
dkulwin 11561cd62a add an invalid parameter handler to catch _get_osfhandle failures under visual studio
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.
2015-11-04 19:34:17 -06:00
dkulwin 58d15ecb9a Add usleep call for visual studio
usleep isn't part of standard windows, so we add a version of it based
on Sleep();
2015-11-04 19:34:17 -06:00
dkulwin 2454a18404 whitespace after \ causes visual studio to not parse as a line continuation
Make the file work better in visual studio
2015-11-04 19:34:16 -06:00
dkulwin 39706fca9c Add code to stop asserts from tossing up dialogs
Assert dialogs can be a problem when running as a service.  This change
instructs assert info to be sent to stdout instead of a dialog.
2015-11-04 19:34:15 -06:00
dkulwin 25e52cb498 Add prototypes for functions returning pointers and modify how some arrays are defined
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.
2015-11-04 19:34:15 -06:00
dkulwin c2c272eaf1 Use xstrdup instead of static memory assignment to avoid a problem when we try to free
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.
2015-11-04 19:34:14 -06:00
dkulwin 319d1bb581 Add cast for GetProcAddress return
GetProcAddress returns a FARPROC, *, but compiler likes it better if you
give a proper cast to the function value.
2015-11-04 19:34:13 -06:00
dkulwin 27739d90ed #if out setting of compress hooks if not using ZLIB
We shouldn't even try to call ssh_packet_set_compress_hooks if zlib
isn't enabled.  This change conditionally compiles it out.
2015-11-04 19:34:13 -06:00
dkulwin ddace27b97 VC2015 doesn't like it when you take a negative of on unsigned value
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.
2015-11-04 19:34:12 -06:00
quamrulmina bf2766ba2d Fix sshd server to not send back space erase when no character in the line
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.
2015-11-04 17:10:40 -06:00
arif-pragmasys 9ec4bf235c Linux build compatible
Same source builds both in Linux and windows
2015-11-04 16:15:04 -06:00
quamrulmina 7683cc1f65 ssh -V does not need to show the time of build, date is sufficient
Take out ___TIME___  and show ___DATE___ in win32 port as both were
win32 enhancements.
2015-11-02 00:43:09 -06:00
quamrulmina 484bab654b Identify ssh client version with more info and sshd server shows it by an env var
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.
2015-11-01 01:25:19 -06:00
quamrulmina 6c4fc9c4c5 version.h file uses WIN32_FIXME and ssh.exe client shows build & date
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.
2015-10-31 17:47:41 -05:00
quamrulmina e918f7c731 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.
2015-10-31 17:07:07 -05:00
dkulwin 3ab9c8f055 fix bug in cng cipher keyobject processing
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.
2015-10-31 12:06:18 -05:00
quamrulmina fad3c4ffc6 Fixed ssh client problem of showing error outputs correctly
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.
2015-10-30 19:36:26 -05:00
dkulwin bc6871e862 Add CNG manual memory management code to support Vista
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.
2015-10-29 15:46:37 -05:00
dkulwin 728c299d67 Fix CNG hash GetProperty bug
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.
2015-10-29 15:07:09 -05:00
dkulwin c4fb7d76ee Manually manage bcrypt hash memory in order to support Vista
The CNG routines added improved memory management in windows 7.  In
order to support Vista, we need to manually manage the scratch memory
used by cng.
2015-10-29 13:08:22 -05:00
quamrulmina 889e58c056 Fix ssh client not executing shell cmd given as argument
"ssh user@host whoami" now works and will show the whoami command
output. sshd server was fine but ssh client was not working.
2015-10-28 18:11:52 -05:00
quamrulmina 3c6c8c3ca5 Fix ssh/sshd failing in Windows 7 due to a flag use in cng_digest
Avoid using BCRYPT_HASH_REUSABLE_FLAG in cng_digest.c file which was
introduced in Windows 8 and not supported in previous OS like Windows 7.
2015-10-28 15:37:02 -05:00
quamrulmina e743b54a61 Fix ssh client to generate LF or CRLF correctly
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.
2015-10-28 00:31:24 -05:00
quamrulmina d4c8ef9ac5 Improved SSH client interactive mode and fixed control-c to work
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.
2015-10-27 19:05:38 -05:00
quamrulmina 1c258ec0ae Fix control-c working in sshd server
control-c is handled correctly by sshd server and passed to shell for it
to process which usually means terminating the current program or
programs.
2015-10-26 15:19:27 -05:00
quamrulmina 1178689011 sshd pty console screen size set to what ssh client requests
Initial remote console screen size set correctly in sshd interactive
session to the value we received from the ssh client in the pty-req
request.
2015-10-25 23:54:56 -05:00
quamrulmina b56534c4a6 Microsoft Copyright message added to all new files
New files for openssh win32 port now contain MS Copyright texts.
2015-10-25 17:33:46 -05:00
quamrulmina a3d0255b69 Fix Console Insertion issue of multiple sshd interactive sessions not working
We create console for each sshd session from CONIN$ and CONOUT$ before
starting shell cmd.exe
2015-10-25 01:53:38 -05:00
quamrulmina 339912c24b Use a Console as input to drive a shell in sshd.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.
2015-10-23 19:11:29 -05:00
arif-pragmasys ce1d1340d9 cng digest code changes to replace openssl digest 2015-10-22 16:03:39 -05:00
Dirk de la Hunt 5d455454de Fix potential memory leak in console.c
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.
2015-10-22 20:04:14 +02:00
quamrulmina 89452c8a2f There shouldn't be any "*" when entering a password or passphrase
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
2015-10-20 19:23:18 -05:00
quamrulmina de4ae13f76 ssh.exe client sends current window size and TERM value when pty-req is made
This was not coded before for Win32 port. Remote sshd server is now
aware of our client's screen size and VT/ANSI TERM emulation.
2015-10-20 18:25:06 -05:00
arif-pragmasys f1d8b2e72d add temp key files to ignore list 2015-10-20 14:28:23 -05:00
arif-pragmasys 9d68c58a02 remove key files as they are generated when needed 2015-10-20 14:26:29 -05:00
arif-pragmasys e2beaa0cc1 add key files to ignore list 2015-10-20 13:51:56 -05:00
arif-pragmasys 7e326eba4a remove key files, since they are supposed to be generated as needed 2015-10-20 13:51:07 -05:00
Manoj Ampalam c636c1ec17 Merged README.md 2015-10-20 10:09:00 -07:00
quamrulmina 2cfb138bb8 Add local shell access feature in sftp.exe client
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.
2015-10-19 17:56:08 -05:00
Steve Lee 98dc596200 Update README.md 2015-10-19 12:42:39 -07:00