mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 18:50:27 +09:00
Soften behaviour of the Compression=no/yes option
Currently Compression=no (the default) force-disables zlib algos, while Compression=yes force-enables it. This means that mismatching options between client and server lead to connection failure. This can easily happen if the server has default settings but the client specifies Compression=yes. OpenSSH treats the option as a "prefer compression" setting: Compression=no -> none,zlib@openssh.com,zlib (default) Compression=yes -> zlib@openssh.com,zlib,none This commit changes the libssh behaviour to the same as OpenSSH. Signed-off-by: Fabian Vogt <fabian@ritter-vogt.de> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
@@ -88,7 +88,7 @@
|
||||
#endif /* HAVE_LIBCRYPTO */
|
||||
|
||||
#ifdef WITH_ZLIB
|
||||
#define ZLIB "none,zlib,zlib@openssh.com"
|
||||
#define ZLIB "none,zlib@openssh.com,zlib"
|
||||
#else
|
||||
#define ZLIB "none"
|
||||
#endif
|
||||
@@ -229,8 +229,8 @@ static const char *default_methods[] = {
|
||||
CHACHA20 AES,
|
||||
"hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-512",
|
||||
"hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-512",
|
||||
"none",
|
||||
"none",
|
||||
ZLIB,
|
||||
ZLIB,
|
||||
"",
|
||||
"",
|
||||
NULL
|
||||
|
||||
@@ -844,10 +844,10 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
|
||||
return -1;
|
||||
} else {
|
||||
if (strcasecmp(value,"yes")==0){
|
||||
if(ssh_options_set_algo(session,SSH_COMP_C_S,"zlib@openssh.com,zlib") < 0)
|
||||
if(ssh_options_set_algo(session,SSH_COMP_C_S,"zlib@openssh.com,zlib,none") < 0)
|
||||
return -1;
|
||||
} else if (strcasecmp(value,"no")==0){
|
||||
if(ssh_options_set_algo(session,SSH_COMP_C_S,"none") < 0)
|
||||
if(ssh_options_set_algo(session,SSH_COMP_C_S,"none,zlib@openssh.com,zlib") < 0)
|
||||
return -1;
|
||||
} else {
|
||||
if (ssh_options_set_algo(session, SSH_COMP_C_S, v) < 0)
|
||||
@@ -862,10 +862,10 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
|
||||
return -1;
|
||||
} else {
|
||||
if (strcasecmp(value,"yes")==0){
|
||||
if(ssh_options_set_algo(session,SSH_COMP_S_C,"zlib@openssh.com,zlib") < 0)
|
||||
if(ssh_options_set_algo(session,SSH_COMP_S_C,"zlib@openssh.com,zlib,none") < 0)
|
||||
return -1;
|
||||
} else if (strcasecmp(value,"no")==0){
|
||||
if(ssh_options_set_algo(session,SSH_COMP_S_C,"none") < 0)
|
||||
if(ssh_options_set_algo(session,SSH_COMP_S_C,"none,zlib@openssh.com,zlib") < 0)
|
||||
return -1;
|
||||
} else {
|
||||
if (ssh_options_set_algo(session, SSH_COMP_S_C, v) < 0)
|
||||
|
||||
Reference in New Issue
Block a user