Skip to content

Commit

Permalink
SSH Client guards on proxyCb
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Cabanero committed Mar 5, 2024
1 parent 1b7286d commit 0ead900
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion SSH/SSHClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,14 @@ public class SSHClient {
let command = String(cString: cmd!)
// Will break if unconfigured. It can be considered
// a code error.
return ctxt.proxyCb!(command, inSock, outSock)
guard let proxyCb = ctxt.proxyCb else {
ctxt.log.message("No proxy callback configured. Cannot run ProxyCommand", SSH_LOG_WARN)
shutdown(inSock, SHUT_RDWR)
shutdown(outSock, SHUT_RDWR)
return
}

return proxyCb(command, inSock, outSock)
}
}

Expand Down

0 comments on commit 0ead900

Please sign in to comment.