qubes-pass/etc/qubes-rpc/ruddo.PassRead
Manuel Amador (Rudd-O) 5935d3c613 Add note.
2021-04-29 21:43:42 +00:00

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