From 5de7651ebeee56e6deca4d5e357b22869719bb8f Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 17 Jan 2010 00:29:28 +0000 Subject: Make a ./configure --system to support system-wide installation of inspircd git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12275 e03df62e-2008-0410-955e-edbf42e46eb7 --- make/template/inspircd | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'make/template/inspircd') diff --git a/make/template/inspircd b/make/template/inspircd index 6a74d1ec1..92f3f3bac 100644 --- a/make/template/inspircd +++ b/make/template/inspircd @@ -22,6 +22,23 @@ my $runpath = "@BASE_DIR@"; my $valgrindlogpath = "$basepath/valgrindlogs"; my $executable = "@EXECUTABLE@"; my $version = "@VERSION@"; +my $uid = "@UID@"; + +if ($< == 0 || $> == 0) { + if ($uid !~ /^\d+$/) { + # Named UID, look it up + $uid = getpwnam $uid; + } + if (!$uid) { + die "Cannot find a valid UID to change to"; + } + # drop root if we were configured with an ircd UID + $< = $uid; + $> = $uid; + if ($< == 0 || $> == 0) { + die "Could not drop root: $!"; + } +} our($pid,$pidfile); # Lets see what they want to do.. Set the variable (Cause i'm a lazy coder) -- cgit v1.2.3