diff options
| author | 2016-12-25 19:08:11 +0000 | |
|---|---|---|
| committer | 2016-12-25 19:08:11 +0000 | |
| commit | e17a73b8591741d00e7727d2dc016e3509a62033 (patch) | |
| tree | 72a0da5c5249d6eff6e008fe58e30ac3260920cd /meta.pl | |
| parent | 29d448e4400c030fbea3210956ca8ac64399cbb2 (diff) | |
Split 'pass' option into 'server_pass', 'account_pass'
Also remove the --pass command-line option for now and introduce a
backward compatibility check that warns when the old option is
encountered. This check is now placed with the mysql option checks in a
dedicated function.
---
So one day, I looked over the AntiSpamMeta console log and noticed
NickServ was echoing back part of the password to us in a "no such
username" error. This is due to us using the 'pass' option for both
nickserv and server password, so we sent PASS NickServPassword.
However, the password happened to have a ':' in it, so services
interpreted it as a user:password combination.
Diffstat (limited to 'meta.pl')
| -rwxr-xr-x | meta.pl | 65 |
1 files changed, 36 insertions, 29 deletions
@@ -36,7 +36,6 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch'; $|++; $Data::Dumper::Useqq=1; -$::pass = ''; @::nick_blacklist=(); $::netsplit = 0; $::netsplit_ignore_lag = 0; @@ -96,6 +95,38 @@ sub alarmdeath $SIG{ALRM} = \&alarmdeath; alarm 300; +sub startup_checks { + my $config_bad = 0; + + if (exists $::mysql->{table}) { + if ($::mysql->{table} ne 'alertlog') { + warn "FATAL - The 'table' option in mysql.json is no longer supported. Please ensure your table is named 'alertlog'.\n"; + $config_bad++; + } + else { + warn "The 'table' option in mysql.json is no longer supported. Please remove it from the configuration.\n"; + } + } + if (exists $::mysql->{actiontable}) { + if ($::mysql->{actiontable} ne 'actionlog') { + warn "FATAL - The 'actiontable' option in mysql.json is no longer supported. Please ensure your table is named 'actionlog'.\n"; + $config_bad++; + } + else { + warn "The 'actiontable' option in mysql.json is no longer supported. Please remove it from the configuration.\n"; + } + } + + if (exists $::settings->{pass}) { + warn "The 'pass' option in settings.json has been split into 'server_pass' and 'account_pass'. Please update your configuration accordingly.\n"; + $::settings->{server_pass} //= $::settings->{account_pass} //= $::settings->{pass}; + } + + if ($config_bad) { + die "The bot cannot operate with the current configuration.\n"; + } +} + sub init { my ( $conn, $host ); $::version .= `git merge-base remotes/origin/master HEAD`; chomp $::version; @@ -105,7 +136,6 @@ sub init { $::version .= `git rev-parse HEAD`; chomp $::version; my $irc = new Net::IRC; GetOptions( 'debug|d!' => \$::debug, - 'pass|p=s' => \$::pass, 'config|c=s' => \$::cset ); if (-e "debugmode") { @@ -114,7 +144,9 @@ sub init { if ($::cset eq '') { $::cset = 'config-default'; } else { $::cset = "config-$::cset"; } ASM::Config->readConfig(); - $::pass = $::settings->{pass} if $::pass eq ''; + + startup_checks(); + $::async = HTTP::Async->new(); $::dns = Net::DNS::Async->new(QueueSize => 5000, Retries => 3); $host = ${$::settings->{server}}[rand @{$::settings->{server}}]; @@ -124,31 +156,6 @@ sub init { $irc->debugsock(1); } - my $mysql_config_bad = 0; - - if (exists $::mysql->{table}) { - if ($::mysql->{table} ne 'alertlog') { - warn "The 'table' option in mysql.json is no longer supported. Please ensure your table is named 'alertlog'.\n"; - $mysql_config_bad++; - } - else { - warn "The 'table' option in mysql.json is no longer supported. Please remove it from the configuration.\n"; - } - } - if (exists $::mysql->{actiontable}) { - if ($::mysql->{actiontable} ne 'actionlog') { - warn "The 'actiontable' option in mysql.json is no longer supported. Please ensure your table is named 'actionlog'.\n"; - $mysql_config_bad++; - } - else { - warn "The 'actiontable' option in mysql.json is no longer supported. Please remove it from the configuration.\n"; - } - } - - if ($mysql_config_bad) { - die "The bot cannot operate with the current database configuration.\n"; - } - if (!$::mysql->{disable}) { my $dsn; if (exists $::mysql->{dsn}) { @@ -168,7 +175,7 @@ sub init { Nick => $::settings->{nick}, Ircname => $::settings->{realname}, Username => $::settings->{username}, - Password => $::settings->{pass}, + Password => $::settings->{server_pass}, Pacing => 0 ); $conn->debug($::debug); if (-e "debugsock") { |
