summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'www-apps/webdavcgi/files/reconfig-suid')
-rwxr-xr-xwww-apps/webdavcgi/files/reconfig-suid26
1 files changed, 26 insertions, 0 deletions
diff --git a/www-apps/webdavcgi/files/reconfig-suid b/www-apps/webdavcgi/files/reconfig-suid
new file mode 100755
index 000000000000..d7fb87722614
--- /dev/null
+++ b/www-apps/webdavcgi/files/reconfig-suid
@@ -0,0 +1,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