commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 17/20: Make sure to record only RWX open modes


From: Samuel Thibault
Subject: [hurd] 17/20: Make sure to record only RWX open modes
Date: Sat, 23 May 2015 05:09:42 +0000

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

sthibault pushed a commit to branch upstream
in repository hurd.

commit bc0163aaa19ba102da3f73f30ca3f4cc11ba7a9d
Author: Samuel Thibault <address@hidden>
Date:   Sat May 23 00:33:04 2015 +0530

    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.
---
 trans/fakeroot.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 671314f..99b6723 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)
        {

-- 
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]