From: cajus Date: Fri, 22 Feb 2008 16:25:29 +0000 (+0000) Subject: Added get_dns_domains X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6994da4a295f9e62685b4fa06181b9231ec750f2;p=gosa.git Added get_dns_domains git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9088 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/modules/GosaSupportDaemon.pm b/gosa-si/modules/GosaSupportDaemon.pm index 813ea4f02..219a2fde5 100644 --- a/gosa-si/modules/GosaSupportDaemon.pm +++ b/gosa-si/modules/GosaSupportDaemon.pm @@ -15,6 +15,7 @@ my @functions = ( "get_update_statement", "get_limit_statement", "get_orderby_statement", + "get_dns_domains", ); @EXPORT = @functions; use strict; @@ -412,4 +413,28 @@ sub get_orderby_statement { return $order_str; } +sub get_dns_domains() { + my $line; + my @searches; + open(RESOLV, "){ + $line= $_; + chomp $line; + $line =~ s/^\s+//; + $line =~ s/\s+$//; + $line =~ s/\s+/ /; + if ($line =~ /^domain (.*)$/ ){ + push(@searches, $1); + } elsif ($line =~ /^search (.*)$/ ){ + push(@searches, split(/ /, $1)); + } + } + close(RESOLV); + + my %tmp = map { $_ => 1 } @searches; + @searches = sort keys %tmp; + + return @searches; +} + 1;