bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 2/4] Fix default file ownership


From: Justus Winter
Subject: [PATCH 2/4] Fix default file ownership
Date: Tue, 16 Jul 2013 10:51:21 +0200

Formerly all nodes were created so that they were owned by root:root
by default. This causes problems if the procfs translator is running
as unprivileged user and serves passive translator records, because
the file ownership is being used as credentials for starting
translators. This obviously fails if the procfs translator is not root
but is trying to acquire credentials including uid/gid 0.

Fix this by using the uid/gid of the procfs translator by default.

procfs.c (procfs_make_node): Fix default node ownership.
---
 procfs.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/procfs.c b/procfs.c
index b52553b..96b6fd2 100644
--- a/procfs.c
+++ b/procfs.c
@@ -19,6 +19,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <fcntl.h>
 #include <mach.h>
 #include <hurd/netfs.h>
@@ -76,6 +77,9 @@ struct node *procfs_make_node (const struct procfs_node_ops 
*ops, void *hook)
   else
     np->nn_stat.st_mode = S_IFREG | 0444;
 
+  np->nn_stat.st_uid = getuid ();
+  np->nn_stat.st_gid = getgid ();
+
   return np;
 
 fail:
-- 
1.7.10.4




reply via email to

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