Check for VPCS version >= 0.5b1

This commit is contained in:
grossmj
2014-07-02 15:04:39 -06:00
parent 15bc2221b9
commit 329891fc83
3 changed files with 27 additions and 3 deletions

View File

@ -121,11 +121,14 @@ def has_privileged_access(executable):
:returns: True or False
"""
if sys.platform.startswith("win"):
# do not check anything on Windows
return True
if os.geteuid() == 0:
# we are root, so we should have privileged access.
return True
if not sys.platform.startswith("win") and os.stat(executable).st_mode & stat.S_ISVTX == stat.S_ISVTX:
if os.stat(executable).st_mode & stat.S_ISVTX == stat.S_ISVTX:
# the executable has a sticky bit.
return True