[osm-tile-server] 65/117: Check if correct user and group in shell script before calling setuid program

Ruben Undheim rubund-guest at moszumanska.debian.org
Tue Nov 3 23:18:21 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 3792e2dda3ba0a37d1390f809f13bd3648206343
Author: Ruben Undheim <ruben.undheim at gmail.com>
Date:   Sun Sep 6 11:38:34 2015 +0200

    Check if correct user and group in shell script before calling setuid program
---
 scripts/osm-tile-server-import | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/scripts/osm-tile-server-import b/scripts/osm-tile-server-import
index ca94f2d..6eeda01 100755
--- a/scripts/osm-tile-server-import
+++ b/scripts/osm-tile-server-import
@@ -1,5 +1,26 @@
 #!/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
 
-/usr/lib/osm-tile-server-base/bin/osm-tile-server-import $*
+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 = 1 ] ;then
+  /usr/lib/osm-tile-server-base/bin/osm-tile-server-import $*
+else
+  no_permission
+fi
+

-- 
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