From ecb57478f71feee806c0577f05436b9a96d908b5 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 31 Aug 2007 11:52:31 +0200 Subject: [PATCH] exec plugin: Call `setgid' first so argitary groups can be configured. --- src/exec.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/exec.c b/src/exec.c index e416c8f0..e899a1c3 100644 --- a/src/exec.c +++ b/src/exec.c @@ -146,14 +146,6 @@ static void exec_child (program_list_t *pl) exit (-1); } - status = setuid (uid); - if (status != 0) - { - ERROR ("exec plugin: setuid failed: %s", - sstrerror (errno, errbuf, sizeof (errbuf))); - exit (-1); - } - if (NULL != pl->group) { if ('\0' != *pl->group) { @@ -187,6 +179,14 @@ static void exec_child (program_list_t *pl) sstrerror (errno, errbuf, sizeof (errbuf))); exit (-1); } + } /* if (pl->group == NULL) */ + + status = setuid (uid); + if (status != 0) + { + ERROR ("exec plugin: setuid failed: %s", + sstrerror (errno, errbuf, sizeof (errbuf))); + exit (-1); } arg0 = strrchr (pl->exec, '/'); -- 2.11.0