Andreas Schneider
83421c0e8c
gssapi: Use correct return code in ssh_gssapi_auth_mic()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-10-06 18:36:54 +02:00
Andreas Schneider
095733ed9c
gssapi: Print minor stat in error logging function
...
This also releases the memory allocated for the messages.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-10-06 18:22:26 +02:00
Andreas Schneider
155a155d1d
sftp: Add sftp_fsync() function
...
BUG: https://red.libssh.org/issues/141
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-10-06 16:26:52 +02:00
Jeremy Cross
dbf72ffba2
sftp: ensure sftp_packet_read recognizes channel EOF to avoid infinite loop
...
Signed-off-by: Jeremy Cross <jcross@bomgar.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-09-09 11:39:32 +02:00
Andreas Schneider
47d21b6420
sftpserver: Fix SSH_FXP_FSTAT arguments
...
Thanks to Игорь Коваленко <igor.a.kovalenko@gmail.com>
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-10 10:15:05 +02:00
Andreas Schneider
412c501442
sftp: Use calloc() instead of malloc()/memset()
...
This is calloc() is faster then calling memset().
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-04 14:56:22 +02:00
Andreas Schneider
5c70dd8b85
config: Fix build warnings
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-04 14:38:48 +02:00
Travers Carter
bc2db86d1c
Make "Host" pattern list handling consistent with OpenSSH
...
https://red.libssh.org/issues/187
Signed-off-by: Travers Carter <tcarter@noggin.com.au>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-03 17:57:12 +02:00
Andreas Schneider
1da5c94b44
client: If SSHv1 is disabled send the banner immediately
...
This saves a round-trip with SSHv2 connecting to the server. See RFC
4253 section 5.2 (New Client, Old Server).
Thanks to Yang Yubo <yang@yangyubo.com> for the suggestion.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-03 09:41:26 +02:00
Andreas Schneider
3d1edffe77
client: Fix ssh_send_banner() to confirm with RFC 4253
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-03 09:41:26 +02:00
Andreas Schneider
cb52ed7b12
client: Fix maximum banner length
...
According to RFC 4253 the max banner length is 255.
Thanks to Saju Panikulam <spanikulam@ipswitch.com> for the report.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-03 09:41:26 +02:00
Andreas Schneider
22799b107d
client: Reformat callback_receive_banner()
...
The function is hard to read as the indentation is not correctly
applied.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-03 09:41:26 +02:00
Ken Reister
c3ce3d5cc3
client: Receive the banner correctly
...
Comply with RFC 4253 compliance section 4.2.
Allow data other than "SSH-" to be sent across prior to the actual
version striong.
Signed-off-by: Ken Reister <reister.kenneth@CIMCOR.COM>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-03 09:41:26 +02:00
Aris Adamantiadis
32eea120af
sockets: Fix callback registration bug
...
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 17:34:09 +02:00
Aris Adamantiadis
8e42d3959c
packet: Improve logging output
...
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 17:27:16 +02:00
Aris Adamantiadis
9b3648ded0
connector: Implement ssh_connector_except()
...
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 16:58:47 +02:00
Aris Adamantiadis
0701745cbc
channels: Move ssh_channel_write_stderr out of server-only
...
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 16:57:13 +02:00
Aris Adamantiadis
bbe437dbb1
callbacks: Implement list of callbacks for channels
...
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 16:56:54 +02:00
Aris Adamantiadis
80d88dd3d9
packets: Handle flow control callbacks
...
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 16:55:46 +02:00
Aris Adamantiadis
5aaae4cb6b
events: Add functions for poll objects
...
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 16:40:43 +02:00
Kohei Suzuki
c092101e01
Add id_ed25519 to the default identity list
...
Signed-off-by: Kohei Suzuki <eagletmt@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 15:34:01 +02:00
David Kedves
d7df4429eb
channels: Bugfix for a possible invalid pointer usage (channel->session) in various places
...
BUG: https://red.libssh.org/issues/230
Signed-off-by: David Kedves <kedazo@severalnines.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 15:31:46 +02:00
Stef Walter
ffe8b98cc2
auth: Cleanup memory leak when using SSH agent
...
In Cockpit we've seen this memory leak:
at 0x4C2A9C7: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x5B76B03: ssh_userauth_agent (auth.c:778)
by 0x40DD5A: cockpit_ssh_authenticate (cockpitsshtransport.c:327)
BUG: https://red.libssh.org/issues/208
Signed-off-by: Stef Walter <stefw@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 15:28:24 +02:00
Andreas Schneider
33ecaaac01
auth1: Fix non-blocking SSHv1 auth
...
BUG: https://red.libssh.org/issues/232
Thanks to Fengyu Gao.
TODO: Add SSHv1 tests to our testsuite.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 12:19:00 +02:00
Justus Winter
3c69092cde
pki_gcrypt: Add primitive to read ASN.1 bit strings
...
* src/pki_gcrypt.c (ASN1_BIT_STRING): New macro.
(asn1_get_bit_string): New function.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 12:07:07 +02:00
Justus Winter
92fdf31d29
pki: Fix debug message
...
* src/pki.c (ssh_pki_signature_verify_blob): Fix debug message.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 11:55:39 +02:00
Justus Winter
878a650c7a
dh: Print hexadecimal data to stderr
...
* src/dh.c (ssh_print_hexa): Print to stderr.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 11:55:38 +02:00
Justus Winter
e518ec1cb7
pki_gcrypt: Rework 'pki_export_pubkey_rsa1'
...
* src/pki_gcrypt.c (pki_export_pubkey_rsa1): Rework to be more
idiomatic. Fix leaking MPIs.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 11:55:38 +02:00
Justus Winter
ed34425306
pki_gcrypt: Rework 'pki_publickey_to_blob'
...
* src/pki_gcrypt.c (pki_publickey_to_blob): Rework using the new
helper 'ssh_sexp_extract_mpi'.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 11:55:38 +02:00
Justus Winter
1d7f87fc0e
pki_gcrypt: Rework 'pki_key_dup'
...
* src/pki_gcrypt.c (pki_key_dup): Rework to be more idiomatic.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 11:55:38 +02:00
Justus Winter
735e34f932
libgcrypt: Add helper to extract MPIs into ssh_strings
...
* include/libssh/libgcrypt.h (ssh_sexp_extract_mpi): New prototype.
* src/libgcrypt.c (ssh_sexp_extract_mpi): New function.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 11:55:38 +02:00
Justus Winter
fea9e3050c
options: Check if a port has been given
...
* src/options.c (ssh_options_getopt): Only call 'ssh_options_set' if
a port has been given.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 11:55:38 +02:00
Andreas Schneider
bbd0522026
dh: Rename ssh_get_publickey() to ssh_get_server_publickey()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-05-02 11:55:38 +02:00
Justus Winter
926b9e937b
pki: Mention relevant RFC for EC key encoding
...
* src/pki.c (ssh_pki_export_pubkey_blob): Mention relevant RFC for EC
key encoding.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-03-21 18:39:46 +01:00
Justus Winter
fc9434465c
pki_gcrypt: Fix memory leak
...
* src/pki_gcrypt.c (_bignum_cmp): Fix memory leak.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-03-21 18:39:39 +01:00
Justus Winter
ba3ee9f007
pki_gcrypt: Burn key material
...
* src/pki_gcrypt.c (b64decode_rsa_privatekey): Burn key material.
(b64decode_dsa_privatekey): Likewise.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-03-21 18:39:31 +01:00
Justus Winter
38d8befcd0
pki_gcrypt: Generalize asn1_get_int
...
* src/pki_gcrypt.c (asn1_get): Generalize from 'asn1_get_int'.
(asn1_get_int): New function simply calling 'asn1_get'.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-03-21 18:39:23 +01:00
Justus Winter
e1d36314a2
pki_gcrypt: Fix memory leak
...
* src/pki_gcrypt.c (b64decode_rsa_privatekey): Free 'v' on version
mismatch.
(b64decode_dsa_privatekey): Likewise.
Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-03-21 18:39:13 +01:00
Axel Eppe
8fe8dbb378
agent: Add cert auth support to ssh_agent_get_next_ident()
...
Signed-off-by: Axel Eppe <aeppe@google.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-03-15 08:37:57 +01:00
Axel Eppe
8923a01264
auth: Add cert auth support to ssh_userauth_publickey()
...
Signed-off-by: Axel Eppe <aeppe@google.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-03-15 08:36:27 +01:00
Axel Eppe
6cbab4936d
pki_gcrypt: Add cert auth support to pki_publickey_to_blob()
...
Signed-off-by: Axel Eppe <aeppe@google.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-03-15 08:36:09 +01:00
Axel Eppe
0310cba2b6
pki_crypto: Add cert auth support to pki_publickey_to_blob()
...
Signed-off-by: Axel Eppe <aeppe@google.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-03-15 08:35:47 +01:00
Aris Adamantiadis
0b9804a95b
server: handle keepalive@openssh.com global requests
2016-03-14 22:28:03 +01:00
Andreas Schneider
4d43fbfb50
options: Document SSH_OPTIONS_ADD_IDENTITY
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-03-03 20:07:16 +01:00
Aris Adamantiadis
4e6ff36a9a
dh: Fix CVE-2016-0739
...
Due to a byte/bit confusion, the DH secret was too short. This file was
completely reworked and will be commited in a future version.
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-02-23 08:16:10 +01:00
Hani Benhabiles
f8bde7156f
options: Fix documentation typo
...
Signed-off-by: Hani Benhabiles <hani@linux.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-02-23 08:14:29 +01:00
Younes Serraj
66c6ae1a55
pki: Fixed documentation about return value.
...
Documentation now is congruent with the code:
- SSH_OK is returned on success,
- SSH_ERROR is returned on error.
Signed-off-by: Younes Serraj <younes.serraj@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-02-23 08:12:34 +01:00
Fabiano Fidêncio
5c5b1aaaa7
buffer: expose ssh_buffer_get()
...
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-01-19 11:31:08 +01:00
Fabiano Fidêncio
6953c8ec91
buffer: expose ssh_buffer_{add,get}_data()
...
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-01-19 11:31:08 +01:00
Fabiano Fidêncio
58aff4495e
buffer: expose ssh_buffer_reinit()
...
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-01-19 11:31:08 +01:00