SSH Agent: Show correct error messages in main window

Fixes #7152
This commit is contained in:
Toni Spets authored and Jonathan White committed 2021-11-24 22:37:28 -05:00
1 parent dc7ad6c1b7
commit 2fb1c076d4
1 file changed
+10 -4
+10 -4
View File
@@ -666,11 +666,14 @@ void DatabaseWidget::addToAgent()
return;
}
SSHAgent* agent = SSHAgent::instance();
OpenSSHKey key;
if (settings.toOpenSSHKey(currentEntry, key, true)) {
SSHAgent::instance()->addIdentity(key, settings, database()->uuid());
if (!agent->addIdentity(key, settings, database()->uuid())) {
m_messageWidget->showMessage(agent->errorString(), MessageWidget::Error);
}
} else {
m_messageWidget->showMessage(key.errorString(), MessageWidget::Error);
m_messageWidget->showMessage(settings.errorString(), MessageWidget::Error);
}
}
@@ -687,11 +690,14 @@ void DatabaseWidget::removeFromAgent()
return;
}
SSHAgent* agent = SSHAgent::instance();
OpenSSHKey key;
if (settings.toOpenSSHKey(currentEntry, key, false)) {
SSHAgent::instance()->removeIdentity(key);
if (!agent->removeIdentity(key)) {
m_messageWidget->showMessage(agent->errorString(), MessageWidget::Error);
}
} else {
m_messageWidget->showMessage(key.errorString(), MessageWidget::Error);
m_messageWidget->showMessage(settings.errorString(), MessageWidget::Error);
}
}
#endif