diff options
-rw-r--r-- | dns_wizard/dns.wiz | 19 | ||||
-rw-r--r-- | dns_wizard/scripts/Dnsconf.pm | 27 |
2 files changed, 31 insertions, 15 deletions
diff --git a/dns_wizard/dns.wiz b/dns_wizard/dns.wiz index b9225c0b..b808e29d 100644 --- a/dns_wizard/dns.wiz +++ b/dns_wizard/dns.wiz @@ -93,7 +93,7 @@ name="wiz_ext_dns1" variableName="wiz_ext_dns1" helpText="Primary DNS Address:" - fillScript="get_var wiz_ext_dns1" + fillfunc="get_dns1" editable="true" > </Freetext> @@ -102,7 +102,7 @@ name="wiz_ext_dns2" variableName="wiz_ext_dns2" helpText="Secondary DNS Address:" - fillScript="get_var wiz_ext_dns2" + fillfunc="get_dns2" editable="true" > </Freetext> @@ -210,26 +210,15 @@ needed to configure your DNS service:" > </Info> - - <Info - helpText="Primary DNS Address:" - > - </Info> - <Freetext + helpText="Primary DNS Address:" name="wiz_ext_dns1" variableName="wiz_ext_dns1" editable="false" > </Freetext> - <Info - > - </Info> - <Info - helpText="Secondary DNS Address:" - > - </Info> <Freetext + helpText="Secondary DNS Address:" name="wiz_ext_dns2" variableName="wiz_ext_dns2" editable="false" diff --git a/dns_wizard/scripts/Dnsconf.pm b/dns_wizard/scripts/Dnsconf.pm index f789f20c..b73359b5 100644 --- a/dns_wizard/scripts/Dnsconf.pm +++ b/dns_wizard/scripts/Dnsconf.pm @@ -27,6 +27,33 @@ use standalone; my $o = DrakconnectConf->new(); +my $dns1; +my $dns2; + +my $file = "/etc/named.conf"; +open (NEW, "< $file"); +DNS : while (<NEW>) { + $dns2 = ""; + if (m/^\s*options\s*\{/s...m/^\s*\}\;/s ) { + if (m/^\s*forwarders\s*\{/s...m/^\s*\}\;/s ) { + if (/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/) { + $dns2 = "$1.$2.$3.$4"; + $dns1 and next DNS; + $dns1 = $dns2; + } + } + } +} +close (NEW); + +sub get_dns1 { + $dns1; +} + +sub get_dns2 { + $dns2; +} + sub up_serial { my ($file) = @_; |