summaryrefslogtreecommitdiffstats
path: root/dns_wizard/scripts/Dnsconf.pm
diff options
context:
space:
mode:
Diffstat (limited to 'dns_wizard/scripts/Dnsconf.pm')
-rw-r--r--dns_wizard/scripts/Dnsconf.pm27
1 files changed, 27 insertions, 0 deletions
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) = @_;