summaryrefslogtreecommitdiff
path: root/src/platform
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-08-01 04:12:04 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-08-01 04:12:04 +0200
commit44f54f0b02b567d621764a50b0920c87c245e4c9 (patch)
tree70d7e478dc86e48a26f7a750bef651d7d04adf82 /src/platform
parent6a6222eef23d25bec90015e49bd69c42062434ee (diff)
downloadpass-44f54f0b02b567d621764a50b0920c87c245e4c9.tar.gz
pass-44f54f0b02b567d621764a50b0920c87c245e4c9.tar.bz2
pass-44f54f0b02b567d621764a50b0920c87c245e4c9.zip
show: do not store binary data in bash vars
Instead we're forced to base64 it, like we do with the clipboard.
Diffstat (limited to '')
-rw-r--r--src/platform/cygwin.sh8
-rw-r--r--src/platform/darwin.sh9
-rw-r--r--src/platform/freebsd.sh1
-rw-r--r--src/platform/openbsd.sh1
4 files changed, 11 insertions, 8 deletions
diff --git a/src/platform/cygwin.sh b/src/platform/cygwin.sh
index 737e367..5a8d5ea 100644
--- a/src/platform/cygwin.sh
+++ b/src/platform/cygwin.sh
@@ -4,13 +4,13 @@
clip() {
local sleep_argv0="password store sleep on display $DISPLAY"
pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
- local before="$(base64 < /dev/clipboard)"
+ local before="$($BASE64 < /dev/clipboard)"
echo -n "$1" > /dev/clipboard
(
( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
- local now="$(base64 < /dev/clipboard)"
- [[ $now != $(echo -n "$1" | base64) ]] && before="$now"
- echo "$before" | base64 -d > /dev/clipboard
+ local now="$($BASE64 < /dev/clipboard)"
+ [[ $now != $(echo -n "$1" | $BASE64) ]] && before="$now"
+ echo "$before" | $BASE64 -d > /dev/clipboard
) >/dev/null 2>&1 & disown
echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."
}
diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh
index a4f3515..342ecce 100644
--- a/src/platform/darwin.sh
+++ b/src/platform/darwin.sh
@@ -4,13 +4,13 @@
clip() {
local sleep_argv0="password store sleep for user $(id -u)"
pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
- local before="$(pbpaste | openssl base64)"
+ local before="$(pbpaste | $BASE64)"
echo -n "$1" | pbcopy
(
( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
- local now="$(pbpaste | openssl base64)"
- [[ $now != $(echo -n "$1" | openssl base64) ]] && before="$now"
- echo "$before" | openssl base64 -d | pbcopy
+ local now="$(pbpaste | $BASE64)"
+ [[ $now != $(echo -n "$1" | $BASE64) ]] && before="$now"
+ echo "$before" | $BASE64 -d | pbcopy
) >/dev/null 2>&1 & disown
echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."
}
@@ -45,3 +45,4 @@ qrcode() {
GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || { which port &>/dev/null && echo /opt/local; } || echo /usr/local)/bin/getopt"
SHRED="srm -f -z"
+BASE64="openssl base64"
diff --git a/src/platform/freebsd.sh b/src/platform/freebsd.sh
index d93c774..390bca2 100644
--- a/src/platform/freebsd.sh
+++ b/src/platform/freebsd.sh
@@ -3,3 +3,4 @@
GETOPT="/usr/local/bin/getopt"
SHRED="rm -P -f"
+BASE64="openssl base64"
diff --git a/src/platform/openbsd.sh b/src/platform/openbsd.sh
index b66b32f..fc27f6a 100644
--- a/src/platform/openbsd.sh
+++ b/src/platform/openbsd.sh
@@ -38,3 +38,4 @@ tmpdir() {
GETOPT="gnugetopt"
SHRED="rm -P -f"
+BASE64="openssl base64"