Andreas Schneider
85a274ff3c
include: Add macros for bytearray handling
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2018-10-05 14:38:43 +02:00
Andreas Schneider
e210b61148
examples: Reformat knownhosts
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-10-05 14:38:43 +02:00
Andreas Schneider
f09ca85ebf
cmake: Always build position independent code
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-10-02 14:48:02 +02:00
Andreas Schneider
096d966e43
gitlab-ci: Report errors on debian
2018-09-27 18:06:23 +02:00
Anderson Toshiyuki Sasaki
cc513c4c9a
messages: Fixed possible memory leak in ssh_message_queue
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-27 15:21:30 +02:00
Anderson Toshiyuki Sasaki
31202822a7
examples: Add null checks in libssh_scp.c
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-27 15:21:30 +02:00
Anderson Toshiyuki Sasaki
6118628424
examples: Fix libssh_scp.c code style
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-27 15:21:30 +02:00
Anderson Toshiyuki Sasaki
00e5ef1b3c
examples: Fix possible memory leak in libssh_scp.c
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-27 15:21:30 +02:00
Anderson Toshiyuki Sasaki
6eef4b4a3c
tests: Add frees to avoid memory leak errors
...
The added frees are unnecessary, but the static analyser does not know.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-27 15:21:30 +02:00
Anderson Toshiyuki Sasaki
79e907402e
tests: Replace ssh_buffer_free() with SSH_BUFFER_FREE()
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-27 15:21:30 +02:00
Anderson Toshiyuki Sasaki
ca7da823c3
tests: Replace ssh_string_free() with SSH_STRING_FREE()
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-27 15:21:30 +02:00
Anderson Toshiyuki Sasaki
2eaa23a20e
tests: Replace ssh_key_free() with SSH_KEY_FREE()
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-27 15:21:30 +02:00
Anderson Toshiyuki Sasaki
143b5e2e50
tests: Use SSH_STRING_FREE_CHAR
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-27 15:21:30 +02:00
Anderson Toshiyuki Sasaki
11d480134c
include: Add SSH_KEY_FREE
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-27 15:21:30 +02:00
Andreas Schneider
3786db4cdf
gitlab-ci: Get build and test errors from mingw
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-27 08:45:41 +02:00
Andreas Schneider
9cf341bad3
gitlab-ci: Use -DCMAKE_BUILD_TYPE=UndefinedSanitizer
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-26 16:55:28 +02:00
Andreas Schneider
e57f0273a6
cmake: Add UndefinedSanitizer
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-26 16:54:31 +02:00
Andreas Schneider
3d74c3802e
cmake: Also add DEFAULT_LINK_FLAGS for Solaris
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-26 16:53:29 +02:00
Anderson Toshiyuki Sasaki
667fb5f9a9
cmake: Rewritten AddCMockaTest.cmake
...
This changes add_cmocka_test() to receive compiler options, the
libraries to be linked to the test, and the linker options. The way the
tests are declared in tests/unittests and tests/client were updated.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-26 16:27:22 +02:00
Alberto Aguirre
14f5624ff5
sftpserver: allocate packet on sftp_server_new
...
Ensure sftp_server_new allocates the packet and payload as
sftp_packet_read now expects the packet and payload to be
pre-allocated.
Similarly, ensure sftp_get_client_message does not free the packet.
Signed-off-by: Alberto Aguirre <albaguirre@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25 16:41:54 +02:00
David Wedderwille
9adc2d36eb
connector: Add checks if file descriptor is a socket
...
Fixes T104
Signed-off-by: David Wedderwille <davidwe@posteo.de>
2018-09-25 14:37:25 +02:00
Andreas Schneider
1e5e09563a
socket: Pass MSG_NOSIGNAL to send()
...
This avoid that we get a SIGPIPE.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25 14:37:25 +02:00
Andreas Schneider
35bf5334b8
socket: Return ssize_t for ssh_socket_unbuffered_write()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25 14:37:25 +02:00
Andreas Schneider
a7604c7d6e
socket: Reformat ssh_socket_write()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25 14:37:25 +02:00
Andreas Schneider
c5cadaa982
socket: Reformat ssh_socket_unbuffered_write()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25 14:37:25 +02:00
Andreas Schneider
caf50270c6
socket: Return ssize_t for ssh_socket_unbuffered_read()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25 14:37:25 +02:00
Andreas Schneider
b7a29c7ffd
socket: Reformat ssh_socket_pollcallback()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25 14:37:25 +02:00
Andreas Schneider
491a42d046
socket: Reformat ssh_socket_unbuffered_read()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25 14:37:25 +02:00
Andreas Schneider
642a1b1aa4
connect: Fix build warning on Windows
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25 14:37:25 +02:00
Andreas Schneider
f709c3ac58
config: Fix building without globbing support
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25 14:37:25 +02:00
Andreas Schneider
ae2b9a3bde
include: Do not declare ssh_channel_new() twice
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25 14:37:25 +02:00
Andreas Schneider
1d7520b68a
cmake: Add -Wattributs for configure checks
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25 14:37:25 +02:00
Andreas Schneider
9c37c8c5a5
cmake: Bump library version
2018-09-20 16:35:13 +02:00
Chris Townsend
6c56c1e0d7
sftpserver: Support some openssh extensions
...
Add support for "hardlink@openssh.com" and
"posix-rename@openssh.com" extensions.
Signed-off-by: Chris Townsend <christopher.townsend@canonical.com>
Signed-off-by: Alberto Aguirre <albaguirre@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-20 16:35:13 +02:00
Andreas Schneider
e4711c469f
pki: Use strndup in ssh_pki_export_privkey_base64()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-20 16:35:13 +02:00
Andreas Schneider
8410f43d8b
tests: Add a test for ssh_pki_export_privkey_base64()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-20 16:35:13 +02:00
DavidWed
d0ce2d1ecd
pki: Add ssh_pki_export_privkey_base64()
...
Fixes T53
Signed-off-by: DavidWedderwille <davidwe@posteo.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
2018-09-20 16:35:13 +02:00
Andreas Schneider
5a198732a5
tests: Add test for ssh_get_fingerprint_hash()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-20 16:35:13 +02:00
Andreas Schneider
92aa2cf496
dh: Use ssh_get_fingerprint_hash() in ssh_print_hash()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-20 16:35:13 +02:00
Andreas Schneider
bbed139eca
dh: Add ssh_get_fingerprint_hash()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-20 16:35:13 +02:00
Anderson Toshiyuki Sasaki
0eab270754
dh: Removed duplicated code
...
The code for calculating SHA 512 in ssh_make_sessionid() had been
duplicated; the cases were unified.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2018-09-20 15:37:23 +02:00
Anderson Toshiyuki Sasaki
71594f9d6c
dh: Add diffie-hellman-group18-sha512 support
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2018-09-20 15:37:23 +02:00
Andreas Schneider
2ae2baf9ca
buffer: Don't call va_end() twice
...
This is handled in the cleanup.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-20 15:37:23 +02:00
Andreas Schneider
4c47719d98
examples: Reformat authenticaton.c
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-20 15:37:23 +02:00
Andreas Schneider
a30d542207
sftp: Include stdint.h
...
Thanks to Apex Liu
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-19 12:25:03 +02:00
Anderson Toshiyuki Sasaki
d9d3b65df2
dh: Add diffie-hellman-group16-sha512 support
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-19 12:17:02 +02:00
Harald Sitter
97cb302c0e
sftp: fix buffer_unpack argument to be char** rather than char*
...
Summary:
buffer variable 's' gets unpacked as char**, the previous code was passing
a char* causing segfaults on all readlink calls inside the unpacking code
Test Plan:
- without patchy examples/samplesftp segfaults in readlink
- with patchy it doesn't
Reviewers: asn
Differential Revision: https://bugs.libssh.org/D14
Signed-off-by: Harald Sitter <sitter@kde.org>
2018-09-19 11:18:12 +02:00
Andreas Schneider
90373d8394
buffer: Do cleanup if ssh_buffer_unpack() fails in the first loop
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-19 11:18:12 +02:00
Andreas Schneider
07f7fa7806
buffer: Fix invalid memory access in ssh_buffer_unpack()
...
Found by oss-fuzz.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-19 11:18:02 +02:00
Andreas Schneider
5123f7955b
tests: Add OK: and a new line to ssh_ping
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-18 18:46:28 +02:00