aboutsummaryrefslogtreecommitdiff
path: root/contrib/gnunet-suidfix
blob: 992378966288d7d2460519a854960694db9bfbb1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/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