[X2Go-Commits] [x2goclient] 01/18: src/sshmasterconnection.cpp: use ssh_channel_listen_forward () instead of ssh_forward_listen () for newer libssh versions. Fixes: #870.
git-admin at x2go.org
git-admin at x2go.org
Fri Feb 10 05:35:18 CET 2017
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 415cced86f4c448722eb1752fc3d079d86fe9b38
Author: Mihai Moldovan <ionic at 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 9239577..ce71471 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -564,6 +564,8 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium
whitespace fixup.
- res/i18n/x2goclient_de.ts: fixup German translation file, including
typo, whitespace, grammar fixes and other stuff.
+ - 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
More information about the x2go-commits
mailing list