/*
* Get effective group ID from group name.
*/
-static int getegid(program_list_t *pl) {
+static int getegr_id(program_list_t *pl, int gid) /* {{{ */
+{
int egid = -1;
if (pl->group != NULL) {
if (*pl->group != '\0') {
DEBUG("exec plugin: release grbuf memory ");
grbuf = NULL;
if (getgr_failed > 0) {
- goto failed;
+ egid = -2; // arbitrary value to indicate fail
}
} else {
egid = gid;
/* The group configured in the configfile is set as effective group, because
* this way the forked process can (re-)gain the user's primary group. */
- egid = getegid(pl);
+ egid = getegr_id(pl, gid);
+ if (egid <= -2) {
+ ERROR("exec plugin: getegr_id failed: %s", STRERRNO);
+ goto failed;
+ }
pid = fork();
if (pid < 0) {