fix disconnect Host

This commit is contained in:
dranik
2026-06-04 17:35:44 +03:00
parent f975a75e23
commit 77418c7f79
+7 -2
View File
@@ -64,7 +64,9 @@ namespace libssh {
int connectionResult = watcher.result();
if (connectionResult != SSH_OK) {
return fromLibsshErrorCode();
ErrorCode errorCode = fromLibsshErrorCode();
disconnectFromHost();
return errorCode;
}
std::string authUsername = credentials.userName.toStdString();
@@ -98,12 +100,15 @@ namespace libssh {
if (errorCode == ErrorCode::NoError) {
errorCode = ErrorCode::SshPrivateKeyFormatError;
}
disconnectFromHost();
return errorCode;
}
} else {
authResult = ssh_userauth_password(m_session, authUsername.c_str(), credentials.secretData.toStdString().c_str());
if (authResult != SSH_OK) {
return fromLibsshErrorCode();
ErrorCode errorCode = fromLibsshErrorCode();
disconnectFromHost();
return errorCode;
}
}