diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2023-08-10 14:19:35 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2023-08-11 11:59:21 +0200 |
commit | dae296c8c0ea9f1f28eb1e4545cf9dd3e459c7ae (patch) | |
tree | d13d1a1abb2667d2423c7d6b8c4040edc50550b8 /pinentry-rofi.sh | |
parent | 7e9dd614c58b6a4b00e3326c57ec75f0da68ec13 (diff) | |
download | pinentry-rofi-dae296c8c0ea9f1f28eb1e4545cf9dd3e459c7ae.tar.gz |
fix: fix the logic of encoding/decoding of the strings.
It must be first decoded to the plain UTF-8 string, and only then
bastard-encoded for the Assuan protocol.
Diffstat (limited to 'pinentry-rofi.sh')
-rwxr-xr-x | pinentry-rofi.sh | 12 |
1 files changed, 8 insertions, 4 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/</\</g' -e 's/>/\>/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 |