2019-11-30 19:56:17 -05:00
|
|
|
#!/bin/bash
|
|
|
|
# This program is a custom mock pinentry program
|
2023-07-08 16:52:41 -04:00
|
|
|
# It uses whatever password is found in the /tmp directory
|
|
|
|
# If the password is empty, replies CANCEL causing an error to similate invalid
|
|
|
|
# credentials
|
2019-11-30 19:56:17 -05:00
|
|
|
echo "OK Pleased to meet you"
|
|
|
|
while read -r line; do
|
|
|
|
if [[ $line =~ GETPIN ]]; then
|
2023-07-08 16:52:41 -04:00
|
|
|
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";
|
2019-11-30 19:56:17 -05:00
|
|
|
fi
|
|
|
|
done
|