summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2015-05-23 00:33:04 +0530
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2015-05-23 00:33:04 +0530
commitbc0163aaa19ba102da3f73f30ca3f4cc11ba7a9d (patch)
tree40cbbd4e1cd6616222ef8aea15df2a0d758e35c4
parent3ffb892a5db5ad64b87261fa01478401806894cf (diff)
Make sure to record only RWX open modes
Thanks Svante Signell for the investigation and proposed patch. * trans/fakeroot.c (new_node): Assert that `openmodes' includes only O_RDWR|O_EXEC (check_openmodes): Likewise with `newmodes'. (netfs_S_dir_lookup): Keep only O_RDWR|O_EXEC from `flags' when calling new_node.
-rw-r--r--trans/fakeroot.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 671314f4..99b6723a 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -75,6 +75,9 @@ new_node (file_t file, mach_port_t idport, int locked, int openmodes,
{
error_t err;
struct netnode *nn;
+
+ assert ((openmodes & ~(O_RDWR|O_EXEC)) == 0);
+
*np = netfs_make_node_alloc (sizeof *nn);
if (*np == 0)
{
@@ -203,6 +206,8 @@ check_openmodes (struct netnode *nn, int newmodes, file_t file)
{
error_t err = 0;
+ assert ((newmodes & ~(O_RDWR|O_EXEC)) == 0);
+
if (newmodes &~ nn->openmodes)
{
/* The user wants openmodes we haven't tried before. */
@@ -390,7 +395,7 @@ netfs_S_dir_lookup (struct protid *diruser,
else
{
pthread_spin_unlock (&netfs_node_refcnt_lock);
- err = new_node (file, idport, 1, flags, &np);
+ err = new_node (file, idport, 1, flags & (O_RDWR|O_EXEC), &np);
pthread_mutex_unlock (&dnp->lock);
if (!err)
{