--- freem/src/mumps.c 2025/04/04 19:43:18 1.16 +++ freem/src/mumps.c 2025/04/04 21:28:16 1.17 @@ -1,5 +1,5 @@ /* - * $Id: mumps.c,v 1.16 2025/04/04 19:43:18 snw Exp $ + * $Id: mumps.c,v 1.17 2025/04/04 21:28:16 snw Exp $ * main module of freem * * @@ -24,6 +24,9 @@ * along with FreeM. If not, see . * * $Log: mumps.c,v $ + * Revision 1.17 2025/04/04 21:28:16 snw + * Remove custom_user and custom_group vars from freem and shed privileges per environment catalog settings + * * Revision 1.16 2025/04/04 19:43:18 snw * Switch to using environment catalog to determine user and group for environment, and remove -u and -g flags from freem * @@ -141,9 +144,6 @@ int main (int argc, char **argv, char ** gid_t d_gid; uid_t d_uid; - short custom_user = FALSE; - short custom_group = FALSE; - #if defined(HAVE_GETOPT_LONG) struct option long_options[] = { {"help", no_argument, 0, 'h'}, @@ -508,8 +508,7 @@ int main (int argc, char **argv, char ** if (run_daemon == FALSE && group_member (d_gid) == 0) { fprintf (stderr, "freem: you must be a member of the %s group to use environment %s\n", d_groupname, shm_env); exit (1); - } - + } #endif if (run_daemon == TRUE) { @@ -574,19 +573,19 @@ int main (int argc, char **argv, char ** if (geteuid () == 0) { /* shed privileges */ - if (custom_group) { - fprintf (stderr, "freem: switching to group %s\n", d_groupname); - m_log (1, "switching groups"); + + fprintf (stderr, "freem: switching to group %s\n", d_groupname); + m_log (1, "switching groups"); - if (setgid (d_gid) == -1) { - fprintf (stderr, "freem: failure switching GID\n"); - m_log (1, "failure switching GIDs"); - exit (1); - } + if (setgid (d_gid) == -1) { + fprintf (stderr, "freem: failure switching GID\n"); + m_log (1, "failure switching GIDs"); + exit (1); } + - if (custom_user) { + if (d_uid != geteuid ()) { fprintf (stderr, "freem: switching to username %s\n", d_username); m_log (1, "switching users");