Commit c7a56900 authored by Rob Riepel's avatar Rob Riepel
Browse files

Refine case-blind comparisons

parent 52523e0b
......@@ -20,7 +20,7 @@ $poller_results = "/var/lib/poller/lb";
$next_poller_time = 0;
$poller_run_variance = 5; # variance in time to poll all load-balance systems
$default_ttl = 0;
$my_domain = "best.stanford.edu"; # lowercase only!
$my_domain = "best.stanford.edu";
$hostmaster = "action.stanford.edu";
@servers = qw(lbdns1.stanford.edu lbdns2.stanford.edu lbdns3.stanford.edu);
@SOA = ($servers[0], $hostmaster, time(), 3600, 1800, 86400, 0);
......@@ -74,6 +74,8 @@ unless($line eq "HELO\t1") {
print "OK lbbe firing up\n";
debug("HELO accepted, on with the show!"); # this is it
$my_domain = lc($my_domain); # case-blind comparisons using lowercase
while (<>) {
chomp();
($query = $_) =~ s/\t/ /g;
......@@ -90,8 +92,10 @@ while (<>) {
next;
}
$qname = lc($qname); # case-blind comparisons using lowercase
# domain SOA and NS queries
if (lc($qname) eq $my_domain) {
if ($qname eq $my_domain) {
if ($qtype eq "SOA" || $qtype eq "ANY") {
write_log("sending SOA record");
print "DATA $qname $qclass SOA 3600 -1 " . join("\t",@SOA) . "\n";
......@@ -103,9 +107,9 @@ while (<>) {
}
# dynamic queries
elsif ($qname =~ /.+\.$my_domain$/i) {
elsif ($qname =~ /.+\.$my_domain$/) {
write_log("sending dynamic response for $qname/$qtype");
print handle_lb_request(split(/\./,lc($qname),2),$qtype,$qclass);
print handle_lb_request(split(/\./,$qname,2),$qtype,$qclass);
}
print "END\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment