From: Philipp Gortan Date: Mon, 30 Jun 2014 14:45:32 +0000 (+0200) Subject: untaint --server and --port X-Git-Url: http://git.ieval.ro/?p=app-devbot.git;a=commitdiff_plain;h=445eb54503fa217b3bd87272397ce1781ccaa843 untaint --server and --port --- diff --git a/Makefile.PL b/Makefile.PL index a83aa86..446b493 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -19,7 +19,8 @@ WriteMakefile( POE 0 POE::Component::IRC::Plugin::AutoJoin 0 POE::Component::IRC::Plugin::NickServID 0 - POE::Component::IRC::State 0/, + POE::Component::IRC::State 0 + Regexp::Common 0/, }, META_MERGE => { dynamic_config => 0, diff --git a/lib/App/Devbot.pm b/lib/App/Devbot.pm index 1e0f5c8..d7cd700 100644 --- a/lib/App/Devbot.pm +++ b/lib/App/Devbot.pm @@ -15,11 +15,10 @@ use IRC::Utils qw/parse_user/; use Getopt::Long; use POSIX qw/strftime/; +use Regexp::Common qw /net/; ################################################## -our $VERSION; - my $nick='devbot'; my $password; my $server='irc.oftc.net'; @@ -73,7 +72,14 @@ sub bot_start{ Retry_when_banned => 60, )); - $irc->yield(register => "all"); + if ($server =~ /^($RE{net}{domain})$/) { + $server = $1; + } + if ($port =~ /^([0-9]+)$/) { + $port = $1; + } + + $irc->yield(register => "all"); $irc->yield( connect => { Nick => $nick,