summaryrefslogtreecommitdiffstats
path: root/ftp_wizard/scripts/ProFtpconf.pm
diff options
context:
space:
mode:
Diffstat (limited to 'ftp_wizard/scripts/ProFtpconf.pm')
-rw-r--r--ftp_wizard/scripts/ProFtpconf.pm33
1 files changed, 14 insertions, 19 deletions
diff --git a/ftp_wizard/scripts/ProFtpconf.pm b/ftp_wizard/scripts/ProFtpconf.pm
index 0893099d..5e737bbc 100644
--- a/ftp_wizard/scripts/ProFtpconf.pm
+++ b/ftp_wizard/scripts/ProFtpconf.pm
@@ -1,11 +1,12 @@
#!/usr/bin/perl
package ProFtpconf;
+require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
use MDK::Common;
use strict;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
-sub true_or_false {
+sub true {
my ($val) = @_;
$val eq "1" || $val eq "\'1\'" || $val eq "\"1\"" ||
@@ -14,31 +15,25 @@ sub true_or_false {
0;
}
-sub do_it {
- my %mdk = Vareqval->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";