summaryrefslogtreecommitdiffstats
path: root/ftp_wizard/scripts/ProFtpconf.pm
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-10-15 16:10:00 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-10-15 16:10:00 +0000
commit83eca6fa0dac3c5dbf68aff23d87ff5fca2e5a5c (patch)
tree4c26d86f98f9c21e47cc27df98ab8ef90e280455 /ftp_wizard/scripts/ProFtpconf.pm
parent7c9035918b08c4f2e6960a9664dbdd4e40e45c6a (diff)
downloaddrakwizard-83eca6fa0dac3c5dbf68aff23d87ff5fca2e5a5c.tar
drakwizard-83eca6fa0dac3c5dbf68aff23d87ff5fca2e5a5c.tar.gz
drakwizard-83eca6fa0dac3c5dbf68aff23d87ff5fca2e5a5c.tar.bz2
drakwizard-83eca6fa0dac3c5dbf68aff23d87ff5fca2e5a5c.tar.xz
drakwizard-83eca6fa0dac3c5dbf68aff23d87ff5fca2e5a5c.zip
wiz update, nfs fixed
Diffstat (limited to 'ftp_wizard/scripts/ProFtpconf.pm')
-rw-r--r--ftp_wizard/scripts/ProFtpconf.pm49
1 files changed, 42 insertions, 7 deletions
diff --git a/ftp_wizard/scripts/ProFtpconf.pm b/ftp_wizard/scripts/ProFtpconf.pm
index a53a1023..85ecfd4d 100644
--- a/ftp_wizard/scripts/ProFtpconf.pm
+++ b/ftp_wizard/scripts/ProFtpconf.pm
@@ -15,6 +15,22 @@ sub true {
0;
}
+sub check_dir {
+ -d ($ENV{wiz_dir}) and return 10;
+ 1;
+}
+
+sub get_dir {
+ while (<NEW>) { # we need 3 elements to consider section as known
+ if (m/^\s*<drakwizard>/s...m/^\s*<\/drakwizard>/s ) {
+ if (m/^\s*<Anonymous\s*(.*)>/s ) {
+ return $1;
+ }
+ }
+ }
+ "";
+}
+
my $o = DrakconnectConf->new();
sub check {
@@ -23,6 +39,23 @@ sub check {
0;
}
+sub print_anonymous() {
+ print '
+#<drakwizard>
+<Anonymous '.$_[0].'>
+ User ftp
+ Group ftp
+ UserAlias anonymous ftp
+ MaxClients 10
+ <Limit WRITE>
+ DenyAll
+ </Limit>
+</Anonymous>
+#</drakwizard>
+';
+EOF
+}
+
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};
@@ -41,23 +74,23 @@ sub do_it {
my $file = "/etc/proftpd.conf";
open (NEW, "< $file");
my $exist = 0;
- while (<NEW>) {
+ while (<NEW>) { # we need 3 elements to consider section as known
if (m/^\s*<Global>/s...m/^\s*<\/Global>/s ) {
if (m/^\s*<Limit LOGIN>/s...m/^\s*<\/Limit>/s ) {
if (/^\s*(?!\#)\s*Order .*$/) {
- $exist += 1;
+ $exist++;
}
if (/^\s*(?!\#)\s*Allow .*$/) {
- $exist += 1;
+ $exist++;
}
if (/^\s*(?!\#)\s*Deny .*$/) {
- $exist += 1;
+ $exist++;
}
}
}
}
close (NEW);
- if ($exist < 3) {
+ if ($exist < 3) { # Odd parameters are commented if exists to then add a known section
substInFile {
if (m/^\s*<Global>/s...m/^\s*<\/Global>/s ) {
if (m/^\s*<Limit LOGIN>/s...m/^\s*<\/Limit>/s ) {
@@ -69,16 +102,18 @@ sub do_it {
} $file;
open (NEW, ">> $file");
print NEW '
+#<drakwizard>
<Global>
<Limit LOGIN>
Order allow,deny
Allow from '.$allow.'
Deny from all
</Limit>
-</Global>';
+</Global>
+#</drakwizard>';
close NEW;
}
- else {
+ else { # the known section (3 parameters ) is replaced with our needs
substInFile {
if (m/^\s*<Global>/s...m/^\s*<\/Global>/s ) {
if (m/^\s*<Limit LOGIN>/s...m/^\s*<\/Limit>/s ) {