initial commit of file from CVS for e-smith-tinydns on Wed 12 Jul 09:11:00 BST 2023

This commit is contained in:
Brian Read
2023-07-12 09:11:00 +01:00
parent 4d5bb6a2a3
commit 1cdaede0de
36 changed files with 1599 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
{
use esmith::ConfigDB;
my $confdb = esmith::ConfigDB->open_ro;
return unless $confdb;
my $systemname = $confdb->get_value('SystemName');
my $domainname = $confdb->get_value('DomainName');
return unless $systemname && $domainname; # nothing to do
my $fqdn = "$systemname.$domainname";
# Make sure that the ReverseDNS property of the proper name of the server
# is set to "yes", unless the $LocalIP has a configured PTR record already.
my $self_host = undef;
foreach my $host ( $DB->get_all() )
{
next unless $host->prop('HostType') eq 'Self';
if ( $host->{key} eq $fqdn )
{
$self_host = $host;
}
if ( $host->prop('ReverseDNS')
&& ( $host->prop('ReverseDNS') eq 'yes' ) )
{
# It already has one configured. Nothing to do.
return;
}
}
$self_host->set_prop( 'ReverseDNS', 'yes' ) if $self_host;
}