[osm-tile-server] 99/117: Check permission for process command as well

Ruben Undheim rubund-guest at moszumanska.debian.org
Tue Nov 3 23:18:25 UTC 2015


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

rubund-guest pushed a commit to branch master
in repository osm-tile-server.

commit 41d2e1c77049666ab99bd9e3578f805a4e8fc995
Author: Ruben Undheim <ruben.undheim at gmail.com>
Date:   Fri Oct 30 18:52:14 2015 +0100

    Check permission for process command as well
---
 scripts/osm-tile-server-process | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/scripts/osm-tile-server-process b/scripts/osm-tile-server-process
index ae2441e..2bfe9c4 100755
--- a/scripts/osm-tile-server-process
+++ b/scripts/osm-tile-server-process
@@ -1,8 +1,29 @@
 #!/bin/bash
 
+no_permission(){
+    echo "You do not have permission to run this command."
+    echo "Add yourself to the 'osm-tile-server' group"
+}
+
 umask 002
 PATH=$PATH:/usr/lib/osm-tile-server-base/bin
 
+ALLOWED=0
+
+WHO=`whoami`
+if [ "$WHO" = "root" ] || [ "$WHO" = "osm-tile-server" ] ; then
+    ALLOWED=1
+fi
+
+if groups | grep -q '\bosm-tile-server\b' ; then
+    ALLOWED=1
+fi
+
+if [ $ALLOWED = 0 ] ;then
+    no_permission
+    exit -1
+fi
+
 failed(){
     echo "Failed"
     osm-tile-server-status todo

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osm-tile-server.git



More information about the Pkg-grass-devel mailing list