mirror of
https://github.com/gaschz/qubes-pass.git
synced 2025-03-01 14:22:31 +01:00
39 lines
780 B
Bash
39 lines
780 B
Bash
#!/bin/bash
|
|
#
|
|
# xterm-256color seems to be the qubes default
|
|
# for gnome-term and Xterm
|
|
#
|
|
# FIXME: the correct fix is to transmit the TERM
|
|
# variable from the client in the send_args()
|
|
# function of qvm-pass.
|
|
#
|
|
export TERM="xterm-256color"
|
|
|
|
set -e
|
|
|
|
read -n 4096 cmd
|
|
cmd=$(echo "$cmd" | base64 -d)
|
|
|
|
if [ "$cmd" == "list" ] ; then
|
|
|
|
logger -t ruddo.PassRead "requested password list".
|
|
exec pass
|
|
|
|
elif [ "$cmd" == "get" ] ; then
|
|
|
|
read -n 4096 entry
|
|
entry=$(echo "$entry" | base64 -d)
|
|
logger -t ruddo.PassRead "requested password entry $entry"
|
|
|
|
tmp=$(mktemp)
|
|
trap 'rm -f "$tmp"' EXIT
|
|
ret=0 ; pass -- "$entry" 2> "$tmp" || ret=$?
|
|
if grep -qF -- "$entry is not in the password store." "$tmp" ; then
|
|
cat "$tmp" >&2
|
|
exit 8
|
|
fi
|
|
cat "$tmp" >&2
|
|
exit $?
|
|
|
|
fi
|