removed setPassphraseCallback() function from ServerController and libssh::Client
This commit is contained in:
parent
a005ed2a84
commit
f8ef69b88a
5 changed files with 12 additions and 23 deletions
|
@ -735,13 +735,8 @@ ErrorCode ServerController::getAlreadyInstalledContainers(const ServerCredential
|
|||
return ErrorCode::NoError;
|
||||
}
|
||||
|
||||
void ServerController::setPassphraseCallback(const std::function<QString()> &callback)
|
||||
ErrorCode ServerController::getDecryptedPrivateKey(const ServerCredentials &credentials, QString &decryptedPrivateKey, const std::function<QString()> &callback)
|
||||
{
|
||||
m_sshClient.setPassphraseCallback(callback);
|
||||
}
|
||||
|
||||
ErrorCode ServerController::getDecryptedPrivateKey(const ServerCredentials &credentials, QString &decryptedPrivateKey)
|
||||
{
|
||||
auto error = m_sshClient.getDecryptedPrivateKey(credentials, decryptedPrivateKey);
|
||||
auto error = m_sshClient.getDecryptedPrivateKey(credentials, decryptedPrivateKey, callback);
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -55,8 +55,7 @@ public:
|
|||
|
||||
void setCancelInstallation(const bool cancel);
|
||||
|
||||
void setPassphraseCallback(const std::function<QString()> &callback);
|
||||
ErrorCode getDecryptedPrivateKey(const ServerCredentials &credentials, QString &decryptedPrivateKey);
|
||||
ErrorCode getDecryptedPrivateKey(const ServerCredentials &credentials, QString &decryptedPrivateKey, const std::function<QString()> &callback);
|
||||
private:
|
||||
ErrorCode installDockerWorker(const ServerCredentials &credentials, DockerContainer container);
|
||||
ErrorCode prepareHostWorker(const ServerCredentials &credentials, DockerContainer container, const QJsonObject &config = QJsonObject());
|
||||
|
|
|
@ -338,12 +338,13 @@ namespace libssh {
|
|||
}
|
||||
}
|
||||
|
||||
ErrorCode Client::getDecryptedPrivateKey(const ServerCredentials &credentials, QString &decryptedPrivateKey)
|
||||
ErrorCode Client::getDecryptedPrivateKey(const ServerCredentials &credentials, QString &decryptedPrivateKey, const std::function<QString()> &passphraseCallback)
|
||||
{
|
||||
int authResult = SSH_ERROR;
|
||||
ErrorCode errorCode = ErrorCode::NoError;
|
||||
|
||||
ssh_key privateKey;
|
||||
m_passphraseCallback = passphraseCallback;
|
||||
authResult = ssh_pki_import_privkey_base64(credentials.password.toStdString().c_str(), nullptr, callback, nullptr, &privateKey);
|
||||
if (authResult == SSH_OK) {
|
||||
char* key = new char[65535];
|
||||
|
@ -363,9 +364,4 @@ namespace libssh {
|
|||
ssh_key_free(privateKey);
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
void Client::setPassphraseCallback(const std::function<QString()> &callback)
|
||||
{
|
||||
m_passphraseCallback = callback;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,8 +36,7 @@ namespace libssh {
|
|||
const std::string& localPath,
|
||||
const std::string& remotePath,
|
||||
const std::string& fileDesc);
|
||||
ErrorCode getDecryptedPrivateKey(const ServerCredentials &credentials, QString &decryptedPrivateKey);
|
||||
void setPassphraseCallback(const std::function<QString()> &callback);
|
||||
ErrorCode getDecryptedPrivateKey(const ServerCredentials &credentials, QString &decryptedPrivateKey, const std::function<QString()> &passphraseCallback);
|
||||
private:
|
||||
ErrorCode closeChannel();
|
||||
ErrorCode closeSftpSession();
|
||||
|
|
|
@ -143,19 +143,19 @@ void StartPageLogic::onPushButtonConnect()
|
|||
|
||||
return m_privateKeyPassphrase;
|
||||
};
|
||||
serverController.setPassphraseCallback(passphraseCallback);
|
||||
}
|
||||
|
||||
QString output = serverController.checkSshConnection(serverCredentials, &errorCode);
|
||||
|
||||
if (pushButtonConnectKeyChecked()) {
|
||||
QString decryptedPrivateKey;
|
||||
errorCode = serverController.getDecryptedPrivateKey(serverCredentials, decryptedPrivateKey);
|
||||
errorCode = serverController.getDecryptedPrivateKey(serverCredentials, decryptedPrivateKey, passphraseCallback);
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
serverCredentials.password = decryptedPrivateKey;
|
||||
}
|
||||
}
|
||||
|
||||
QString output;
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
output = serverController.checkSshConnection(serverCredentials, &errorCode);
|
||||
}
|
||||
|
||||
bool ok = true;
|
||||
if (errorCode) {
|
||||
set_labelWaitInfoVisible(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue