diff --git a/src/libs/ssh/sshconnection.cpp b/src/libs/ssh/sshconnection.cpp index 8c4abf2347c..5b7db878d6a 100644 --- a/src/libs/ssh/sshconnection.cpp +++ b/src/libs/ssh/sshconnection.cpp @@ -81,8 +81,10 @@ namespace { SshConnectionParameters::SshConnectionParameters() : - timeout(0), authenticationType(AuthenticationByKey), port(0), options(SshIgnoreDefaultProxy) + timeout(0), authenticationType(AuthenticationByKey), port(0) { + options |= SshIgnoreDefaultProxy; + options |= SshEnableStrictConformanceChecks; } static inline bool equals(const SshConnectionParameters &p1, const SshConnectionParameters &p2) @@ -398,18 +400,19 @@ void SshConnectionPrivate::handleServerId() .arg(serverProtoVersion)); } - // Disable this check to accept older OpenSSH servers that do this wrong. - if (serverProtoVersion == QLatin1String("2.0") && !hasCarriageReturn) { - throw SshServerException(SSH_DISCONNECT_PROTOCOL_ERROR, - "Identification string is invalid.", - tr("Server identification string is invalid (missing carriage return).")); - } + if (m_connParams.options & SshEnableStrictConformanceChecks) { + if (serverProtoVersion == QLatin1String("2.0") && !hasCarriageReturn) { + throw SshServerException(SSH_DISCONNECT_PROTOCOL_ERROR, + "Identification string is invalid.", + tr("Server identification string is invalid (missing carriage return).")); + } - if (serverProtoVersion == QLatin1String("1.99") && m_serverHasSentDataBeforeId) { - throw SshServerException(SSH_DISCONNECT_PROTOCOL_ERROR, - "No extra data preceding identification string allowed for 1.99.", - tr("Server reports protocol version 1.99, but sends data " - "before the identification string, which is not allowed.")); + if (serverProtoVersion == QLatin1String("1.99") && m_serverHasSentDataBeforeId) { + throw SshServerException(SSH_DISCONNECT_PROTOCOL_ERROR, + "No extra data preceding identification string allowed for 1.99.", + tr("Server reports protocol version 1.99, but sends data " + "before the identification string, which is not allowed.")); + } } m_keyExchange.reset(new SshKeyExchange(m_sendFacility)); diff --git a/src/libs/ssh/sshconnection.h b/src/libs/ssh/sshconnection.h index 07746f94420..a007db478dd 100644 --- a/src/libs/ssh/sshconnection.h +++ b/src/libs/ssh/sshconnection.h @@ -51,7 +51,8 @@ class SshConnectionPrivate; } // namespace Internal enum SshConnectionOption { - SshIgnoreDefaultProxy = 0x1 + SshIgnoreDefaultProxy = 0x1, + SshEnableStrictConformanceChecks = 0x2 }; Q_DECLARE_FLAGS(SshConnectionOptions, SshConnectionOption) diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp index a157dff4c82..0a1cc8ef67c 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp @@ -77,6 +77,7 @@ GenericLinuxDeviceConfigurationWizard::~GenericLinuxDeviceConfigurationWizard() IDevice::Ptr GenericLinuxDeviceConfigurationWizard::device() { QSsh::SshConnectionParameters sshParams; + sshParams.options &= ~SshConnectionOptions(SshEnableStrictConformanceChecks); // For older SSH servers. sshParams.host = d->setupPage.hostName(); sshParams.userName = d->setupPage.userName(); sshParams.port = 22;