From dcd37d35a22f3685e434d5367f256647297904ea Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Thu, 15 Sep 2011 16:22:32 +0200 Subject: [PATCH] Add initgroups() call to drop_root_privileges --- src/daemonfunc.cpp | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/daemonfunc.cpp b/src/daemonfunc.cpp index ab541cd..b9a9402 100644 --- a/src/daemonfunc.cpp +++ b/src/daemonfunc.cpp @@ -91,6 +91,10 @@ bool drop_root_privileges(const std::string &username, return false; } + // Initialize additional groups the user is a member of + if (initgroups(username.c_str(), getgid() == -1)) + return false; + if (setuid(my_user.Uid)) return false; } -- 1.7.1