diff options
Diffstat (limited to 'src/libs/ssh/sshconnection.cpp')
-rw-r--r-- | src/libs/ssh/sshconnection.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libs/ssh/sshconnection.cpp b/src/libs/ssh/sshconnection.cpp index f873e35b51..956e45a0fb 100644 --- a/src/libs/ssh/sshconnection.cpp +++ b/src/libs/ssh/sshconnection.cpp @@ -65,7 +65,8 @@ namespace QSsh { const QByteArray ClientId("SSH-2.0-QtCreator\r\n"); SshConnectionParameters::SshConnectionParameters() : - timeout(0), authenticationType(AuthenticationTypePublicKey), port(0) + timeout(0), authenticationType(AuthenticationTypePublicKey), port(0), + hostKeyCheckingMode(SshHostKeyCheckingNone) { options |= SshIgnoreDefaultProxy; options |= SshEnableStrictConformanceChecks; @@ -77,6 +78,7 @@ static inline bool equals(const SshConnectionParameters &p1, const SshConnection && p1.authenticationType == p2.authenticationType && (p1.authenticationType == SshConnectionParameters::AuthenticationTypePassword ? p1.password == p2.password : p1.privateKeyFile == p2.privateKeyFile) + && p1.hostKeyCheckingMode == p2.hostKeyCheckingMode && p1.timeout == p2.timeout && p1.port == p2.port; } @@ -90,7 +92,6 @@ bool operator!=(const SshConnectionParameters &p1, const SshConnectionParameters return !equals(p1, p2); } -// TODO: Mechanism for checking the host key. First connection to host: save, later: compare SshConnection::SshConnection(const SshConnectionParameters &serverInfo, QObject *parent) : QObject(parent) @@ -329,13 +330,13 @@ void SshConnectionPrivate::handleIncomingData() if (m_serverId.isEmpty()) handleServerId(); handlePackets(); - } catch (SshServerException &e) { + } catch (const SshServerException &e) { closeConnection(e.error, SshProtocolError, e.errorStringServer, tr("SSH Protocol error: %1").arg(e.errorStringUser)); - } catch (SshClientException &e) { + } catch (const SshClientException &e) { closeConnection(SSH_DISCONNECT_BY_APPLICATION, e.error, "", e.errorString); - } catch (Botan::Exception &e) { + } catch (const Botan::Exception &e) { closeConnection(SSH_DISCONNECT_BY_APPLICATION, SshInternalError, "", tr("Botan library exception: %1").arg(QString::fromLatin1(e.what()))); } @@ -411,7 +412,7 @@ void SshConnectionPrivate::handleServerId() } } - m_keyExchange.reset(new SshKeyExchange(m_sendFacility)); + m_keyExchange.reset(new SshKeyExchange(m_connParams, m_sendFacility)); m_keyExchange->sendKexInitPacket(m_serverId); m_keyExchangeState = KexInitSent; } @@ -460,7 +461,7 @@ void SshConnectionPrivate::handleKeyExchangeInitPacket() // Server-initiated re-exchange. if (m_keyExchangeState == NoKeyExchange) { - m_keyExchange.reset(new SshKeyExchange(m_sendFacility)); + m_keyExchange.reset(new SshKeyExchange(m_connParams, m_sendFacility)); m_keyExchange->sendKexInitPacket(m_serverId); } @@ -784,7 +785,7 @@ void SshConnectionPrivate::closeConnection(SshErrorCode sshError, try { m_channelManager->closeAllChannels(SshChannelManager::CloseAllAndReset); m_sendFacility.sendDisconnectPacket(sshError, serverErrorString); - } catch (Botan::Exception &) {} // Nothing sensible to be done here. + } catch (const Botan::Exception &) {} // Nothing sensible to be done here. if (m_error != SshNoError) emit error(userError); if (m_state == ConnectionEstablished) |