[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
- [hurd] 14/23: libtrivfs: optimize the object lookup code, (continued)
- [hurd] 14/23: libtrivfs: optimize the object lookup code, Samuel Thibault, 2015/10/12
- [hurd] 23/23: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2015/10/12
- [hurd] 10/23: trans/magic: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 04/23: libdiskfs: fflush stdout when pausing, Samuel Thibault, 2015/10/12
- [hurd] 11/23: trans/new-fifo: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 07/23: pflocal: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 09/23: trans/ifsock: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 12/23: trans/passwd: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 13/23: trans/proxy-defpager: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/15
- [hurd] 17/23: libdiskfs: fflush stdout when pausing, Samuel Thibault, 2015/10/15
- [hurd] 22/23: Make dir_lookup create files with user permissions enabled,
Samuel Thibault <=
- [hurd] 16/23: Minor documentation changes, Samuel Thibault, 2015/10/15
- [hurd] 03/23: libdiskfs: improve error handling, Samuel Thibault, 2015/10/15
- [hurd] 02/23: exec: add missing include, Samuel Thibault, 2015/10/15
- [hurd] 05/23: exec: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/15
- [hurd] 01/23: libports: remove unused variables, Samuel Thibault, 2015/10/15
- [hurd] 06/23: pfinet: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/15
- [hurd] 08/23: trans/crash: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/15