Skip to content

Commit

Permalink
Add functionality to parse environment variable for primary namespace…
Browse files Browse the repository at this point in the history
… and replace hardcoded namespace in print statements.
  • Loading branch information
nsouto committed Feb 5, 2024
1 parent 97b4b0e commit 865c5dd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions pdns/var/lib/powerdns/bin/default.pl
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,21 @@
next;
}

my $primary_ns;
if (exists $ENV{"PIPE_DEFAULT_NS"}) {
($primary_ns) = split(',', $ENV{"PIPE_DEFAULT_NS"});
}

if(($qtype eq "SOA" || $qtype eq "ANY")) {
print STDERR "$$ Sent SOA records\n";
# print "DATA $bits $auth $qname $qclass SOA 3600 -1 ns1.domain.link hostmaster.$domain 2008080300 1800 3600 604800 3600\n";
# print "DATA\t$bits\t$auth\t$qname\t$qclass\tSOA\t3600\t-1\tns1.domain.link hostmaster.$domain 2008080300 1800 3600 604800 3600\n";

if (exists $ENV{"PIPE_DEFAULT_NS"}) {
my @ns_records = split(',', $ENV{"PIPE_DEFAULT_NS"});
print "DATA $bits $auth $qname $qclass SOA 3600 -1 @ns_records[1] hostmaster.$domain 2008080300 1800 3600 604800 3600\n";
# print "DATA\t$bits\t$auth\t$qname\t$qclass\tSOA\t3600\t-1\t@ns_records[1]\thostmaster.$domain\t2008080300\t1800\t3600\t604800\t3600\n";
# print "DATA $bits $auth $qname $qclass SOA 3600 -1 $primary_ns hostmaster.$domain 2008080300 1800 3600 604800 3600\n";
print "DATA\t$bits\t$auth\t$qname\t$qclass\tSOA\t3600\t-1\t$primary_ns\thostmaster.$domain\t2008080300\t1800\t3600\t604800\t3600\n";
} else {
print "DATA $bits $auth $qname $qclass SOA 3600 -1 ns1.localhost hostmaster.$domain 2008080300 1800 3600 604800 3600\n";
# print "DATA\t$bits\t$auth\t$qname\t$qclass\tSOA\t3600\t-1\tns1.localhost\thostmaster.$domain\t2008080300\t1800\t3600\t604800\t3600\n";
# print "DATA $bits $auth $qname $qclass SOA 3600 -1 ns1.localhost hostmaster.$domain 2008080300 1800 3600 604800 3600\n";
print "DATA\t$bits\t$auth\t$qname\t$qclass\tSOA\t3600\t-1\tns1.localhost\thostmaster.$domain\t2008080300\t1800\t3600\t604800\t3600\n";
}
}

Expand Down

0 comments on commit 865c5dd

Please sign in to comment.