aboutsummaryrefslogtreecommitdiff
path: root/saxrobot
diff options
context:
space:
mode:
Diffstat (limited to 'saxrobot')
-rwxr-xr-xsaxrobot8
1 files changed, 8 insertions, 0 deletions
diff --git a/saxrobot b/saxrobot
index 0dcd5f1..065e01a 100755
--- a/saxrobot
+++ b/saxrobot
@@ -2,6 +2,7 @@
use strict;
use warnings;
+use POSIX qw(setuid setgid);
use POE;
use POE::Kernel;
use POE::Component::IRC;
@@ -33,8 +34,15 @@ POE::Session->create(
heap => { irc => $irc },
);
+drop_priv();
+
$poe_kernel->run();
+sub drop_priv {
+ setgid($config{gid}) or die "Failed to setgid: $!\n";
+ setuid($config{uid}) or die "Failed to setuid: $!\n";
+}
+
sub _start {
my $heap = $_[HEAP];
my $irc = $heap->{irc};