summaryrefslogtreecommitdiff
path: root/CodeLite/cl_ssh.cpp
diff options
context:
space:
mode:
authorJames Cowgill <james410@cowgill.org.uk>2014-08-29 12:01:12 +0100
committerJames Cowgill <james410@cowgill.org.uk>2014-08-29 12:01:12 +0100
commit517e089547f0b721a104ad2fabc6881d2fe2fff0 (patch)
tree65e15229c45ed375b5e381c46ed016d0cc670ae2 /CodeLite/cl_ssh.cpp
parent9535c6126d9ed34e0fdf40cc0bdd2dc01159644d (diff)
Imported Upstream version 6.1.1+dfsg
Diffstat (limited to 'CodeLite/cl_ssh.cpp')
-rw-r--r--CodeLite/cl_ssh.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/CodeLite/cl_ssh.cpp b/CodeLite/cl_ssh.cpp
index 958716f8..517cbb30 100644
--- a/CodeLite/cl_ssh.cpp
+++ b/CodeLite/cl_ssh.cpp
@@ -1,3 +1,28 @@
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//
+// copyright : (C) 2014 The CodeLite Team
+// file name : cl_ssh.cpp
+//
+// -------------------------------------------------------------------------
+// A
+// _____ _ _ _ _
+// / __ \ | | | | (_) |
+// | / \/ ___ __| | ___| | _| |_ ___
+// | | / _ \ / _ |/ _ \ | | | __/ _ )
+// | \__/\ (_) | (_| | __/ |___| | || __/
+// \____/\___/ \__,_|\___\_____/_|\__\___|
+//
+// F i l e
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
#if USE_SFTP
#include <wx/string.h>
@@ -50,16 +75,28 @@ void clSSH::Connect() throw(clException)
bool clSSH::AuthenticateServer(wxString &message) throw (clException)
{
- int state = -1, hlen = 0;
+ int state = -1;
unsigned char *hash = NULL;
char *hexa = NULL;
message.Clear();
state = ssh_is_server_known(m_session);
+
+#if LIBSSH_VERSION_INT < SSH_VERSION_INT(0, 6, 1)
+ int hlen = 0;
hlen = ssh_get_pubkey_hash(m_session, &hash);
if (hlen < 0) {
throw clException("Unable to obtain server public key!");
}
+#else
+ size_t hlen = 0;
+ ssh_key key = NULL;
+ ssh_get_publickey(m_session, &key);
+ ssh_get_publickey_hash(key, SSH_PUBLICKEY_HASH_SHA1, &hash, &hlen);
+ if (hlen == 0) {
+ throw clException("Unable to obtain server public key!");
+ }
+#endif
switch (state) {
case SSH_SERVER_KNOWN_OK: