Jakub Jelen
a71e2f8f37
tests: Reproducer for #203
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Sahana Prasad <sahana@redhat.com >
2023-08-07 11:09:49 +02:00
Simon Josefsson
582905affa
tests: Test override of chacha20 && poly1305 instead of ||.
...
Signed-off-by: Simon Josefsson <simon@josefsson.org >
2023-08-02 18:31:37 +02:00
Ahsen Kamal
254149dbe8
add control master and path config test
...
Signed-off-by: Ahsen Kamal <itsahsenkamal@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-08-02 15:37:17 +02:00
Ahsen Kamal
db32a8e683
add control master and path option test
...
Signed-off-by: Ahsen Kamal <itsahsenkamal@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-08-02 15:37:17 +02:00
Eshan Kelkar
5726af1956
priv.h : Add compatibility code for Windows
...
Compatibility code for mapping open, read, write, close and unlink
to _open, _read, _write, _close and _unlink respectively on Windows
was repeated in a lot of .c files.
This commit adds that compatibility code to include/libssh/priv.h
and removes it from the .c files (while ensuring that those .c
files include priv.h) so that the compatibility code stays in one
place, can be maintained easily and can be added easily to another
source file by including priv.h in that file.
Signed-off-by: Eshan Kelkar <eshankelkar@galorithm.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-07-11 17:47:34 +02:00
Jakub Jelen
19404bf509
bench: Add missing allocations checks
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-07-11 17:45:15 +02:00
Jakub Jelen
9847f3f638
Deprecate SSH_BIND_OPTIONS_{RSA,ECDSA}KEY in favor of generic HOSTKEY
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-06-26 15:10:52 +02:00
Jakub Jelen
df0a445c87
tests: Clean correctly SFTP context
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
Jakub Jelen
79425f8b92
tests: Remove needless assignemnt and clean memory on errors
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
Jakub Jelen
af771cc35f
tests: Adjust to the current implementation to correctly free memory
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
Jakub Jelen
213d1c7fd8
tests: Improve sftpserver test coverage
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
Jakub Jelen
e5a6dc6757
Allow building benchmarks without SFTP
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
Jakub Jelen
5ea54c8159
sftpserver: Move duplicate code handling SFTP operations to library
...
These can be replaced by user-provided functions when needed.
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
Jakub Jelen
af60e23081
Reformat sftpserver examples and tests and remove unused code
...
there were unused structure members and some code formatted not following our
code guidelines.
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
Jakub Jelen
f1f766f14f
Reformat the test sftpserver
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
Jakub Jelen
13b2727023
tests: Fix assertion
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
Jakub Jelen
5854937328
tests: Support libssh server logging into separate file
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
Jakub Jelen
2f45688066
tests: Drop support for DSA
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
Jakub Jelen
cb4bdf893d
tests: Replace non-english variable names
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
tatataeki
8104c19013
sftp: fix problems in sftp APIs and example
...
Signed-off-by: tatataeki <shengzeyu19_98@163.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
tatataeki
0a5161a7d1
sftp: fix format problems, style nit and building problems
...
Signed-off-by: tatataeki <shengzeyu19_98@163.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
tatataeki
329d53a109
tests: add sftp server test
...
Signed-off-by: tatataeki <shengzeyu19_98@163.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
2023-06-06 10:54:31 +02:00
Norbert Pocs
c4a00ee430
torture_connect: Test bad IPv6 connection trying IPv4
...
If IPv6 address fail to connect IPv4 should be tried in non-blocking mode.
Signed-off-by: Norbert Pocs <npocs@redhat.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-06-01 10:14:37 +02:00
Norbert Pocs
3951bbabd5
Remove remained HAVE_DSA ifdefs and WITH_DSA
...
Signed-off-by: Norbert Pocs <npocs@redhat.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-06-01 10:09:43 +02:00
Norbert Pocs
5c7bfaa5f6
pkd_hello: Run chacha20 tests on dropbear too
...
Signed-off-by: Norbert Pocs <npocs@redhat.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-06-01 10:07:55 +02:00
Norbert Pocs
2bf49e3e65
torture_auth: Add test for MaxAuthTries
...
The reproducer is originally from jjelen@redhat.com:
https://gitlab.com/libssh/libssh-mirror/-/issues/11
Signed-off-by: Norbert Pocs <npocs@redhat.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-05-29 14:04:03 +02:00
Jakub Jelen
f7a9c07de3
tests: Skip pkd_hello_i1 under valgrind
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-23 10:49:12 +02:00
Jakub Jelen
96d7616166
tests: Give the server more time handle rekey
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-19 11:38:23 +02:00
Jakub Jelen
da815b641b
ci: Add valgrind target
...
We used to have this in the old ctest. The code should be ready for this as we
already skip tracing openssh sshd (ca4fb9c6 ) and have workaround for openssl
issues (55252e4d ), but it took me some time to figure out the secret command to
run tests under valgrind with cmake.
This adds also convenient custom target to run the memcheck manually.
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-16 15:01:16 +02:00
Jakub Jelen
cbd85a48db
tests: Hide memory leak from cmocka
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-16 13:53:16 +02:00
Jakub Jelen
31abaec00b
tests: Avoid dereferencing freed channels
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-09 09:07:16 +02:00
Jakub Jelen
8f463a851c
tests: Free dynamically allocated callbacks
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-09 09:07:16 +02:00
Jakub Jelen
ce7cc49465
test_server: Use dynamically allocated state
...
The "dynamically" loaded server is using allocated state and using something
else complicates proper cleanup.
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-09 09:07:16 +02:00
Jakub Jelen
e4bf3b97b4
Avoid memory leaks from the server_auth_kbdint
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-09 09:07:16 +02:00
Jakub Jelen
4278499e26
tests: Under valgrind wait for server cleanup longer
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-09 09:07:16 +02:00
Jakub Jelen
28dc1ef45b
tests: Use sigterm handler for graceful exit
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-09 09:07:16 +02:00
Jakub Jelen
f80faa89ce
tests: Wait longer for the server
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-09 09:07:16 +02:00
Jakub Jelen
fcb6ee4031
tests: Log server messages to separate file
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-09 09:07:16 +02:00
Jakub Jelen
4022ef69f3
test_server: Check for hostkey
...
The address was tested twice so repurposed the needless check for the check for
hostkey, which is also mandatory
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-09 09:07:16 +02:00
Jakub Jelen
20f52432fc
tests: Support libssh server logging into separate file
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-09 09:07:16 +02:00
Jakub Jelen
ae59d21e93
tests: Avoid memory leaks
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-04 16:55:16 +02:00
Norbert Pocs
543f3cba7d
torture_options: Add tests for incorrect number parsing options
...
Signed-off-by: Norbert Pocs <npocs@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2023-05-04 11:51:17 +02:00
Jakub Jelen
4e8db9d44b
CVE-2023-1667:tests: Send a bit more to make sure rekey is completed
...
This was for some reason failing on CentOS 7 in 0.10 branch so bringing this to
the master too.
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2023-05-04 11:51:17 +02:00
Jakub Jelen
8bb17c46a8
CVE-2023-1667:tests: Client coverage for key exchange with kex guessing
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2023-05-04 11:51:17 +02:00
Ahsen Kamal
14f3910d12
add server test for no-more-sessions
...
Signed-off-by: Ahsen Kamal <itsahsenkamal@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-04-28 10:58:13 +02:00
Ahsen Kamal
bfa7a94b83
add client test for no-more-sessions
...
Signed-off-by: Ahsen Kamal <itsahsenkamal@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-04-28 10:58:12 +02:00
Ran Park
d109b5bd5f
Add tests for run ssh_execute_command
...
Signed-off-by: Ran Park <bagayonghuming@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-04-25 18:01:32 +02:00
Eshan Kelkar
bfa988a7c7
Implement tests for sftp_rename
...
torture_sftp_rename has been added which
tries to rename an existing file (positive
test case) and tries to rename a file that
does not exist (negative test case).
Signed-off-by: Eshan Kelkar <eshankelkar@galorithm.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-04-25 12:13:49 +02:00
Eshan Kelkar
73c3d8965d
Add tests for sftp_hardlink
...
For testing sftp_hardlink, torture_sftp_hardlink has been
introduced in tests/client.
Signed-off-by: Eshan Kelkar <eshankelkar@galorithm.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-04-24 10:29:13 +02:00
Jakub Jelen
804814b895
fuzz: Avoid the server fuzzer to proceed to the authentication and further
...
Thanks Phil Turnbull from GitHub
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-04-21 14:27:46 +02:00