* [PATCH] uid: initialize nobody_uid/nobody/gid only if --dropprivs requested
@ 2014-04-01 10:57 Kirill A. Shutemov
0 siblings, 0 replies; only message in thread
From: Kirill A. Shutemov @ 2014-04-01 10:57 UTC (permalink / raw)
To: trinity, Dave Jones; +Cc: Kirill A. Shutemov
I don't have nobody user in my dummy rootfs for virtual machine and
trinity stops on getpwnam("nobody").
Let's request uid/gid for nobody only if --dropprivs requested.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
trinity.c | 4 ++--
uid.c | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/trinity.c b/trinity.c
index dd32418411be..4d8d200c7a89 100644
--- a/trinity.c
+++ b/trinity.c
@@ -66,8 +66,6 @@ int main(int argc, char* argv[])
initpid = getpid();
- init_uids();
-
page_size = getpagesize();
num_online_cpus = sysconf(_SC_NPROCESSORS_ONLN);
max_children = num_online_cpus; /* possibly overridden in params. */
@@ -80,6 +78,8 @@ int main(int argc, char* argv[])
create_shm_arrays();
+ init_uids();
+
if (logging == TRUE)
open_logfiles();
diff --git a/uid.c b/uid.c
index 6a7e65a6a722..fbcf4744cb15 100644
--- a/uid.c
+++ b/uid.c
@@ -55,6 +55,9 @@ void init_uids(void)
orig_uid = getuid();
orig_gid = getgid();
+ if (dropprivs == FALSE)
+ return;
+
passwd = getpwnam("nobody");
if (passwd == NULL) {
outputerr("Error getting nobody pwent (%s)\n", strerror(errno));
--
1.9.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-04-01 10:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-01 10:57 [PATCH] uid: initialize nobody_uid/nobody/gid only if --dropprivs requested Kirill A. Shutemov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).