Exemplo n.º 1
0
def test_chmod_rejects_group_writable_suid(tmpdir):
    path = str(tmpdir.join('file').ensure())
    mode = stat.S_ISUID | stat.S_ISGID | stat.S_ISVTX
    fs.chmod_x(path, mode)

    perms = stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO
    with pytest.raises(InvalidPermissionsError):
        set_permissions(path, perms)
Exemplo n.º 2
0
def test_chmod_rejects_world_writable_sgid(tmpdir):
    path = str(tmpdir.join('file').ensure())
    mode = stat.S_ISGID
    fs.chmod_x(path, mode)

    perms = stat.S_IWOTH
    with pytest.raises(InvalidPermissionsError):
        set_permissions(path, perms)
Exemplo n.º 3
0
def test_chmod_real_entries_ignores_suid_sgid(tmpdir):
    path = str(tmpdir.join('file').ensure())
    mode = stat.S_ISUID | stat.S_ISGID | stat.S_ISVTX
    os.chmod(path, mode)
    mode = os.stat(path).st_mode  # adds a high bit we aren't concerned with

    perms = stat.S_IRWXU
    set_permissions(path, perms)

    assert os.stat(path).st_mode == mode | perms & ~stat.S_IXUSR