summaryrefslogtreecommitdiff
blob: d7fb8772261495ad7a691ea39b067bdadfb1107d (plain)
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
#!/bin/bash

webDavWrapper="webdavwrapper"
webDavWrapperPath="${VHOST_CGIBINDIR}/${webDavWrapper}"

chmodCmd="/bin/chmod"
chownCmd="/bin/chown"


function die ()
{
	echo "reconfig error: $1" >&2
    	exit 1
}

if [ $1 = "install" ]; then
	# In order to change the user and group ID at runtime, the webdavwrapper
	# needs to be run as root (set-user-ID and set-group-ID bit)
	if ! ${chownCmd} root:root ${webDavWrapperPath}; then
		die "Chown for ${webDavWrapperPath} failed"
	fi

	if ! ${chmodCmd} 6755 ${webDavWrapperPath}; then
		die "Setting SUID and SGID bit on ${webDavWrapperPath} failed"
	fi
fi