Skip to content

Commit

Permalink
We no longer have to use the rungroup provided at build time, it is s…
Browse files Browse the repository at this point in the history
…pecified in the config now
  • Loading branch information
Adam- committed Nov 8, 2012
1 parent 8b78b6b commit ac57f41
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 39 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(strings.h HAVE_STRINGS_H)

# Check for the existance of the following functions
check_function_exists(setgrent HAVE_SETGRENT)
check_function_exists(strcasecmp HAVE_STRCASECMP)
check_function_exists(stricmp HAVE_STRICMP)
check_function_exists(umask HAVE_UMASK)
Expand Down
2 changes: 0 additions & 2 deletions include/sysconf.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#cmakedefine HAVE_CSTDINT 1
#cmakedefine HAVE_STDINT_H 1
#cmakedefine HAVE_STDDEF_H 1
#cmakedefine HAVE_SETGRENT 1
#cmakedefine HAVE_STRCASECMP 1
#cmakedefine HAVE_STRICMP 1
#cmakedefine HAVE_STRINGS_H 1
Expand All @@ -16,7 +15,6 @@
#cmakedefine HAVE_EPOLL 1
#cmakedefine HAVE_POLL 1
#cmakedefine GETTEXT_FOUND 1
#cmakedefine RUNGROUP "@RUNGROUP@"

#ifdef HAVE_CSTDINT
# include <cstdint>
Expand Down
37 changes: 1 addition & 36 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
#include "servers.h"

#ifndef _WIN32
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <grp.h>
#endif

Anope::string conf_dir = "conf", db_dir = "data", modules_dir = "lib", locale_dir = "locale", log_dir = "logs";
Expand Down Expand Up @@ -68,37 +66,6 @@ void introduce_user(const Anope::string &user)

/*************************************************************************/

/* Set GID if necessary. Return 0 if successful (or if RUNGROUP not
* defined), else print an error message to logfile and return -1.
*/

static int set_group()
{
#if defined(RUNGROUP) && defined(HAVE_SETGRENT)
struct group *gr;

setgrent();
while ((gr = getgrent()))
{
if (!strcmp(gr->gr_name, RUNGROUP))
break;
}
endgrent();
if (gr)
{
setgid(gr->gr_gid);
}
else
{
Log() << "Unknown run group '" << RUNGROUP << "'";
return -1;
}
#endif
return 0;
}

/*************************************************************************/

/* Vector of pairs of command line arguments and their params */
static std::vector<std::pair<Anope::string, Anope::string> > CommandLineArguments;

Expand Down Expand Up @@ -294,9 +261,7 @@ void Init(int ac, char **av)
#if defined(DEFUMASK) && HAVE_UMASK
umask(DEFUMASK);
#endif
if (set_group() < 0)
throw FatalException("set_group() fail");


RegisterTypes();

/* Parse command line arguments */
Expand Down

0 comments on commit ac57f41

Please sign in to comment.