diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2004-01-22 20:00:06 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2004-01-22 20:00:06 +0000 |
commit | 568cc7c168e09ca61e6a6652ad0ab597fa5b6421 (patch) | |
tree | 7ae6b93d322db1543350608f9dba88007fa23f14 | |
parent | 1d8f4f1511ffe1a3e499e089b126397f1d9d0af4 (diff) | |
download | drakwizard-568cc7c168e09ca61e6a6652ad0ab597fa5b6421.tar drakwizard-568cc7c168e09ca61e6a6652ad0ab597fa5b6421.tar.gz drakwizard-568cc7c168e09ca61e6a6652ad0ab597fa5b6421.tar.bz2 drakwizard-568cc7c168e09ca61e6a6652ad0ab597fa5b6421.tar.xz drakwizard-568cc7c168e09ca61e6a6652ad0ab597fa5b6421.zip |
perl_checker fixes
-rwxr-xr-x | Wiztemplate.pm | 6 | ||||
-rw-r--r-- | dns_wizard/Bind.pm | 10 | ||||
-rwxr-xr-x | ftp_wizard/Proftpd.pm | 87 |
3 files changed, 54 insertions, 49 deletions
diff --git a/Wiztemplate.pm b/Wiztemplate.pm index 737ed509..68a19f33 100755 --- a/Wiztemplate.pm +++ b/Wiztemplate.pm @@ -19,7 +19,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -package WizTemplate; +package Wiztemplate; use strict; use common; @@ -34,7 +34,7 @@ my $o = { ip2 => '' }, needed_packages => [], - defaultimage => "$ENV{__WIZ_HOME__}", + defaultimage => $ENV{__WIZ_HOME__}, }; $o->{pages} = { @@ -82,7 +82,7 @@ $o->{pages} = { }; sub new { - my ($class, $conf) = @_; + my ($class) = @_; bless { o => $o, }, $class; diff --git a/dns_wizard/Bind.pm b/dns_wizard/Bind.pm index 5e5d2fe4..5d67de3a 100644 --- a/dns_wizard/Bind.pm +++ b/dns_wizard/Bind.pm @@ -90,7 +90,7 @@ my @list_hosts; sub list_hosts { my $iprev = get_spe_ip('iprev', $IPSERVER); my $db = "$ZONE_DIR/db.$iprev.hosts"; - my $ipnor = get_spe_ip('iprev', $IPSERVER); + #my $ipnor = get_spe_ip('iprev', $IPSERVER); # push @list_hosts, ""; foreach (cat_($db)) { my ($h) = /\d{1,3}\tIN\tPTR\t(.*)/; @@ -574,7 +574,7 @@ sub save_old_config { sub generate_rndc { mkdir_p($WDIR); system("rndc-confgen -a -c $WDIR/rndc.key"); - my ($key) = cat_("$WDIR/rndc.key") =~ /secret \"(\S*)\";/; + my ($key) = cat_("$WDIR/rndc.key") =~ /secret "(\S*)";/; $key; } @@ -646,7 +646,7 @@ sub check_iph { sub do_it { $::testing and return; - my ($st) = @_; + #my ($st) = @_; crea_wdir($WDIR); # create files crea_db_local(); @@ -755,7 +755,7 @@ sub do_it_list { return if $::testing; my $iprev = get_spe_ip('iprev', $IPSERVER); my $db = "$ZONE_DIR/db.$iprev.hosts"; - my $ipnor = get_spe_ip('ipnor', $IPSERVER); + #my $ipnor = get_spe_ip('ipnor', $IPSERVER); my @hosts; my @ip; foreach (cat_($db)) { my ($ipend, $h) = /(\d{1,3})\tIN\tPTR\t(.*)/; @@ -765,7 +765,7 @@ sub do_it_list { sub new { - my ($class, $conf) = @_; + my ($class) = @_; bless { o => $o, }, $class; diff --git a/ftp_wizard/Proftpd.pm b/ftp_wizard/Proftpd.pm index d50644ca..0bee21ce 100755 --- a/ftp_wizard/Proftpd.pm +++ b/ftp_wizard/Proftpd.pm @@ -28,7 +28,7 @@ use common; use services; require MDK::Wizard::Wizcommon; -my $wiz = new MDK::Wizard::Wizcommon; +my $wiz = MDK::Wizard::Wizcommon->new; my $o = { name => N("FTP wizard"), @@ -50,14 +50,14 @@ my %opt = ( "SystemLog" => "/var/log/proftpd/proftpd.log", "TransferLog" => "/var/log/proftpd/xferlog", "Extendedlog" => "/var/log/proftpd/ftp.log", - "LogFormat default" => "\"%h %l %u %t \"%r\" %s %b\"", - "LogFormat auth" => "\"%v [%P] %h %t \"%r\" %s\"", - "LogFormat write" => "\"%h %l %u %t \"%r\" %s %b\"", + "LogFormat default" => qq("%h %l %u %t "%r" %s %b"), + "LogFormat auth" => qq("%v [%P] %h %t "%r" %s"), + "LogFormat write" => qq("%h %l %u %t "%r" %s %b"), "ServerIdent" => "off", "DeferWelcome" => "on", "DisplayConnect" => "/etc/banner-proftpd", - "AccessDenyMsg" => "\" !-!! ACCESS DENY !!-! SEEMS YOU HAVE NO RIGHT THERE !!\"", - "AccessGrantMsg" => "\" -- Guest access granted for %u --\"", + "AccessDenyMsg" => qq(" !-!! ACCESS DENY !!-! SEEMS YOU HAVE NO RIGHT THERE !!"), + "AccessGrantMsg" => qq(" -- Guest access granted for %u --"), "IdentLookups" => "off", "UseReverseDNS" => "off", "TimesGMT" => "off", @@ -145,14 +145,14 @@ needed to configure your FTP Server") . "\n\n" . N("To accept these values, and }; sub new { - my ($class, $conf) = @_; + my ($class) = @_; bless { o => $o, }, $class; } sub true { - my ($val) = @_; + my ($val) = @_; return member($val, qw(1 '1' "1" true 'true' "true")); } @@ -163,12 +163,14 @@ sub check_dir { sub get_dir { my $file = "/etc/proftpd.conf"; - die "no ftp configuration file found ! warning." if (!-f $file); + die "no ftp configuration file found ! warning." if !-f $file; + local *NEW; open(NEW, "< $file") or die "error while opening $file: $!"; + local $_; 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 ) { + if (m/^\s*<drakwizard>/s...m!^\s*</drakwizard>!s) { + if (m/^\s*<Anonymous\s*(.*)>/s) { return $1; } } @@ -178,14 +180,15 @@ sub get_dir { sub check { $> and return 'must_be_root'; - $wiz->{net}->is_dhcp() and return 'warning_dhcp'; + $wiz->{net}->is_dhcp and return 'warning_dhcp'; '' } -sub print_anonymous() { +sub print_anonymous { + my ($arg) = @_; print ' #<drakwizard> -<Anonymous '.$_[0].'> +<Anonymous '.$arg.'> User ftp Group ftp UserAlias anonymous ftp @@ -203,7 +206,7 @@ sub change_options { my $file = "/etc/proftpd.conf"; my $status; if ($var == 1) { $status = "on" } else { $status = "off" } - if ( any { /^$var_in_conf/ } cat_($file)) { + if (any { /^$var_in_conf/ } cat_($file)) { substInFile { s/$var_in_conf.*/$var_in_conf $status/ } $file; } else { append_to_file($file, "$var_in_conf $status\n") @@ -213,7 +216,7 @@ sub change_options { sub add_options { my ($var, $value) = @_; my $file = "/etc/proftpd.conf"; - if ( any { /^$var/ } cat_($file)) { + if (any { /^$var/ } cat_($file)) { substInFile { s/$var.*/$var $value/ } $file; } else { append_to_file($file, "$var $value\n") @@ -226,8 +229,9 @@ sub do_it { my $wiz_ftp_internal = $o->{var}{wiz_ftp_external} ? 1 : true $o->{var}{wiz_ftp_internal}; my $wiz_ftp_external = true $o->{var}{wiz_ftp_external}; my $file = "/etc/proftpd.conf"; - die "no ftp configuration file found ! warning." if (!-f $file); + die "no ftp configuration file found ! warning." if !-f $file; MDK::Common::cp_af($file, $file . ".orig"); + local *NEW; open(NEW, "< $file") or die "error while opening $file: $!"; my $allow = "all"; if ($wiz_ftp_internal && !$wiz_ftp_external) { @@ -237,36 +241,37 @@ sub do_it { elsif (!$wiz_ftp_external) { $allow = "none"; } - my $file = "/etc/proftpd.conf"; - open (NEW, "< $file"); + $file = "/etc/proftpd.conf"; + open(NEW, "< $file"); my $exist = 0; + local $_; 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 .*$/) { + if (m/^\s*<Global>/s...m!^\s*</Global>!s) { + if (m/^\s*<Limit LOGIN>/s...m!^\s*</Limit>!s) { + if (/^\s*(?!#)\s*Order /) { $exist++; } - if (/^\s*(?!\#)\s*Allow .*$/) { + if (/^\s*(?!#)\s*Allow /) { $exist++; } - if (/^\s*(?!\#)\s*Deny .*$/) { + if (/^\s*(?!#)\s*Deny /) { $exist++; } } } } - close (NEW); + close(NEW); 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 ) { - s/^\s*(?!\#)\s*Order .*$/\#$&\n/s; - s/^\s*(?!\#)\s*Allow .*$/\#$&\n/s; - s/^\s*(?!\#)\s*Deny .*$/\#$&\n/s; + if (m/^\s*<Global>/s...m!^\s*</Global>!s) { + if (m/^\s*<Limit LOGIN>/s...m!^\s*</Limit>!s) { + s/^\s*(?!#)\s*Order .*$/#$&\n/s; + s/^\s*(?!#)\s*Allow .*$/#$&\n/s; + s/^\s*(?!#)\s*Deny .*$/#$&\n/s; } } } $file; - open (NEW, ">> $file"); + open(NEW, ">> $file"); print NEW ' #<drakwizard> <Global> @@ -280,23 +285,23 @@ sub do_it { '; close NEW; } - else { # the known section (3 parameters ) is replaced with our needs + 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 ) { - if (/^\s*(?!\#)\s*Order .*$/i) { + if (m/^\s*<Global>/s...m!^\s*</Global>!s) { + if (m/^\s*<Limit LOGIN>/s...m!^\s*</Limit>!s) { + if (/^\s*(?!#)\s*Order /i) { if (!/\s*Order\s*allow,\s*deny\s*$/) { - s//\#$&\n Order allow,deny\n/; + s//#$&\n Order allow,deny\n/; } } - if (/^\s*(?!\#)\s*Allow .*$/i) { + if (/^\s*(?!#)\s*Allow /i) { if (!/\s*Allow\s*from\s*$allow\s*$/) { - s//\#$&\n Allow from $allow/; + s//#$&\n Allow from $allow/; } } - if (/^\s*(?!\#)\s*Deny .*$/i) { + if (/^\s*(?!#)\s*Deny /i) { if (!/\s*Deny\s*from\s*all\s*$/) { - s//\#$&\n Deny from all\n/; + s//#$&\n Deny from all\n/; } } } @@ -326,7 +331,7 @@ sub do_it { } else { $data = "" } - if ( any { /^DefaultRoot/ } cat_($file)) { + if (any { /^DefaultRoot/ } cat_($file)) { substInFile { s/DefaultRoot.*/$data/ } $file; } else { append_to_file($file, "$data\n"); |