forked from qt-creator/qt-creator
SSH: Choose better names for public types and variables.
This commit is contained in:
@@ -76,16 +76,16 @@ namespace {
|
||||
|
||||
|
||||
SshConnectionParameters::SshConnectionParameters(ProxyType proxyType) :
|
||||
timeout(0), authType(AuthByKey), port(0), proxyType(proxyType)
|
||||
timeout(0), authorizationType(AuthorizationByKey), port(0), proxyType(proxyType)
|
||||
{
|
||||
}
|
||||
|
||||
static inline bool equals(const SshConnectionParameters &p1, const SshConnectionParameters &p2)
|
||||
{
|
||||
return p1.host == p2.host && p1.uname == p2.uname
|
||||
&& p1.authType == p2.authType
|
||||
&& (p1.authType == SshConnectionParameters::AuthByPwd ?
|
||||
p1.pwd == p2.pwd : p1.privateKeyFile == p2.privateKeyFile)
|
||||
return p1.host == p2.host && p1.userName == p2.userName
|
||||
&& p1.authorizationType == p2.authorizationType
|
||||
&& (p1.authorizationType == SshConnectionParameters::AuthorizationByPassword ?
|
||||
p1.password == p2.password : p1.privateKeyFile == p2.privateKeyFile)
|
||||
&& p1.timeout == p2.timeout && p1.port == p2.port;
|
||||
}
|
||||
|
||||
@@ -394,9 +394,9 @@ void SshConnectionPrivate::handleNewKeysPacket()
|
||||
|
||||
void SshConnectionPrivate::handleServiceAcceptPacket()
|
||||
{
|
||||
if (m_connParams.authType == SshConnectionParameters::AuthByPwd) {
|
||||
m_sendFacility.sendUserAuthByPwdRequestPacket(m_connParams.uname.toUtf8(),
|
||||
SshCapabilities::SshConnectionService, m_connParams.pwd.toUtf8());
|
||||
if (m_connParams.authorizationType == SshConnectionParameters::AuthorizationByPassword) {
|
||||
m_sendFacility.sendUserAuthByPwdRequestPacket(m_connParams.userName.toUtf8(),
|
||||
SshCapabilities::SshConnectionService, m_connParams.password.toUtf8());
|
||||
} else {
|
||||
QFile privKeyFile(m_connParams.privateKeyFile);
|
||||
bool couldOpen = privKeyFile.open(QIODevice::ReadOnly);
|
||||
@@ -410,7 +410,7 @@ void SshConnectionPrivate::handleServiceAcceptPacket()
|
||||
}
|
||||
|
||||
m_sendFacility.createAuthenticationKey(contents);
|
||||
m_sendFacility.sendUserAuthByKeyRequestPacket(m_connParams.uname.toUtf8(),
|
||||
m_sendFacility.sendUserAuthByKeyRequestPacket(m_connParams.userName.toUtf8(),
|
||||
SshCapabilities::SshConnectionService);
|
||||
}
|
||||
m_state = UserAuthRequested;
|
||||
@@ -418,7 +418,7 @@ void SshConnectionPrivate::handleServiceAcceptPacket()
|
||||
|
||||
void SshConnectionPrivate::handlePasswordExpiredPacket()
|
||||
{
|
||||
if (m_connParams.authType == SshConnectionParameters::AuthByKey) {
|
||||
if (m_connParams.authorizationType == SshConnectionParameters::AuthorizationByKey) {
|
||||
throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
|
||||
"Got SSH_MSG_USERAUTH_PASSWD_CHANGEREQ, but did not use password.");
|
||||
}
|
||||
@@ -449,7 +449,7 @@ void SshConnectionPrivate::handleUserAuthSuccessPacket()
|
||||
void SshConnectionPrivate::handleUserAuthFailurePacket()
|
||||
{
|
||||
m_timeoutTimer.stop();
|
||||
const QString errorMsg = m_connParams.authType == SshConnectionParameters::AuthByPwd
|
||||
const QString errorMsg = m_connParams.authorizationType == SshConnectionParameters::AuthorizationByPassword
|
||||
? tr("Server rejected password.") : tr("Server rejected key.");
|
||||
throw SshClientException(SshAuthenticationError, errorMsg);
|
||||
}
|
||||
|
||||
@@ -54,14 +54,15 @@ class SshConnectionPrivate;
|
||||
struct QTCREATOR_UTILS_EXPORT SshConnectionParameters
|
||||
{
|
||||
enum ProxyType { DefaultProxy, NoProxy };
|
||||
enum AuthorizationType { AuthorizationByPassword, AuthorizationByKey };
|
||||
SshConnectionParameters(ProxyType proxyType);
|
||||
|
||||
QString host;
|
||||
QString uname;
|
||||
QString pwd;
|
||||
QString userName;
|
||||
QString password;
|
||||
QString privateKeyFile;
|
||||
int timeout;
|
||||
enum AuthType { AuthByPwd, AuthByKey } authType;
|
||||
int timeout; // In seconds.
|
||||
AuthorizationType authorizationType;
|
||||
quint16 port;
|
||||
ProxyType proxyType;
|
||||
};
|
||||
|
||||
@@ -1711,11 +1711,11 @@ void DebuggerPluginPrivate::startRemoteEngine()
|
||||
return;
|
||||
|
||||
sp.connParams.host = dlg.host();
|
||||
sp.connParams.uname = dlg.username();
|
||||
sp.connParams.pwd = dlg.password();
|
||||
sp.connParams.userName = dlg.username();
|
||||
sp.connParams.password = dlg.password();
|
||||
|
||||
sp.connParams.timeout = 5;
|
||||
sp.connParams.authType = Utils::SshConnectionParameters::AuthByPwd;
|
||||
sp.connParams.authorizationType = Utils::SshConnectionParameters::AuthorizationByPassword;
|
||||
sp.connParams.port = 22;
|
||||
sp.connParams.proxyType = Utils::SshConnectionParameters::NoProxy;
|
||||
|
||||
|
||||
@@ -377,7 +377,7 @@ void MaemoDebugSupport::setState(State newState)
|
||||
|
||||
QString MaemoDebugSupport::uploadDir(const MaemoDeviceConfig::ConstPtr &devConf)
|
||||
{
|
||||
return MaemoGlobal::homeDirOnDevice(devConf->sshParameters().uname);
|
||||
return MaemoGlobal::homeDirOnDevice(devConf->sshParameters().userName);
|
||||
}
|
||||
|
||||
bool MaemoDebugSupport::useGdb() const
|
||||
|
||||
@@ -286,7 +286,7 @@ void MaemoDeployStep::stop()
|
||||
|
||||
QString MaemoDeployStep::uploadDir() const
|
||||
{
|
||||
return MaemoGlobal::homeDirOnDevice(m_connection->connectionParameters().uname);
|
||||
return MaemoGlobal::homeDirOnDevice(m_connection->connectionParameters().userName);
|
||||
}
|
||||
|
||||
bool MaemoDeployStep::currentlyNeedsDeployment(const QString &host,
|
||||
@@ -835,7 +835,7 @@ void MaemoDeployStep::handleCopyProcessFinished(int exitStatus)
|
||||
|
||||
QString MaemoDeployStep::deployMountPoint() const
|
||||
{
|
||||
return MaemoGlobal::homeDirOnDevice(m_cachedDeviceConfig->sshParameters().uname)
|
||||
return MaemoGlobal::homeDirOnDevice(m_cachedDeviceConfig->sshParameters().userName)
|
||||
+ QLatin1String("/deployMountPoint_") + packagingStep()->projectName();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
|
||||
typedef Utils::SshConnectionParameters::AuthType AuthType;
|
||||
typedef Utils::SshConnectionParameters::AuthorizationType AuthType;
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
@@ -74,7 +74,7 @@ namespace {
|
||||
const int DefaultGdbServerPortSim(13219);
|
||||
const QString DefaultHostNameHW(QLatin1String("192.168.2.15"));
|
||||
const QString DefaultHostNameSim(QLatin1String("localhost"));
|
||||
const AuthType DefaultAuthType(Utils::SshConnectionParameters::AuthByKey);
|
||||
const AuthType DefaultAuthType(Utils::SshConnectionParameters::AuthorizationByKey);
|
||||
const int DefaultTimeout(30);
|
||||
const MaemoDeviceConfig::DeviceType DefaultDeviceType(MaemoDeviceConfig::Physical);
|
||||
}
|
||||
@@ -232,7 +232,7 @@ MaemoDeviceConfig::Ptr MaemoDeviceConfig::createHardwareConfig(const QString &na
|
||||
const QString privateKeyFilePath, Id &nextId)
|
||||
{
|
||||
Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy);
|
||||
sshParams.authType = Utils::SshConnectionParameters::AuthByKey;
|
||||
sshParams.authorizationType = Utils::SshConnectionParameters::AuthorizationByKey;
|
||||
sshParams.host = hostName;
|
||||
sshParams.privateKeyFile = privateKeyFilePath;
|
||||
return Ptr(new MaemoDeviceConfig(name, osVersion, Physical, sshParams, nextId));
|
||||
@@ -242,9 +242,9 @@ MaemoDeviceConfig::Ptr MaemoDeviceConfig::createEmulatorConfig(const QString &na
|
||||
MaemoGlobal::MaemoVersion osVersion, Id &nextId)
|
||||
{
|
||||
Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy);
|
||||
sshParams.authType = Utils::SshConnectionParameters::AuthByPwd;
|
||||
sshParams.authorizationType = Utils::SshConnectionParameters::AuthorizationByPassword;
|
||||
sshParams.host = defaultHost(Emulator);
|
||||
sshParams.pwd = defaultQemuPassword(osVersion);
|
||||
sshParams.password = defaultQemuPassword(osVersion);
|
||||
return Ptr(new MaemoDeviceConfig(name, osVersion, Emulator, sshParams, nextId));
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ MaemoDeviceConfig::MaemoDeviceConfig(const QString &name,
|
||||
m_internalId(nextId++)
|
||||
{
|
||||
m_sshParameters.port = defaultSshPort(m_type);
|
||||
m_sshParameters.uname = defaultUser(m_osVersion);
|
||||
m_sshParameters.userName = defaultUser(m_osVersion);
|
||||
m_sshParameters.timeout = DefaultTimeout;
|
||||
}
|
||||
|
||||
@@ -278,10 +278,10 @@ MaemoDeviceConfig::MaemoDeviceConfig(const QSettings &settings,
|
||||
++nextId;
|
||||
m_sshParameters.host = settings.value(HostKey, defaultHost(m_type)).toString();
|
||||
m_sshParameters.port = settings.value(SshPortKey, defaultSshPort(m_type)).toInt();
|
||||
m_sshParameters.uname = settings.value(UserNameKey, defaultUser(m_osVersion)).toString();
|
||||
m_sshParameters.authType
|
||||
m_sshParameters.userName = settings.value(UserNameKey, defaultUser(m_osVersion)).toString();
|
||||
m_sshParameters.authorizationType
|
||||
= static_cast<AuthType>(settings.value(AuthKey, DefaultAuthType).toInt());
|
||||
m_sshParameters.pwd = settings.value(PasswordKey).toString();
|
||||
m_sshParameters.password = settings.value(PasswordKey).toString();
|
||||
m_sshParameters.privateKeyFile
|
||||
= settings.value(KeyFileKey, defaultPrivateKeyFilePath()).toString();
|
||||
m_sshParameters.timeout = settings.value(TimeoutKey, DefaultTimeout).toInt();
|
||||
@@ -372,9 +372,9 @@ void MaemoDeviceConfig::save(QSettings &settings) const
|
||||
settings.setValue(HostKey, m_sshParameters.host);
|
||||
settings.setValue(SshPortKey, m_sshParameters.port);
|
||||
settings.setValue(PortsSpecKey, m_portsSpec);
|
||||
settings.setValue(UserNameKey, m_sshParameters.uname);
|
||||
settings.setValue(AuthKey, m_sshParameters.authType);
|
||||
settings.setValue(PasswordKey, m_sshParameters.pwd);
|
||||
settings.setValue(UserNameKey, m_sshParameters.userName);
|
||||
settings.setValue(AuthKey, m_sshParameters.authorizationType);
|
||||
settings.setValue(PasswordKey, m_sshParameters.password);
|
||||
settings.setValue(KeyFileKey, m_sshParameters.privateKeyFile);
|
||||
settings.setValue(TimeoutKey, m_sshParameters.timeout);
|
||||
settings.setValue(IsDefaultKey, m_isDefault);
|
||||
|
||||
@@ -205,7 +205,7 @@ void MaemoDeviceConfigurationsSettingsWidget::displayCurrent()
|
||||
m_ui->deviceTypeValueLabel->setText(tr("Emulator (Qemu)"));
|
||||
m_ui->portsLineEdit->setReadOnly(true);
|
||||
}
|
||||
if (sshParams.authType == Utils::SshConnectionParameters::AuthByPwd)
|
||||
if (sshParams.authorizationType == Utils::SshConnectionParameters::AuthorizationByPassword)
|
||||
m_ui->passwordButton->setChecked(true);
|
||||
else
|
||||
m_ui->keyButton->setChecked(true);
|
||||
@@ -224,8 +224,8 @@ void MaemoDeviceConfigurationsSettingsWidget::fillInValues()
|
||||
m_ui->sshPortSpinBox->setValue(sshParams.port);
|
||||
m_ui->portsLineEdit->setText(current->portsSpec());
|
||||
m_ui->timeoutSpinBox->setValue(sshParams.timeout);
|
||||
m_ui->userLineEdit->setText(sshParams.uname);
|
||||
m_ui->pwdLineEdit->setText(sshParams.pwd);
|
||||
m_ui->userLineEdit->setText(sshParams.userName);
|
||||
m_ui->pwdLineEdit->setText(sshParams.password);
|
||||
m_ui->keyFileLineEdit->setPath(sshParams.privateKeyFile);
|
||||
m_ui->showPasswordCheckBox->setChecked(false);
|
||||
updatePortsWarningLabel();
|
||||
@@ -265,9 +265,9 @@ void MaemoDeviceConfigurationsSettingsWidget::authenticationTypeChanged()
|
||||
{
|
||||
SshConnectionParameters sshParams = currentConfig()->sshParameters();
|
||||
const bool usePassword = m_ui->passwordButton->isChecked();
|
||||
sshParams.authType = usePassword
|
||||
? SshConnectionParameters::AuthByPwd
|
||||
: SshConnectionParameters::AuthByKey;
|
||||
sshParams.authorizationType = usePassword
|
||||
? SshConnectionParameters::AuthorizationByPassword
|
||||
: SshConnectionParameters::AuthorizationByKey;
|
||||
m_devConfigs->setSshParameters(currentIndex(), sshParams);
|
||||
m_ui->pwdLineEdit->setEnabled(usePassword);
|
||||
m_ui->passwordLabel->setEnabled(usePassword);
|
||||
@@ -300,14 +300,14 @@ void MaemoDeviceConfigurationsSettingsWidget::timeoutEditingFinished()
|
||||
void MaemoDeviceConfigurationsSettingsWidget::userNameEditingFinished()
|
||||
{
|
||||
SshConnectionParameters sshParams = currentConfig()->sshParameters();
|
||||
sshParams.uname = m_ui->userLineEdit->text();
|
||||
sshParams.userName = m_ui->userLineEdit->text();
|
||||
m_devConfigs->setSshParameters(currentIndex(), sshParams);
|
||||
}
|
||||
|
||||
void MaemoDeviceConfigurationsSettingsWidget::passwordEditingFinished()
|
||||
{
|
||||
SshConnectionParameters sshParams = currentConfig()->sshParameters();
|
||||
sshParams.pwd = m_ui->pwdLineEdit->text();
|
||||
sshParams.password = m_ui->pwdLineEdit->text();
|
||||
m_devConfigs->setSshParameters(currentIndex(), sshParams);
|
||||
}
|
||||
|
||||
|
||||
@@ -407,12 +407,12 @@ private:
|
||||
m_ui->passwordLineEdit->setEnabled(false);
|
||||
m_ui->deployButton->setEnabled(false);
|
||||
Utils::SshConnectionParameters sshParams(SshConnectionParameters::NoProxy);
|
||||
sshParams.authType = SshConnectionParameters::AuthByPwd;
|
||||
sshParams.authorizationType = SshConnectionParameters::AuthorizationByPassword;
|
||||
sshParams.host = hostAddress();
|
||||
sshParams.port = MaemoDeviceConfig::defaultSshPort(MaemoDeviceConfig::Physical);
|
||||
sshParams.pwd = password();
|
||||
sshParams.password = password();
|
||||
sshParams.timeout = 30;
|
||||
sshParams.uname = MaemoDeviceConfig::defaultUser(m_wizardData.maemoVersion);
|
||||
sshParams.userName = MaemoDeviceConfig::defaultUser(m_wizardData.maemoVersion);
|
||||
m_ui->statusLabel->setText(tr("Deploying... "));
|
||||
m_keyDeployer->deployPublicKey(sshParams, m_wizardData.publicKeyFilePath);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ MaemoPublisherFremantleFree::MaemoPublisherFremantleFree(const ProjectExplorer::
|
||||
m_state(Inactive),
|
||||
m_sshParams(SshConnectionParameters::DefaultProxy)
|
||||
{
|
||||
m_sshParams.authType = SshConnectionParameters::AuthByKey;
|
||||
m_sshParams.authorizationType = SshConnectionParameters::AuthorizationByKey;
|
||||
m_sshParams.timeout = 30;
|
||||
m_sshParams.port = 22;
|
||||
m_process = new QProcess(this);
|
||||
@@ -96,7 +96,7 @@ void MaemoPublisherFremantleFree::setSshParams(const QString &hostName,
|
||||
{
|
||||
Q_ASSERT(m_doUpload);
|
||||
m_sshParams.host = hostName;
|
||||
m_sshParams.uname = userName;
|
||||
m_sshParams.userName = userName;
|
||||
m_sshParams.privateKeyFile = keyFile;
|
||||
m_remoteDir = remoteDir;
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ QString MaemoRunConfiguration::localDirToMountForRemoteGdb() const
|
||||
|
||||
QString MaemoRunConfiguration::remoteProjectSourcesMountPoint() const
|
||||
{
|
||||
return MaemoGlobal::homeDirOnDevice(deviceConfig()->sshParameters().uname)
|
||||
return MaemoGlobal::homeDirOnDevice(deviceConfig()->sshParameters().userName)
|
||||
+ QLatin1String("/gdbSourcesDir_")
|
||||
+ QFileInfo(localExecutableFilePath()).fileName();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user