X-Git-Url: https://scripts.mit.edu/gitweb/wizard.git/blobdiff_plain/ac95fb16ae2a8b1c73ffb491fe4efb83523aff4a..86062007299166fdc28688a8d61c7f45937899c0:/wizard/command/__init__.py diff --git a/wizard/command/__init__.py b/wizard/command/__init__.py index 62a561b..bc1b718 100644 --- a/wizard/command/__init__.py +++ b/wizard/command/__init__.py @@ -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):