qubes-pass/etc/qubes-rpc/ruddo.PassRead
Beto HydroxyButyrate e1aae10b77
qrexec-client-vm was stripping the escape chars on output.
The server was not aware of the TERM setting, so I made it
explicit, based on common assumptions.  For both gnome-term and
Xterm, the output now matches that of the pass command.
2021-03-02 20:55:32 +10:00

35 lines
659 B
Bash

#!/bin/bash
#
# xterm-256color seems to be the qubes default
# for gnome-term and Xterm
#
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