From 7766bee9c30f4a3580406846a8113c8786ecf1f5 Mon Sep 17 00:00:00 2001 From: Arnaud Desmons Date: Tue, 13 Aug 2002 13:46:35 +0000 Subject: use drakconnect db --- ftp_wizard/ftp.wiz | 90 ++++------------------------------------ ftp_wizard/scripts/ProFtpconf.pm | 33 +++++++-------- 2 files changed, 22 insertions(+), 101 deletions(-) (limited to 'ftp_wizard') diff --git a/ftp_wizard/ftp.wiz b/ftp_wizard/ftp.wiz index 843b78df..e54c90c6 100644 --- a/ftp_wizard/ftp.wiz +++ b/ftp_wizard/ftp.wiz @@ -34,7 +34,7 @@ @@ -126,100 +126,26 @@ - - - - - - - - - - - - - - - - - - - - - get("/etc/sysconfig/mdk_serv"); - $mdk{wiz_ftp_external} = $ENV{wiz_ftp_external} if defined $ENV{wiz_ftp_external} or - die "wiz_ftp_external not defined in env !"; - $mdk{wiz_ftp_internal} = $ENV{wiz_ftp_internal} if defined $ENV{wiz_ftp_internal} or - die "wiz_ftp_internal not defined in env !"; - $mdk{wiz_ftp_external} = true_or_false($mdk{wiz_ftp_external}); - $mdk{wiz_ftp_internal} = $mdk{wiz_ftp_external} ? 1 : true_or_false($mdk{wiz_ftp_internal}); - my $wiz_ftp_internal = $mdk{wiz_ftp_internal}; - my $wiz_ftp_external = $mdk{wiz_ftp_external}; - my $wiz_device = $mdk{wiz_device} if defined $mdk{wiz_device} or - die "wiz_device not in /etc/sysconfig/mdk_serv"; - Vareqval->commit("/etc/sysconfig/mdk_serv", \%mdk); +my $o = DrakconnectConf->new(); + +sub check { + $> and return 1; + $o->is_dhcp() and return 2; + 0; +} + +sub do_it { + my $wiz_ftp_internal = $ENV{wiz_ftp_external} ? 1 : true $ENV{wiz_ftp_internal}; + my $wiz_ftp_external = true $ENV{wiz_ftp_external}; my $file = "/etc/proftpd.conf"; die "no ftp configuration file found ! warning." if (!-f $file); MDK::Common::cp_af($file, $file . ".orig"); open(NEW, "< $file") or die "error while opening $file: $!"; my $allow = "all"; if ($wiz_ftp_internal && !$wiz_ftp_external) { - my %mdk = Vareqval->get("/etc/sysconfig/network-scripts/ifcfg-".$wiz_device); - my $wiz_ip_net = $mdk{NETWORK} if defined $mdk{NETWORK} or - die "NETWORK not in /etc/sysconfig/network-scripts/ifcfg-".$wiz_device; - ($wiz_ip_net) = ($wiz_ip_net =~ /(.*)\..*/); - $allow = "$wiz_ip_net."; + ($allow) = $o->get_from_known_dev("IP") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/; } elsif (!$wiz_ftp_external) { $allow = "none"; -- cgit v1.2.1