SSH auth tries to login with simply password if auth with public key failed
This commit is contained in:
parent
2383a3b2db
commit
d5aaa1dd30
@ -57,6 +57,10 @@ class GRemoteSession @Inject constructor(
|
||||
credentials.password
|
||||
|
||||
result = session.userAuthPublicKeyAuto(null, password)
|
||||
|
||||
if (result != 0) {
|
||||
result = session.userAuthPassword(password)
|
||||
}
|
||||
}
|
||||
|
||||
if (result != 0)
|
||||
|
@ -33,6 +33,15 @@ class LibSshSession @Inject constructor() {
|
||||
return result
|
||||
}
|
||||
|
||||
fun userAuthPassword(password: String): Int {
|
||||
val result = sshLib.ssh_userauth_password(session, null, password)
|
||||
|
||||
if (result != 0)
|
||||
printError(TAG, "Result is: $result.\nError is: ${getError()}")
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
fun createChannel(): LibSshChannel {
|
||||
val newChannel = LibSshChannel(session)
|
||||
|
||||
|
@ -19,6 +19,7 @@ interface SSHLibrary : Library {
|
||||
|
||||
fun ssh_userauth_agent(session: ssh_session, username: String?): Int
|
||||
fun ssh_userauth_publickey_auto(session: ssh_session, username: String?, password: String?): Int
|
||||
fun ssh_userauth_password(session: ssh_session, username: String?, password: String?): Int
|
||||
fun ssh_get_error(session: ssh_session): String
|
||||
|
||||
fun ssh_channel_new(sshSession: ssh_session): ssh_channel
|
||||
|
Loading…
Reference in New Issue
Block a user