Fix handling of NUL data in inter-VM operations.

This commit is contained in:
Manuel Amador (Rudd-O) 2018-10-15 21:00:11 +00:00
parent f603dda2f2
commit a92c4ca1fb
3 changed files with 5 additions and 5 deletions

View File

@ -54,7 +54,7 @@ elif [ "$1" == "insert" ] ; then
cmd=$(echo "$1" | base64 -w 0)
key=$(echo "$2" | base64 -w 0)
multiline=$(echo "$3" | base64 -w 0)
contents=$(echo "$4" | base64 -w 0)
contents=$(echo "$4") # Insert already sends its first parameters base64-encoded
echo "$cmd
$key
$multiline

View File

@ -135,7 +135,7 @@ case "$1" in
if [ "$multiline" == "1" ] ; then
echo "Enter contents of $1 and press Ctrl+D when finished:"
echo ""
contents=$(cat)
contents=$(cat | base64 -w 0)
elif [ "$echo" == "1" ] ; then
read -p "Enter password for $1: " contents >&2
else

View File

@ -68,14 +68,14 @@ elif [ "$cmd" == "insert" ] ; then
read -n 1048576 contents
entry=$(echo "$entry" | base64 -d)
multiline=$(echo "$multiline" | base64 -d)
contents=$(echo "$contents" | base64 -d)
contents=$(echo "$contents")
logger -t ruddo.PassManage "creating password entry $entry"
if [ "$multiline" == "1" ] ; then
echo "$contents" | pass insert --multiline --force -- "$entry"
echo "$contents" | base64 -d | pass insert --multiline --force -- "$entry"
else
echo "$contents" | pass insert -e --force -- "$entry"
echo "$contents" | base64 -d | pass insert -e --force -- "$entry"
fi
elif [ "$cmd" == "rm" ] ; then