aboutsummaryrefslogtreecommitdiffstats
path: root/pinentry-rofi.sh
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2023-08-10 12:31:43 +0200
committerMatěj Cepl <mcepl@cepl.eu>2023-08-11 11:59:15 +0200
commit0369230fbc74afbc8d289377567ecf9858b1d822 (patch)
treebfdc3d41f8b88790262f68e30765b306650514a8 /pinentry-rofi.sh
parenta17fee5ee64a6b6cb294a9f166d7995832b0abe4 (diff)
downloadpinentry-rofi-0369230fbc74afbc8d289377567ecf9858b1d822.tar.gz
fix: just do very light decoding of the SETDESC strings.
So, after getting complete and tested implementation of URLencode/decode, I have found that Assuan doesn’t read that. No encoding aside from very simple ones are deciphered.
Diffstat (limited to 'pinentry-rofi.sh')
-rwxr-xr-xpinentry-rofi.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/pinentry-rofi.sh b/pinentry-rofi.sh
index 7f01b2e..2695a88 100755
--- a/pinentry-rofi.sh
+++ b/pinentry-rofi.sh
@@ -70,7 +70,7 @@ rawurlencode() {
esac
encoded+="${o}"
done
- printf "%s" "${encoded}" # You can either set a return variable (FASTER)
+ printf "%s" "${encoded}" # You can either set a return variable (FASTER)
}
rawurldecode() {
@@ -81,6 +81,11 @@ rawurldecode() {
printf '%b' "${1//%/\\x}"
}
+# Except Assuan apparently doesn't want really encoded strings, but some kind of bastard
+basturldecode () {
+ echo "$1" | sed -e 's/</\&lt;/g' -e 's/>/\&gt;/g'
+}
+
rofi_cmd="rofi -dmenu -input /dev/null -password"
INSIDE_BATS=${INSIDE_BATS:-0}
@@ -164,7 +169,7 @@ while : ; do
#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[*]}"
- temp_str="$(rawurldecode "${line_arr[*]}")"
+ temp_str="$(basturldecode "${line_arr[*]}")"
log_debug "temp_str: ${temp_str}"
win_mesg="$(rawurlencode "${temp_str}")"
assuan_send "OK"
@@ -178,7 +183,7 @@ while : ; do
IFS=" " line_arr=($(split_line "$line"))
log_debug "line_arr: ${line_arr[*]}"
log_debug "line_arr: ${line_arr[*]}"
- temp_str="$(rawurldecode "${line_arr[*]}")"
+ temp_str="$(basturldecode "${line_arr[*]}")"
log_debug "temp_str: ${temp_str}"
win_title="$(rawurlencode "${temp_str}")"
assuan_send "OK"