You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
TheLocehiliosan_yadm/test/pinentry-mock

21 lines
513 B

#!/bin/bash
# This program is a custom mock pinentry program
# It uses whatever password is found in the /tmp directory
# If the password is empty, replies CANCEL causing an error to similate invalid
# credentials
echo "OK Pleased to meet you"
while read -r line; do
if [[ $line =~ GETPIN ]]; then
password="$(cat /tmp/mock-password 2>/dev/null)"
if [ -n "$password" ]; then
echo -n "D "
echo "$password"
echo "OK";
else
echo "CANCEL";
fi
else
echo "OK";
fi
done