#!/bin/sh
#
# "suidfix" is german and it means something like immediate suicide.

# taken from dangole's lede config.. thx!
suid_root_helpers="exit nat-server nat-client transport-bluetooth transport-wlan vpn"
libexec="${GNUNET_PREFIX}/lib/gnunet/libexec"

chmodown_execbin() {
        if [ -x $1 ]; then
                if [ "$3" ]; then
                        chown $3 $1 2>/dev/null && chmod $2 $1
                else
                        chmod $2 $1
                fi
		ls -l $1
	else
		echo "Missing: $1"
        fi
}

for helper in $suid_root_helpers; do
	chmodown_execbin ${libexec}/gnunet-helper-$helper u+s
done
chmodown_execbin ${libexec}/gnunet-helper-dns 4750 root:gnunetdns
chmodown_execbin ${libexec}/gnunet-service-dns 2750 gnunet:gnunetdns

