[pkg-bacula-commits] [bacula] 01/02: Check for capabilities

Sven Hartge hartge-guest at moszumanska.debian.org
Mon Aug 29 20:34:14 UTC 2016


This is an automated email from the git hooks/post-receive script.

hartge-guest pushed a commit to branch systemd-fixuser
in repository bacula.

commit e4db330b6877a751a079a7044ec4f75db1ac7c27
Author: Sven Hartge <sven at svenhartge.de>
Date:   Mon Aug 29 22:32:31 2016 +0200

    Check for capabilities
    
    Check for capabilities before using them, otherwise the start would
    fail on FreeBSD if ENABLE_NONROOT is not set to false.
---
 debian/bacula-fd.init | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/debian/bacula-fd.init b/debian/bacula-fd.init
index 6edb45e..553255f 100644
--- a/debian/bacula-fd.init
+++ b/debian/bacula-fd.init
@@ -29,9 +29,6 @@ DAEMON=/usr/sbin/bacula-fd
 NAME="bacula-fd"
 PORT=9102
 DESC="Bacula File daemon"
-BUSER="root"
-BGROUP="root"
-KEEPCAPS=""
 
 test -x $DAEMON || exit 0
 
@@ -47,11 +44,24 @@ fi
 
 ENABLE_NONROOT="${ENABLE_NONROOT:-true}"
 
-if [ "$ENABLE_NONROOT" = "true" ]; then 
+if [ -x /sbin/getcap ]; then
+	GETCAPS=`/sbin/getcap $DAEMON`
+	if [ "`echo ${GETCAPS##* }`" = "cap_dac_read_search+ep" ]; then
+		HASCAPS=true
+	else
+		HASCAPS=false
+	fi
+fi
+
+if [ "$HASCAPS" = true -a "$ENABLE_NONROOT" = "true" ]; then 
 	BUSER="bacula"
 	BGROUP="bacula"
 	# KEEPCAPS just needed for configtest
 	KEEPCAPS="-k"
+else
+	BUSER="root"
+	BGROUP="root"
+	KEEPCAPS=""
 fi
 
 CONFIG="${CONFIG:-/etc/bacula/$NAME.conf}"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bacula/bacula.git



More information about the pkg-bacula-commits mailing list