aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Brubaker <jbru362@gmail.com>2022-06-10 09:51:32 -0400
committerJeremy Brubaker <jbru362@gmail.com>2022-06-10 09:51:32 -0400
commite7862d6a8e15d050ea9ecadd177e3111121819ff (patch)
treeca425efe770b1e904d36d6046bff2bf04b511fb9
parentadc0321b11107c9770ccc7a522ffca4b65b1729a (diff)
downloadanypinentry-e7862d6a8e15d050ea9ecadd177e3111121819ff.tar.gz
anypinentry-e7862d6a8e15d050ea9ecadd177e3111121819ff.zip
% escape $, CR and LF per Assuan spec
-rwxr-xr-xanypinentry8
1 files changed, 7 insertions, 1 deletions
diff --git a/anypinentry b/anypinentry
index 0742281..bad8057 100755
--- a/anypinentry
+++ b/anypinentry
@@ -84,7 +84,13 @@ password_prompt() {
show_error "$error__password_mismatch";
password_prompt "$repeat";
else
- [ -n "$pass" ] && echo "D $pass";
+ if [ ! -z "$pass" ]; then
+ echo "D $pass" |
+ sed 's/%/%25/; s/\r/%0D/' | # % = 25 and CR = %0D
+ awk 'BEGIN {ORS="%0A"} /^..*$/ {print}' | # LF = %0A
+ sed 's/%0A$//' # Strip trailing %0A
+ echo
+ fi
echo "OK";
fi;
fi;