2021-01-27 09:15:07 +01:00
|
|
|
---
|
|
|
|
mcelog.c | 9 +++++++++
|
|
|
|
1 file changed, 9 insertions(+)
|
|
|
|
|
2024-05-14 08:52:51 +02:00
|
|
|
Index: mcelog-198/mcelog.c
|
2022-05-03 16:52:12 +02:00
|
|
|
===================================================================
|
2024-05-14 08:52:51 +02:00
|
|
|
--- mcelog-198.orig/mcelog.c
|
|
|
|
+++ mcelog-198/mcelog.c
|
2015-01-23 13:50:02 +01:00
|
|
|
@@ -37,6 +37,7 @@
|
|
|
|
#include <assert.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
+#include <grp.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <fnmatch.h>
|
|
|
|
#include "mcelog.h"
|
2024-05-14 08:52:51 +02:00
|
|
|
@@ -1163,6 +1164,14 @@ static void general_setup(void)
|
2015-01-23 13:50:02 +01:00
|
|
|
|
|
|
|
static void drop_cred(void)
|
|
|
|
{
|
|
|
|
+ /* When dropping privileges from root, the `setgroups` call will
|
|
|
|
+ * remove any extraneous groups. If we don't call this, then
|
|
|
|
+ * even though our uid has dropped, we may still have groups
|
|
|
|
+ * that enable us to do super-user things. This will fail if we
|
|
|
|
+ * aren't root, so don't bother checking the return value, this
|
|
|
|
+ * is just done as an optimistic privilege dropping function.
|
|
|
|
+ */
|
|
|
|
+ setgroups(0, NULL);
|
|
|
|
if (runcred.uid != -1U && runcred.gid == -1U) {
|
|
|
|
struct passwd *pw = getpwuid(runcred.uid);
|
|
|
|
if (pw)
|