util.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:nav 作者: UNINETT 项目源码 文件源码
def is_setuid_root(path):
    """Return True if the file is owned by root and has
    the setuid bit set."""

    # Can't be setuid root if it's not there.
    if not os.path.isfile(path):
        return False

    pstat = os.stat(path)

    # Owned by root?
    if pstat.st_uid != 0:
        return False

    # Setuid bit set?
    if pstat.st_mode & stat.S_ISUID == 0:
        return False

    # Yay, passed all test!
    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号