commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 22/23: Make dir_lookup create files with user permissions enabled


From: Samuel Thibault
Subject: [hurd] 22/23: Make dir_lookup create files with user permissions enabled
Date: Tue, 13 Oct 2015 00:09:56 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit a6185e280c1e9ca17e9bd24eff169671fe28fb1b
Author: Samuel Thibault <address@hidden>
Date:   Mon Oct 12 01:50:34 2015 +0200

    Make dir_lookup create files with user permissions enabled
    
    So we will always be able to re-open them.
    
    * trans/fakeroot.c (netfs_S_dir_lookup): Call real_from_fake_mode() on modes
    before calling the underlying filesystem's dir_lookup.
---
 trans/fakeroot.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 76fc901..6962810 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -247,6 +247,17 @@ check_openmodes (struct netnode *nn, int newmodes, file_t 
file)
   return err;
 }
 
+/* Return the mode that the real underlying file should have if the
+   fake mode is being set to MODE.  We always give ourselves read and
+   write permission so that we can open the file as root would be able
+   to.  We give ourselves execute permission iff any execute bit is
+   set in the fake mode.  */
+static inline mode_t
+real_from_fake_mode (mode_t mode)
+{
+  return mode | S_IREAD | S_IWRITE | (((mode << 3) | (mode << 6)) & S_IEXEC);
+}
+
 /* This is called by netfs_S_fsys_getroot.  */
 error_t
 netfs_check_open_permissions (struct iouser *user, struct node *np,
@@ -283,7 +294,7 @@ netfs_S_dir_lookup (struct protid *diruser,
  redo_lookup:
   err = dir_lookup (dir, filename,
                    flags & (O_NOLINK|O_RDWR|O_EXEC|O_CREAT|O_EXCL|O_NONBLOCK),
-                   mode, do_retry, retry_name, &file);
+                   real_from_fake_mode (mode), do_retry, retry_name, &file);
   if (dir != netfs_node_netnode (dnp)->file)
     mach_port_deallocate (mach_task_self (), dir);
   if (err)
@@ -525,17 +536,6 @@ netfs_attempt_chauthor (struct iouser *cred, struct node 
*np, uid_t author)
   return 0;
 }
 
-/* Return the mode that the real underlying file should have if the
-   fake mode is being set to MODE.  We always give ourselves read and
-   write permission so that we can open the file as root would be able
-   to.  We give ourselves execute permission iff any execute bit is
-   set in the fake mode.  */
-static inline mode_t
-real_from_fake_mode (mode_t mode)
-{
-  return mode | S_IREAD | S_IWRITE | (((mode << 3) | (mode << 6)) & S_IEXEC);
-}
-
 /* This should attempt a chmod call for the user specified by CRED on
    locked node NODE, to change the mode to MODE.  Unlike the normal Unix
    and Hurd meaning of chmod, this function is also used to attempt to

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]