forked from qt-creator/qt-creator
Combine some SshConnectionParameter members
Combine host, port, username and password into a 'url' member and add some convenience accessors. Change-Id: Iddc26ff00dad1285c96aa56f196dbc4febe8e974 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -63,21 +63,21 @@ namespace QSsh {
|
|||||||
const QByteArray ClientId("SSH-2.0-QtCreator\r\n");
|
const QByteArray ClientId("SSH-2.0-QtCreator\r\n");
|
||||||
|
|
||||||
SshConnectionParameters::SshConnectionParameters() :
|
SshConnectionParameters::SshConnectionParameters() :
|
||||||
timeout(0), authenticationType(AuthenticationTypePublicKey), port(0),
|
timeout(0), authenticationType(AuthenticationTypePublicKey),
|
||||||
hostKeyCheckingMode(SshHostKeyCheckingNone)
|
hostKeyCheckingMode(SshHostKeyCheckingNone)
|
||||||
{
|
{
|
||||||
|
url.setPort(0);
|
||||||
options |= SshIgnoreDefaultProxy;
|
options |= SshIgnoreDefaultProxy;
|
||||||
options |= SshEnableStrictConformanceChecks;
|
options |= SshEnableStrictConformanceChecks;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool equals(const SshConnectionParameters &p1, const SshConnectionParameters &p2)
|
static inline bool equals(const SshConnectionParameters &p1, const SshConnectionParameters &p2)
|
||||||
{
|
{
|
||||||
return p1.host == p2.host && p1.userName == p2.userName
|
return p1.url == p2.url
|
||||||
&& p1.authenticationType == p2.authenticationType
|
&& p1.authenticationType == p2.authenticationType
|
||||||
&& (p1.authenticationType == SshConnectionParameters::AuthenticationTypePassword ?
|
&& p1.privateKeyFile == p2.privateKeyFile
|
||||||
p1.password == p2.password : p1.privateKeyFile == p2.privateKeyFile)
|
|
||||||
&& p1.hostKeyCheckingMode == p2.hostKeyCheckingMode
|
&& p1.hostKeyCheckingMode == p2.hostKeyCheckingMode
|
||||||
&& p1.timeout == p2.timeout && p1.port == p2.port;
|
&& p1.timeout == p2.timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const SshConnectionParameters &p1, const SshConnectionParameters &p2)
|
bool operator==(const SshConnectionParameters &p1, const SshConnectionParameters &p2)
|
||||||
@@ -521,11 +521,11 @@ void SshConnectionPrivate::handleServiceAcceptPacket()
|
|||||||
m_triedAllPasswordBasedMethods = false;
|
m_triedAllPasswordBasedMethods = false;
|
||||||
// Fall-through.
|
// Fall-through.
|
||||||
case SshConnectionParameters::AuthenticationTypePassword:
|
case SshConnectionParameters::AuthenticationTypePassword:
|
||||||
m_sendFacility.sendUserAuthByPasswordRequestPacket(m_connParams.userName.toUtf8(),
|
m_sendFacility.sendUserAuthByPasswordRequestPacket(m_connParams.userName().toUtf8(),
|
||||||
SshCapabilities::SshConnectionService, m_connParams.password.toUtf8());
|
SshCapabilities::SshConnectionService, m_connParams.password().toUtf8());
|
||||||
break;
|
break;
|
||||||
case SshConnectionParameters::AuthenticationTypeKeyboardInteractive:
|
case SshConnectionParameters::AuthenticationTypeKeyboardInteractive:
|
||||||
m_sendFacility.sendUserAuthByKeyboardInteractiveRequestPacket(m_connParams.userName.toUtf8(),
|
m_sendFacility.sendUserAuthByKeyboardInteractiveRequestPacket(m_connParams.userName().toUtf8(),
|
||||||
SshCapabilities::SshConnectionService);
|
SshCapabilities::SshConnectionService);
|
||||||
break;
|
break;
|
||||||
case SshConnectionParameters::AuthenticationTypePublicKey:
|
case SshConnectionParameters::AuthenticationTypePublicKey:
|
||||||
@@ -575,7 +575,7 @@ void SshConnectionPrivate::handleUserAuthInfoRequestPacket()
|
|||||||
|
|
||||||
// Not very interactive, admittedly, but we don't want to be for now.
|
// Not very interactive, admittedly, but we don't want to be for now.
|
||||||
for (int i = 0; i < requestPacket.prompts.count(); ++i)
|
for (int i = 0; i < requestPacket.prompts.count(); ++i)
|
||||||
responses << m_connParams.password;
|
responses << m_connParams.password();
|
||||||
m_sendFacility.sendUserAuthInfoResponsePacket(responses);
|
m_sendFacility.sendUserAuthInfoResponsePacket(responses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -626,7 +626,7 @@ void SshConnectionPrivate::handleUserAuthFailurePacket()
|
|||||||
&& !m_triedAllPasswordBasedMethods) {
|
&& !m_triedAllPasswordBasedMethods) {
|
||||||
m_triedAllPasswordBasedMethods = true;
|
m_triedAllPasswordBasedMethods = true;
|
||||||
m_sendFacility.sendUserAuthByKeyboardInteractiveRequestPacket(
|
m_sendFacility.sendUserAuthByKeyboardInteractiveRequestPacket(
|
||||||
m_connParams.userName.toUtf8(),
|
m_connParams.userName().toUtf8(),
|
||||||
SshCapabilities::SshConnectionService);
|
SshCapabilities::SshConnectionService);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -840,7 +840,7 @@ void SshConnectionPrivate::tryAllAgentKeys()
|
|||||||
qCDebug(sshLog) << "trying authentication with" << keys.count()
|
qCDebug(sshLog) << "trying authentication with" << keys.count()
|
||||||
<< "public keys received from agent";
|
<< "public keys received from agent";
|
||||||
foreach (const QByteArray &key, keys) {
|
foreach (const QByteArray &key, keys) {
|
||||||
m_sendFacility.sendQueryPublicKeyPacket(m_connParams.userName.toUtf8(),
|
m_sendFacility.sendQueryPublicKeyPacket(m_connParams.userName().toUtf8(),
|
||||||
SshCapabilities::SshConnectionService, key);
|
SshCapabilities::SshConnectionService, key);
|
||||||
m_pendingKeyChecks.enqueue(key);
|
m_pendingKeyChecks.enqueue(key);
|
||||||
}
|
}
|
||||||
@@ -860,7 +860,7 @@ void SshConnectionPrivate::authenticateWithPublicKey()
|
|||||||
signature = m_agentSignature;
|
signature = m_agentSignature;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sendFacility.sendUserAuthByPublicKeyRequestPacket(m_connParams.userName.toUtf8(),
|
m_sendFacility.sendUserAuthByPublicKeyRequestPacket(m_connParams.userName().toUtf8(),
|
||||||
SshCapabilities::SshConnectionService, key, signature);
|
SshCapabilities::SshConnectionService, key, signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -929,7 +929,7 @@ void SshConnectionPrivate::connectToHost()
|
|||||||
m_state = SocketConnecting;
|
m_state = SocketConnecting;
|
||||||
m_keyExchangeState = NoKeyExchange;
|
m_keyExchangeState = NoKeyExchange;
|
||||||
m_timeoutTimer.start();
|
m_timeoutTimer.start();
|
||||||
m_socket->connectToHost(m_connParams.host, m_connParams.port);
|
m_socket->connectToHost(m_connParams.host(), m_connParams.port());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshConnectionPrivate::closeConnection(SshErrorCode sshError,
|
void SshConnectionPrivate::closeConnection(SshErrorCode sshError,
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
namespace QSsh {
|
namespace QSsh {
|
||||||
class SftpChannel;
|
class SftpChannel;
|
||||||
@@ -75,13 +76,19 @@ public:
|
|||||||
|
|
||||||
SshConnectionParameters();
|
SshConnectionParameters();
|
||||||
|
|
||||||
QString host;
|
QString host() const { return url.host(); }
|
||||||
QString userName;
|
quint16 port() const { return url.port(); }
|
||||||
QString password;
|
QString userName() const { return url.userName(); }
|
||||||
|
QString password() const { return url.password(); }
|
||||||
|
void setHost(const QString &host) { url.setHost(host); }
|
||||||
|
void setPort(int port) { url.setPort(port); }
|
||||||
|
void setUserName(const QString &name) { url.setUserName(name); }
|
||||||
|
void setPassword(const QString &password) { url.setPassword(password); }
|
||||||
|
|
||||||
|
QUrl url;
|
||||||
QString privateKeyFile;
|
QString privateKeyFile;
|
||||||
int timeout; // In seconds.
|
int timeout; // In seconds.
|
||||||
AuthenticationType authenticationType;
|
AuthenticationType authenticationType;
|
||||||
quint16 port;
|
|
||||||
SshConnectionOptions options;
|
SshConnectionOptions options;
|
||||||
SshHostKeyCheckingMode hostKeyCheckingMode;
|
SshHostKeyCheckingMode hostKeyCheckingMode;
|
||||||
SshHostKeyDatabasePtr hostKeyDatabase;
|
SshHostKeyDatabasePtr hostKeyDatabase;
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ void SshKeyExchange::checkHostKey(const QByteArray &hostKey)
|
|||||||
{
|
{
|
||||||
if (m_connParams.hostKeyCheckingMode == SshHostKeyCheckingNone) {
|
if (m_connParams.hostKeyCheckingMode == SshHostKeyCheckingNone) {
|
||||||
if (m_connParams.hostKeyDatabase)
|
if (m_connParams.hostKeyDatabase)
|
||||||
m_connParams.hostKeyDatabase->insertHostKey(m_connParams.host, hostKey);
|
m_connParams.hostKeyDatabase->insertHostKey(m_connParams.host(), hostKey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ void SshKeyExchange::checkHostKey(const QByteArray &hostKey)
|
|||||||
"if host key checking is enabled."));
|
"if host key checking is enabled."));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m_connParams.hostKeyDatabase->matchHostKey(m_connParams.host, hostKey)) {
|
switch (m_connParams.hostKeyDatabase->matchHostKey(m_connParams.host(), hostKey)) {
|
||||||
case SshHostKeyDatabase::KeyLookupMatch:
|
case SshHostKeyDatabase::KeyLookupMatch:
|
||||||
return; // Nothing to do.
|
return; // Nothing to do.
|
||||||
case SshHostKeyDatabase::KeyLookupMismatch:
|
case SshHostKeyDatabase::KeyLookupMismatch:
|
||||||
@@ -259,14 +259,14 @@ void SshKeyExchange::checkHostKey(const QByteArray &hostKey)
|
|||||||
throwHostKeyException();
|
throwHostKeyException();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_connParams.hostKeyDatabase->insertHostKey(m_connParams.host, hostKey);
|
m_connParams.hostKeyDatabase->insertHostKey(m_connParams.host(), hostKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshKeyExchange::throwHostKeyException()
|
void SshKeyExchange::throwHostKeyException()
|
||||||
{
|
{
|
||||||
throw SshServerException(SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE, "Host key changed",
|
throw SshServerException(SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE, "Host key changed",
|
||||||
SSH_TR("Host key of machine \"%1\" has changed.")
|
SSH_TR("Host key of machine \"%1\" has changed.")
|
||||||
.arg(m_connParams.host));
|
.arg(m_connParams.host()));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -104,8 +104,8 @@ void BareMetalDevice::setChannelByServerProvider(GdbServerProvider *provider)
|
|||||||
if (colon < 0)
|
if (colon < 0)
|
||||||
return;
|
return;
|
||||||
QSsh::SshConnectionParameters sshParams = sshParameters();
|
QSsh::SshConnectionParameters sshParams = sshParameters();
|
||||||
sshParams.host = channel.left(colon);
|
sshParams.setHost(channel.left(colon));
|
||||||
sshParams.port = channel.mid(colon + 1).toUShort();
|
sshParams.setPort(channel.mid(colon + 1).toUShort());
|
||||||
setSshParameters(sshParams);
|
setSshParameters(sshParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,8 +121,8 @@ void BareMetalDevice::fromMap(const QVariantMap &map)
|
|||||||
const QSsh::SshConnectionParameters sshParams = sshParameters();
|
const QSsh::SshConnectionParameters sshParams = sshParameters();
|
||||||
DefaultGdbServerProvider *newProvider = new DefaultGdbServerProvider;
|
DefaultGdbServerProvider *newProvider = new DefaultGdbServerProvider;
|
||||||
newProvider->setDisplayName(name);
|
newProvider->setDisplayName(name);
|
||||||
newProvider->m_host = sshParams.host;
|
newProvider->m_host = sshParams.host();
|
||||||
newProvider->m_port = sshParams.port;
|
newProvider->m_port = sshParams.port();
|
||||||
if (GdbServerProviderManager::registerProvider(newProvider))
|
if (GdbServerProviderManager::registerProvider(newProvider))
|
||||||
gdbServerProvider = newProvider->id();
|
gdbServerProvider = newProvider->id();
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent)
|
|||||||
d->kitChooser = new KitChooser(this);
|
d->kitChooser = new KitChooser(this);
|
||||||
d->kitChooser->setKitPredicate([](const Kit *kit) {
|
d->kitChooser->setKitPredicate([](const Kit *kit) {
|
||||||
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||||
return kit->isValid() && device && !device->sshParameters().host.isEmpty();
|
return kit->isValid() && device && !device->sshParameters().host().isEmpty();
|
||||||
});
|
});
|
||||||
d->executable = new QLineEdit(this);
|
d->executable = new QLineEdit(this);
|
||||||
d->arguments = new QLineEdit(this);
|
d->arguments = new QLineEdit(this);
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ void StartApplicationDialog::run(bool attachRemote)
|
|||||||
if (!inputAddress.isEmpty())
|
if (!inputAddress.isEmpty())
|
||||||
debugger->setRemoteChannel(inputAddress);
|
debugger->setRemoteChannel(inputAddress);
|
||||||
else
|
else
|
||||||
debugger->setRemoteChannel(dev->sshParameters().host, newParameters.serverPort);
|
debugger->setRemoteChannel(dev->sshParameters().host(), newParameters.serverPort);
|
||||||
debugger->setRunControlName(newParameters.displayName());
|
debugger->setRunControlName(newParameters.displayName());
|
||||||
debugger->setBreakOnMain(newParameters.breakAtMain);
|
debugger->setBreakOnMain(newParameters.breakAtMain);
|
||||||
debugger->setDebugInfoLocation(newParameters.debugInfoLocation);
|
debugger->setDebugInfoLocation(newParameters.debugInfoLocation);
|
||||||
|
|||||||
@@ -2141,7 +2141,7 @@ void DebuggerPluginPrivate::attachToQmlPort()
|
|||||||
debugger->setQmlServer(qmlServer);
|
debugger->setQmlServer(qmlServer);
|
||||||
|
|
||||||
QSsh::SshConnectionParameters sshParameters = device->sshParameters();
|
QSsh::SshConnectionParameters sshParameters = device->sshParameters();
|
||||||
debugger->setRemoteChannel(sshParameters.host, sshParameters.port);
|
debugger->setRemoteChannel(sshParameters.host(), sshParameters.port());
|
||||||
debugger->setStartMode(AttachToQmlServer);
|
debugger->setStartMode(AttachToQmlServer);
|
||||||
|
|
||||||
debugger->startRunControl();
|
debugger->startRunControl();
|
||||||
|
|||||||
@@ -972,7 +972,7 @@ Port GdbServerPortsGatherer::gdbServerPort() const
|
|||||||
QString GdbServerPortsGatherer::gdbServerChannel() const
|
QString GdbServerPortsGatherer::gdbServerChannel() const
|
||||||
{
|
{
|
||||||
QUrl url = channel(0);
|
QUrl url = channel(0);
|
||||||
const QString host = m_device->sshParameters().host;
|
const QString host = m_device->sshParameters().host();
|
||||||
return QString("%1:%2").arg(host).arg(url.port());
|
return QString("%1:%2").arg(host).arg(url.port());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ public:
|
|||||||
m_channelForwarder->setFromUrlGetter([this] {
|
m_channelForwarder->setFromUrlGetter([this] {
|
||||||
QUrl url;
|
QUrl url;
|
||||||
url.setScheme(urlTcpScheme());
|
url.setScheme(urlTcpScheme());
|
||||||
url.setHost(device()->sshParameters().host);
|
url.setHost(device()->sshParameters().host());
|
||||||
url.setPort(m_portGatherer->findPort().number());
|
url.setPort(m_portGatherer->findPort().number());
|
||||||
return url;
|
return url;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -332,12 +332,12 @@ void IDevice::fromMap(const QVariantMap &map)
|
|||||||
d->id = newId();
|
d->id = newId();
|
||||||
d->origin = static_cast<Origin>(map.value(QLatin1String(OriginKey), ManuallyAdded).toInt());
|
d->origin = static_cast<Origin>(map.value(QLatin1String(OriginKey), ManuallyAdded).toInt());
|
||||||
|
|
||||||
d->sshParameters.host = map.value(QLatin1String(HostKey)).toString();
|
d->sshParameters.setHost(map.value(QLatin1String(HostKey)).toString());
|
||||||
d->sshParameters.port = map.value(QLatin1String(SshPortKey), 22).toInt();
|
d->sshParameters.setPort(map.value(QLatin1String(SshPortKey), 22).toInt());
|
||||||
d->sshParameters.userName = map.value(QLatin1String(UserNameKey)).toString();
|
d->sshParameters.setUserName(map.value(QLatin1String(UserNameKey)).toString());
|
||||||
d->sshParameters.authenticationType
|
d->sshParameters.authenticationType
|
||||||
= static_cast<AuthType>(map.value(QLatin1String(AuthKey), DefaultAuthType).toInt());
|
= static_cast<AuthType>(map.value(QLatin1String(AuthKey), DefaultAuthType).toInt());
|
||||||
d->sshParameters.password = map.value(QLatin1String(PasswordKey)).toString();
|
d->sshParameters.setPassword(map.value(QLatin1String(PasswordKey)).toString());
|
||||||
d->sshParameters.privateKeyFile = map.value(QLatin1String(KeyFileKey), defaultPrivateKeyFilePath()).toString();
|
d->sshParameters.privateKeyFile = map.value(QLatin1String(KeyFileKey), defaultPrivateKeyFilePath()).toString();
|
||||||
d->sshParameters.timeout = map.value(QLatin1String(TimeoutKey), DefaultTimeout).toInt();
|
d->sshParameters.timeout = map.value(QLatin1String(TimeoutKey), DefaultTimeout).toInt();
|
||||||
d->sshParameters.hostKeyCheckingMode = static_cast<QSsh::SshHostKeyCheckingMode>
|
d->sshParameters.hostKeyCheckingMode = static_cast<QSsh::SshHostKeyCheckingMode>
|
||||||
@@ -371,11 +371,11 @@ QVariantMap IDevice::toMap() const
|
|||||||
map.insert(QLatin1String(OriginKey), d->origin);
|
map.insert(QLatin1String(OriginKey), d->origin);
|
||||||
|
|
||||||
map.insert(QLatin1String(MachineTypeKey), d->machineType);
|
map.insert(QLatin1String(MachineTypeKey), d->machineType);
|
||||||
map.insert(QLatin1String(HostKey), d->sshParameters.host);
|
map.insert(QLatin1String(HostKey), d->sshParameters.host());
|
||||||
map.insert(QLatin1String(SshPortKey), d->sshParameters.port);
|
map.insert(QLatin1String(SshPortKey), d->sshParameters.port());
|
||||||
map.insert(QLatin1String(UserNameKey), d->sshParameters.userName);
|
map.insert(QLatin1String(UserNameKey), d->sshParameters.userName());
|
||||||
map.insert(QLatin1String(AuthKey), d->sshParameters.authenticationType);
|
map.insert(QLatin1String(AuthKey), d->sshParameters.authenticationType);
|
||||||
map.insert(QLatin1String(PasswordKey), d->sshParameters.password);
|
map.insert(QLatin1String(PasswordKey), d->sshParameters.password());
|
||||||
map.insert(QLatin1String(KeyFileKey), d->sshParameters.privateKeyFile);
|
map.insert(QLatin1String(KeyFileKey), d->sshParameters.privateKeyFile);
|
||||||
map.insert(QLatin1String(TimeoutKey), d->sshParameters.timeout);
|
map.insert(QLatin1String(TimeoutKey), d->sshParameters.timeout);
|
||||||
map.insert(QLatin1String(HostKeyCheckingKey), d->sshParameters.hostKeyCheckingMode);
|
map.insert(QLatin1String(HostKeyCheckingKey), d->sshParameters.hostKeyCheckingMode);
|
||||||
@@ -416,7 +416,7 @@ QUrl IDevice::toolControlChannel(const ControlChannelHint &) const
|
|||||||
{
|
{
|
||||||
QUrl url;
|
QUrl url;
|
||||||
url.setScheme(Utils::urlTcpScheme());
|
url.setScheme(Utils::urlTcpScheme());
|
||||||
url.setHost(d->sshParameters.host);
|
url.setHost(d->sshParameters.host());
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -696,17 +696,17 @@ void DeviceKitInformation::addToMacroExpander(Kit *kit, Utils::MacroExpander *ex
|
|||||||
expander->registerVariable("Device:HostAddress", tr("Host address"),
|
expander->registerVariable("Device:HostAddress", tr("Host address"),
|
||||||
[kit]() -> QString {
|
[kit]() -> QString {
|
||||||
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||||
return device ? device->sshParameters().host : QString();
|
return device ? device->sshParameters().host() : QString();
|
||||||
});
|
});
|
||||||
expander->registerVariable("Device:SshPort", tr("SSH port"),
|
expander->registerVariable("Device:SshPort", tr("SSH port"),
|
||||||
[kit]() -> QString {
|
[kit]() -> QString {
|
||||||
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||||
return device ? QString::number(device->sshParameters().port) : QString();
|
return device ? QString::number(device->sshParameters().port()) : QString();
|
||||||
});
|
});
|
||||||
expander->registerVariable("Device:UserName", tr("User name"),
|
expander->registerVariable("Device:UserName", tr("User name"),
|
||||||
[kit]() -> QString {
|
[kit]() -> QString {
|
||||||
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||||
return device ? device->sshParameters().userName : QString();
|
return device ? device->sshParameters().userName() : QString();
|
||||||
});
|
});
|
||||||
expander->registerVariable("Device:KeyFile", tr("Private key file"),
|
expander->registerVariable("Device:KeyFile", tr("Private key file"),
|
||||||
[kit]() -> QString {
|
[kit]() -> QString {
|
||||||
|
|||||||
@@ -1422,7 +1422,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
[]() -> QString {
|
[]() -> QString {
|
||||||
Kit *kit = currentKit();
|
Kit *kit = currentKit();
|
||||||
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||||
return device ? device->sshParameters().host : QString();
|
return device ? device->sshParameters().host() : QString();
|
||||||
});
|
});
|
||||||
|
|
||||||
expander->registerVariable("CurrentDevice:SshPort",
|
expander->registerVariable("CurrentDevice:SshPort",
|
||||||
@@ -1430,7 +1430,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
[]() -> QString {
|
[]() -> QString {
|
||||||
Kit *kit = currentKit();
|
Kit *kit = currentKit();
|
||||||
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||||
return device ? QString::number(device->sshParameters().port) : QString();
|
return device ? QString::number(device->sshParameters().port()) : QString();
|
||||||
});
|
});
|
||||||
|
|
||||||
expander->registerVariable("CurrentDevice:UserName",
|
expander->registerVariable("CurrentDevice:UserName",
|
||||||
@@ -1438,7 +1438,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
[]() -> QString {
|
[]() -> QString {
|
||||||
Kit *kit = currentKit();
|
Kit *kit = currentKit();
|
||||||
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||||
return device ? device->sshParameters().userName : QString();
|
return device ? device->sshParameters().userName() : QString();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ void QnxQmlProfilerSupport::start()
|
|||||||
Port qmlPort = m_portsGatherer->findPort();
|
Port qmlPort = m_portsGatherer->findPort();
|
||||||
|
|
||||||
QUrl serverUrl;
|
QUrl serverUrl;
|
||||||
serverUrl.setHost(device()->sshParameters().host);
|
serverUrl.setHost(device()->sshParameters().host());
|
||||||
serverUrl.setPort(qmlPort.number());
|
serverUrl.setPort(qmlPort.number());
|
||||||
serverUrl.setScheme("tcp");
|
serverUrl.setScheme("tcp");
|
||||||
m_profiler->recordData("QmlServerUrl", serverUrl);
|
m_profiler->recordData("QmlServerUrl", serverUrl);
|
||||||
|
|||||||
@@ -64,15 +64,11 @@ IDevice::Ptr QnxDeviceWizard::device()
|
|||||||
{
|
{
|
||||||
QSsh::SshConnectionParameters sshParams;
|
QSsh::SshConnectionParameters sshParams;
|
||||||
sshParams.options = QSsh::SshIgnoreDefaultProxy;
|
sshParams.options = QSsh::SshIgnoreDefaultProxy;
|
||||||
sshParams.host = m_setupPage->hostName();
|
sshParams.url = m_setupPage->url();
|
||||||
sshParams.userName = m_setupPage->userName();
|
|
||||||
sshParams.port = 22;
|
|
||||||
sshParams.timeout = 10;
|
sshParams.timeout = 10;
|
||||||
sshParams.authenticationType = m_setupPage->authenticationType();
|
sshParams.authenticationType = m_setupPage->authenticationType();
|
||||||
if (sshParams.authenticationType == QSsh::SshConnectionParameters::AuthenticationTypeTryAllPasswordBasedMethods
|
if (sshParams.authenticationType != QSsh::SshConnectionParameters::AuthenticationTypeTryAllPasswordBasedMethods
|
||||||
|| sshParams.authenticationType == QSsh::SshConnectionParameters::AuthenticationTypePassword)
|
&& sshParams.authenticationType != QSsh::SshConnectionParameters::AuthenticationTypePassword)
|
||||||
sshParams.password = m_setupPage->password();
|
|
||||||
else
|
|
||||||
sshParams.privateKeyFile = m_setupPage->privateKeyFilePath();
|
sshParams.privateKeyFile = m_setupPage->privateKeyFilePath();
|
||||||
|
|
||||||
QnxDevice::Ptr device = QnxDevice::create(m_setupPage->configurationName(),
|
QnxDevice::Ptr device = QnxDevice::create(m_setupPage->configurationName(),
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ void DeploymentTimeInfo::saveDeploymentTimeStamp(const DeployableFile &deployabl
|
|||||||
systemRoot = SysRootKitInformation::sysRoot(kit).toString();
|
systemRoot = SysRootKitInformation::sysRoot(kit).toString();
|
||||||
|
|
||||||
const IDevice::ConstPtr deviceConfiguration = DeviceKitInformation::device(kit);
|
const IDevice::ConstPtr deviceConfiguration = DeviceKitInformation::device(kit);
|
||||||
const QString host = deviceConfiguration->sshParameters().host;
|
const QString host = deviceConfiguration->sshParameters().host();
|
||||||
|
|
||||||
d->lastDeployed.insert(
|
d->lastDeployed.insert(
|
||||||
DeployParameters(deployableFile, host, systemRoot),
|
DeployParameters(deployableFile, host, systemRoot),
|
||||||
@@ -115,7 +115,7 @@ bool DeploymentTimeInfo::hasChangedSinceLastDeployment(const DeployableFile &dep
|
|||||||
systemRoot = SysRootKitInformation::sysRoot(kit).toString();
|
systemRoot = SysRootKitInformation::sysRoot(kit).toString();
|
||||||
|
|
||||||
const IDevice::ConstPtr deviceConfiguration = DeviceKitInformation::device(kit);
|
const IDevice::ConstPtr deviceConfiguration = DeviceKitInformation::device(kit);
|
||||||
const QString host = deviceConfiguration->sshParameters().host;
|
const QString host = deviceConfiguration->sshParameters().host();
|
||||||
|
|
||||||
const DeployParameters dp(deployableFile, host, systemRoot);
|
const DeployParameters dp(deployableFile, host, systemRoot);
|
||||||
|
|
||||||
|
|||||||
@@ -106,14 +106,14 @@ void GenericLinuxDeviceConfigurationWidget::authenticationTypeChanged()
|
|||||||
void GenericLinuxDeviceConfigurationWidget::hostNameEditingFinished()
|
void GenericLinuxDeviceConfigurationWidget::hostNameEditingFinished()
|
||||||
{
|
{
|
||||||
SshConnectionParameters sshParams = device()->sshParameters();
|
SshConnectionParameters sshParams = device()->sshParameters();
|
||||||
sshParams.host = m_ui->hostLineEdit->text().trimmed();
|
sshParams.setHost(m_ui->hostLineEdit->text().trimmed());
|
||||||
device()->setSshParameters(sshParams);
|
device()->setSshParameters(sshParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericLinuxDeviceConfigurationWidget::sshPortEditingFinished()
|
void GenericLinuxDeviceConfigurationWidget::sshPortEditingFinished()
|
||||||
{
|
{
|
||||||
SshConnectionParameters sshParams = device()->sshParameters();
|
SshConnectionParameters sshParams = device()->sshParameters();
|
||||||
sshParams.port = m_ui->sshPortSpinBox->value();
|
sshParams.setPort(m_ui->sshPortSpinBox->value());
|
||||||
device()->setSshParameters(sshParams);
|
device()->setSshParameters(sshParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,14 +127,14 @@ void GenericLinuxDeviceConfigurationWidget::timeoutEditingFinished()
|
|||||||
void GenericLinuxDeviceConfigurationWidget::userNameEditingFinished()
|
void GenericLinuxDeviceConfigurationWidget::userNameEditingFinished()
|
||||||
{
|
{
|
||||||
SshConnectionParameters sshParams = device()->sshParameters();
|
SshConnectionParameters sshParams = device()->sshParameters();
|
||||||
sshParams.userName = m_ui->userLineEdit->text();
|
sshParams.setUserName(m_ui->userLineEdit->text());
|
||||||
device()->setSshParameters(sshParams);
|
device()->setSshParameters(sshParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericLinuxDeviceConfigurationWidget::passwordEditingFinished()
|
void GenericLinuxDeviceConfigurationWidget::passwordEditingFinished()
|
||||||
{
|
{
|
||||||
SshConnectionParameters sshParams = device()->sshParameters();
|
SshConnectionParameters sshParams = device()->sshParameters();
|
||||||
sshParams.password = m_ui->pwdLineEdit->text();
|
sshParams.setPassword(m_ui->pwdLineEdit->text());
|
||||||
device()->setSshParameters(sshParams);
|
device()->setSshParameters(sshParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,12 +235,12 @@ void GenericLinuxDeviceConfigurationWidget::initGui()
|
|||||||
m_ui->sshPortSpinBox->setEnabled(!device()->isAutoDetected());
|
m_ui->sshPortSpinBox->setEnabled(!device()->isAutoDetected());
|
||||||
m_ui->hostKeyCheckBox->setChecked(sshParams.hostKeyCheckingMode != SshHostKeyCheckingNone);
|
m_ui->hostKeyCheckBox->setChecked(sshParams.hostKeyCheckingMode != SshHostKeyCheckingNone);
|
||||||
|
|
||||||
m_ui->hostLineEdit->setText(sshParams.host);
|
m_ui->hostLineEdit->setText(sshParams.host());
|
||||||
m_ui->sshPortSpinBox->setValue(sshParams.port);
|
m_ui->sshPortSpinBox->setValue(sshParams.port());
|
||||||
m_ui->portsLineEdit->setText(device()->freePorts().toString());
|
m_ui->portsLineEdit->setText(device()->freePorts().toString());
|
||||||
m_ui->timeoutSpinBox->setValue(sshParams.timeout);
|
m_ui->timeoutSpinBox->setValue(sshParams.timeout);
|
||||||
m_ui->userLineEdit->setText(sshParams.userName);
|
m_ui->userLineEdit->setText(sshParams.userName());
|
||||||
m_ui->pwdLineEdit->setText(sshParams.password);
|
m_ui->pwdLineEdit->setText(sshParams.password());
|
||||||
m_ui->keyFileLineEdit->setPath(sshParams.privateKeyFile);
|
m_ui->keyFileLineEdit->setPath(sshParams.privateKeyFile);
|
||||||
m_ui->showPasswordCheckBox->setChecked(false);
|
m_ui->showPasswordCheckBox->setChecked(false);
|
||||||
m_ui->gdbServerLineEdit->setText(device()->debugServerPath());
|
m_ui->gdbServerLineEdit->setText(device()->debugServerPath());
|
||||||
|
|||||||
@@ -72,14 +72,10 @@ IDevice::Ptr GenericLinuxDeviceConfigurationWizard::device()
|
|||||||
{
|
{
|
||||||
SshConnectionParameters sshParams;
|
SshConnectionParameters sshParams;
|
||||||
sshParams.options &= ~SshConnectionOptions(SshEnableStrictConformanceChecks); // For older SSH servers.
|
sshParams.options &= ~SshConnectionOptions(SshEnableStrictConformanceChecks); // For older SSH servers.
|
||||||
sshParams.host = d->setupPage.hostName();
|
sshParams.url = d->setupPage.url();
|
||||||
sshParams.userName = d->setupPage.userName();
|
|
||||||
sshParams.port = 22;
|
|
||||||
sshParams.timeout = 10;
|
sshParams.timeout = 10;
|
||||||
sshParams.authenticationType = d->setupPage.authenticationType();
|
sshParams.authenticationType = d->setupPage.authenticationType();
|
||||||
if (sshParams.authenticationType != SshConnectionParameters::AuthenticationTypePublicKey)
|
if (sshParams.authenticationType == SshConnectionParameters::AuthenticationTypePublicKey)
|
||||||
sshParams.password = d->setupPage.password();
|
|
||||||
else
|
|
||||||
sshParams.privateKeyFile = d->setupPage.privateKeyFilePath();
|
sshParams.privateKeyFile = d->setupPage.privateKeyFilePath();
|
||||||
IDevice::Ptr device = LinuxDevice::create(d->setupPage.configurationName(),
|
IDevice::Ptr device = LinuxDevice::create(d->setupPage.configurationName(),
|
||||||
Core::Id(Constants::GenericLinuxOsType), IDevice::Hardware);
|
Core::Id(Constants::GenericLinuxOsType), IDevice::Hardware);
|
||||||
|
|||||||
@@ -88,7 +88,9 @@ void GenericLinuxDeviceConfigurationWizardSetupPage::initializePage()
|
|||||||
|
|
||||||
bool GenericLinuxDeviceConfigurationWizardSetupPage::isComplete() const
|
bool GenericLinuxDeviceConfigurationWizardSetupPage::isComplete() const
|
||||||
{
|
{
|
||||||
return !configurationName().isEmpty() && !hostName().isEmpty() && !userName().isEmpty()
|
return !configurationName().isEmpty()
|
||||||
|
&& !d->ui.hostNameLineEdit->text().trimmed().isEmpty()
|
||||||
|
&& !d->ui.userNameLineEdit->text().trimmed().isEmpty()
|
||||||
&& (authenticationType() != SshConnectionParameters::AuthenticationTypePublicKey
|
&& (authenticationType() != SshConnectionParameters::AuthenticationTypePublicKey
|
||||||
|| d->ui.privateKeyPathChooser->isValid());
|
|| d->ui.privateKeyPathChooser->isValid());
|
||||||
}
|
}
|
||||||
@@ -98,14 +100,14 @@ QString GenericLinuxDeviceConfigurationWizardSetupPage::configurationName() cons
|
|||||||
return d->ui.nameLineEdit->text().trimmed();
|
return d->ui.nameLineEdit->text().trimmed();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GenericLinuxDeviceConfigurationWizardSetupPage::hostName() const
|
QUrl GenericLinuxDeviceConfigurationWizardSetupPage::url() const
|
||||||
{
|
{
|
||||||
return d->ui.hostNameLineEdit->text().trimmed();
|
QUrl url;
|
||||||
}
|
url.setHost(d->ui.hostNameLineEdit->text().trimmed());
|
||||||
|
url.setUserName(d->ui.userNameLineEdit->text().trimmed());
|
||||||
QString GenericLinuxDeviceConfigurationWizardSetupPage::userName() const
|
url.setPassword(d->ui.passwordLineEdit->text());
|
||||||
{
|
url.setPort(22);
|
||||||
return d->ui.userNameLineEdit->text().trimmed();
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
SshConnectionParameters::AuthenticationType GenericLinuxDeviceConfigurationWizardSetupPage::authenticationType() const
|
SshConnectionParameters::AuthenticationType GenericLinuxDeviceConfigurationWizardSetupPage::authenticationType() const
|
||||||
@@ -116,11 +118,6 @@ SshConnectionParameters::AuthenticationType GenericLinuxDeviceConfigurationWizar
|
|||||||
: SshConnectionParameters::AuthenticationTypeAgent;
|
: SshConnectionParameters::AuthenticationTypeAgent;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GenericLinuxDeviceConfigurationWizardSetupPage::password() const
|
|
||||||
{
|
|
||||||
return d->ui.passwordLineEdit->text();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString GenericLinuxDeviceConfigurationWizardSetupPage::privateKeyFilePath() const
|
QString GenericLinuxDeviceConfigurationWizardSetupPage::privateKeyFilePath() const
|
||||||
{
|
{
|
||||||
return d->ui.privateKeyPathChooser->path();
|
return d->ui.privateKeyPathChooser->path();
|
||||||
|
|||||||
@@ -49,10 +49,8 @@ public:
|
|||||||
bool isComplete() const;
|
bool isComplete() const;
|
||||||
|
|
||||||
QString configurationName() const;
|
QString configurationName() const;
|
||||||
QString hostName() const;
|
QUrl url() const;
|
||||||
QString userName() const;
|
|
||||||
QSsh::SshConnectionParameters::AuthenticationType authenticationType() const;
|
QSsh::SshConnectionParameters::AuthenticationType authenticationType() const;
|
||||||
QString password() const;
|
|
||||||
QString privateKeyFilePath() const;
|
QString privateKeyFilePath() const;
|
||||||
|
|
||||||
virtual QString defaultConfigurationName() const;
|
virtual QString defaultConfigurationName() const;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ void RemoteLinuxQmlToolingSupport::start()
|
|||||||
|
|
||||||
QUrl serverUrl;
|
QUrl serverUrl;
|
||||||
serverUrl.setScheme(urlTcpScheme());
|
serverUrl.setScheme(urlTcpScheme());
|
||||||
serverUrl.setHost(device()->sshParameters().host);
|
serverUrl.setHost(device()->sshParameters().host());
|
||||||
serverUrl.setPort(qmlPort.number());
|
serverUrl.setPort(qmlPort.number());
|
||||||
m_runworker->recordData("QmlServerUrl", serverUrl);
|
m_runworker->recordData("QmlServerUrl", serverUrl);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user