qrexec: add service argument support
Fixes QubesOS/qubes-issues#1876 Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
This commit is contained in:
parent
c629529565
commit
21bec492e8
@ -13,19 +13,26 @@ if ! [ $# = 2 ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
export QREXEC_REMOTE_DOMAIN="$2"
|
export QREXEC_REMOTE_DOMAIN="$2"
|
||||||
|
export QREXEC_SERVICE_FULL_NAME="$1"
|
||||||
|
SERVICE_WITHOUT_ARGUMENT="${1%%+*}"
|
||||||
|
if [ "${QREXEC_SERVICE_FULL_NAME}" != "${SERVICE_WITHOUT_ARGUMENT}" ]; then
|
||||||
|
export QREXEC_SERVICE_ARGUMENT="${QREXEC_SERVICE_FULL_NAME#*+}"
|
||||||
|
fi
|
||||||
|
|
||||||
for CFG_FILE in $LOCAL_QUBES_RPC/"$1" $QUBES_RPC/"$1"; do
|
for CFG_FILE in $LOCAL_QUBES_RPC/"$1" $QUBES_RPC/"$1" \
|
||||||
|
$LOCAL_QUBES_RPC/"${SERVICE_WITHOUT_ARGUMENT}" \
|
||||||
|
$QUBES_RPC/"${SERVICE_WITHOUT_ARGUMENT}"; do
|
||||||
if [ -s "$CFG_FILE" ]; then
|
if [ -s "$CFG_FILE" ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -x "$CFG_FILE" ] ; then
|
if [ -x "$CFG_FILE" ] ; then
|
||||||
exec "$CFG_FILE"
|
exec "$CFG_FILE" ${QREXEC_SERVICE_ARGUMENT}
|
||||||
echo "$0: failed to execute handler for" "$1" >&2
|
echo "$0: failed to execute handler for" "$1" >&2
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
exec /bin/sh "$CFG_FILE"
|
exec /bin/sh -- "$CFG_FILE" ${QREXEC_SERVICE_ARGUMENT}
|
||||||
echo "$0: failed to execute handler for" "$1" >&2
|
echo "$0: failed to execute handler for" "$1" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user