#!/bin/sh # Minimal, deterministic stand-in for the real `ssh` binary, used by # SshSessionBackend's state-machine tests so they never touch a real # network or SSH server. Behavior is selected by which fixture hostname # appears among argv (SshSessionBackend always passes the profile's # host, optionally as user@host, as the final argument). for arg in "$@"; do case "$arg" in *@succeed|succeed) echo "Welcome to the fake host." # Stay alive echoing stdin back (simulates an interactive # session) until the backend terminates us. while IFS= read -r line; do echo "$line" done exit 0 ;; *@fail-auth|fail-auth) echo "Permission denied (publickey,password)." >&2 exit 255 ;; *@refuse|refuse) echo "ssh: connect to host refuse port 22: Connection refused" >&2 exit 255 ;; esac done echo "fake_ssh.sh: no recognized fixture host in arguments: $*" >&2 exit 1