aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpinentry-rofi.sh12
-rw-r--r--tests/foundational.bats2
2 files changed, 9 insertions, 5 deletions
diff --git a/pinentry-rofi.sh b/pinentry-rofi.sh
index 13e89cb..5c7dd37 100755
--- a/pinentry-rofi.sh
+++ b/pinentry-rofi.sh
@@ -82,7 +82,7 @@ rawurldecode() {
}
# Except Assuan apparently doesn't want really encoded strings, but some kind of bastard
-basturldecode () {
+basturlencode () {
echo "$1" | sed -e 's/</\&lt;/g' -e 's/>/\&gt;/g'
}
@@ -98,6 +98,7 @@ win_mesg=""
keyinfo=""
main () {
+ local temp_str
while : ; do
read -r line
@@ -167,7 +168,9 @@ main () {
#SETDESC Please enter the passphrase for the ssh key%0A ke:yf:in:ge:rp:ri:nt
IFS=" " line_arr=($(split_line "$line"))
log_debug "line_arr: ${line_arr[*]}"
- win_mesg="$(basturldecode "${line_arr[*]}")"
+ temp_str="$(rawurldecode "${line_arr[*]}")"
+ log_debug "temp_str: ${temp_str}"
+ win_mesg="$(basturlencode "${temp_str}")"
assuan_send "OK"
elif [[ "$line" =~ ^SETPROMPT ]] ; then
#SETPROMPT Passphrase:
@@ -178,8 +181,9 @@ main () {
elif [[ "$line" =~ ^SETTITLE ]] ; then
IFS=" " line_arr=($(split_line "$line"))
log_debug "line_arr: ${line_arr[*]}"
- log_debug "line_arr: ${line_arr[*]}"
- win_title="$(basturldecode "${line_arr[*]}")"
+ temp_str="$(rawurldecode "${line_arr[*]}")"
+ log_debug "temp_str: ${temp_str}"
+ win_title="$(basturlencode "${temp_str}")"
assuan_send "OK"
elif [[ "$line" =~ ^GETPIN ]] ; then
passw=None
diff --git a/tests/foundational.bats b/tests/foundational.bats
index 7c69969..4507d38 100644
--- a/tests/foundational.bats
+++ b/tests/foundational.bats
@@ -58,7 +58,7 @@ created 2016-04-27 (main key ID 79205802880BC9D8)."
EOF
log_debug "expected: ${expected}"
log_debug "instr: ${instr}"
- observed=$(basturldecode "${instr}")
+ observed=$(basturlencode "${instr}")
log_debug "observed: ${observed}"
[[ "$observed" == "$expected" ]] || diff -u <(echo "$observed") <(printf "%s" "$expected")
}