diff options
-rw-r--r-- | bin/drakhosts | 6 | ||||
-rwxr-xr-x | bin/draknetprofile | 10 | ||||
-rwxr-xr-x | bin/draknfs | 10 | ||||
-rwxr-xr-x | bin/draksambashare | 57 | ||||
-rwxr-xr-x | bin/net_applet | 10 | ||||
-rwxr-xr-x | bin/net_monitor | 20 | ||||
-rw-r--r-- | lib/network/connection/cellular.pm | 4 | ||||
-rw-r--r-- | lib/network/connection/cellular_card.pm | 12 | ||||
-rw-r--r-- | lib/network/connection/ethernet.pm | 9 | ||||
-rw-r--r-- | lib/network/connection/isdn.pm | 1 | ||||
-rw-r--r-- | lib/network/connection/ppp.pm | 9 | ||||
-rw-r--r-- | lib/network/connection/wireless.pm | 4 | ||||
-rw-r--r-- | lib/network/connection_manager.pm | 20 | ||||
-rw-r--r-- | lib/network/drakfirewall.pm | 2 | ||||
-rwxr-xr-x | lib/network/drakroam.pm | 6 | ||||
-rw-r--r-- | lib/network/ifw.pm | 2 | ||||
-rw-r--r-- | lib/network/ipsec.pm | 3 | ||||
-rw-r--r-- | lib/network/monitor.pm | 2 | ||||
-rw-r--r-- | lib/network/ndiswrapper.pm | 4 | ||||
-rwxr-xr-x | lib/network/netcenter.pm | 6 | ||||
-rw-r--r-- | lib/network/netconnect.pm | 6 | ||||
-rw-r--r-- | lib/network/network.pm | 71 | ||||
-rw-r--r-- | lib/network/nfs.pm | 22 | ||||
-rw-r--r-- | lib/network/shorewall.pm | 4 | ||||
-rw-r--r-- | lib/network/vpn/openvpn.pm | 2 |
25 files changed, 153 insertions, 149 deletions
diff --git a/bin/drakhosts b/bin/drakhosts index 1b99c1b..1c2a49a 100644 --- a/bin/drakhosts +++ b/bin/drakhosts @@ -17,8 +17,6 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -my $version = "0.1"; - # i18n: IMPORTANT: to get correct namespace (drakhosts instead of libDrakX) BEGIN { unshift @::textdomains, 'drakhosts' } @@ -80,7 +78,7 @@ sub add_modify_entry { my $model = $treeview->get_model; my $selection = $treeview->get_selection; my $iter; - my ($i, $ip, $hostname, $alias, $oldip); + my ($i, $ip, $hostname, $alias); undef $i; undef $iter; @@ -103,7 +101,6 @@ sub add_modify_entry { $ip->set_text($listhosts[$i]{ip}); $hostname->set_text($listhosts[$i]{hostname}); $alias->set_text($listhosts[$i]{alias}); - $oldip = $listhosts[$i]{ip}; } my $text; @@ -178,7 +175,6 @@ sub create_model() { # add colum to model sub add_columns { my $treeview = shift; - my $model = $treeview->get_model; each_index { my $renderer = Gtk2::CellRendererText->new; $renderer->set(editable => 0); diff --git a/bin/draknetprofile b/bin/draknetprofile index 7a43689..e8ca2fd 100755 --- a/bin/draknetprofile +++ b/bin/draknetprofile @@ -104,15 +104,15 @@ sub load_netprofile_modules() { sub get_selected_profile() { my ($index) = $profiles_list->get_selected_indices; - if (not $index ) { + if (!$index) { my $pc = @{$profiles_list->{data}}; my $index = 0; for (my $i = 0; $i < $pc; $i++) { - if ( $profiles_list->{data}[$i][0] == 1 ) { + if ($profiles_list->{data}[$i][0] == 1) { $index = $i; } } - }; + } defined $index && $profiles_list->{data}[$index][1]; } @@ -148,7 +148,7 @@ sub set_profile { } sub clone_profile() { - my $source_profile = get_selected_profile(); + #my $source_profile = get_selected_profile(); my $dialog = _create_dialog(N("New profile...")); my $entry_dialog = Gtk2::Entry->new; gtkpack($dialog->vbox, @@ -181,7 +181,7 @@ sub delete_selected_profile() { my $profile = get_selected_profile(); if ($profile eq $default_profile) { my $ret = warn_dialog(N("Warning"), N("Are you sure you want to delete the default profile?")); - return if not $ret; + return if !$ret; } elsif ($profile eq $net->{PROFILE}) { err_dialog(N("Error"), N("You can not delete the current profile. Please switch to a different profile first.")); return; diff --git a/bin/draknfs b/bin/draknfs index aa0d8fb..3a0cf31 100755 --- a/bin/draknfs +++ b/bin/draknfs @@ -118,7 +118,7 @@ sub show_file_dialog { } $file_dlg->hide; $file_dlg->destroy; -}; +} sub get_nfs_data() { # /home/nis *(async,rw,no_root_squash) @@ -269,7 +269,7 @@ sub add_modify_entry { $lsubtree_check->set_popdown_strings(@yesno); my $button = gtknew('Button', text => N("Directory")); - $button->signal_connect(clicked => sub { show_file_dialog($dir); }); + $button->signal_connect(clicked => sub { show_file_dialog($dir) }); # test if modify or add a nfs share @@ -324,8 +324,8 @@ sub add_modify_entry { else { $lsubtree_check->set_text("yes") } } else { next } } - foreach ($lsecure, $lsync) { if ($_->get_text =~ //) { $_->set_text("yes") } }; - foreach ($lr, $lsubtree_check) { if ($_->get_text =~ //) { $_->set_text("no") } }; + foreach ($lsecure, $lsync) { if ($_->get_text =~ //) { $_->set_text("yes") } } + foreach ($lr, $lsubtree_check) { if ($_->get_text =~ //) { $_->set_text("no") } } } $luserid->signal_connect(changed => sub { @@ -370,7 +370,7 @@ sub add_modify_entry { $w->{window}->set_modal(1); $w->{window}->set_position('center'); - $expender->signal_connect(activate => sub { $w->shrink_topwindow; }); + $expender->signal_connect(activate => sub { $w->shrink_topwindow }); gtkadd($w->{window}, gtknew('VBox', spacing => 0, children_loose => [ diff --git a/bin/draksambashare b/bin/draksambashare index 6a2a26a..14d62c9 100755 --- a/bin/draksambashare +++ b/bin/draksambashare @@ -183,7 +183,7 @@ sub get_items() { [ N("/_Help") . N("/_Samba Documentation"), undef, sub { $in->do_pkgs->ensure_is_installed('samba-doc', '/usr/share/doc/samba-doc'); - system("/usr/bin/www-browser /usr/share/doc/samba-doc/htmldocs/index.html &") + system("/usr/bin/www-browser /usr/share/doc/samba-doc/htmldocs/index.html &"); }, 1, '<Item>', ], @@ -255,7 +255,7 @@ sub show_file_dialog { } $file_dlg->hide; $file_dlg->destroy; -}; +} sub get_samba_share() { undef @listshare; @@ -368,7 +368,7 @@ sub add_entry() { my ($addshare_name, $addshare_comment, $addshare_dir); $_ = Gtk2::Entry->new foreach $addshare_name, $addshare_comment, $addshare_dir; my $button = Gtk2::Button->new(N("Open")); - $button->signal_connect(clicked => sub { show_file_dialog($addshare_dir); }); + $button->signal_connect(clicked => sub { show_file_dialog($addshare_dir) }); my $dialog = _create_dialog(N("DrakSamba add entry"), { transient_for => $::main_window, modal => 1 }); local $::main_window = $dialog; @@ -565,7 +565,7 @@ sub modify_printers_entry { $use_client_driver->set_text($printer_list->{data}[$selected][14]); my $button = Gtk2::Button->new(N("Open")); - $button->signal_connect(clicked => sub { show_file_dialog($dir); }); + $button->signal_connect(clicked => sub { show_file_dialog($dir) }); my $dialog = _create_dialog(N("DrakSamba Printers entry"), { transient_for => $::main_window, modal => 1 }); @@ -685,7 +685,7 @@ sub modify_entry { $_->set_popdown_strings(@yesno) foreach $browseable, $public, $writable, $hide_dot_files, $preserve_case, $inherit_permissions; my $button = Gtk2::Button->new(N("Open")); - $button->signal_connect(clicked => sub { show_file_dialog($dir); }); + $button->signal_connect(clicked => sub { show_file_dialog($dir) }); my $w = ugtk2->new(N("DrakSamba entry")); $w->{window}->set_modal(1); @@ -1151,7 +1151,7 @@ sub configure_samba { next => 'ask_log', }, ask_log => { - name => N("Samba Log") . "\n" . N("Log file: use file.%m to use a separate log file for each machine that connects") . "\n" . N("Log level: set the log (verbosity) level (0 <= log level <= 10)") . "\n" . N("Max Log size: put a capping on the size of the log files (in Kb)."), + name => N("Samba Log") . "\n" . N("Log file: use %s to use a separate log file for each machine that connects", "file.%m") . "\n" . N("Log level: set the log (verbosity) level (0 <= log level <= 10)") . "\n" . N("Max Log size: put a capping on the size of the log files (in Kb)."), pre => sub { $o->{var}{wiz_log_file} ||= $samba->{global}{'log file'}; $o->{var}{wiz_log_level} ||= $samba->{global}{'log level'}; @@ -1180,11 +1180,15 @@ sub configure_samba { { text => N(" "), advanced => 1 }, { label => N("Unix Charset:"), val => \$o->{var}{wiz_unixcharset}, help => "Unix Charset pecifies the charset the unix machine Samba runs on uses.", advanced => 1 }, { label => N("Dos Charset:"), val => \$o->{var}{wiz_doscharset}, help => "Dos Charset specifies which charset Samba should talk to DOS clients.", advanced => 1 }, - { label => N("Display Charset:"), val => \$o->{var}{wiz_displaycharset}, help=> "Display Charset specifies the charset that samba will use to print messages to stdout and stderr. The default value is 'LOCALE', which means automatically set, depending on the current locale.", advanced => 1 }, + { label => N("Display Charset:"), val => \$o->{var}{wiz_displaycharset}, help => "Display Charset specifies the charset that samba will use to print messages to stdout and stderr. The default value is 'LOCALE', which means automatically set, depending on the current locale.", advanced => 1 }, ], post => sub { $samba->{global}{workgroup} = $o->{var}{wiz_workgroup}; - $o->{var}{wiz_netbios_name} ? $samba->{global}{"netbios name"} = $o->{var}{wiz_netbios_name} : delete $samba->{global}{"netbios name"}; + if ($o->{var}{wiz_netbios_name}) { + $samba->{global}{"netbios name"} = $o->{var}{wiz_netbios_name}; + } else { + delete $samba->{global}{"netbios name"}; + } $samba->{global}{'server string'} = $o->{var}{wiz_banner}; $o->{var}{wiz_log_file} and $samba->{global}{'log file'} = $o->{var}{wiz_log_file}; $o->{var}{wiz_log_level} and $samba->{global}{'log level'} = $o->{var}{wiz_log_level}; @@ -1207,14 +1211,34 @@ sub configure_samba { sub global_special_options() { # set charset - $o->{var}{wiz_doscharset} ? $samba->{global}{'dos charset'} = $o->{var}{wiz_doscharset} : delete $samba->{global}{'dos charset'}; - $o->{var}{wiz_unixcharset} ? $samba->{global}{'unix charset'} = $o->{var}{wiz_unixcharset} : delete $samba->{global}{'unix charset'}; - $o->{var}{wiz_displaycharset} ? $samba->{global}{'display charset'} = $o->{var}{wiz_displaycharset} : delete $samba->{global}{'display charset'}; - $o->{var}{wiz_security} ? $samba->{global}{security} = $o->{var}{wiz_security} : delete $samba->{global}{security}; - $o->{var}{hosts_allow} ? $samba->{global}{'hosts allow'} = $o->{var}{hosts_allow} : delete $samba->{global}{'hosts allow'}; + if ($o->{var}{wiz_doscharset}) { + $samba->{global}{'dos charset'} = $o->{var}{wiz_doscharset}; + } else { + delete $samba->{global}{'dos charset'}; + } + if ($o->{var}{wiz_unixcharset}) { + $samba->{global}{'unix charset'} = $o->{var}{wiz_unixcharset}; + } else { + delete $samba->{global}{'unix charset'}; + } + if ($o->{var}{wiz_displaycharset}) { + $samba->{global}{'display charset'} = $o->{var}{wiz_displaycharset}; + } else { + delete $samba->{global}{'display charset'}; + } + if ($o->{var}{wiz_security}) { + $samba->{global}{security} = $o->{var}{wiz_security}; + } else { + delete $samba->{global}{security}; + } + if ($o->{var}{hosts_allow}) { + $samba->{global}{'hosts allow'} = $o->{var}{hosts_allow}; + } else { + delete $samba->{global}{'hosts allow'}; + } # $samba->{global}{security} = $o->{var}{wiz_security}; # detect Samba type 3 is standalone - if ($o->{var}{wiz_type} == "3") { + if ($o->{var}{wiz_type} eq "3") { exists $samba->{global}{domain_master} and delete $samba->{global}{domain_master}; exists $samba->{global}{'domain logons'} and delete $samba->{global}{'domain logons'}; exists $samba->{global}{'wins support'} and delete $samba->{global}{'wins support'}; @@ -1237,10 +1261,7 @@ sub global_special_options() { } my $conf = "/etc/group"; - my @groups; - foreach (cat_($conf)) { - push @groups, $1 if m/^([^#:]+):[^:]+:([^:]+):/ and $2 > 499; - } + my @groups = map { if_(m/^([^#:]+):[^:]+:([^:]+):/ and $2 > 499, $1) } cat_($conf); foreach (@groups) { system("net groupmap add unixgroup=$_ ntgroup=$_"); } diff --git a/bin/net_applet b/bin/net_applet index 2873679..43c692c 100755 --- a/bin/net_applet +++ b/bin/net_applet @@ -151,7 +151,7 @@ my %actions = ( }, 'drakvpn' => { name => N("Manage VPN connections"), - launch => sub { run_program::raw({ detach => 1 }, '/usr/sbin/drakvpn'); }, + launch => sub { run_program::raw({ detach => 1 }, '/usr/sbin/drakvpn') }, }, 'confNetwork' => { name => N("Configure Network"), @@ -162,7 +162,7 @@ my %actions = ( choices => sub { N("Auto-detect"), sort keys %{$net->{ifcfg}} }, choice_selected => sub { $watched_interface ? $_[0] eq $watched_interface : - $_[0] eq N("Auto-detect") + $_[0] eq N("Auto-detect"); }, launch => sub { $watched_interface = $_[0] eq N("Auto-detect") ? undef : $_[0]; @@ -203,14 +203,14 @@ my %actions = ( name => N("VPN connection"), header => "drakvpn", choices => sub { - map { $_->get_configured_connections } network::vpn::list_types + map { $_->get_configured_connections } network::vpn::list_types; }, allow_single_choice => 1, format_choice => \&network::vpn::get_label, choice_selected => sub { $_[0]->is_started }, launch => sub { require interactive; $_[0]->is_started ? - $_[0]->stop : $_[0]->start(interactive->vnew) + $_[0]->stop : $_[0]->start(interactive->vnew); }, }, 'help' => { @@ -275,7 +275,7 @@ $SIG{HUP} = sub { }; $SIG{USR1} = sub { # clear all ifw notifications - my @packets = eval { $network::net_applet::ifw->get_reports }; + eval { $network::net_applet::ifw->get_reports }; }; # do not create zombies (#20552) diff --git a/bin/net_monitor b/bin/net_monitor index 5c27f85..eb9a37a 100755 --- a/bin/net_monitor +++ b/bin/net_monitor @@ -183,17 +183,17 @@ sub main_quit() { ugtk2->exit(0); } -sub getcurrentintf { +sub getcurrentintf() { my $currp = $notebook->get_current_page; foreach (@interfaces) { my $intf = $_; - return $intf if ($monitor->{$intf}{page} == $currp) + return $intf if $monitor->{$intf}{page} == $currp; } } -sub intf_reset { +sub intf_reset() { # resets counters for currently selected tab - my $intf = getcurrentintf; + my $intf = getcurrentintf(); if (defined $intf) { $monitor->{$intf}{totalt} = 0; $monitor->{$intf}{totalr} = 0; @@ -276,7 +276,7 @@ sub connection() { gtkflush(); - print ("Action on " . getcurrentintf() . "\n"); + print "Action on " . getcurrentintf() . "\n"; $tool_pid = $wasconnected == 1 @@ -300,17 +300,17 @@ sub rescan() { # prevent for case 32 bits or 64 bits unsigned value of /proc (if rotate to zero) if ($diffr < 0) { if ($refr < 2**32) { # transition (2^32 - 1) to 0 - $diffr += 2**32 + $diffr += 2**32; } else { $diffr += 2**64 } # transition (2^64 - 1) to 0 # { $diffr = 0; $monitor->{$intf}{totalr} = 0 } # Alternatively, if bug for very big number in perl - }; + } # prevent for case 32 bits or 64 bits unsigned value of /proc (if rotate to zero) if ($difft < 0) { if ($reft < 2**32) { # transition (2^32 - 1) to 0 - $difft += 2**32 + $difft += 2**32; } else { $difft += 2**64 } # transition (2^64 - 1) to 0 # { $difft = 0; $monitor->{$intf}{totalt} = 0 } # Alternatively, if bug for very big number in perl - }; + } $monitor->{$intf}{totalr} += $diffr; $monitor->{$intf}{totalt} += $difft; @@ -448,7 +448,7 @@ sub update() { gtknew('HBox', spacing => 5, border_width => 5, children_tight => [ color_button($gca, $colora), N("average") ]), - gtknew('Button', text => N("Reset counters"), sensitive => 1, clicked => sub { intf_reset }) + gtknew('Button', text => N("Reset counters"), sensitive => 1, clicked => sub { intf_reset() }) ]), 0, gtknew('VBox', border_width => 5, children_tight => [ gtknew('Frame', text => N("Local measure"), shadow_type => 'etched_out', child => diff --git a/lib/network/connection/cellular.pm b/lib/network/connection/cellular.pm index 5bb2259..3084480 100644 --- a/lib/network/connection/cellular.pm +++ b/lib/network/connection/cellular.pm @@ -16,7 +16,7 @@ sub get_providers { # filtering out CDMA-only providers which we do not support for now my %providers = ( %network::connection::providers::cellular::data, - grep_each{!$::b->{cdma} } %network::connection::providers::cellular_extra::data + grep_each { !$::b->{cdma} } %network::connection::providers::cellular_extra::data ); (\%providers, '|'); } @@ -48,7 +48,7 @@ sub write_cellular_settings { sub guess_apn_from_chat { my ($self) = @_; my $chat = cat_($::prefix . $self->get_chat_file); - my $chat_apn = $chat =~ /\bAT\+CGDCONT=\d+,"IP","([^"]+)"/ && $1; + $chat =~ /\bAT\+CGDCONT=\d+,"IP","([^"]+)"/ && $1; } sub guess_provider_settings { diff --git a/lib/network/connection/cellular_card.pm b/lib/network/connection/cellular_card.pm index 0fc3fbf..c68b3a2 100644 --- a/lib/network/connection/cellular_card.pm +++ b/lib/network/connection/cellular_card.pm @@ -68,11 +68,11 @@ sub get_tty_device { my %udev_env = map { if_(/^([^=]*)=(.*)$/, $1 => $2) } chomp_(run_program::get_stdout("udevadm info --query=property --path=$self->{device}{sysfs_device}")); if ($udev_env{USB_MODEM_INTERFACE}) { - my $dev_sys_path = $self->{device}->{sysfs_device}; + my $dev_sys_path = $self->{device}{sysfs_device}; my $cfg = chomp_(cat_($dev_sys_path . "/bConfigurationValue")); my $tty_usb = basename(glob_("$dev_sys_path/" . - $self->{device}->{pci_bus} . "-" . - ($self->{device}->{usb_port} + 1) . ":$cfg." . + $self->{device}{pci_bus} . "-" . + ($self->{device}{usb_port} + 1) . ":$cfg." . $udev_env{USB_MODEM_INTERFACE} . "/ttyUSB*")); if ($tty_usb) { $tty_usb =~ s/ttyUSB//; @@ -81,8 +81,8 @@ sub get_tty_device { } else { # if no usb interface for tty port given, use first one my @intfs = glob_("$self->{device}->{sysfs_device}/" . - $self->{device}->{pci_bus} . "-" . - ($self->{device}->{usb_port} + 1) . ":*"); + $self->{device}{pci_bus} . "-" . + ($self->{device}{usb_port} + 1) . ":*"); foreach (@intfs) { my $tty_usb = basename(glob_("$_/tty*")); if ($tty_usb) { @@ -108,7 +108,7 @@ sub get_control_device { my ($self) = @_; my $tty_device = $self->get_tty_device; if ($tty_device eq "/dev/ttyUSB0") { - for my $id (2, 1) { + foreach my $id (2, 1) { my $usb_control_device = "/dev/ttyUSB" . $id; return $usb_control_device if -e $usb_control_device; } diff --git a/lib/network/connection/ethernet.pm b/lib/network/connection/ethernet.pm index 7b76396..c2f9718 100644 --- a/lib/network/connection/ethernet.pm +++ b/lib/network/connection/ethernet.pm @@ -188,7 +188,7 @@ sub check_address_settings { return 0; } #- test if IP address is already used - if (my $conflict = find { text2bool($_->{ONBOOT}) && $_->{DEVICE} ne $self->get_interface && $_->{IPADDR} eq $self->{address}{ip_address} } values %{$net->{ifcfg}} ) { + if (my $conflict = find { text2bool($_->{ONBOOT}) && $_->{DEVICE} ne $self->get_interface && $_->{IPADDR} eq $self->{address}{ip_address} } values %{$net->{ifcfg}}) { # find out what connection we are conflicting with my $conflict_device = $conflict->{DEVICE}; @@ -216,14 +216,14 @@ sub get_hostname_settings { my ($self) = @_; my $auto_hostname = sub { $self->{protocol} eq 'dhcp' && $self->{address}{needhostname} }; # configure the default hostname so the hostname setting should be more obvious to the users - $self->{address}{hostname} = 'localhost.localdomain' unless $self->{address}{hostname}; + $self->{address}{hostname} ||= 'localhost.localdomain'; [ if_($self->{protocol} eq 'dhcp', { text => N("Assign host name from DHCP server (or generate a unique one)"), val => \$self->{address}{needhostname}, type => "bool", - help => N("This will allow the server to attribute a name for this machine. If the server does not provides a valid host name, it will be generated automatically.")}, + help => N("This will allow the server to attribute a name for this machine. If the server does not provides a valid host name, it will be generated automatically.") }, ), { label => N("Host name"), val => \$self->{address}{hostname}, disabled => $auto_hostname, - help => N("You should define a hostname for this machine, which will identify this PC. Note that this hostname will be shared among all network connections. If left blank, 'localhost.localdomain' will be used.")}, + help => N("You should define a hostname for this machine, which will identify this PC. Note that this hostname will be shared among all network connections. If left blank, 'localhost.localdomain' will be used.") }, ]; } @@ -508,7 +508,6 @@ sub update_iftab() { } sub update_udev_net_config() { - my $lib = arch() =~ /x86_64/ ? "lib64" : "lib"; my $net_name_helper = "/lib/udev/write_net_rules"; my $udev_net_config = "$::prefix/etc/udev/rules.d/70-persistent-net.rules"; my @old_config = cat_($udev_net_config); diff --git a/lib/network/connection/isdn.pm b/lib/network/connection/isdn.pm index 1b8debc..7187aed 100644 --- a/lib/network/connection/isdn.pm +++ b/lib/network/connection/isdn.pm @@ -23,6 +23,7 @@ use run_program; use log; use network::tools; use services; +use network::connection::isdn::consts; # for @isdndata sub apply_config { my ($in, $isdn) = @_; diff --git a/lib/network/connection/ppp.pm b/lib/network/connection/ppp.pm index 287d7bb..277971f 100644 --- a/lib/network/connection/ppp.pm +++ b/lib/network/connection/ppp.pm @@ -5,15 +5,6 @@ use common; use base qw(network::connection); -my %authentication_methods = ( - script => N_("Script-based"), - pap => N_("PAP"), - terminal_ => N_("Terminal-based"), - chap => N_("CHAP"), - pap_chap => N_("PAP/CHAP"), -); - -my @kppp_authentication_methods = qw(script pap terminal chap pap_chap); my @secrets_files = qw(pap-secrets chap-secrets); sub get_access_settings { diff --git a/lib/network/connection/wireless.pm b/lib/network/connection/wireless.pm index 4f86f17..89d57dd 100644 --- a/lib/network/connection/wireless.pm +++ b/lib/network/connection/wireless.pm @@ -388,7 +388,7 @@ sub load_interface_settings { $self->{hide_passwords} = 1; # override ifcfg with network-specific settings if available my $network = $self->get_selected_network; - $self->{ifcfg}= $network ? + $self->{ifcfg} = $network ? get_network_ifcfg($network->{ap}) || get_network_ifcfg($network->{essid}) : $self->{ifcfg}; @@ -970,7 +970,7 @@ sub wpa_supplicant_read_conf() { if ($network) { #- in a "network = {}" block # value is either the string with "quotes" - or a full-length string - if (/^\s*(\w+)=\s*(?|([^"].*)|("[^"]*")).*$/) { + if (/^\s*(\w+)=\s*(?|([^"].*)|("[^"]*"))/) { $network->{$1} = $2; } elsif (/^\}/) { #- end of network block diff --git a/lib/network/connection_manager.pm b/lib/network/connection_manager.pm index 3efb2c1..3bbac97 100644 --- a/lib/network/connection_manager.pm +++ b/lib/network/connection_manager.pm @@ -81,7 +81,7 @@ sub setup_connection { auto_window_size => 1, }, $cmanager->{connection}->get_hardware_settings) or return; if ($cmanager->{connection}->can("check_hardware_settings") && !$cmanager->{connection}->check_hardware_settings) { - $cmanager->{in}->ask_warn(N("Error"), $cmanager->{connection}->{hardware}{error}); + $cmanager->{in}->ask_warn(N("Error"), $cmanager->{connection}{hardware}{error}); return; } } @@ -225,7 +225,7 @@ sub start_connection { } undef; }); - }; + } } sub stop_connection { @@ -293,31 +293,31 @@ sub create_networks_list { }); $cmanager->{gui}{networks_list}->set_has_tooltip(1); $cmanager->{gui}{networks_list}->get_column(1)->set_sort_column_id(1); - $cmanager->{gui}{networks_list}->get_model->set_sort_func (1, sub { + $cmanager->{gui}{networks_list}->get_model->set_sort_func(1, sub { my ($sortable, $iter_left, $iter_right) = @_; my $s1 = $sortable->get($iter_left, 2); my $s2 = $sortable->get($iter_right, 2); return $s1 cmp $s2; }); $cmanager->{gui}{networks_list}->get_column(2)->set_sort_column_id(2); - $cmanager->{gui}{networks_list}->get_model->set_sort_func (2, sub { + $cmanager->{gui}{networks_list}->get_model->set_sort_func(2, sub { my ($sortable, $iter_left, $iter_right) = @_; - my $s1 = $cmanager->{connection}{networks}{$sortable->get($iter_left, 0)}->{signal_strength}; - my $s2 = $cmanager->{connection}{networks}{$sortable->get($iter_right, 0)}->{signal_strength}; + my $s1 = $cmanager->{connection}{networks}{$sortable->get($iter_left, 0)}{signal_strength}; + my $s2 = $cmanager->{connection}{networks}{$sortable->get($iter_right, 0)}{signal_strength}; return $s1 <=> $s2; }); $cmanager->{gui}{networks_list}->get_column(3)->set_sort_column_id(3); - $cmanager->{gui}{networks_list}->get_model->set_sort_func (3, sub { + $cmanager->{gui}{networks_list}->get_model->set_sort_func(3, sub { my ($sortable, $iter_left, $iter_right) = @_; - my $s1 = $cmanager->{connection}{networks}{$sortable->get($iter_left, 0)}->{flags}; - my $s2 = $cmanager->{connection}{networks}{$sortable->get($iter_right, 0)}->{flags}; + my $s1 = $cmanager->{connection}{networks}{$sortable->get($iter_left, 0)}{flags}; + my $s2 = $cmanager->{connection}{networks}{$sortable->get($iter_right, 0)}{flags}; #FIXME Should define an explicit order OPEN < WEP < WPA return $s1 cmp $s2; }); $cmanager->{gui}{networks_list}->set_enable_search(1); $cmanager->{gui}{networks_list}->set_search_column(1); $cmanager->{gui}{networks_list}->set_search_equal_func(sub { - my ($model, $column, $key, $iter, $data) = @_; + my ($model, $_column, $key, $iter) = @_; return $model->get($iter, 2) !~ /^\Q$key/i; }); # Sort by signal level by default diff --git a/lib/network/drakfirewall.pm b/lib/network/drakfirewall.pm index 9c5f0f5..6ce6b13 100644 --- a/lib/network/drakfirewall.pm +++ b/lib/network/drakfirewall.pm @@ -57,7 +57,7 @@ my @all_servers = pkg => 'nfs-utils nfs-utils-clients', ports => '111/tcp 111/udp 2049/tcp 2049/udp ' . network::nfs::list_nfs_ports(), hide => 1, - prepare => sub { network::nfs::write_nfs_ports(network::nfs::read_nfs_ports()); }, + prepare => sub { network::nfs::write_nfs_ports(network::nfs::read_nfs_ports()) }, restart => 'nfs-common nfs-server', }, { diff --git a/lib/network/drakroam.pm b/lib/network/drakroam.pm index 9ff8189..f6c28d0 100755 --- a/lib/network/drakroam.pm +++ b/lib/network/drakroam.pm @@ -41,7 +41,7 @@ sub select_connection { my ($droam) = @_; $droam->set_connection(get_connection($droam)); - $droam->check_setup || $droam->setup_connection if $droam->{connection}; + $droam->check_setup or $droam->setup_connection if $droam->{connection}; update_on_connection_change($droam); } @@ -54,7 +54,7 @@ sub update_on_connection_change { } sub create_drakroam_gui { - my ($droam, $dbus, $title, $icon) = @_; + my ($droam, $_dbus, $title, $icon) = @_; $droam->{gui}{model} = Gtk2::ListStore->new('Gtk2::Gdk::Pixbuf', 'Glib::String'); $droam->{gui}{connections_combo} = Gtk2::ComboBox->new($droam->{gui}{model}); @@ -77,7 +77,7 @@ sub create_drakroam_gui { Glib::Timeout->add(20000, sub { $status_bar->remove($status_bar_cid, $m_id); 0 }); }; - (undef, my $rootwin_height) = gtkroot()->get_size(); + (undef, my $rootwin_height) = gtkroot()->get_size; my $scrolled_height = $rootwin_height > 480 ? 300 : 225; gtkadd($droam->{gui}{w}{window}, gtknew('VBox', spacing => 5, children => [ diff --git a/lib/network/ifw.pm b/lib/network/ifw.pm index 2509b93..94ea851 100644 --- a/lib/network/ifw.pm +++ b/lib/network/ifw.pm @@ -113,7 +113,7 @@ sub resolve_address { eval { local $SIG{ALRM} = sub { die "ALARM" }; alarm 2; - $hostname = gethostbyaddr(inet_aton($ip_addr), AF_INET); + $hostname = gethostbyaddr(inet_aton($ip_addr), Socket::AF_INET); alarm 0; }; $hostname || $ip_addr; diff --git a/lib/network/ipsec.pm b/lib/network/ipsec.pm index 846b07a..bf30b3d 100644 --- a/lib/network/ipsec.pm +++ b/lib/network/ipsec.pm @@ -465,10 +465,7 @@ sub read_ipsec_conf { my ($ipsec_conf) = @_; my %conf; my $nb = 0; #total number - my $i = 0; #nb within a connexion my $in_a_conn = "n"; - my $line = ""; - my @line1; local $_; my @mylist; my $myline = ""; diff --git a/lib/network/monitor.pm b/lib/network/monitor.pm index d8fb258..b1dc9ac 100644 --- a/lib/network/monitor.pm +++ b/lib/network/monitor.pm @@ -28,7 +28,7 @@ sub list_wireless { if (!$has_roaming && !$>) { $results = `$::prefix/usr/sbin/wpa_cli scan_results 2>/dev/null`; $list = `$::prefix/usr/sbin/wpa_cli list_networks 2>/dev/null`; - $_ =~ s/^Selected interface (.*)\n//g foreach $results, $list; + s/^Selected interface (.*)\n//g foreach $results, $list; } if ($results && $list) { #- bssid / frequency / signal level / flags / ssid diff --git a/lib/network/ndiswrapper.pm b/lib/network/ndiswrapper.pm index 22af6d6..d626770 100644 --- a/lib/network/ndiswrapper.pm +++ b/lib/network/ndiswrapper.pm @@ -79,7 +79,7 @@ sub find_matching_devices { #- add original driver push @devices, { interface => undef, drivers => [ $device->{driver} ] } - if !$is_driver_listed->($device->{driver}) && any { $_ eq $device->{driver} } modules::loaded_modules(); + if !$is_driver_listed->($device->{driver}) && member($device->{driver}, modules::loaded_modules()); @devices; } @@ -101,7 +101,7 @@ sub setup_device { my @conflicts = find_conflicting_devices($device); if (@conflicts) { $in->ask_yesorno(N("Warning"), N("The selected device has already been configured with the %s driver. -Do you really want to use a ndiswrapper driver?", $conflicts[0]->{drivers}[0])) or return; +Do you really want to use a ndiswrapper driver?", $conflicts[0]{drivers}[0])) or return; #- stop old interfaces network::tools::stop_interface($_->{interface}, 0) foreach grep { defined $_->{interface} } @conflicts; #- unload old modules before trying to load ndiswrapper diff --git a/lib/network/netcenter.pm b/lib/network/netcenter.pm index 10d156d..fa65a33 100755 --- a/lib/network/netcenter.pm +++ b/lib/network/netcenter.pm @@ -51,7 +51,7 @@ sub build_cmanager_box { ($cmanager->{connection}->can('get_networks') ? ( $cmanager->{gui}{show_unique_network} ? ( $cmanager->{gui}{networks_list}, - ): ( + ) : ( gtknew('Label', text => N("Please select your network:"), alignment => [ 0, 0 ]), gtknew('ScrolledWindow', height => 160, child => $cmanager->{gui}{networks_list}) ), @@ -168,7 +168,7 @@ sub main { gtkadd($w->{window}, gtknew('VBox', spacing => 5, children => [ $::isEmbedded ? () : (0, Gtk2::Banner->new($icon, $title)), - if_($net->{PROFILE} && network::network::netprofile_count() > 0, 0, gtknew('Label', text_markup => N("You are currently using the network profile <b>%s</b>", $net->{PROFILE})) ), + if_($net->{PROFILE} && network::network::netprofile_count() > 0, 0, gtknew('Label', text_markup => N("You are currently using the network profile <b>%s</b>", $net->{PROFILE}))), 1, gtknew('ScrolledWindow', width => 600, height => $scrolled_height, shadow_type => 'none', child => $managers_box = gtknew('VBox', spacing => 5, children_tight => [ map_index { build_cmanager_box($_, $::i == 0) } @cmanagers, @@ -195,7 +195,7 @@ sub main { push @connections, $connection; push @cmanagers, $cmanager; my $box = build_cmanager_box($cmanager, @connections == 0); - $managers_box ->add($box); + $managers_box->add($box); $box->show_all; } $cmanager->{parent_box}->show; diff --git a/lib/network/netconnect.pm b/lib/network/netconnect.pm index abe94c7..adb048a 100644 --- a/lib/network/netconnect.pm +++ b/lib/network/netconnect.pm @@ -124,7 +124,7 @@ sub real_main { welcome => { pre => sub { undef $net->{type} }, if_(!$::isInstall, no_back => 1), - name => N("Choose the connection you want to configure") . if_($net->{PROFILE} && network::network::netprofile_count() > 0, "\n".N("Those settings will be saved for the network profile <b>%s</b>", $net->{PROFILE}) ), + name => N("Choose the connection you want to configure") . if_($net->{PROFILE} && network::network::netprofile_count() > 0, "\n" . N("Those settings will be saved for the network profile <b>%s</b>", $net->{PROFILE})), if_(!$::isInstall, interactive_help_id => 'configureNetwork'), data => [ { list => [ network::connection::get_types ], type => 'list', val => \$net->{type}, format => sub { $_[0] && $_[0]->get_type_description }, @@ -148,7 +148,7 @@ sub real_main { select_connection => { name => sub { $net->{type}->get_type_name . "\n\n" . N("Select the network interface to configure:") }, data => [ { val => \$connection, type => 'list', list => \@connections_list, - format => sub { $_[0] && N("%s: %s", $_[0]->get_interface, $_[0]->get_description) }, allow_empty_list => !text2bool($global_settings{AUTOMATIC_IFACE_CHOICE})} ], + format => sub { $_[0] && N("%s: %s", $_[0]->get_interface, $_[0]->get_description) }, allow_empty_list => !text2bool($global_settings{AUTOMATIC_IFACE_CHOICE}) } ], complete => sub { $connection->setup_thirdparty($in) or return 1; $connection->prepare_device; @@ -322,7 +322,7 @@ If you do not know it, keep the preselected protocol.") }, sleep 1; } } - $success = $connection->get_status(); + $success = $connection->get_status; # try to resolve the network address for some time my $timeout = 3; while ($timeout--) { diff --git a/lib/network/network.pm b/lib/network/network.pm index 1f7e79f..62824d8 100644 --- a/lib/network/network.pm +++ b/lib/network/network.pm @@ -248,21 +248,21 @@ sub add2hosts { my $file = "$::prefix/etc/hosts"; my @l; - push(@l, [$_, $hostname, if_($sub_hostname, $sub_hostname)]) foreach(@ips); + push @l, [ $_, $hostname, if_($sub_hostname, $sub_hostname) ] foreach @ips; foreach (cat_($file)) { # strip our own comments - next if ($_ =~ /# generated by drak.*/); + next if /# generated by drak/; my ($ip, $aliases) = /^\s*(\S+)\s+(\S+.*)$/ or next; my @hosts = difference2([ split /\s+/, $aliases ], [ $hostname, $sub_hostname ]); if (@hosts) { - push (@l, [$ip, @hosts]); + push @l, [ $ip, @hosts ]; } - }; + } log::explanations("writing host information to $file"); output($file, "# generated by drakconnect\n"); foreach (@l) { - append_to_file($file, join(" ", @{$_}) . "\n"); + append_to_file($file, join(" ", @$_) . "\n"); } } @@ -409,13 +409,13 @@ sub gateway { sub netprofile_modules() { my @m = split('\n', `/sbin/netprofile modules`); - my @modules = (); + my @modules; foreach my $module (@m) { my @params = split('\t', $module); my $vals = { module => @params[0], - enabled => @params[1] eq '+' ? 1 : 0, + enabled => $params[1] eq '+' ? 1 : 0, name => @params[2], description => @params[3], }; @@ -466,26 +466,26 @@ sub netprofile_read { $net->{PROFILE} = $profile || 'default'; } -sub advanced_settings_read { +sub advanced_settings_read() { my $modprobe = "$::prefix/etc/modprobe.conf"; my $sysctl = "$::prefix/etc/sysctl.conf"; my $msecconf = "$::prefix/etc/security/msec/security.conf"; - my $ipv6_disabled = grep { /^options ipv6 disable=1$/ } cat_($modprobe); - my $disable_window_scaling = grep { /^net\.ipv4\.tcp_window_scaling\s*=\s*0$/ } cat_($sysctl); - my $disable_tcp_timestamps = grep { /^net\.ipv4\.tcp_timestamps\s*=\s*0$/ } cat_($sysctl); - my $log_martians = grep { /^net\.ipv4\.conf\.all\.log_martians\s*=\s*1$/ } cat_($sysctl); - my $disable_icmp = grep { /^net\.ipv4\.icmp_echo_ignore_all\s*=\s*1$/ } cat_($sysctl); - my $disable_icmp_broadcasts = grep { /^net\.ipv4\.icmp_echo_ignore_broadcasts\s*=\s*1$/ } cat_($sysctl); - my $disable_bogus_error_responses = grep { /^net\.ipv4\.icmp_ignore_bogus_error_responses\s*=\s*1$/ } cat_($sysctl); - my $msec = grep { /^BASE_LEVEL=/ } cat_($msecconf); + my $ipv6_disabled = find { /^options ipv6 disable=1$/ } cat_($modprobe); + my $disable_window_scaling = find { /^net\.ipv4\.tcp_window_scaling\s*=\s*0$/ } cat_($sysctl); + my $disable_tcp_timestamps = find { /^net\.ipv4\.tcp_timestamps\s*=\s*0$/ } cat_($sysctl); + my $log_martians = find { /^net\.ipv4\.conf\.all\.log_martians\s*=\s*1$/ } cat_($sysctl); + my $disable_icmp = find { /^net\.ipv4\.icmp_echo_ignore_all\s*=\s*1$/ } cat_($sysctl); + my $disable_icmp_broadcasts = find { /^net\.ipv4\.icmp_echo_ignore_broadcasts\s*=\s*1$/ } cat_($sysctl); + my $disable_bogus_error_responses = find { /^net\.ipv4\.icmp_ignore_bogus_error_responses\s*=\s*1$/ } cat_($sysctl); + my $msec = find { /^BASE_LEVEL=/ } cat_($msecconf); { ipv6_disabled => $ipv6_disabled, disable_window_scaling => $disable_window_scaling, disable_tcp_timestamps => $disable_tcp_timestamps, log_martians => $log_martians, disable_icmp => $disable_icmp, disable_icmp_broadcasts => $disable_icmp_broadcasts, disable_bogus_error_responses => $disable_bogus_error_responses, msec => $msec, - } + }; } sub advanced_settings_write { @@ -493,22 +493,22 @@ sub advanced_settings_write { # ipv6 substInFile { /^(options ipv6 .*|install ipv6 .*|alias net-pf-10 off)/ and $_=""; - if (eof and $u->{ipv6_disabled}) { + if (eof && $u->{ipv6_disabled}) { $_ .= "options ipv6 disable=1\n"; } } "$::prefix/etc/modprobe.conf"; # sysctl substInFile { # remove old entries - /^net\.ipv4\.(tcp_window_scaling|tcp_timestamps|conf\.all\.log_martians|icmp_echo_ignore_all|icmp_echo_ignore_broadcasts|icmp_ignore_bogus_error_responses).*/ and $_=""; + /^net\.ipv4\.(tcp_window_scaling|tcp_timestamps|conf\.all\.log_martians|icmp_echo_ignore_all|icmp_echo_ignore_broadcasts|icmp_ignore_bogus_error_responses)/ and $_=""; if (eof) { # add new values - my $window_scaling = ($u->{disable_window_scaling}) ? "0" : "1"; - my $tcp_timestamps = ($u->{disable_tcp_timestamps}) ? "0" : "1"; - my $log_martians = ($u->{log_martians}) ? "1" : "0"; # this is inversed property - my $disable_icmp = ($u->{disable_icmp}) ? "1" : "0"; # this is inversed property - my $disable_icmp_broadcasts = ($u->{disable_icmp_broadcasts}) ? "1" : "0"; # this is inversed property - my $disable_bogus_error_responses = ($u->{disable_bogus_error_responses}) ? "1" : "0"; # this is inversed property + my $window_scaling = $u->{disable_window_scaling} ? "0" : "1"; + my $tcp_timestamps = $u->{disable_tcp_timestamps} ? "0" : "1"; + my $log_martians = $u->{log_martians} ? "1" : "0"; # this is inversed property + my $disable_icmp = $u->{disable_icmp} ? "1" : "0"; # this is inversed property + my $disable_icmp_broadcasts = $u->{disable_icmp_broadcasts} ? "1" : "0"; # this is inversed property + my $disable_bogus_error_responses = $u->{disable_bogus_error_responses} ? "1" : "0"; # this is inversed property $_ .= "net.ipv4.tcp_window_scaling=$window_scaling\n"; $_ .= "net.ipv4.tcp_timestamps=$tcp_timestamps\n"; $_ .= "net.ipv4.conf.all.log_martians=$log_martians\n"; @@ -522,20 +522,19 @@ sub advanced_settings_write { sub advanced_choose { my ($in, $net, $u) = @_; - my $use_http_for_https = $u->{https_proxy} eq $u->{http_proxy}; $in->ask_from(N("Advanced network settings"), N("Here you can configure advanced network settings. Please note that you have to reboot the machine for changes to take effect."), [ { label => N("Wireless regulatory domain"), val => \$net->{network}{CRDA_DOMAIN}, sort => 1, list => \@crda_domains }, - { label => "<b>".N("TCP/IP settings")."</b>"}, + { label => "<b>" . N("TCP/IP settings") . "</b>" }, { text => N("Disable IPv6"), val => \$u->{ipv6_disabled}, type => "bool" }, - { text => N("Disable TCP Window Scaling"), val => \$u->{disable_window_scaling}, type => "bool"}, - { text => N("Disable TCP Timestamps"), val => \$u->{disable_tcp_timestamps}, type => "bool"}, - { label => "<b>".N("Security settings (defined by MSEC policy)")."</b>"}, - { text => N("Disable ICMP echo"), val => \$u->{disable_icmp}, type => "bool", disabled => sub { $u->{msec} }}, - { text => N("Disable ICMP echo for broadcasting messages"), val => \$u->{disable_icmp_broadcasts}, type => "bool", disabled => sub { $u->{msec} }}, - { text => N("Disable invalid ICMP error responses"), val => \$u->{disable_bogus_error_responses}, type => "bool", disabled => sub { $u->{msec} }}, - { text => N("Log strange packets"), val => \$u->{log_martians}, type => "bool", disabled => sub { $u->{msec} }}, + { text => N("Disable TCP Window Scaling"), val => \$u->{disable_window_scaling}, type => "bool" }, + { text => N("Disable TCP Timestamps"), val => \$u->{disable_tcp_timestamps}, type => "bool" }, + { label => "<b>" . N("Security settings (defined by MSEC policy)") . "</b>" }, + { text => N("Disable ICMP echo"), val => \$u->{disable_icmp}, type => "bool", disabled => sub { $u->{msec} } }, + { text => N("Disable ICMP echo for broadcasting messages"), val => \$u->{disable_icmp_broadcasts}, type => "bool", disabled => sub { $u->{msec} } }, + { text => N("Disable invalid ICMP error responses"), val => \$u->{disable_bogus_error_responses}, type => "bool", disabled => sub { $u->{msec} } }, + { text => N("Log strange packets"), val => \$u->{log_martians}, type => "bool", disabled => sub { $u->{msec} } }, ] ) or return; 1; @@ -549,7 +548,7 @@ sub miscellaneous_choose { my $use_http_for_https = $u->{https_proxy} eq $u->{http_proxy}; $in->ask_from(N("Proxies configuration"), - N("Here you can set up your proxies configuration (eg: http://my_caching_server:8080)") . if_($net->{PROFILE} && netprofile_count() > 0, "\n".N("Those settings will be saved for the network profile <b>%s</b>", $net->{PROFILE})), + N("Here you can set up your proxies configuration (eg: http://my_caching_server:8080)") . if_($net->{PROFILE} && netprofile_count() > 0, "\n" . N("Those settings will be saved for the network profile <b>%s</b>", $net->{PROFILE})), [ { label => N("HTTP proxy"), val => \$u->{http_proxy} }, { text => N("Use HTTP proxy for HTTPS connections"), val => \$use_http_for_https, type => "bool" }, { label => N("HTTPS proxy"), val => \$u->{https_proxy}, disabled => sub { $use_http_for_https } }, @@ -719,7 +718,7 @@ sub proxy_configure { proxy_configure_mozilla_firefox($proxy); } -sub detect_crda_domain { +sub detect_crda_domain() { my $crda = { getVarsFromSh($::prefix . $network_file) }->{CRDA_DOMAIN}; if (!$crda) { my $locale = lang::read($>); diff --git a/lib/network/nfs.pm b/lib/network/nfs.pm index 93df7ab..fb716ed 100644 --- a/lib/network/nfs.pm +++ b/lib/network/nfs.pm @@ -3,25 +3,25 @@ package network::nfs; use strict; use common; -sub read_nfs_ports { +sub read_nfs_ports() { my $statd_port = 4001; - my $statd_outgoing_port = undef; + my $statd_outgoing_port; my $lockd_tcp_port = 4002; my $lockd_udp_port = 4002; my $rpc_mountd_port = 4003; my $rpc_rquotad_port = 4004; if (-f "$::prefix/etc/sysconfig/nfs-common") { foreach (cat_("$::prefix/etc/sysconfig/nfs-common")) { - $_ =~ /^STATD_OPTIONS=.*(--port|-p) (\d+).*$/ and $statd_port = $2; - $_ =~ /^STATD_OPTIONS=.*(--outgoing-port|-o) (\d+).*$/ and $statd_outgoing_port = $2; - $_ =~ /^LOCKD_TCPPORT=(\d+)/ and $lockd_tcp_port = $1; - $_ =~ /^LOCKD_UDPPORT=(\d+)/ and $lockd_udp_port = $1; + /^STATD_OPTIONS=.*(--port|-p) (\d+)/ and $statd_port = $2; + /^STATD_OPTIONS=.*(--outgoing-port|-o) (\d+)/ and $statd_outgoing_port = $2; + /^LOCKD_TCPPORT=(\d+)/ and $lockd_tcp_port = $1; + /^LOCKD_UDPPORT=(\d+)/ and $lockd_udp_port = $1; } } if (-f "$::prefix/etc/sysconfig/nfs-server") { foreach (cat_("$::prefix/etc/sysconfig/nfs-server")) { - $_ =~ /^RPCMOUNTD_OPTIONS=.*(--port|-p) (\d+).*$/ and $rpc_mountd_port = $2; - $_ =~ /^RPCRQUOTAD_OPTIONS=.*(--port|-p) (\d+).*$/ and $rpc_rquotad_port = $2; + /^RPCMOUNTD_OPTIONS=.*(--port|-p) (\d+)/ and $rpc_mountd_port = $2; + /^RPCRQUOTAD_OPTIONS=.*(--port|-p) (\d+)/ and $rpc_rquotad_port = $2; } } @@ -37,11 +37,11 @@ sub read_nfs_ports { $ports; } -sub list_nfs_ports { +sub list_nfs_ports() { my $ports = read_nfs_ports(); - my $portlist = $ports->{lockd_tcp_port}. "/tcp " . $ports->{lockd_udp_port} . "/udp"; - if (defined $ports->{statd_outgoing_port} and $ports->{statd_outgoing_port} ne $ports->{statd_port}) { + my $portlist = $ports->{lockd_tcp_port} . "/tcp " . $ports->{lockd_udp_port} . "/udp"; + if (defined $ports->{statd_outgoing_port} && $ports->{statd_outgoing_port} ne $ports->{statd_port}) { $portlist .= " " . $ports->{statd_outgoing_port} . "/tcp " . $ports->{statd_outgoing_port} . "/udp"; } foreach (qw(statd_port rpc_mountd_port rpc_rquotad_port)) { diff --git a/lib/network/shorewall.pm b/lib/network/shorewall.pm index 83442ba..49cf01a 100644 --- a/lib/network/shorewall.pm +++ b/lib/network/shorewall.pm @@ -29,7 +29,7 @@ sub set_config_file { $done = 1; } else { $_ = '' unless - /^#/ or $file eq 'rules' && /^SECTION/; + /^#/ || $file eq 'rules' && /^SECTION/; } } "$::prefix${shorewall_root}/$file"; } @@ -206,7 +206,7 @@ What do you want to do?"), if_($use_pptp, [ 'ACCEPT', 'fw', 'loc:10.0.0.138', 'gre' ]), (map_each { [ 'ACCEPT', 'net', 'fw', $::a, join(',', @$::b), '-' ] } %$ports_by_proto), (map_each { - if_($::b, map { [ 'ACCEPT+', 'fw', 'net', 'tcp', $::a, '-', '-', '-', $_ ] } @{$::b}); + if_($::b, map { [ 'ACCEPT+', 'fw', 'net', 'tcp', $::a, '-', '-', '-', $_ ] } @$::b); } %{$conf->{accept_local_users}}), (map { my $proto = $_; diff --git a/lib/network/vpn/openvpn.pm b/lib/network/vpn/openvpn.pm index 68e1b3f..05f68f3 100644 --- a/lib/network/vpn/openvpn.pm +++ b/lib/network/vpn/openvpn.pm @@ -294,7 +294,7 @@ sub cache_pkcs11_tokens { } } } - foreach $slot_id (keys %{$pkcs11_tokens->{slots}}) { + foreach my $slot_id (keys %{$pkcs11_tokens->{slots}}) { my ($type, $label); my @stdout; #- do rooted_get_stdout manually because pkcs11-tool may exit with non-zero code with proprietary modules run_program::rooted($::prefix, '/usr/bin/pkcs11-tool', '>', \@stdout, '--module', $openvpn_default_pkcs11_provider, '-O', '--slot', $slot_id); |