ttcn3-dumpcap-start.sh: Accept running as root or setuid dumpcap

Change-Id: Id97fb22e0018739a07e46ecaf26463248554f276
This commit is contained in:
Harald Welte 2020-12-11 17:19:58 +01:00
parent 5b11d91db2
commit ccee3a50c3
1 changed files with 8 additions and 1 deletions

View File

@ -30,7 +30,14 @@ fi
kill_rm_pidfile $PIDFILE_NETCAT kill_rm_pidfile $PIDFILE_NETCAT
kill_rm_pidfile $PIDFILE_PCAP kill_rm_pidfile $PIDFILE_PCAP
if [ -x $DUMPCAP ]; then if [ ! -x $DUMPCAP ]; then
echo "Missing required dumpcap binary at ${DUMPCAP}"
exit 31
fi
if [ "$(id -u)" = "0" ]; then
CMD="$DUMPCAP -q"
else
CAP_ERR="1" CAP_ERR="1"
if [ -x /sbin/setcap ]; then if [ -x /sbin/setcap ]; then
# N. B: this check requires libcap2-bin package # N. B: this check requires libcap2-bin package