From 9af87626109494c4e2c3031fc740efba4062153d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20=E2=80=9CAd=C3=A6dra=E2=80=9D=20Hamel?= Date: Thu, 18 Apr 2024 01:08:33 +0200 Subject: [PATCH] Default to ask a password --- ssh-askpass | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/ssh-askpass b/ssh-askpass index 3b8d6c5..ef58c0c 100644 --- a/ssh-askpass +++ b/ssh-askpass @@ -2,20 +2,29 @@ PINENTRY=@pinentry_mac@/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac +function send() { + print -p "$@" + read -p +} + coproc $PINENTRY PINENTRY_PID=$! trap "kill -TERM $PINENTRY_PID" INT TERM read -p -print -p SETDESC $@ -read -p +send SETDESC $@ -print -p SETOK Hide -read -p - -print -p CONFIRM --one-button -read -p +case "$@" in + "Confirm user presence"*) + send SETOK Hide + send CONFIRM --one-button + ;; + *) + send GETPIN + test "${REPLY:0:3}" = ERR && { coproc : ; exit 1 } + echo ${REPLY:2} + ;; +esac # Close the coproc coproc : -exit 1