Root is allowed to cd into any directory, regardless of the directory

permissions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24417 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-03-16 23:45:10 +00:00
parent 631aa54864
commit 18a83f09cf
@@ -446,9 +446,14 @@ Inode::CheckPermissions(int accessMode) const
if (accessMode & W_OK && fVolume->IsReadOnly())
return B_READ_ONLY_DEVICE;
// root users always have full access (but they can't execute anything)
if (user == 0 && !((accessMode & X_OK) && (Mode() & S_IXUSR) == 0))
return B_OK;
// root users always have full access (but they can't execute files without
// any execute permissions set)
if (user == 0) {
if (!((accessMode & X_OK) != 0 && (Mode() & S_IXUSR) == 0)
|| (Mode() & S_DIRECTORY) != 0) {
return B_OK;
}
}
// shift mode bits, to check directly against accessMode
mode_t mode = Mode();