Jakub Jelen
94cbd58128
Unbreak the build example on alpine
...
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
691105e93b
Remove needless new symbols and add required to API
...
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
0affa5d705
sftp: Remove duplicate code handling packet types
...
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
Jakub Jelen
8e1d6e4567
examples: Replace strcpy with snprintf
...
This allows the libssh to build with more memory-strict compliers.
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
254ec093ff
examples: Initialize pointers
...
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
97e038c6e9
sample_sftpserver: fix format and nit 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
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
tatataeki
69ad6985de
sftp: format modified
...
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
48d14ee9a9
examples: add sftpserver example and fix 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
f8bfb5a7a1
sftp: add sftp api for sftpserver
...
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:30 +02:00
Jakub Jelen
4d98390678
CONTRIBUTING: Do not indent case labels nor blocks
...
Fixes : #188
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2023-06-05 15:52:58 +02:00
Kevin Backhouse
6a965e0981
Error out if ctx is NULL.
...
Signed-off-by: Kevin Backhouse <kevinbackhouse@github.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-06-05 09:19:35 +02:00
Gerald Combs
c01377081f
libgcrypt.c: Fix type mismatches
...
Fix
/build/libssh-0.10.5/src/libgcrypt.c:903:20: error: incompatible function pointer types initializing 'void (*)(struct ssh_cipher_struct *, void *, void *, size_t)' (aka 'void (*)(struct ssh_cipher_struct *, void *, void *, unsigned long long)') with an expression of type 'void (struct ssh_cipher_struct *, void *, void *, unsigned long)' [-Wincompatible-function-pointer-types]
.encrypt = des3_encrypt,
^~~~~~~~~~~~
/build/libssh-0.10.5/src/libgcrypt.c:904:20: error: incompatible function pointer types initializing 'void (*)(struct ssh_cipher_struct *, void *, void *, size_t)' (aka 'void (*)(struct ssh_cipher_struct *, void *, void *, unsigned long long)') with an expression of type 'void (struct ssh_cipher_struct *, void *, void *, unsigned long)' [-Wincompatible-function-pointer-types]
.decrypt = des3_decrypt
^~~~~~~~~~~~
Fixes : #196
Signed-off-by: Gerald Combs <gerald@zing.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-06-02 13:41:54 +02:00
Norbert Pocs
5eb8685932
socket.c: Remove bug from documentation as it was solved
...
Signed-off-by: Norbert Pocs <npocs@redhat.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-06-01 10:34:21 +02:00
Norbert Pocs
1c0b8f624e
connect.c: Try to connect to other host addresses than just the first
...
When one host has multiple addresses returned by `getaddrinfo` try not just
the first address. The scenario where the first address is wrong but the
second is good was failing, because the second address was never tried.
This applies to ipv6 as well as to ipv4 addresses.
As the implementation uses non-blocking sockets it may return EINPROGRESS
when error happened as well as just "non-blocking" statement. The socket
can not be queried for status code to determine the error if any, because it
requires calling blocking functions.
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
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
Norbert Pocs
6424971a98
auth.c: Add termination when server disconnects during authentication
...
When the server is reaches MaxAuthTries it sends disconnect immediately
which was not correctly handled in the libssh client and hanged.
Solves #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
Samuel Thibault
b3f6194122
Fix Hurd build
...
It does not have a PATH_MAX compile-time limitation. Instead of using it we
can just allocate dynamically.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-05-22 10:55:42 +02:00
Norbert Pocs
009bbc0546
sftp.c: Avoid null dereference
...
Issue found by covscan (gcc analyzer)
Signed-off-by: Norbert Pocs <npocs@redhat.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2023-05-19 12:52:50 +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
241c1ed91a
ci: Skip PKCS#11 tests under valgrind
...
The pkcs11 tests bring a lot of dependencies that are outside of our control
(openssl, engine_pkcs11, pkcs11_provider, p11-kit, softhsm, ...) and that might
always not handle the memory well.
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
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
roytak
9b263cf5e1
pki_crypto: Fix ecdsa memory leak
...
Fixed a memory leak in pki_privkey_build_ecdsa. The BIGNUM bexp was
getting allocated, but not free'd. It gets stored by reference in
param_bld.
Signed-off-by: roytak <xjanot04@fit.vutbr.cz >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-09 09:07:16 +02:00
Jakub Jelen
4f64aa3a5a
agent: Avoid memory leaks
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-04 16:55:17 +02:00
Jakub Jelen
655cda2b0e
auth: Avoid memory leaks during agent authentication
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Norbert Pocs <npocs@redhat.com >
2023-05-04 16:55:17 +02:00
Jakub Jelen
fa94777ed9
ecdh: 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