From f1812bcf7c04e5a513e96fdf6ac923cb3243f74d Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Sun, 1 Nov 2009 18:02:01 +0000 Subject: [PATCH] - Check user's privileges before executing start/stop targets. Signed-off-by: Peter Lemenkov git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1606 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- pkg/rpm/sems.init | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/rpm/sems.init b/pkg/rpm/sems.init index 142efbeb..4ab6d44c 100755 --- a/pkg/rpm/sems.init +++ b/pkg/rpm/sems.init @@ -39,6 +39,14 @@ RETVAL=0 start() { echo -n $"Starting $prog: " + # Check user's rights (we need only creating/opening fds + # so we check only effective UID) + if [ $EUID -ne 0 ] ; then + echo -n "not enough rights" && failure && echo + RETVAL=4 + return $RETVAL + fi + # check whether SEMS was already started if pidofproc -p $pidfile > /dev/null 2>&1 ; then echo -n "already running" && warning && echo @@ -55,6 +63,14 @@ start() { stop() { echo -n $"Stopping $prog: " + # Check user's rights (we need only creating/opening fds + # so we check only effective UID) + if [ $EUID -ne 0 ] ; then + echo -n "not enough rights" && failure && echo + RETVAL=4 + return $RETVAL + fi + # check whether SEMS is running if ! pidofproc -p $pidfile > /dev/null 2>&1 ; then echo -n "not running" && warning && echo