Commit Graph

320 Commits (9b5c54cd7f991119c01d673397ef8980f7c0c5eb)

Author SHA1 Message Date
JacobBarthelmeh 0d480fa419 adjust shutdown for sending exit status cleanly 2024-01-19 09:18:41 -07:00
JacobBarthelmeh afe109acf8 client side handling of exit-status packet 2024-01-19 09:18:41 -07:00
John Safranek ec1248f14d
SFTP Test Maintenance
1. Modified SignalTcpReady() to test.h. Matched its prototype to the
   other functions for TcpReady.
2. Add a timeout in WaitTcpReady() specifically for Zephyr builds.
3. Misc few cleanups.
2024-01-03 13:24:10 -08:00
John Safranek 25a4984e59
Remove Example Server
The example server was never used. All new behaviors were added to the
echoserver only. Now with wolfSSHd, the server example can finally be
removed.

1. Remove the example server from the build.
2. Remove the file notes.md.
3. Update the readme.
2023-12-28 12:28:16 -08:00
John Safranek 948b545ad8
Release v1.4.15: Release Testing Fixes
1. Fix an instance in the example sftpclient where the size of something
   is treated as an int and may have caused trouble, per the pedantic
   compiler settings.
2. Changed a check for snprintf where we checked the lengths of
   everything before calling snprintf. Turned it around where we check
   the return of snprintf and error if the process would have output too
   much.
2023-12-22 14:43:34 -08:00
John Safranek f35cab9e86 SFTP Zero Byte Files
1. When putting a file with SFTP, the client should check that the
   requested file is a regular file based on its attributes.
 2. Add the attributes to check in the permissions.
 3. Add server checking for non-regular files and not allowing them to
    be opened for reading or writing.
2023-12-06 14:04:27 -08:00
John Safranek 9d92672931 SFTP Zero Byte Files
1. When getting a file with SFTP, the client should check that the
   requested file is a regular file based on its attributes.
2. Add the attributes to check in the permissions.
3. Add a new error for a non-regular file.
2023-12-06 14:04:27 -08:00
John Safranek 66dc60853c
Echoserver Select Timeouts
A couple changes to keep the echoserver from spin-locking.

1. The SFTP worker should wait for data if the channel window is full.
   If the client isn't sending a window adjust, it might be because of a
   human time scale issue. New timeout is 60 seconds.
2. When the echoserver is waiting for something from the user and the
   select times out, wait a second instead.
2023-10-31 10:21:44 -07:00
Juliusz Sosinowicz 37412ff50f Init zephyr support
- SSH
- SFTP
- SCP
2023-10-02 20:38:21 +02:00
JacobBarthelmeh 5780570880 limit additional nonblocking test 2023-09-29 16:12:21 -07:00
JacobBarthelmeh bbc9f9e157 add more test debug prints and better rekeying handling 2023-09-29 15:05:39 -07:00
JacobBarthelmeh a650415476
Merge pull request #582 from danielinux/fix_no_term
Fix compile errors when WOLFSSH_TERM is undefined
2023-09-25 09:45:18 -06:00
John Safranek 481c334a39
Fix No Term
1. Widened the scope of a couple of the guards for WOLFSSH_TERM.
2. Added a pthread_join for one of the threads in the example client.
2023-09-22 16:26:23 -07:00
John Safranek 5b094d6f43
Term Update
1. Change GetTerminalSize() to GetTerminalInfo().
2. Add the term variable to the things GetTerminalInfo() looks up.
3. Return the actual value of the environment variable TERM to the
   server. If one isn't present, default to "xterm".
4. Clean up the whitespace in SendChannelTerminalRequest().

Misc other changes:
1. Cleanup whitespace in the recently added function
   SendChannelOpenFail().
2. Add labels to the parameters in the prototype for
   SendChannelOpenFail().
3. Remove the CR addition for Windows in the example client. Causes the
   enter key to double-strike.
2023-09-19 11:40:23 -07:00
Daniele Lacamera 7ff76751f6 Fix compile errors when WOLFSSH_TERM is undefined 2023-09-18 08:23:30 +02:00
John Safranek 526ade03df
Linux-Semaphore
1. Made a similar change for Linux semaphores.
2. Moved the check for the quit flag in the windowMonitor.
2023-09-14 16:46:06 -07:00
John Safranek 503e1bb288
Mac-Semaphore
1. Add quit parameter to the example client's thread_args structure.
   This will be used to let the windowMonitor thread know the
   application is quitting.
2. If the windowMonitor's quit flag is set, it will exit and not call
   wait again.
3. Join the windowMonitor thread rather than cancel it.
2023-09-14 16:30:44 -07:00
John Safranek f35a92fd48
Nonblock Client Login Failure
When the example client is using non-blocking sockets, sometimes they
don't block. The monitor thread on the socket wasn't handling
WS_WANT_READ explicitly, and treated it as a fatal error. It should be
reset to WS_SUCCESS.
2023-09-13 09:26:29 -07:00
JacobBarthelmeh 57519c6a54
remove extra newline in debug message 2023-09-07 13:28:43 -06:00
JacobBarthelmeh 6e5b3c00d2 use WLOG for debug messages when checking peer IP address 2023-09-06 11:03:45 -07:00
John Safranek d4fa4ebd69
Merge branch 'master' into pull-reqs/f4021bb_All_the_filesystem-related_W_macros_accept_a_filesystem_context_pointer_as_first_parameter 2023-09-01 09:08:34 -07:00
JacobBarthelmeh 034ed7fe9f fix ups for format, spelling, includes, and string compare 2023-08-30 13:32:17 -07:00
JacobBarthelmeh 3e270cd0df still need to send initial terminal size with exec command 2023-08-30 09:08:25 -07:00
JacobBarthelmeh 0bd4539ef6 adjust req-pty terminal size sent with Windows 2023-08-30 09:08:25 -07:00
JacobBarthelmeh ecd47ddfd6 add OSX semaphore use, and fix warning 2023-08-30 09:08:25 -07:00
JacobBarthelmeh ab742ca766 wolfSSHd port to Windows
handling of terminal size adjustments

stub case for ECH virtual terminal command
2023-08-30 09:08:25 -07:00
JacobBarthelmeh bd1506db93 reset want read before attempting to read 2023-08-25 15:29:23 -06:00
JacobBarthelmeh 067cc069aa add check for full window with SSHD and improve nonblocking connect with client 2023-08-07 09:55:33 -07:00
Fabio Alemagna 092c04fe30 All the filesystem-related W* macros accept a filesystem context pointer as first parameter, to make portability better. 2023-07-21 11:53:40 +02:00
JacobBarthelmeh 5d8a64f062 check on absolute path from Linux to Windows machine 2023-07-13 13:24:32 -07:00
JacobBarthelmeh b589883539 fix for building client on windows with shell support 2023-06-28 14:32:15 -06:00
John Safranek 639f896320
Merge pull request #519 from JacobBarthelmeh/scp
break between SSH accept and SCP operation
2023-06-01 20:54:43 -07:00
JacobBarthelmeh 981a506967 add check for channel eof and remove shutdown call 2023-06-01 15:05:24 -07:00
JacobBarthelmeh 3da8e2a690 add cr for enter with shell connections to windows server 2023-05-19 12:59:04 -07:00
JacobBarthelmeh 3f2aa055ab break between SSH accept and SCP operation 2023-05-19 06:26:18 -07:00
John Safranek 851ac5525e
Variable Scope
1. Tighten up scope on variables in function SendKexDhReply.
2. Fix echoserver not handling the non-blocking would block state for
   SFTP.
2023-05-11 11:10:44 -07:00
John Safranek d00db44b2f
SFTP Update
1. In the API test for SFTP, change the amount of the file requested to
   the limit WOLFSSH_MAX_SFTP_RW.
2. The check for want read on the exit of the server worker should clear
   ret if it is want read.
2023-04-19 13:39:35 -07:00
John Safranek 35554745bc
Update sftpclient
1. Update the example SFTP client with changes made for the echoserver.
2. Better handling of rekeying status.
2023-04-13 16:17:59 -07:00
John Safranek c97e8ea319
Rekey
With the previous change for speed and timing, rekeying started having
trouble in SFTP. Each file block travels as two messages, and the
rekeying starts, but the messages are sent and lost. The client would
terminate the connection.

1. Tweak the timeout in the echoserver's SFTP loop.
2. Better checking for rekeying.
3. Returning that rekeying is happening.
2023-04-11 19:50:55 -07:00
John Safranek 73946a36c6
Decoupling SFTP from SSH
wolfSSH has a reach too deep into the wolfSSH internals. SFTP should
be more like an application running on top of wolfSSH. We prefer to
keep it all in one application, so it will work well in an embedded
environment, but there needs more separation.

1. The sftp_worker loop in the echoserver should prioritize reading
   the socket and processing the SSH layer messages. Next it should
   ensure the transmit buffer for the SFTP channel is being written.
   Last it should check the receive buffer for the SFTP for new
   messages from the peer. wolfSSH_worker() will ensure data is read
   from the socket, and distributed to the appropriate channel
   receieve buffers, and will make sure the SSH bookkeeping is
   performed.
2. SendChannelData() should also bound the send data amount by the
   local maxPacketSz.
3. wolfSSH_SFTP_buffer_send() should send only one chunk of data, not
   looping until everything is gone. Need to send, but cannot flood
   the output.
4. Remove the call to wolfSSH_worker() from the buffer send.
5. The wolfSSH_SFTP_read() state machine should check the return
   status from the call to buffer send, and if it isn't an error,
   don't clear the state, allow for a want-write write again later.
6. Do not limit the file chunk size to send to WOLFSSH_MAX_SFTP_RW.
   This limit is provided during SFTP negotiation. If the peer
   requests that much data, send it.
6. Modify the select wrapper to have a very small microseconds value
   in addition to the requested seconds.
2023-04-10 15:57:25 -07:00
JacobBarthelmeh 5a674a42d7 fix for ssh->error with SCP and public key use with common client code 2023-04-04 21:57:36 -07:00
JacobBarthelmeh 80f6ebb963 resolve unused function warnings 2023-04-04 14:59:46 -07:00
JacobBarthelmeh 5971e8a4fa warning fixes and windows build 2023-04-04 14:59:46 -07:00
JacobBarthelmeh a9224993fd refactor client apps and add X509 to scpclient 2023-04-04 14:59:46 -07:00
John Safranek 95bcc4541c
Release v1.4.13
1. Update the copyright year in all file header comments.
2. Update the STM32CUBE files to use the correct GPL headers.
2023-04-03 10:41:10 -07:00
Eric Blankenhorn 85f904dbfe Fix build error in client_test 2023-03-15 09:46:01 -05:00
John Safranek f8651c952b
Merge pull request #498 from JacobBarthelmeh/sshd-forcedcmd
remove leading tabs in config file while parsing, add force command test
2023-03-10 15:17:57 -08:00
John Safranek 55f352781e
Merge pull request #489 from JacobBarthelmeh/ip_check
add runtime option to override IP check with client
2023-03-10 15:00:46 -08:00
Kareem d1bdc32de1 Fix 32-bit builds of the SFTP client. Only build SFTP client if building examples is enabled. 2023-02-15 16:59:34 -07:00
John Safranek c59226c36b
Build Cleanup
1. Found a few cases where disabling RSA made some things either not
   build or run correctly.
2. Hushed a few unused variables in gated-disabled situations.
3. Moved a temp variable closer to where it is used.
2023-02-03 17:18:26 -08:00