aboutsummaryrefslogtreecommitdiff
path: root/sb_config.pm
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-03-17 21:40:20 +1300
committerDavid Phillips <david@sighup.nz>2017-03-17 21:40:20 +1300
commit165301c42b14a7096eaa31f631c402361872db88 (patch)
tree12222660f46df9a9f053b7c78f7fff4094e4a71c /sb_config.pm
parent84664ecaacaa1d480d02dc836dfd6a33f552e325 (diff)
downloadidalius-165301c42b14a7096eaa31f631c402361872db88.tar.xz
Add privellege dropping
Diffstat (limited to 'sb_config.pm')
-rw-r--r--sb_config.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/sb_config.pm b/sb_config.pm
index dcff683..ade80b8 100644
--- a/sb_config.pm
+++ b/sb_config.pm
@@ -8,7 +8,7 @@ use Config::Tiny;
sub parse_config
{
- my @scalar_configs = ('nick', 'username', 'ircname', 'server', 'port', 'password', 'must_id');
+ my @scalar_configs = ('nick', 'username', 'ircname', 'server', 'port', 'password', 'must_id', 'user', 'group');
my @list_configs = ('channels', 'ignore', 'admins');
my $file = $_[0];
my %built_config;
@@ -35,6 +35,12 @@ sub parse_config
$triggers{$match} = $response;
}
+ $built_config{uid} = getpwnam($built_config{user})
+ or die "Cannot get uid of $built_config{user}: $!\n";
+ $built_config{gid} = getgrnam($built_config{group})
+ or die "Cannot get gid of $built_config{group}: $!\n";
+
+
$built_config{triggers} = \%triggers;
return %built_config;