mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
switched while loop out for a guard to break the loop
This commit is contained in:
@@ -71,26 +71,25 @@ class SSHHandler: @unchecked Sendable, ObservableObject {
|
|||||||
|
|
||||||
//TODO: check hostkey
|
//TODO: check hostkey
|
||||||
|
|
||||||
while state != .authorized {
|
for method in getAuthMethods() {
|
||||||
for method in getAuthMethods() {
|
guard state != .authorized else { break }
|
||||||
switch method {
|
switch method {
|
||||||
case .password:
|
case .password:
|
||||||
do { try authWithPw() } catch {
|
do { try authWithPw() } catch {
|
||||||
state = .authFailed
|
state = .authFailed
|
||||||
print("pw auth error")
|
print("pw auth error")
|
||||||
print(error.localizedDescription)
|
print(error.localizedDescription)
|
||||||
}
|
|
||||||
case .publickey:
|
|
||||||
do { try authWithPubkey() } catch {
|
|
||||||
state = .authFailed
|
|
||||||
print("error with pubkey auth")
|
|
||||||
print(error.localizedDescription)
|
|
||||||
}
|
|
||||||
case .hostbased:
|
|
||||||
disconnect()
|
|
||||||
case .interactive:
|
|
||||||
disconnect()
|
|
||||||
}
|
}
|
||||||
|
case .publickey:
|
||||||
|
do { try authWithPubkey() } catch {
|
||||||
|
state = .authFailed
|
||||||
|
print("error with pubkey auth")
|
||||||
|
print(error.localizedDescription)
|
||||||
|
}
|
||||||
|
case .hostbased:
|
||||||
|
disconnect()
|
||||||
|
case .interactive:
|
||||||
|
disconnect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user