Browse Source

init/grass.py: check if owner mapset is valid

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@66473 15284696-431f-4ddb-bdfa-cd5b030d7da7
Luca Delucchi 9 years ago
parent
commit
fbedf25e21
1 changed files with 7 additions and 0 deletions
  1. 7 0
      lib/init/grass.py

+ 7 - 0
lib/init/grass.py

@@ -1161,6 +1161,13 @@ def lock_mapset(mapset_path, force_gislock_removal, user, grass_gui):
     """
     if not os.path.exists(mapset_path):
         fatal(_("Path '%s' doesn't exist") % mapset_path)
+    if not os.access(mapset_path, os.W_OK):
+        error = "Path '%s' not accessible.\n" % mapset_path
+        stat_info = os.stat(mapset_path)
+        mapset_uid = stat_info.st_uid
+        if mapset_uid != os.getuid():
+            error += "You are not the owner of '%s'" % mapset_path
+        fatal(_(error))
     # Check for concurrent use
     lockfile = os.path.join(mapset_path, ".gislock")
     ret = call([gpath("etc", "lock"), lockfile, "%d" % os.getpid()])