Changeset 349 for trunk


Ignore:
Timestamp:
06/26/12 13:40:41 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Convert all lookups on the domain name to use lower() on both
the domain column and the passed value

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r347 r349  
    299299  $hname =~ s/^\*\.//;  # this should be impossible to find in the domains table.
    300300  my @hostbits = split /\./, $hname;
    301   my $sth = $dbh->prepare("SELECT count(*),domain_id FROM domains WHERE domain = ? GROUP BY domain_id");
     301  my $sth = $dbh->prepare("SELECT count(*),domain_id FROM domains WHERE lower(domain) = lower(?) GROUP BY domain_id");
    302302  foreach (@hostbits) {
    303303    $sth->execute($hname);
     
    17051705  return ('FAIL', "Invalid characters in domain") if $domain !~ /^[a-zA-Z0-9_.-]+$/;
    17061706
    1707   my $sth = $dbh->prepare("SELECT domain_id FROM domains WHERE domain=?");
     1707  my $sth = $dbh->prepare("SELECT domain_id FROM domains WHERE lower(domain) = lower(?)");
    17081708  my $dom_id;
    17091709
     
    17251725
    17261726    # get the ID...
    1727     ($dom_id) = $dbh->selectrow_array("SELECT domain_id FROM domains WHERE domain=?", undef, ($domain));
     1727    ($dom_id) = $dbh->selectrow_array("SELECT domain_id FROM domains WHERE lower(domain) = lower(?)",
     1728        undef, ($domain));
    17281729
    17291730    _log($dbh, (domain_id => $dom_id, group_id => $group,
     
    18871888  my $dbh = shift;
    18881889  my $domain = shift;
    1889   my ($domid) = $dbh->selectrow_array("SELECT domain_id FROM domains WHERE domain=?", undef, ($domain) );
     1890  my ($domid) = $dbh->selectrow_array("SELECT domain_id FROM domains WHERE lower(domain) = lower(?)",
     1891        undef, ($domain) );
    18901892  $errstr = $DBI::errstr if !$domid;
    18911893  return $domid if $domid;
     
    38133815  } else {
    38143816    # default to domain
    3815     ($zone_id) = $dbh->selectrow_array("SELECT domain_id FROM domains WHERE domain=?",
     3817    ($zone_id) = $dbh->selectrow_array("SELECT domain_id FROM domains WHERE lower(domain) = lower(?)",
    38163818        undef, ($zone));
    38173819    $domain_id = $zone_id;
Note: See TracChangeset for help on using the changeset viewer.