qrexec: execute RPC service directly (without a shell) if it has executable bit set
This will allow to use some different shell/language for a service (for example python). Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
This commit is contained in:
parent
7b582e0339
commit
f8d23d0d64
@ -9,22 +9,27 @@ QUBES_RPC=/etc/qubes-rpc
|
|||||||
# XXX: Backward compatibility
|
# XXX: Backward compatibility
|
||||||
DEPRECATED_QUBES_RPC=/etc/qubes_rpc
|
DEPRECATED_QUBES_RPC=/etc/qubes_rpc
|
||||||
if ! [ $# = 2 ] ; then
|
if ! [ $# = 2 ] ; then
|
||||||
echo $0: bad argument count >&2
|
echo $0: bad argument count, usage: $0 SERVICE-NAME REMOTE-DOMAIN-NAME >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
export QREXEC_REMOTE_DOMAIN="$2"
|
export QREXEC_REMOTE_DOMAIN="$2"
|
||||||
|
|
||||||
|
if [ -s "$QUBES_RPC/$1" ]; then
|
||||||
CFG_FILE=$QUBES_RPC/"$1"
|
CFG_FILE=$QUBES_RPC/"$1"
|
||||||
if [ -s "$CFG_FILE" ] ; then
|
elif [ -s "$DEPRECATED_QUBES_RPC/$1" ]; then
|
||||||
exec /bin/sh "$CFG_FILE"
|
|
||||||
echo "$0: failed to execute handler for" "$1" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
CFG_FILE=$DEPRECATED_QUBES_RPC/"$1"
|
|
||||||
if [ -s "$CFG_FILE" ] ; then
|
|
||||||
echo "$0: RPC service '$1' uses deprecated directory, please move to $QUBES_RPC" >&2
|
echo "$0: RPC service '$1' uses deprecated directory, please move to $QUBES_RPC" >&2
|
||||||
|
CFG_FILE=$DEPRECATED_QUBES_RPC/"$1"
|
||||||
|
else
|
||||||
|
echo "$0: Cannot find service $1 file in $QUBES_RPC" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -x "$CFG_FILE" ] ; then
|
||||||
|
exec "$CFG_FILE"
|
||||||
|
echo "$0: failed to execute handler for" "$1" >&2
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
exec /bin/sh "$CFG_FILE"
|
exec /bin/sh "$CFG_FILE"
|
||||||
echo "$0: failed to execute handler for" "$1" >&2
|
echo "$0: failed to execute handler for" "$1" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "$0: nonexistent or empty" "$CFG_FILE" file >&2
|
|
||||||
exit 1
|
|
||||||
|
Loading…
Reference in New Issue
Block a user