ssh kitten: Passthrough to ssh if run outside of kitty

Also, ensure that the ssh data request is only served if it is received
over the tty of the correct kitty window.
This commit is contained in:
Kovid Goyal
2022-03-07 06:48:18 +05:30
parent e5c57a679d
commit 2404eba11f
6 changed files with 25 additions and 12 deletions

View File

@@ -59,7 +59,8 @@ def dcs_to_kitty(type, payload):
def send_data_request():
hostname = os.environ.get('HOSTNAME') or os.uname().nodename
write_all(tty_fd, dcs_to_kitty('ssh', 'hostname={}:pwfile=PASSWORD_FILENAME:user={}:pw=DATA_PASSWORD'.format(hostname, getpass.getuser())))
write_all(tty_fd, dcs_to_kitty(
'ssh', 'id=REQUEST_ID:hostname={}:pwfile=PASSWORD_FILENAME:user={}:pw=DATA_PASSWORD'.format(hostname, getpass.getuser())))
def debug(msg):

View File

@@ -93,12 +93,10 @@ if [ -z "$HOME" ]; then HOME=~; fi
if [ -z "$USER" ]; then USER=$(command whoami 2> /dev/null); fi
# ask for the SSH data
data_password="DATA_PASSWORD"
password_filename="PASSWORD_FILENAME"
leading_data=""
init_tty && trap 'cleanup_on_bootstrap_exit' EXIT
[ "$tty_ok" = "y" ] && dcs_to_kitty "ssh" "hostname="$hostname":pwfile="$password_filename":user="$USER":pw="$data_password""
[ "$tty_ok" = "y" ] && dcs_to_kitty "ssh" "id="REQUEST_ID":hostname="$hostname":pwfile="PASSWORD_FILENAME":user="$USER":pw="DATA_PASSWORD""
record_separator=$(printf "\036")
mv_files_and_dirs() {