]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/__init__.py
Fix web verification in MediaWiki and improve handling.
[wizard.git] / wizard / command / __init__.py
index 62a561b4ae9366154efbee7f8c1d0f68abcfedd3..bc1b718b3ba8f0ad02cebbc2b25682a5a1e56c45 100644 (file)
@@ -83,17 +83,20 @@ def security_check_homedir(location):
     This protects against malicious mountpoints, and is roughly equivalent
     to the suexec checks.
     """
-    uid = util.get_dir_uid(location)
-    real = os.path.realpath(location)
     try:
+        uid = util.get_dir_uid(location)
+        real = os.path.realpath(location)
         if not real.startswith(pwd.getpwuid(uid).pw_dir + "/"):
-            logging.error("Security check failed, owner of deployment and"
-                    "owner of home directory mismatch for %s" % d.location)
+            logging.error("Security check failed, owner of deployment and "
+                    "owner of home directory mismatch for %s" % location)
             return False
     except KeyError:
-        logging.error("Security check failed, could not look up"
+        logging.error("Security check failed, could not look up "
                 "owner of %s (uid %d)" % (location, uid))
         return False
+    except OSError as e:
+        logging.error("OSError: %s" % str(e))
+        return False
     return True
 
 def calculate_log_name(log_dir, i, dir):