[haiku-commits] haiku: hrev48088 - in src: system/kernel/fs add-ons/kernel/file_systems/bfs

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 25 Oct 2014 15:58:44 +0200 (CEST)

hrev48088 adds 2 changesets to branch 'master'
old head: 87d1eac74e0e5ec190ca0b6d8b2bc66234c85765
new head: 8efd5b761352ca5ba3b5118895c40eedb1cf692b
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=8efd5b7+%5E87d1eac

----------------------------------------------------------------------------

49c3101: bfs: root may always enter directories.
  
  * If you're root, you can now always enter directories, even if they
    don't have the X permission.

8efd5b7: vfs: check the X permission on set cwd.
  
  * When you change the current working directory, you actually
    should have the permission to enter that directory.
  * This gives us a 0.04% better score on the perl test suite :-)

                                   [ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 9 insertions(+)
src/add-ons/kernel/file_systems/bfs/Inode.cpp | 2 ++
src/system/kernel/fs/vfs.cpp                  | 7 +++++++

############################################################################

Commit:      49c31016cdf29502541eb8f4f39d557a91f65901
URL:         http://cgit.haiku-os.org/haiku/commit/?id=49c3101
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Sat Oct 25 13:53:57 2014 UTC

bfs: root may always enter directories.

* If you're root, you can now always enter directories, even if they
  don't have the X permission.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/bfs/Inode.cpp 
b/src/add-ons/kernel/file_systems/bfs/Inode.cpp
index bbdd06b..4bab297 100644
--- a/src/add-ons/kernel/file_systems/bfs/Inode.cpp
+++ b/src/add-ons/kernel/file_systems/bfs/Inode.cpp
@@ -523,6 +523,8 @@ Inode::CheckPermissions(int accessMode) const
                // X bits must be set for execute permission
                permissions = userPermissions | groupPermissions | 
otherPermissions
                        | R_OK | W_OK;
+               if (IsDirectory())
+                       permissions |= X_OK;
        } else if (uid == (uid_t)fNode.UserID()) {
                // user is node owner
                permissions = userPermissions;

############################################################################

Revision:    hrev48088
Commit:      8efd5b761352ca5ba3b5118895c40eedb1cf692b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8efd5b7
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Sat Oct 25 13:54:56 2014 UTC

vfs: check the X permission on set cwd.

* When you change the current working directory, you actually
  should have the permission to enter that directory.
* This gives us a 0.04% better score on the perl test suite :-)

----------------------------------------------------------------------------

diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp
index b875b90..0a0a7eb 100644
--- a/src/system/kernel/fs/vfs.cpp
+++ b/src/system/kernel/fs/vfs.cpp
@@ -7883,6 +7883,13 @@ set_cwd(int fd, char* path, bool kernel)
                goto err;
        }
 
+       // We need to have the permission to enter the directory, too
+       if (HAS_FS_CALL(vnode, access)) {
+               status = FS_CALL(vnode, access, X_OK);
+               if (status != B_OK)
+                       goto err;
+       }
+
        // Get current io context and lock
        context = get_current_io_context(kernel);
        mutex_lock(&context->io_mutex);


Other related posts:

  • » [haiku-commits] haiku: hrev48088 - in src: system/kernel/fs add-ons/kernel/file_systems/bfs - axeld