commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 27/31: Fix root operations on trivfs-translated nodes


From: Samuel Thibault
Subject: [hurd] 27/31: Fix root operations on trivfs-translated nodes
Date: Mon, 02 May 2016 23:48:33 +0000

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

sthibault pushed a commit to branch upstream
in repository hurd.

commit d18ea50ec00210680b80359cb182a0175374d5e1
Author: Samuel Thibault <address@hidden>
Date:   Fri Apr 29 21:03:08 2016 +0200

    Fix root operations on trivfs-translated nodes
    
    * libtrivfs/fsys-getroot.c: When `uids` contain 0, make a verbatim copy of
    the real node instead of making an auth-restricted copy.
---
 libtrivfs/fsys-getroot.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/libtrivfs/fsys-getroot.c b/libtrivfs/fsys-getroot.c
index 2bc11f5..c44e535 100644
--- a/libtrivfs/fsys-getroot.c
+++ b/libtrivfs/fsys-getroot.c
@@ -69,8 +69,20 @@ trivfs_S_fsys_getroot (struct trivfs_control *cntl,
   flags &= O_HURD;
   flags &= ~(O_CREAT|O_EXCL|O_NOLINK|O_NOTRANS);
 
-  err = io_restrict_auth (cntl->underlying,
-                         &new_realnode, uids, nuids, gids, ngids);
+  struct idvec idvec = {
+    .ids = uids,
+    .num = nuids,
+    .alloced = nuids,
+  };
+
+  if (idvec_contains (&idvec, 0))
+    /* Root should be given all our rights.  */
+    err = io_duplicate (cntl->underlying, &new_realnode);
+  else
+    /* Non-root, restrict rights.  */
+    err = io_restrict_auth (cntl->underlying,
+                           &new_realnode, uids, nuids, gids, ngids);
+
   if (err)
     return 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]