diff options
Diffstat (limited to 'make/template/inspircd')
-rw-r--r-- | make/template/inspircd | 17 |
1 files changed, 17 insertions, 0 deletions
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) |