Posted by aogWednesday, 06 April 2005 at 21:03 TrackBack Ping URL

There was a wave of trackback spam over at JYB and I ended tweaking MTBlacklist 1.65 itself to take care of it. The key marker on the trackbacks was that the putative title of the post and the weblog were identical. That doesn’t happen for real trackbacks. I therefore modified MTBlacklist to check for that and automatically reject any trackbacks with that property. I changed the search mechanism to match on such trackbacks as well, just to be thorough.


This handles searching.

Line 1262, after the first if@ statement. Actually, this can also go after any of the @elsif clauses as well, depending on whether you want it to take precedence over normal black list matches.

} elsif (($matchType eq 'blacklist')
              and ($type eq 'ping')
              and ($obj->title eq $obj->blog_name)) {
  push(@filtered_objects, { class => 'title_name_match',
  blog => $blognames{$obj->blog_id},
  entry => $e,
  object => $obj,
  matched => $obj->title});

There’s a bug around line 1684. It generates the “unitialized value” messages you sometimes get on the MTBlacklist search page. It always does that for the title / name match types unless you fix it.

#if ($matchType eq 'blacklist') { #AOG - comment out this line
if  ($_->{class} eq 'blacklist') { #AOG - add this line
    $html .= '&lt;tr class="'.$alternate.


This does the actual rejection of trackbacks.

Around line 99, insert the code from #AOG< to #AOG>. It’s an ugly hack on top of an ugly hack, but there you are.

return $app->_response(Error => $blResponse);
} elsif ($tb->title eq $tb->blog_name) {
  my $blog = jayallen::Blacklist::_getBlog($tb->blog_id);
  $app->log('MT-Blacklist trackback denial on '
    .$blog->name.': Title matched Weblog Name &ndash; "
  my $blResponse = jayallen::Blacklist::_getConfig()->{denyResponse};
  $blResponse =~ s/__TYPE__/ping/g;
  return $app->_response(Error => $blResponse);