From 6fa05102ab3006192b789372d77262d0bb384905 Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Mon, 13 Jun 2016 09:05:22 +0200 Subject: [PATCH 1/2] remove NIS netgroup handling --- mxstartup2mxconfig | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/mxstartup2mxconfig b/mxstartup2mxconfig index 021f915..28c1505 100755 --- a/mxstartup2mxconfig +++ b/mxstartup2mxconfig @@ -248,28 +248,6 @@ sub print_ips_cfg { ############################################################################## -sub walknetgroup { - my @ng; - - &y(\@ng,@_); - - sub y { - my ($ary,$m)=@_; - $_=`ypmatch $m netgroup 2>/dev/null`; - foreach ( split ) { - if (/\(/) { - s/[\(\),]//g; - push @$ary, $_; - } else { - foreach ( split ) { - &y($ary,$_); - } - } - } - } - - return @ng; -} sub expand_hosts { @@ -278,9 +256,7 @@ sub expand_hosts { foreach my $host (@oh) { - if($host =~ /^\@(\S+)/) { - push @hosts, walknetgroup($1); - } elsif($host =~ /^(\/\S+)/) { + if ($host =~ /^(\/\S+)/) { next unless(-r $1); push @hosts, expand_hosts(read_file($1)); } else { From 3e163e506ac3a248d9b44b6c1503542c69e5da13 Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Mon, 13 Jun 2016 09:34:45 +0200 Subject: [PATCH 2/2] allow @tag for hostconfig selection --- mxstartup2mxconfig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mxstartup2mxconfig b/mxstartup2mxconfig index 28c1505..b1b2010 100755 --- a/mxstartup2mxconfig +++ b/mxstartup2mxconfig @@ -248,6 +248,11 @@ sub print_ips_cfg { ############################################################################## +sub hostconfig_list { + my $tag = shift; + $_=`/usr/sbin/hostconfig --list $tag 2>/dev/null`; + return ( split ); +} sub expand_hosts { @@ -256,7 +261,10 @@ sub expand_hosts { foreach my $host (@oh) { - if ($host =~ /^(\/\S+)/) { + if($host =~ /^\@(\S+)/) { + push @hosts, hostconfig_list($1); + } + elsif ($host =~ /^(\/\S+)/) { next unless(-r $1); push @hosts, expand_hosts(read_file($1)); } else {