[X2Go-Commits] [x2goclient] 01/01: src/sshmasterconnection.cpp: libssh < 0.6.0 does not have the ssh_options_get () API, but instead expects users to pull out information directly from the ssh_session structure.

git-admin at x2go.org git-admin at x2go.org
Thu Feb 23 06:09:19 CET 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goclient.

commit 43da15a4074378ef81c33e97aa79a72f7f0d6202
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Feb 23 06:05:26 2017 +0100

    src/sshmasterconnection.cpp: libssh < 0.6.0 does not have the ssh_options_get () API, but instead expects users to pull out information directly from the ssh_session structure.
    
    This fixes compile issues on systems with older libssh versions.
---
 debian/changelog            |    4 ++++
 src/sshmasterconnection.cpp |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 0e8cf77..713e269 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -63,6 +63,10 @@ x2goclient (4.1.0.1-0x2go1) UNRELEASED; urgency=medium
     - src/pulsemanager.cpp: fix up a debug string. Qt drops a space where I'd
       like to have one and inserts a space where I'd like none, so work around
       that fancifully.
+    - src/sshmasterconnection.cpp: libssh < 0.6.0 does not have the
+      ssh_options_get () API, but instead expects users to pull out
+      information directly from the ssh_session structure. This fixes compile
+      issues on systems with older libssh versions.
 
  -- X2Go Release Manager <git-admin at x2go.org>  Wed, 22 Feb 2017 07:13:10 +0100
 
diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp
index f16bf85..f99a1bd 100644
--- a/src/sshmasterconnection.cpp
+++ b/src/sshmasterconnection.cpp
@@ -224,7 +224,11 @@ SshMasterConnection::SshMasterConnection (QObject* parent, QString host, int por
             }
 
             char *inferred_username = NULL;
+#if LIBSSH_VERSION_INT < SSH_VERSION_INT (0, 6, 0)
+            inferred_username = tmp_session->username;
+#else
             ssh_options_get (tmp_session, SSH_OPTIONS_USER, &inferred_username);
+#endif
             x2goDebug << "Temporary session user name after config file parse: " << inferred_username;
 
             this->user = QString::fromLocal8Bit (inferred_username);
@@ -825,7 +829,11 @@ bool SshMasterConnection::sshConnect()
     }
 
     unsigned int cur_port = 0;
+#if LIBSSH_VERSION_INT < SSH_VERSION_INT (0, 6, 0)
+    cur_port = my_ssh_session->port;
+#else
     ssh_options_get_port (my_ssh_session, &cur_port);
+#endif
     x2goDebug << "Session port before config file parse: " << cur_port;
 
     /* Parse ~/.ssh/config. */
@@ -833,7 +841,11 @@ bool SshMasterConnection::sshConnect()
         x2goDebug << "Warning: unable to parse the SSH config file.";
     }
 
+#if LIBSSH_VERSION_INT < SSH_VERSION_INT (0, 6, 0)
+    cur_port = my_ssh_session->port;
+#else
     ssh_options_get_port (my_ssh_session, &cur_port);
+#endif
     x2goDebug << "Session port after config file parse: " << cur_port;
 
     rc = ssh_connect ( my_ssh_session );
@@ -850,7 +862,11 @@ bool SshMasterConnection::sshConnect()
         }
     }
 
+#if LIBSSH_VERSION_INT < SSH_VERSION_INT (0, 6, 0)
+    cur_port = my_ssh_session->port;
+#else
     ssh_options_get_port (my_ssh_session, &cur_port);
+#endif
     x2goDebug << "Session port before config file parse (part 2): " << cur_port;
 
     /* Parse ~/.ssh/config. */
@@ -858,7 +874,11 @@ bool SshMasterConnection::sshConnect()
         x2goDebug << "Warning: unable to parse the SSH config file.";
     }
 
+#if LIBSSH_VERSION_INT < SSH_VERSION_INT (0, 6, 0)
+    cur_port = my_ssh_session->port;
+#else
     ssh_options_get_port (my_ssh_session, &cur_port);
+#endif
     x2goDebug << "Session port after config file parse (part 2): " << cur_port;
 
     return true;
@@ -1679,17 +1699,34 @@ void SshMasterConnection::channelLoop()
                         }
 
                         unsigned int inferred_port = 0;
+#if LIBSSH_VERSION_INT < SSH_VERSION_INT (0, 6, 0)
+                        inferred_port = tmp_session->port;
+#else
                         ssh_options_get_port (tmp_session, &inferred_port);
+#endif
                         x2goDebug << "Temporary session port after config file parse: " << inferred_port;
 
                         char *inferred_host = NULL;
+#if LIBSSH_VERSION_INT < SSH_VERSION_INT (0, 6, 0)
+                        if (inferred_host) {
+                            inferred_host = strdup(tmp_session->host);
+                        }
+                        else {
+                            x2goDebug << "Temporary session host after config file parse NULL; should not happen, as it was set before.";
+                        }
+#else
                         ssh_options_get (tmp_session, SSH_OPTIONS_HOST, &inferred_host);
+#endif
                         x2goDebug << "Temporary session host after config file parse: " << inferred_host;
 
                         channelConnections[i].forwardHost = QString (inferred_host);
                         channelConnections[i].forwardPort = static_cast<int> (inferred_port);
 
+#if LIBSSH_VERSION_INT < SSH_VERSION_INT (0, 6, 0)
+                        free (inferred_host);
+#else
                         ssh_string_free_char (inferred_host);
+#endif
                         ssh_free (tmp_session);
                     }
 

--
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