This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch feature/libssh-api-upgrade in repository x2goclient. at 81d9085 src/sshmasterconnection.cpp: with libssh 0.6.0 and newer, get the public key via ssh_get_server_publickey () and its hash via ssh_get_publickey_hash () instead of using the deprecated ssh_get_pubkey_hash () function. This branch includes the following new commits: new 138a1ac src/sshmasterconnection.cpp: use ssh_channel_listen_forward () instead of ssh_forward_listen () for newer libssh versions. new 81d9085 src/sshmasterconnection.cpp: with libssh 0.6.0 and newer, get the public key via ssh_get_server_publickey () and its hash via ssh_get_publickey_hash () instead of using the deprecated ssh_get_pubkey_hash () function. The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch feature/libssh-api-upgrade in repository x2goclient. commit 138a1ac4f01a2348f9f0ab3b8a7ca6f541b819d9 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 16:04:28 2017 +0100 src/sshmasterconnection.cpp: use ssh_channel_listen_forward () instead of ssh_forward_listen () for newer libssh versions. --- debian/changelog | 2 ++ src/sshmasterconnection.cpp | 35 ++++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index fad063a..8824554 100644 --- a/debian/changelog +++ b/debian/changelog @@ -557,6 +557,8 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium time (for instance when running x2goclient --help.) - src/onmainwindow.cpp: correctly guard the new lines from the previous commit. Fixes compile issues on Linux and other systems. + - src/sshmasterconnection.cpp: use ssh_channel_listen_forward () instead + of ssh_forward_listen () for newer libssh versions. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index 84e0970..b3f9aa3 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -279,22 +279,35 @@ void SshMasterConnection::addReverseTunnelConnections() if(!reverseTunnelRequest[i].listen) { reverseTunnelRequest[i].listen=true; - int rc=ssh_forward_listen(my_ssh_session, NULL, reverseTunnelRequest[i].forwardPort, NULL); - if(rc==SSH_OK) - { - emit reverseTunnelOk(reverseTunnelRequest[i].creator); + + int rc = SSH_AGAIN; + +#if LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 7, 0) + /* Non-blocking mode may return SSH_AGAIN, so try again if neceassary. */ + while (SSH_AGAIN == rc) { + rc = ssh_channel_listen_forward(my_ssh_session, NULL, reverseTunnelRequest[i].forwardPort, NULL); +#else + rc = ssh_forward_listen(my_ssh_session, NULL, reverseTunnelRequest[i].forwardPort, NULL); +#endif + + if(rc==SSH_OK) + { + emit reverseTunnelOk(reverseTunnelRequest[i].creator); #ifdef DEBUG - x2goDebug<<"Listening for TCP/IP connections on "<<reverseTunnelRequest[i].forwardPort; + x2goDebug<<"Listening for TCP/IP connections on "<<reverseTunnelRequest[i].forwardPort; #endif - } - if(rc==SSH_ERROR) - { - QString err=ssh_get_error(my_ssh_session); + } + if(rc==SSH_ERROR) + { + QString err=ssh_get_error(my_ssh_session); #ifdef DEBUG - x2goDebug<<"Forward port "<<reverseTunnelRequest[i].forwardPort<<" failed:"<<err; + x2goDebug<<"Forward port "<<reverseTunnelRequest[i].forwardPort<<" failed:"<<err; #endif - emit reverseTunnelFailed(reverseTunnelRequest[i].creator, err); + emit reverseTunnelFailed(reverseTunnelRequest[i].creator, err); + } +#if LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 7, 0) } +#endif } } reverseTunnelRequestMutex.unlock(); -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch feature/libssh-api-upgrade in repository x2goclient. commit 81d90855f1f182c713b4500fe158f140c11caf19 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 17:08:43 2017 +0100 src/sshmasterconnection.cpp: with libssh 0.6.0 and newer, get the public key via ssh_get_server_publickey () and its hash via ssh_get_publickey_hash () instead of using the deprecated ssh_get_pubkey_hash () function. Additionally, replace free () with the more appropriate ssh_string_free_char () function after using ssh_get_hexa (). This will break on very old systems with a hopelessly outdated libssh version, but we do not care about these systems in the first place. --- debian/changelog | 8 ++++++++ src/sshmasterconnection.cpp | 32 ++++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8824554..5e6557e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -559,6 +559,14 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium commit. Fixes compile issues on Linux and other systems. - src/sshmasterconnection.cpp: use ssh_channel_listen_forward () instead of ssh_forward_listen () for newer libssh versions. + - src/sshmasterconnection.cpp: with libssh 0.6.0 and newer, get the public + key via ssh_get_server_publickey () and its hash via + ssh_get_publickey_hash () instead of using the deprecated + ssh_get_pubkey_hash () function. Additionally, replace free () with the + more appropriate ssh_string_free_char () function after using + ssh_get_hexa (). This will break on very old systems with a hopelessly + outdated libssh version, but we do not care about these systems in the + first place. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index b3f9aa3..e5da19c 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -20,6 +20,7 @@ #include "sshmasterconnection.h" #include <stdlib.h> #include <stdio.h> +#include <stddef.h> #include "sshprocess.h" @@ -812,13 +813,33 @@ int SshMasterConnection::serverAuth ( QString& errorMsg ) x2goDebug<<"cserverAuth"; #endif - int state, hlen; + int state = SSH_SERVER_ERROR; + size_t hlen = 0; unsigned char *hash = NULL; - char *hexa; + char *hexa = NULL; +#if LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 6, 0) + ssh_key srv_pubkey = { }; + int rc = SSH_ERROR; +#endif state = ssh_is_server_known ( my_ssh_session ); - hlen = ssh_get_pubkey_hash ( my_ssh_session, &hash ); +#if LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 6, 0) + rc = ssh_get_server_publickey (session, &srv_pubkey); + + if (SSH_OK != rc) { + return (SSH_SERVER_ERROR); + } + + rc = ssh_get_publickey_hash (srv_pubkey, SSH_PUBLICKEY_HASH_SHA1, &hash, &hlen); + ssh_key_free (srv_pubkey); + + if (0 != rc) { + return (SSH_SERVER_ERROR); + } +#else + hlen = ssh_get_pubkey_hash ( my_ssh_session, &hash ); +#endif if ( hlen < 0 ) return SSH_SERVER_ERROR; @@ -827,7 +848,6 @@ int SshMasterConnection::serverAuth ( QString& errorMsg ) x2goDebug<<"state: "<<state<<endl; #endif - switch ( state ) { case SSH_SERVER_KNOWN_OK: @@ -836,7 +856,7 @@ int SshMasterConnection::serverAuth ( QString& errorMsg ) case SSH_SERVER_KNOWN_CHANGED: hexa = ssh_get_hexa ( hash, hlen ); errorMsg=host+":"+QString::number(port)+" - "+hexa; - free ( hexa ); + ssh_string_free_char ( hexa ); break; case SSH_SERVER_FOUND_OTHER: break; @@ -846,7 +866,7 @@ int SshMasterConnection::serverAuth ( QString& errorMsg ) { hexa = ssh_get_hexa ( hash, hlen ); errorMsg=host+":"+QString::number(port)+" - "+hexa; - free ( hexa ); + ssh_string_free_char ( hexa ); break; } ssh_write_knownhost ( my_ssh_session ); -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git