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
|
2024-11-11 16:30:41 -05:00
|
|
|
password="$(cat "$GNUPGHOME/mock-password" 2>/dev/null)"
|
2023-07-08 16:52:41 -04:00
|
|
|
if [ -n "$password" ]; then
|
2024-11-11 16:30:41 -05:00
|
|
|
echo "D $password"
|
2023-07-08 16:52:41 -04:00
|
|
|
echo "OK";
|
|
|
|
else
|
|
|
|
echo "CANCEL";
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "OK";
|
2019-11-30 19:56:17 -05:00
|
|
|
fi
|
|
|
|
done
|