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. discards 0ba2e55 src/sshmasterconnection.cpp: enable parsing of ~/.ssh/config. Fixes: #1121. discards 148f236 src/sshmasterconnection.cpp: port more occurrences of "QString to C string" akin to 1b21d75f2c10609f3586f5b5e0b4ceb7fca83fdd. discards a8b9e3c src/sshmasterconnection.cpp: fix up some debug strings. discards 9aa514c src/sshmasterconnection.cpp: use QString::arg () to insert function name and thus deduplicate error translation messages. discards 58ff99d src/sshmasterconnection.cpp: replace deprecated channel_free () function with ssh_channel_free (). discards bfbc01f src/sshmasterconnection.cpp: replace deprecated channel_close () function with ssh_channel_close (). discards b53ea01 src/sshmasterconnection.cpp: replace deprecated channel_send_eof () function with ssh_channel_send_eof (). discards 1920cfd src/sshmasterconnection.cpp: replace deprecated channel_write () function with ssh_channel_write (). discards 7e87053 src/sshmasterconnection.cpp: replace deprecated channel_is_eof () function with ssh_channel_is_eof (). discards 5b3e174 src/sshmasterconnection.cpp: replace deprecated channel_read () function with ssh_channel_read (). discards bc6dd6e src/sshmasterconnection.cpp: replace deprecated channel_poll () function with ssh_channel_poll (). discards d9ee965 src/sshmasterconnection.cpp: replace deprecated channel_request_exec () function with ssh_channel_request_exec (). discards 456c140 src/sshmasterconnection.cpp: replace deprecated channel_open_session () function with ssh_channel_open_session (). discards d5edf53 src/sshmasterconnection.cpp: replace deprecated channel_open_forward () function with ssh_channel_open_forward (). discards a23a3db src/sshmasterconnection.cpp: replace deprecated channel_new () function with ssh_channel_new (). discards e8d67c4 src/sshmasterconnection.cpp: replace string_free () with its successor ssh_string_free (). discards 0b9f140 src/sshmasterconnection.cpp: with libssh 0.6.0 and newer, get the public key via ssh_get_server_publickey () (0.7.4 and higher) or ssh_get_publickey () (0.7.3 and lower) and its hash via ssh_get_publickey_hash () instead of using the deprecated ssh_get_pubkey_hash () function. discards 64abe5a src/sshmasterconnection.cpp: use ssh_channel_listen_forward () instead of ssh_forward_listen () for newer libssh versions. Fixes: #870. adds b114c54 res/i18n/x2goclient_es.ts: update Spanish translation file. adds ec534c7 res/i18n/x2goclient_es.ts: fixup Spanish translation file where necessary and add comments/requests for re-translations for the next time. new 93dd915 src/sshmasterconnection.cpp: use ssh_channel_listen_forward () instead of ssh_forward_listen () for newer libssh versions. Fixes: #870. new d8d30e3 src/sshmasterconnection.cpp: with libssh 0.6.0 and newer, get the public key via ssh_get_server_publickey () (0.7.4 and higher) or ssh_get_publickey () (0.7.3 and lower) and its hash via ssh_get_publickey_hash () instead of using the deprecated ssh_get_pubkey_hash () function. new 530a5e6 src/sshmasterconnection.cpp: replace string_free () with its successor ssh_string_free (). new d1e7566 src/sshmasterconnection.cpp: replace deprecated channel_new () function with ssh_channel_new (). new 0c9dc98 src/sshmasterconnection.cpp: replace deprecated channel_open_forward () function with ssh_channel_open_forward (). new e753fe2 src/sshmasterconnection.cpp: replace deprecated channel_open_session () function with ssh_channel_open_session (). new 6e8faf2 src/sshmasterconnection.cpp: replace deprecated channel_request_exec () function with ssh_channel_request_exec (). new a34bb98 src/sshmasterconnection.cpp: replace deprecated channel_poll () function with ssh_channel_poll (). new 9c326fd src/sshmasterconnection.cpp: replace deprecated channel_read () function with ssh_channel_read (). new 6770e23 src/sshmasterconnection.cpp: replace deprecated channel_is_eof () function with ssh_channel_is_eof (). new d6ef7cf src/sshmasterconnection.cpp: replace deprecated channel_write () function with ssh_channel_write (). new 9ab0859 src/sshmasterconnection.cpp: replace deprecated channel_send_eof () function with ssh_channel_send_eof (). new a5ecc9f src/sshmasterconnection.cpp: replace deprecated channel_close () function with ssh_channel_close (). new ae43804 src/sshmasterconnection.cpp: replace deprecated channel_free () function with ssh_channel_free (). new b1e826e src/sshmasterconnection.cpp: use QString::arg () to insert function name and thus deduplicate error translation messages. new bd335f0 src/sshmasterconnection.cpp: fix up some debug strings. new fc84c24 src/sshmasterconnection.cpp: port more occurrences of "QString to C string" akin to 1b21d75f2c10609f3586f5b5e0b4ceb7fca83fdd. new 5479c31 src/sshmasterconnection.cpp: enable parsing of ~/.ssh/config. Fixes: #1121. This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (0ba2e55) \ N -- N -- N refs/heads/feature/libssh-api-upgrade (5479c31) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omits" are not gone; other references still refer to them. Any revisions marked "discards" are gone forever. The 18 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. Summary of changes: debian/changelog | 7 ++ res/i18n/x2goclient_es.ts | 218 ++++++++++++++++++++++++++------------------- 2 files changed, 134 insertions(+), 91 deletions(-) -- 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 93dd9152d5e1b2cb4700658934da417664e26379 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. Fixes: #870. --- debian/changelog | 2 ++ src/sshmasterconnection.cpp | 35 ++++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index 705916b..db1b531 100644 --- a/debian/changelog +++ b/debian/changelog @@ -560,6 +560,8 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - res/i18n/x2goclient_es.ts: fixup Spanish translation file where necessary and add comments/requests for re-translations for the next time. + - src/sshmasterconnection.cpp: use ssh_channel_listen_forward () instead + of ssh_forward_listen () for newer libssh versions. Fixes: #870. [ 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 e753fe2ce5c21282d9a9ba5b65450f80011a992b Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 17:50:05 2017 +0100 src/sshmasterconnection.cpp: replace deprecated channel_open_session () function with ssh_channel_open_session (). Might break on ancient systems, but we don't care. --- debian/changelog | 3 +++ src/sshmasterconnection.cpp | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 45a6816..907966f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -579,6 +579,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: replace deprecated channel_open_forward () function with ssh_channel_open_forward (). Might break on ancient systems, but we don't care. + - src/sshmasterconnection.cpp: replace deprecated channel_open_session () + function with ssh_channel_open_session (). Might break on ancient + systems, but we don't care. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index ba955cd..d671d35 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1602,11 +1602,11 @@ void SshMasterConnection::channelLoop() #ifdef DEBUG x2goDebug<<"Executing remote: "<<channelConnections.at ( i ).command<<endl; #endif - if ( channel_open_session ( channel ) !=SSH_OK ) + if ( ssh_channel_open_session ( channel ) !=SSH_OK ) { QString err=ssh_get_error ( my_ssh_session ); - QString errorMsg=tr ( "channel_open_session failed." ); - emit ioErr ( channelConnections[i].creator, errorMsg, err ); + QString errorMsg=tr ( "ssh_channel_open_session failed" ); + emit ioErr ( channelConnections[i].creator, errorMsg + ".", err ); #ifdef DEBUG x2goDebug<<errorMsg<<": "<<err<<endl; #endif -- 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 0c9dc982a93c04a17617bf91580738c8dc4649f0 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 17:45:31 2017 +0100 src/sshmasterconnection.cpp: replace deprecated channel_open_forward () function with ssh_channel_open_forward (). Might break on ancient systems, but we don't care. --- debian/changelog | 3 +++ src/sshmasterconnection.cpp | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 28c1ba5..45a6816 100644 --- a/debian/changelog +++ b/debian/changelog @@ -576,6 +576,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: replace deprecated channel_new () function with ssh_channel_new (). Might break on ancient systems, but we don't care. Also, add error handling in case ssh_channel_new () failed... + - src/sshmasterconnection.cpp: replace deprecated channel_open_forward () + function with ssh_channel_open_forward (). Might break on ancient + systems, but we don't care. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index bb9a8dd..ba955cd 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1577,15 +1577,15 @@ void SshMasterConnection::channelLoop() #ifdef DEBUG x2goDebug<<"Forwarding new channel, local port: "<<channelConnections.at ( i ).localPort<<endl; #endif - if ( channel_open_forward ( channel, - channelConnections.at ( i ).forwardHost.toLatin1(), - channelConnections.at ( i ).forwardPort, - channelConnections.at ( i ).localHost.toLatin1(), - channelConnections.at ( i ).localPort ) != SSH_OK ) + if ( ssh_channel_open_forward ( channel, + channelConnections.at ( i ).forwardHost.toLatin1(), + channelConnections.at ( i ).forwardPort, + channelConnections.at ( i ).localHost.toLatin1(), + channelConnections.at ( i ).localPort ) != SSH_OK ) { QString err=ssh_get_error ( my_ssh_session ); - QString errorMsg=tr ( "channel_open_forward failed." ); - emit ioErr ( channelConnections[i].creator, errorMsg, err ); + QString errorMsg=tr ( "ssh_channel_open_forward failed" ); + emit ioErr ( channelConnections[i].creator, errorMsg + ".", err ); #ifdef DEBUG x2goDebug<<errorMsg<<": "<<err<<endl; #endif -- 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 6e8faf2a4cec739dfd13de9eec2507be5cc5121c Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 17:52:29 2017 +0100 src/sshmasterconnection.cpp: replace deprecated channel_request_exec () function with ssh_channel_request_exec (). Might break on ancient systems, but we don't care. --- debian/changelog | 3 +++ src/sshmasterconnection.cpp | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 907966f..4b192be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -582,6 +582,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: replace deprecated channel_open_session () function with ssh_channel_open_session (). Might break on ancient systems, but we don't care. + - src/sshmasterconnection.cpp: replace deprecated channel_request_exec () + function with ssh_channel_request_exec (). Might break on ancient + systems, but we don't care. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index d671d35..8417d34 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1611,11 +1611,11 @@ void SshMasterConnection::channelLoop() x2goDebug<<errorMsg<<": "<<err<<endl; #endif } - else if ( channel_request_exec ( channel, channelConnections[i].command.toLatin1() ) != SSH_OK ) + else if ( ssh_channel_request_exec ( channel, channelConnections[i].command.toLatin1() ) != SSH_OK ) { QString err=ssh_get_error ( my_ssh_session ); - QString errorMsg=tr ( "channel_request_exec failed" ); - emit ioErr ( channelConnections[i].creator, errorMsg, err ); + QString errorMsg=tr ( "ssh_channel_request_exec failed" ); + emit ioErr ( channelConnections[i].creator, errorMsg + ".", err ); #ifdef DEBUG x2goDebug<<errorMsg<<": "<<err<<endl; #endif -- 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 530a5e6e3afd372c1632b280abc171f4748f001b Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 17:15:38 2017 +0100 src/sshmasterconnection.cpp: replace string_free () with its successor ssh_string_free (). Will break on ancient systems, but we don't care. --- debian/changelog | 2 ++ src/sshmasterconnection.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index b1d9fee..b6c2ea7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -571,6 +571,8 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium 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. + - src/sshmasterconnection.cpp: replace string_free () with its successor + ssh_string_free (). Will break on ancient systems, but we don't care. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index 99e35df..57ca78c 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1192,7 +1192,7 @@ bool SshMasterConnection::userAuthWithKey() int rc=ssh_userauth_pubkey(my_ssh_session, NULL, pubkeyStr, prkey); privatekey_free(prkey); - string_free(pubkeyStr); + ssh_string_free(pubkeyStr); #ifdef DEBUG x2goDebug<<"Authenticating with key: "<<rc<<endl; -- 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 d1e7566ee36be568552d0a07474fd2ff0b717a27 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 17:36:03 2017 +0100 src/sshmasterconnection.cpp: replace deprecated channel_new () function with ssh_channel_new (). Might break on ancient systems, but we don't care. Also, add error handling in case ssh_channel_new () failed... --- debian/changelog | 3 +++ src/sshmasterconnection.cpp | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index b6c2ea7..28c1ba5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -573,6 +573,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium first place. - src/sshmasterconnection.cpp: replace string_free () with its successor ssh_string_free (). Will break on ancient systems, but we don't care. + - src/sshmasterconnection.cpp: replace deprecated channel_new () function + with ssh_channel_new (). Might break on ancient systems, but we don't + care. Also, add error handling in case ssh_channel_new () failed... [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index 57ca78c..bb9a8dd 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1555,7 +1555,19 @@ void SshMasterConnection::channelLoop() #ifdef DEBUG x2goDebug<<"Creating new channel."<<endl; #endif - ssh_channel channel=channel_new ( my_ssh_session ); + ssh_channel channel = ssh_channel_new ( my_ssh_session ); + + if (!channel) { + QString err = ssh_get_error (my_ssh_session); + QString error_msg = tr ("ssh_channel_new failed"); + emit ioErr (channelConnections[i].creator, error_msg + ".", err); + +#ifdef DEBUG + x2goDebug << errorMsg << ": " << err << endl; +#endif + + continue; + } #ifdef DEBUG x2goDebug<<"New channel:"<<channel<<endl; #endif -- 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 d8d30e34d2515f91eb46b8f2f58d65ee9880f183 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 () (0.7.4 and higher) or ssh_get_publickey () (0.7.3 and lower) 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 | 9 +++++++++ src/sshmasterconnection.cpp | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index db1b531..b1d9fee 100644 --- a/debian/changelog +++ b/debian/changelog @@ -562,6 +562,15 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium time. - src/sshmasterconnection.cpp: use ssh_channel_listen_forward () instead of ssh_forward_listen () for newer libssh versions. Fixes: #870. + - src/sshmasterconnection.cpp: with libssh 0.6.0 and newer, get the public + key via ssh_get_server_publickey () (0.7.4 and higher) or + ssh_get_publickey () (0.7.3 and lower) 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..99e35df 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,22 +813,47 @@ int SshMasterConnection::serverAuth ( QString& errorMsg ) x2goDebug<<"cserverAuth"; #endif - int state, hlen; + int state = SSH_SERVER_ERROR; unsigned char *hash = NULL; - char *hexa; + char *hexa = NULL; +#if LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 6, 0) + ssh_key srv_pubkey = { 0 }; + int rc = SSH_ERROR; + size_t hlen = 0; +#else + int hlen = 0; +#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) +#if LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 7, 4) + rc = ssh_get_server_publickey (my_ssh_session, &srv_pubkey); +#else /* LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 7, 4) */ + rc = ssh_get_publickey (my_ssh_session, &srv_pubkey); +#endif /* LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 7, 4) */ + + 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 ( hlen < 0 ) + if (0 != rc) { + return (SSH_SERVER_ERROR); + } +#else + hlen = ssh_get_pubkey_hash ( my_ssh_session, &hash ); +#endif + + if ( 0 >= hlen ) return SSH_SERVER_ERROR; #ifdef DEBUG x2goDebug<<"state: "<<state<<endl; #endif - switch ( state ) { case SSH_SERVER_KNOWN_OK: @@ -836,7 +862,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 +872,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
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 6770e2322d726e417b0df35577fd3d69c1c86b8a Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 18:08:26 2017 +0100 src/sshmasterconnection.cpp: replace deprecated channel_is_eof () function with ssh_channel_is_eof (). Might break on ancient systems, but we don't care. --- debian/changelog | 3 +++ src/sshmasterconnection.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 4260f69..f133773 100644 --- a/debian/changelog +++ b/debian/changelog @@ -591,6 +591,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: replace deprecated channel_read () function with ssh_channel_read (). Might break on ancient systems, but we don't care. + - src/sshmasterconnection.cpp: replace deprecated channel_is_eof () + function with ssh_channel_is_eof (). Might break on ancient systems, but + we don't care. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index 5828d0f..2857e11 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1724,7 +1724,7 @@ void SshMasterConnection::channelLoop() continue; } - if ( channel_is_eof ( channel ) ) + if ( ssh_channel_is_eof ( channel ) ) { #ifdef DEBUG x2goDebug<<"EOF on channel "<<channel<<"; SshProcess object: "<<channelConnections[i].creator->pid; -- 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 9ab085920347ebf14e6613c821b2bdd63887f29f Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 18:12:09 2017 +0100 src/sshmasterconnection.cpp: replace deprecated channel_send_eof () function with ssh_channel_send_eof (). Might break on ancient systems, but we don't care. --- debian/changelog | 3 +++ src/sshmasterconnection.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index fbc1cff..58cca50 100644 --- a/debian/changelog +++ b/debian/changelog @@ -597,6 +597,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: replace deprecated channel_write () function with ssh_channel_write (). Might break on ancient systems, but we don't care. + - src/sshmasterconnection.cpp: replace deprecated channel_send_eof () + function with ssh_channel_send_eof (). Might break on ancient systems, + but we don't care. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index 91739b8..09dd40d 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1793,7 +1793,7 @@ void SshMasterConnection::finalize ( int item ) ssh_channel channel=channelConnections.at ( item ).channel; if ( channel ) { - channel_send_eof ( channel ); + ssh_channel_send_eof ( channel ); #ifdef DEBUG x2goDebug<<"EOF sent."; #endif -- 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 a5ecc9fd4278aaffa2b3ecb7db9c60a95d8699b3 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 18:13:28 2017 +0100 src/sshmasterconnection.cpp: replace deprecated channel_close () function with ssh_channel_close (). Might break on ancient systems, but we don't care. --- debian/changelog | 3 +++ src/sshmasterconnection.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 58cca50..7c9715d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -600,6 +600,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: replace deprecated channel_send_eof () function with ssh_channel_send_eof (). Might break on ancient systems, but we don't care. + - src/sshmasterconnection.cpp: replace deprecated channel_close () + function with ssh_channel_close (). Might break on ancient systems, but + we don't care. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index 09dd40d..fc7c069 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1797,7 +1797,7 @@ void SshMasterConnection::finalize ( int item ) #ifdef DEBUG x2goDebug<<"EOF sent."; #endif - channel_close ( channel ); + ssh_channel_close ( channel ); #ifdef DEBUG x2goDebug<<"Channel closed."; #endif -- 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 ae43804310c747a480614ff6842d5fb8b0f4989a Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 18:14:56 2017 +0100 src/sshmasterconnection.cpp: replace deprecated channel_free () function with ssh_channel_free (). Might break on ancient systems, but we don't care. --- debian/changelog | 3 +++ src/sshmasterconnection.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 7c9715d..cc91bbc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -603,6 +603,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: replace deprecated channel_close () function with ssh_channel_close (). Might break on ancient systems, but we don't care. + - src/sshmasterconnection.cpp: replace deprecated channel_free () function + with ssh_channel_free (). Might break on ancient systems, but we don't + care. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index fc7c069..21ab275 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1801,7 +1801,7 @@ void SshMasterConnection::finalize ( int item ) #ifdef DEBUG x2goDebug<<"Channel closed."; #endif - channel_free ( channel ); + ssh_channel_free ( channel ); } if ( tcpSocket>0 ) { -- 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 9c326fd8e54a368aa460a5f41458e6b808ef7554 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 18:06:22 2017 +0100 src/sshmasterconnection.cpp: replace deprecated channel_read () function with ssh_channel_read (). Might break on ancient systems, but we don't care. --- debian/changelog | 3 +++ src/sshmasterconnection.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 317af03..4260f69 100644 --- a/debian/changelog +++ b/debian/changelog @@ -588,6 +588,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: replace deprecated channel_poll () function with ssh_channel_poll (). Might break on ancient systems, but we don't care. + - src/sshmasterconnection.cpp: replace deprecated channel_read () function + with ssh_channel_read (). Might break on ancient systems, but we don't + care. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index babd71a..5828d0f 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1662,7 +1662,7 @@ void SshMasterConnection::channelLoop() #ifdef DEBUG // x2goDebug<<"read err data from channel\n"; #endif - nbytes = channel_read ( channel, buffer, sizeof ( buffer )-1, 1 ); + nbytes = ssh_channel_read ( channel, buffer, sizeof ( buffer )-1, 1 ); emit stdErr ( channelConnections[i].creator, QByteArray ( buffer,nbytes ) ); #ifdef DEBUG // x2goDebug<<nbytes<<" err from channel"<<endl; @@ -1683,7 +1683,7 @@ void SshMasterConnection::channelLoop() #ifdef DEBUG // x2goDebug<<"read data from channel "<<channel<<endl; #endif - nbytes = channel_read ( channel, buffer, sizeof ( buffer )-1, 0 ); + nbytes = ssh_channel_read ( channel, buffer, sizeof ( buffer )-1, 0 ); #ifdef DEBUG // x2goDebug<<nbytes<<" from channel "<<channel<<endl; #endif -- 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 a34bb98e7f11f8dd4cd2460d64cebb671fccc5f2 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 17:54:41 2017 +0100 src/sshmasterconnection.cpp: replace deprecated channel_poll () function with ssh_channel_poll (). Might break on ancient systems, but we don't care. --- debian/changelog | 3 +++ src/sshmasterconnection.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4b192be..317af03 100644 --- a/debian/changelog +++ b/debian/changelog @@ -585,6 +585,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: replace deprecated channel_request_exec () function with ssh_channel_request_exec (). Might break on ancient systems, but we don't care. + - src/sshmasterconnection.cpp: replace deprecated channel_poll () function + with ssh_channel_poll (). Might break on ancient systems, but we don't + care. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index 8417d34..babd71a 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1657,7 +1657,7 @@ void SshMasterConnection::channelLoop() ssh_channel channel=channelConnections.at ( i ).channel; if ( channel==0l ) continue; - if ( channel_poll ( channel,1 ) >0 ) + if ( ssh_channel_poll ( channel,1 ) > 0 ) { #ifdef DEBUG // x2goDebug<<"read err data from channel\n"; @@ -1668,7 +1668,7 @@ void SshMasterConnection::channelLoop() // x2goDebug<<nbytes<<" err from channel"<<endl; #endif } - int rez=channel_poll ( channel,0 ); + int rez = ssh_channel_poll ( channel, 0 ); if ( rez==SSH_EOF ) { #ifdef DEBUG -- 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 d6ef7cfefddafaac535b08f50f6a4b55459d4987 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 18:10:26 2017 +0100 src/sshmasterconnection.cpp: replace deprecated channel_write () function with ssh_channel_write (). Might break on ancient systems, but we don't care. --- debian/changelog | 3 +++ src/sshmasterconnection.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index f133773..fbc1cff 100644 --- a/debian/changelog +++ b/debian/changelog @@ -594,6 +594,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: replace deprecated channel_is_eof () function with ssh_channel_is_eof (). Might break on ancient systems, but we don't care. + - src/sshmasterconnection.cpp: replace deprecated channel_write () + function with ssh_channel_write (). Might break on ancient systems, but + we don't care. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index 2857e11..91739b8 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1746,13 +1746,13 @@ void SshMasterConnection::channelLoop() #endif if ( nbytes > 0 ) { - if ( channel_write ( channel, buffer, nbytes ) !=nbytes ) + if ( ssh_channel_write ( channel, buffer, nbytes ) !=nbytes ) { QString err=ssh_get_error ( my_ssh_session ); - QString errorMsg=tr ( "channel_write failed." ); - emit ioErr ( channelConnections[i].creator, errorMsg, err ); + QString errorMsg=tr ( "ssh_channel_write failed" ); + emit ioErr ( channelConnections[i].creator, errorMsg + ".", err ); #ifdef DEBUG - x2goDebug<<errorMsg<<" - "<<err<<endl; + x2goDebug<<errorMsg<<": "<<err<<endl; #endif finalize ( i ); continue; -- 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 5479c31f14af23058d8da9bd357c6e72905d8de7 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Feb 2 08:09:08 2017 +0100 src/sshmasterconnection.cpp: enable parsing of ~/.ssh/config. Fixes: #1121. Shorthands as host names and other bells and whistles like inferred port or user name values are now supported. --- debian/changelog | 3 + src/sessionwidget.cpp | 19 ++++-- src/sshmasterconnection.cpp | 148 +++++++++++++++++++++++++++++++++++++------ 3 files changed, 143 insertions(+), 27 deletions(-) diff --git a/debian/changelog b/debian/changelog index 789747b..fa1cd0e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -612,6 +612,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: fix up some debug strings. - src/sshmasterconnection.cpp: port more occurrences of "QString to C string" akin to 1b21d75f2c10609f3586f5b5e0b4ceb7fca83fdd. + - src/sshmasterconnection.cpp: enable parsing of ~/.ssh/config. + Fixes: #1121. Shorthands as host names and other bells and whistles like + inferred port or user name values are now supported. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sessionwidget.cpp b/src/sessionwidget.cpp index 9fd2781..e70aff6 100644 --- a/src/sessionwidget.cpp +++ b/src/sessionwidget.cpp @@ -84,17 +84,23 @@ SessionWidget::SessionWidget ( bool newSession, QString id, ONMainWindow * mw, #else QFrame* sgb=this; #endif + const QString ssh_port_tooltip_text = tr ("Values ranging from <b>0</b> to <b>65535</b> are allowed." + "<br />A value of <b>0</b> will either use the port specified in the " + "SSH configuration file belonging to a host or shortname, " + "or use the default of <b>22</b>."); server=new QLineEdit ( sgb ); uname=new QLineEdit ( sgb ); sshPort=new QSpinBox ( sgb ); sshPort->setValue ( mainWindow->getDefaultSshPort().toInt() ); - sshPort->setMinimum ( 1 ); - sshPort->setMaximum ( 999999999 ); + sshPort->setMinimum ( 0 ); + sshPort->setMaximum ( 65535 ); + sshPort->setToolTip (ssh_port_tooltip_text); #ifdef Q_OS_LINUX rdpPort=new QSpinBox ( sgb ); rdpPort->setValue ( mainWindow->getDefaultSshPort().toInt() ); - rdpPort->setMinimum ( 1 ); - rdpPort->setMaximum ( 999999999 ); + rdpPort->setMinimum ( 0 ); + rdpPort->setMaximum ( 65535 ); + rdpPort->setToolTip (ssh_port_tooltip_text); #endif key=new QLineEdit ( sgb ); @@ -156,8 +162,9 @@ SessionWidget::SessionWidget ( bool newSession, QString id, ONMainWindow * mw, proxyType->addButton(rbHttpProxy); proxyHost=new QLineEdit(proxyBox); proxyPort=new QSpinBox(proxyBox); - proxyPort->setMinimum ( 1 ); - proxyPort->setMaximum ( 999999999 ); + proxyPort->setMinimum ( 0 ); + proxyPort->setMaximum ( 65535 ); + proxyPort->setToolTip (ssh_port_tooltip_text); cbProxySameUser=new QCheckBox(tr("Same login as on X2Go Server"), proxyBox); proxyLogin=new QLineEdit(proxyBox); diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index bd05809..46d4f7e 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -195,14 +195,53 @@ SshMasterConnection::SshMasterConnection (QObject* parent, QString host, int por mainWnd=(ONMainWindow*) parent; kerberos=krblogin; challengeAuthVerificationCode=QString::null; - if(this->user==QString::null||this->user.length()<=0) - { + + if (this->user.isEmpty ()) { + /* We might have a config file request pending, honor this. */ + ssh_session tmp_session = ssh_new (); + + if (!tmp_session) { + QString error_msg = tr ("Cannot create SSH session."); + error_msg += " " + tr ("Using environment-provided username."); +#ifdef DEBUG + x2goDebug << error_msg; +#endif + } + else { + QByteArray tmp_BA; + + if ((useproxy) && (PROXYSSH == proxytype)) { + tmp_BA = this->proxyserver.toLocal8Bit (); + } + else { + tmp_BA = this->host.toLocal8Bit (); + } + + ssh_options_set (tmp_session, SSH_OPTIONS_HOST, tmp_BA.data ()); + + if (ssh_options_parse_config (tmp_session, NULL) < 0) { + x2goDebug << "Warning: unable to parse the SSH config file."; + } + + char *inferred_username = NULL; + ssh_options_get (tmp_session, SSH_OPTIONS_USER, &inferred_username); + x2goDebug << "Temporary session user name after config file parse: " << inferred_username; + + this->user = QString::fromLocal8Bit (inferred_username); + + ssh_string_free_char (inferred_username); + ssh_free (tmp_session); + } + } + + if (this->user.isEmpty ()) { #ifdef Q_OS_WIN - this->user=getenv("USERNAME"); + this->user = getenv ("USERNAME"); #else - this->user=getenv("USER"); + this->user = getenv ("USER"); #endif } + #ifdef DEBUG if (kerberos) { @@ -773,14 +812,30 @@ bool SshMasterConnection::sshConnect() if(useproxy && proxytype==PROXYSSH) { ssh_options_set ( my_ssh_session, SSH_OPTIONS_HOST, "127.0.0.1" ); - ssh_options_set ( my_ssh_session, SSH_OPTIONS_PORT, &localProxyPort ); - + if (localProxyPort) { + ssh_options_set ( my_ssh_session, SSH_OPTIONS_PORT, &localProxyPort ); + } } else { ssh_options_set ( my_ssh_session, SSH_OPTIONS_HOST, tmpBA.data() ); - ssh_options_set ( my_ssh_session, SSH_OPTIONS_PORT, &port ); + if (port) { + ssh_options_set ( my_ssh_session, SSH_OPTIONS_PORT, &port ); + } } + + unsigned int cur_port = 0; + ssh_options_get_port (my_ssh_session, &cur_port); + x2goDebug << "Session port before config file parse: " << cur_port; + + /* Parse ~/.ssh/config. */ + if (ssh_options_parse_config (my_ssh_session, NULL) < 0) { + x2goDebug << "Warning: unable to parse the SSH config file."; + } + + ssh_options_get_port (my_ssh_session, &cur_port); + x2goDebug << "Session port after config file parse: " << cur_port; + rc = ssh_connect ( my_ssh_session ); if ( rc != SSH_OK ) { @@ -790,9 +845,22 @@ bool SshMasterConnection::sshConnect() if(useproxy && proxytype==PROXYSSH) { ssh_options_set ( my_ssh_session, SSH_OPTIONS_HOST, tmpBA.data() ); - ssh_options_set ( my_ssh_session, SSH_OPTIONS_PORT, &port ); + if (port) { + ssh_options_set ( my_ssh_session, SSH_OPTIONS_PORT, &port ); + } + } + + ssh_options_get_port (my_ssh_session, &cur_port); + x2goDebug << "Session port before config file parse (part 2): " << cur_port; + /* Parse ~/.ssh/config. */ + if (ssh_options_parse_config (my_ssh_session, NULL) < 0) { + x2goDebug << "Warning: unable to parse the SSH config file."; } + + ssh_options_get_port (my_ssh_session, &cur_port); + x2goDebug << "Session port after config file parse (part 2): " << cur_port; + return true; } @@ -1583,23 +1651,61 @@ void SshMasterConnection::channelLoop() #ifdef DEBUG x2goDebug<<"Forwarding new channel, local port: "<<channelConnections.at ( i ).localPort<<endl; #endif - if ( ssh_channel_open_forward ( channel, - channelConnections.at ( i ).forwardHost.toLatin1(), - channelConnections.at ( i ).forwardPort, - channelConnections.at ( i ).localHost.toLatin1(), - channelConnections.at ( i ).localPort ) != SSH_OK ) - { - QString err=ssh_get_error ( my_ssh_session ); - QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_open_forward"); - emit ioErr ( channelConnections[i].creator, errorMsg, err ); + ssh_session tmp_session = ssh_new (); + + if (!tmp_session) { + QString error_msg = tr ("Cannot create SSH session."); #ifdef DEBUG - x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; + x2goDebug << error_msg; #endif + emit ioErr (channelConnections[i].creator, error_msg, ""); } -#ifdef DEBUG - else + else { + QByteArray tmp_BA = channelConnections.at (i).forwardHost.toLocal8Bit (); + ssh_options_set (tmp_session, SSH_OPTIONS_HOST, tmp_BA.data ()); + + /* The host and port might be a shorthand and zero, so fetch the actual data. */ + if (ssh_options_parse_config (tmp_session, NULL) < 0) { + x2goDebug << "Warning: unable to parse the SSH config file."; + } + + unsigned int inferred_port = 0; + ssh_options_get_port (tmp_session, &inferred_port); + x2goDebug << "Temporary session port after config file parse: " << inferred_port; + + char *inferred_host = NULL; + ssh_options_get (tmp_session, SSH_OPTIONS_HOST, &inferred_host); + x2goDebug << "Temporary session host after config file parse: " << inferred_host; + + channelConnections[i].forwardHost = QString (inferred_host); + channelConnections[i].forwardPort = static_cast<int> (inferred_port); + + ssh_string_free_char (inferred_host); + ssh_free (tmp_session); + } + { - x2goDebug<<"New channel forwarded."<<endl; + QByteArray tmp_BA_forward = channelConnections.at (i).forwardHost.toLocal8Bit (); + QByteArray tmp_BA_local = channelConnections.at (i).localHost.toLocal8Bit (); + + if ( ssh_channel_open_forward ( channel, + tmp_BA_forward.data (), + channelConnections.at ( i ).forwardPort, + tmp_BA_local.data (), + channelConnections.at ( i ).localPort ) != SSH_OK ) + { + QString err=ssh_get_error ( my_ssh_session ); + QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_open_forward"); + emit ioErr ( channelConnections[i].creator, errorMsg, err ); +#ifdef DEBUG + x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; +#endif + } +#ifdef DEBUG + else + { + x2goDebug<<"New channel forwarded."<<endl; + } } #endif } -- 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 bd335f0d9ea19019ee91a5f0c5ac6112c606da39 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Feb 2 06:56:32 2017 +0100 src/sshmasterconnection.cpp: fix up some debug strings. --- debian/changelog | 1 + src/sshmasterconnection.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2b3098f..058393e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -609,6 +609,7 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: use QString::arg () to insert function name and thus deduplicate error translation messages. Also re-add the full stop sign and remove it when needed for x2goDebug. + - src/sshmasterconnection.cpp: fix up some debug strings. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index 6469cd7..c2e8659 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -173,9 +173,9 @@ SshMasterConnection::SshMasterConnection (QObject* parent, QString host, int por breakLoop=false; kerberosDelegation=false; - x2goDebug << "SshMasterConnection, host " << host << "port " << port << "user " << user - << "useproxy " << useproxy << "proxyserver " << proxyserver - << "proxyport " << proxyport; + x2goDebug << "SshMasterConnection, host " << host << "; port " << port << "; user " << user + << "; useproxy " << useproxy << "; proxyserver " << proxyserver + << "; proxyport " << proxyport; this->host=host; this->port=port; this->user=user; @@ -467,7 +467,7 @@ void SshMasterConnection::run() #endif if(useproxy && proxytype==PROXYSSH) { - x2goDebug << "proxyserver: " << proxyserver << "proxyport: " << proxyport << "proxylogin: " << proxylogin; + x2goDebug << "proxyserver: " << proxyserver << "; proxyport: " << proxyport << "; proxylogin: " << proxylogin; sshProxy=new SshMasterConnection (0, proxyserver, proxyport,acceptUnknownServers, proxylogin, proxypassword, proxykey, proxyautologin, proxyKrbLogin, false); connect ( sshProxy, SIGNAL ( connectionOk(QString) ), this, SLOT ( slotSshProxyConnectionOk() ) ); -- 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 b1e826edfef57650de4ccbe48d2967a15ed0587b Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Jan 28 18:34:46 2017 +0100 src/sshmasterconnection.cpp: use QString::arg () to insert function name and thus deduplicate error translation messages. Also re-add the full stop sign and remove it when needed for x2goDebug. --- debian/changelog | 3 +++ src/sshmasterconnection.cpp | 31 ++++++++++++++++--------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/debian/changelog b/debian/changelog index cc91bbc..2b3098f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -606,6 +606,9 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium - src/sshmasterconnection.cpp: replace deprecated channel_free () function with ssh_channel_free (). Might break on ancient systems, but we don't care. + - src/sshmasterconnection.cpp: use QString::arg () to insert function name + and thus deduplicate error translation messages. Also re-add the full + stop sign and remove it when needed for x2goDebug. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index 21ab275..6469cd7 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1559,11 +1559,12 @@ void SshMasterConnection::channelLoop() if (!channel) { QString err = ssh_get_error (my_ssh_session); - QString error_msg = tr ("ssh_channel_new failed"); - emit ioErr (channelConnections[i].creator, error_msg + ".", err); + /*: Argument in this context will be a function name. */ + QString error_msg = tr ("%1 failed.").arg ("ssh_channel_new"); + emit ioErr (channelConnections[i].creator, error_msg, err); #ifdef DEBUG - x2goDebug << errorMsg << ": " << err << endl; + x2goDebug << error_msg.left (error_msg.size () - 1) << ": " << err << endl; #endif continue; @@ -1584,10 +1585,10 @@ void SshMasterConnection::channelLoop() channelConnections.at ( i ).localPort ) != SSH_OK ) { QString err=ssh_get_error ( my_ssh_session ); - QString errorMsg=tr ( "ssh_channel_open_forward failed" ); - emit ioErr ( channelConnections[i].creator, errorMsg + ".", err ); + QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_open_forward"); + emit ioErr ( channelConnections[i].creator, errorMsg, err ); #ifdef DEBUG - x2goDebug<<errorMsg<<": "<<err<<endl; + x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; #endif } #ifdef DEBUG @@ -1605,19 +1606,19 @@ void SshMasterConnection::channelLoop() if ( ssh_channel_open_session ( channel ) !=SSH_OK ) { QString err=ssh_get_error ( my_ssh_session ); - QString errorMsg=tr ( "ssh_channel_open_session failed" ); - emit ioErr ( channelConnections[i].creator, errorMsg + ".", err ); + QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_open_session"); + emit ioErr ( channelConnections[i].creator, errorMsg, err ); #ifdef DEBUG - x2goDebug<<errorMsg<<": "<<err<<endl; + x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; #endif } else if ( ssh_channel_request_exec ( channel, channelConnections[i].command.toLatin1() ) != SSH_OK ) { QString err=ssh_get_error ( my_ssh_session ); - QString errorMsg=tr ( "ssh_channel_request_exec failed" ); - emit ioErr ( channelConnections[i].creator, errorMsg + ".", err ); + QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_request_exec"); + emit ioErr ( channelConnections[i].creator, errorMsg, err ); #ifdef DEBUG - x2goDebug<<errorMsg<<": "<<err<<endl; + x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; #endif } #ifdef DEBUG @@ -1749,10 +1750,10 @@ void SshMasterConnection::channelLoop() if ( ssh_channel_write ( channel, buffer, nbytes ) !=nbytes ) { QString err=ssh_get_error ( my_ssh_session ); - QString errorMsg=tr ( "ssh_channel_write failed" ); - emit ioErr ( channelConnections[i].creator, errorMsg + ".", err ); + QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_write"); + emit ioErr ( channelConnections[i].creator, errorMsg, err ); #ifdef DEBUG - x2goDebug<<errorMsg<<": "<<err<<endl; + x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; #endif finalize ( i ); continue; -- 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 fc84c24b51e3d0c9109e58639621294677074308 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Feb 2 08:06:03 2017 +0100 src/sshmasterconnection.cpp: port more occurrences of "QString to C string" akin to 1b21d75f2c10609f3586f5b5e0b4ceb7fca83fdd. --- debian/changelog | 2 ++ src/sshmasterconnection.cpp | 31 ++++++++++++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/debian/changelog b/debian/changelog index 058393e..789747b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -610,6 +610,8 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium and thus deduplicate error translation messages. Also re-add the full stop sign and remove it when needed for x2goDebug. - src/sshmasterconnection.cpp: fix up some debug strings. + - src/sshmasterconnection.cpp: port more occurrences of "QString to C + string" akin to 1b21d75f2c10609f3586f5b5e0b4ceb7fca83fdd. [ Bernard Cafarelli ] * New upstream version (4.1.0.0): diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index c2e8659..bd05809 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -541,16 +541,20 @@ void SshMasterConnection::run() } #ifdef Q_OS_WIN - ssh_options_set ( my_ssh_session, SSH_OPTIONS_SSH_DIR, (mainWnd->getHomeDirectory()+"/ssh").toLocal8Bit()); + { + QByteArray tmp_BA = (mainWnd->getHomeDirectory () + "/ssh").toLocal8Bit (); + + ssh_options_set ( my_ssh_session, SSH_OPTIONS_SSH_DIR, tmp_BA.data ()); #ifdef DEBUG - x2goDebug<<"Setting SSH directory to "<<(mainWnd->getHomeDirectory()+"/ssh").toLocal8Bit(); + x2goDebug << "Setting SSH directory to " << tmp_BA.data (); #endif - if (kerberos) - { - parseKnownHosts(); + if (kerberos) + { + parseKnownHosts(); + } } - #endif + ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); ssh_options_set(my_ssh_session, SSH_OPTIONS_TIMEOUT, &timeout); @@ -652,17 +656,18 @@ void SshMasterConnection::run() return; } -#ifdef Q_OS_WIN - ssh_options_set ( my_ssh_session, SSH_OPTIONS_USER, user.toLocal8Bit() ); -#else - ssh_options_set ( my_ssh_session, SSH_OPTIONS_USER, user.toLatin1() ); -#endif + QByteArray tmp_BA = user.toLocal8Bit (); + ssh_options_set ( my_ssh_session, SSH_OPTIONS_USER, tmp_BA.data () ); #ifdef Q_OS_WIN - ssh_options_set ( my_ssh_session, SSH_OPTIONS_SSH_DIR, (mainWnd->getHomeDirectory()+"/ssh").toLocal8Bit()); + { + QByteArray tmp_BA = (mainWnd->getHomeDirectory () + "/ssh").toLocal8Bit (); + + ssh_options_set ( my_ssh_session, SSH_OPTIONS_SSH_DIR, tmp_BA.data () ); #ifdef DEBUG - x2goDebug<<"Setting SSH directory to "<<(mainWnd->getHomeDirectory()+"/ssh").toLocal8Bit(); + x2goDebug << "Setting SSH directory to " << tmp_BA.data (); #endif + } #endif if ( userAuth() ) -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git