diff options
Diffstat (limited to 'CodeLite/cl_ssh.cpp')
-rw-r--r-- | CodeLite/cl_ssh.cpp | 39 |
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: |