mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-27 06:19:25 +01:00
quotemeta doesn't escape underscores, whoops -- manually escape underscores for Message History SQL statements
This commit is contained in:
parent
79796f9710
commit
750b78cb53
@ -242,6 +242,7 @@ sub find_message_account_by_nick {
|
|||||||
my ($id, $hostmask) = eval {
|
my ($id, $hostmask) = eval {
|
||||||
my $sth = $self->{dbh}->prepare('SELECT id,hostmask FROM Hostmasks WHERE hostmask LIKE ? ESCAPE "\" LIMIT 1');
|
my $sth = $self->{dbh}->prepare('SELECT id,hostmask FROM Hostmasks WHERE hostmask LIKE ? ESCAPE "\" LIMIT 1');
|
||||||
my $qnick = quotemeta $nick;
|
my $qnick = quotemeta $nick;
|
||||||
|
$qnick =~ s/_/\\_/g;
|
||||||
$sth->bind_param(1, "$qnick!%");
|
$sth->bind_param(1, "$qnick!%");
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
my $row = $sth->fetchrow_hashref();
|
my $row = $sth->fetchrow_hashref();
|
||||||
@ -270,6 +271,7 @@ sub find_message_accounts_by_mask {
|
|||||||
my ($self, $mask) = @_;
|
my ($self, $mask) = @_;
|
||||||
|
|
||||||
my $qmask = quotemeta $mask;
|
my $qmask = quotemeta $mask;
|
||||||
|
$qmask =~ s/_/\\_/g;
|
||||||
$qmask =~ s/\\\*/%/g;
|
$qmask =~ s/\\\*/%/g;
|
||||||
$qmask =~ s/\\\?/_/g;
|
$qmask =~ s/\\\?/_/g;
|
||||||
$qmask =~ s/\\\$.*$//;
|
$qmask =~ s/\\\$.*$//;
|
||||||
@ -294,6 +296,7 @@ sub get_message_account {
|
|||||||
my $rows = eval {
|
my $rows = eval {
|
||||||
my $sth = $self->{dbh}->prepare('SELECT id,hostmask FROM Hostmasks WHERE hostmask LIKE ? ESCAPE "\" ORDER BY last_seen DESC');
|
my $sth = $self->{dbh}->prepare('SELECT id,hostmask FROM Hostmasks WHERE hostmask LIKE ? ESCAPE "\" ORDER BY last_seen DESC');
|
||||||
my $qnick = quotemeta $nick;
|
my $qnick = quotemeta $nick;
|
||||||
|
$qnick =~ s/_/\\_/g;
|
||||||
$sth->bind_param(1, "$qnick!%");
|
$sth->bind_param(1, "$qnick!%");
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
my $rows = $sth->fetchall_arrayref({});
|
my $rows = $sth->fetchall_arrayref({});
|
||||||
@ -366,6 +369,7 @@ sub update_hostmask_data {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $qmask = quotemeta $mask;
|
my $qmask = quotemeta $mask;
|
||||||
|
$qmask =~ s/_/\\_/g;
|
||||||
$sth->bind_param($param, $qmask);
|
$sth->bind_param($param, $qmask);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
$self->{new_entries}++;
|
$self->{new_entries}++;
|
||||||
@ -671,6 +675,7 @@ sub get_also_known_as {
|
|||||||
my %aka_hostmasks;
|
my %aka_hostmasks;
|
||||||
my $sth = $self->{dbh}->prepare('SELECT hostmask FROM Hostmasks WHERE hostmask LIKE ? ESCAPE "\" ORDER BY last_seen DESC');
|
my $sth = $self->{dbh}->prepare('SELECT hostmask FROM Hostmasks WHERE hostmask LIKE ? ESCAPE "\" ORDER BY last_seen DESC');
|
||||||
my $qnick = quotemeta $nick;
|
my $qnick = quotemeta $nick;
|
||||||
|
$qnick =~ s/_/\\_/g;
|
||||||
$sth->bind_param(1, "$qnick!%");
|
$sth->bind_param(1, "$qnick!%");
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
my $rows = $sth->fetchall_arrayref({});
|
my $rows = $sth->fetchall_arrayref({});
|
||||||
|
@ -13,8 +13,8 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 789,
|
BUILD_REVISION => 790,
|
||||||
BUILD_DATE => "2014-09-18",
|
BUILD_DATE => "2014-10-01",
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
Reference in New Issue
Block a user