Add initgroups() call to drop_root_privileges
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Thu, 15 Sep 2011 14:22:32 +0000 (16:22 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Thu, 22 Sep 2011 14:26:43 +0000 (16:26 +0200)
src/daemonfunc.cpp

index ab541cd..b9a9402 100644 (file)
@@ -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;
    }