[psad] adjust qw() use to new perl (#771779)

Peter Vrabec pvrabec at fedoraproject.org
Thu Jan 19 12:36:00 UTC 2012


commit e5fb5b0dd69c523671a794d6a73567e19bb2c0b6
Author: Peter Vrabec <pvrabec at redhat.com>
Date:   Thu Jan 19 13:35:28 2012 +0100

    adjust qw() use to new perl (#771779)

 psad-2.1.7-qw.patch |  263 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 263 insertions(+), 0 deletions(-)
---
diff --git a/psad-2.1.7-qw.patch b/psad-2.1.7-qw.patch
new file mode 100644
index 0000000..f9a9210
--- /dev/null
+++ b/psad-2.1.7-qw.patch
@@ -0,0 +1,263 @@
+diff -up psad-2.1.7/deps/IPTables-ChainMgr/lib/IPTables/ChainMgr.pm.qw psad-2.1.7/deps/IPTables-ChainMgr/lib/IPTables/ChainMgr.pm
+--- psad-2.1.7/deps/IPTables-ChainMgr/lib/IPTables/ChainMgr.pm.qw	2012-01-17 14:12:56.037754253 +0100
++++ psad-2.1.7/deps/IPTables-ChainMgr/lib/IPTables/ChainMgr.pm	2012-01-17 14:06:15.000000000 +0100
+@@ -155,7 +155,7 @@ sub append_ip_rule() {
+         if ($extended_href) {
+             $msg = "Table: $table, chain: $chain, $normalized_src -> " .
+                 "$normalized_dst ";
+-            for my $key qw(protocol s_port d_port mac_source) {
++            for my $key (qw(protocol s_port d_port mac_source)) {
+                 $msg .= "$key $extended_href->{$key} "
+                     if defined $extended_href->{$key};
+             }
+@@ -188,7 +188,7 @@ sub append_ip_rule() {
+ 
+         $msg = "Table: $table, chain: $chain, added $normalized_src " .
+             "-> $normalized_dst ";
+-        for my $key qw(protocol s_port d_port mac_source) {
++        for my $key (qw(protocol s_port d_port mac_source)) {
+             $msg .= "$key $extended_href->{$key} "
+                 if defined $extended_href->{$key};
+         }
+@@ -244,7 +244,7 @@ sub add_ip_rule() {
+         if ($extended_href) {
+             $msg = "Table: $table, chain: $chain, $normalized_src -> " .
+                 "$normalized_dst ";
+-            for my $key qw(protocol s_port d_port mac_source) {
++            for my $key (qw(protocol s_port d_port mac_source)) {
+                 $msg .= "$key $extended_href->{$key} "
+                     if defined $extended_href->{$key};
+             }
+@@ -287,7 +287,7 @@ sub add_ip_rule() {
+ 
+         $msg = "Table: $table, chain: $chain, added $normalized_src " .
+             "-> $normalized_dst ";
+-        for my $key qw(protocol s_port d_port mac_source) {
++        for my $key (qw(protocol s_port d_port mac_source)) {
+             $msg .= "$key $extended_href->{$key} "
+                 if defined $extended_href->{$key};
+         }
+@@ -344,7 +344,7 @@ sub delete_ip_rule() {
+ 
+     my $extended_msg = '';
+     if ($extended_href) {
+-        for my $key qw(protocol s_port d_port mac_source) {
++        for my $key (qw(protocol s_port d_port mac_source)) {
+             $extended_msg .= "$key: $extended_href->{$key} "
+                 if defined $extended_href->{$key};
+         }
+@@ -403,13 +403,13 @@ sub find_ip_rule() {
+                 and $rule_href->{'dst'} eq $dst) {
+             if ($extended_href) {
+                 my $found = 1;
+-                for my $key qw(
++                for my $key (qw(
+                     protocol
+                     s_port
+                     d_port
+                     to_ip
+                     to_port
+-                ) {
++                )) {
+                     if (defined $extended_href->{$key}) {
+                         unless ($extended_href->{$key}
+                                 eq $rule_href->{$key}) {
+diff -up psad-2.1.7/deps/IPTables-Parse/lib/IPTables/Parse.pm.qw psad-2.1.7/deps/IPTables-Parse/lib/IPTables/Parse.pm
+--- psad-2.1.7/deps/IPTables-Parse/lib/IPTables/Parse.pm.qw	2012-01-17 14:13:04.069697202 +0100
++++ psad-2.1.7/deps/IPTables-Parse/lib/IPTables/Parse.pm	2012-01-17 14:06:41.000000000 +0100
+@@ -662,7 +662,7 @@ IPTables::Parse - Perl extension for par
+       if (defined $ipt_hr->{'all'}) {
+           print "The INPUT chain has a default DROP rule for all protocols.\n";
+       } else {
+-          for my $proto qw/tcp udp icmp/ {
++          for my $proto (qw/tcp udp icmp/) {
+               if (defined $ipt_hr->{$proto}) {
+                   print "The INPUT chain drops $proto by default.\n";
+               }
+@@ -677,7 +677,7 @@ IPTables::Parse - Perl extension for par
+       if (defined $ipt_hr->{'all'}) {
+           print "The INPUT chain has a default LOG rule for all protocols.\n";
+       } else {
+-          for my $proto qw/tcp udp icmp/ {
++          for my $proto (qw/tcp udp icmp/) {
+               if (defined $ipt_hr->{$proto}) {
+                   print "The INPUT chain logs $proto by default.\n";
+               }
+diff -up psad-2.1.7/fwcheck_psad.pl.qw psad-2.1.7/fwcheck_psad.pl
+--- psad-2.1.7/fwcheck_psad.pl.qw	2012-01-17 14:13:12.060640447 +0100
++++ psad-2.1.7/fwcheck_psad.pl	2012-01-17 14:04:45.000000000 +0100
+@@ -276,7 +276,7 @@ sub ipt_chk_chain() {
+         } else {
+             my $log_protos    = '';
+             my $no_log_protos = '';
+-            for my $proto qw(tcp udp icmp) {
++            for my $proto (qw(tcp udp icmp)) {
+                 if (defined $ipt_log->{$proto}) {
+                     $log_protos .= "$proto/";
+                 } else {
+diff -up psad-2.1.7/install.pl.qw psad-2.1.7/install.pl
+--- psad-2.1.7/install.pl.qw	2012-01-17 14:13:21.829571059 +0100
++++ psad-2.1.7/install.pl	2012-01-17 14:04:24.000000000 +0100
+@@ -509,8 +509,8 @@ sub install() {
+     &perms_ownership($prod_file, 0600);
+ 
+     ### install auto_dl, signatures, icmp_types, posf, and pf.os files
+-    for my $filename qw(signatures icmp_types
+-            posf auto_dl snort_rule_dl pf.os ip_options) {
++    for my $filename (qw(signatures icmp_types
++            posf auto_dl snort_rule_dl pf.os ip_options)) {
+         my $file = $config{$file_vars{$filename}};
+         if (-e $file) {
+             &archive($file) unless $noarchive;
+@@ -530,8 +530,8 @@ sub install() {
+     }
+ 
+     ### archive and remove legacy config files
+-    for my $filename qw(kmsgsd.conf psadwatchd.conf alert.conf
+-            fw_search.conf) {
++    for my $filename (qw(kmsgsd.conf psadwatchd.conf alert.conf
++            fw_search.conf)) {
+         my $path = "$config{'PSAD_CONF_DIR'}/$filename";
+         if (-e $path) {
+             &archive($path);
+diff -up psad-2.1.7/psad.qw psad-2.1.7/psad
+--- psad-2.1.7/psad.qw	2012-01-17 14:13:31.141504921 +0100
++++ psad-2.1.7/psad	2012-01-17 14:03:57.000000000 +0100
+@@ -4261,7 +4261,7 @@ sub assign_danger_level() {
+             }
+ 
+             ### calculate the range over _both_ tcp and udp
+-            for my $proto qw(tcp udp) {
++            for my $proto (qw(tcp udp)) {
+                 next unless defined $scan{$src}{$dst}{$proto};
+                 next unless defined $scan{$src}{$dst}{$proto}{'abs_sp'};
+                 if ($s_port > $scan{$src}{$dst}{$proto}{'abs_sp'}) {
+@@ -4429,7 +4429,7 @@ sub write_src_packet_counters() {
+         die "[*] Could not open $file: $!";
+     for my $chain (keys %$hr) {
+         for my $intf (keys %{$hr->{$chain}}) {
+-            for my $proto qw(tcp udp icmp) {
++            for my $proto (qw(tcp udp icmp)) {
+                 next unless defined $hr->{$chain}->{$intf}->{$proto};
+                 if ($proto eq 'tcp' and $tcp_absrange) {
+                     print P "${chain}_${intf}_${proto}:  ",
+@@ -5103,7 +5103,7 @@ sub scan_logr_signatures() {
+     my @log_sigs = ();
+     my $found_sid = 0;
+ 
+-    for my $proto qw(tcp udp icmp ip) {
++    for my $proto (qw(tcp udp icmp ip)) {
+         next unless defined $scan{$src}{$dst}{$proto};
+         my $href = $scan{$src}{$dst}{$proto};
+ 
+@@ -6612,7 +6612,7 @@ sub stop_psad() {
+     &sys_log('shutting down psad daemons');
+     ### must kill psadwatchd first since if not, it might try to restart
+     ### any of the other two daemons.
+-    for my $pidname qw(psadwatchd kmsgsd psad) {
++    for my $pidname (qw(psadwatchd kmsgsd psad)) {
+         my $pidfile = $pidfiles{$pidname};
+         if (-e $pidfile) {
+             my $pid = &is_running($pidfile);
+@@ -7633,9 +7633,9 @@ sub csv_tokens() {
+                 $search =~ s/^not//;
+             }
+ 
+-            for my $count_type qw/countabs countuniq
++            for my $count_type (qw/countabs countuniq
+                     countday counthouruniq countminuniq countdayuniq
+-                    counthour countmin countday count/ {
++                    counthour countmin countday count/) {
+ 
+                 if ($search =~ /,$count_type$/ or $search =~ /^$count_type/) {
+ 
+@@ -7812,7 +7812,7 @@ sub fw_analyze_mode() {
+ sub status() {
+ 
+     my $rv = 0;   ### assume psad is not running and test...
+-    for my $pidname qw(psadwatchd kmsgsd psad) {
++    for my $pidname (qw(psadwatchd kmsgsd psad)) {
+         my $pidfile = $pidfiles{$pidname};
+         if (-e $pidfile) {
+             my $pid = &is_running($pidfile);
+@@ -7959,7 +7959,7 @@ sub print_scan_status() {
+     my %uniq_dsts = ();
+ 
+     my $printed = 0;
+-    for my $dl qw/5 4 3 2 1/ {
++    for my $dl (qw/5 4 3 2 1/) {
+         SRC: for my $src (sort keys %scan) {
+             next SRC unless $scan_dl{$src} == $dl;
+             my $dl = $scan_dl{$src};
+@@ -7975,7 +7975,7 @@ sub print_scan_status() {
+                 next unless defined $scan{$src}{$dst}{'absnum'};
+                 $tot_pkts += $scan{$src}{$dst}{'absnum'};
+             }
+-            for my $proto qw/tcp udp icmp ip/ {
++            for my $proto (qw/tcp udp icmp ip/) {
+                 for my $dst (keys %{$scan{$src}}) {
+                     next unless defined $scan{$src}{$dst}{$proto}
+                         and defined $scan{$src}{$dst}{$proto}{'sid'};
+@@ -8053,7 +8053,7 @@ sub print_scan_status() {
+                 }
+ 
+                 ### signature matches
+-                for my $proto qw/tcp udp icmp ip/ {
++                for my $proto (qw/tcp udp icmp ip/) {
+                     next unless defined $scan{$src}{$dst}{$proto}
+                         and defined $scan{$src}{$dst}{$proto}{'sid'};
+ 
+@@ -8676,7 +8676,7 @@ sub print_top_attackers() {
+         $pre_sort_dl{$scan_dl{$src}}{$src} = '';
+     }
+ 
+-    for my $dl qw/5 4 3 2 1/ {
++    for my $dl (qw/5 4 3 2 1/) {
+         next unless defined $pre_sort_dl{$dl};
+ 
+         for my $src (sort keys %{$pre_sort_dl{$dl}}) {
+@@ -8770,7 +8770,7 @@ sub usr1_handler() {
+ 
+ sub hup() {
+     my $rv = 0;
+-    for my $pidname qw(psadwatchd psad kmsgsd) {
++    for my $pidname (qw(psadwatchd psad kmsgsd)) {
+         my $pidfile = $pidfiles{$pidname};
+         my $pid = &is_running($pidfile);
+         if ($pid) {
+@@ -8916,22 +8916,22 @@ sub handle_cmdline() {
+ }
+ 
+ sub make_psad_dirs() {
+-    for my $dir qw(
++    for my $dir (qw(
+         /var/lib
+         /var/run
+-    ) {
++    )) {
+         next if -d $dir;
+         mkdir $dir, 0755 or die "[*] Could not mkdir $dir: $!";
+     }
+ 
+-    for my $dir qw(
++    for my $dir (qw(
+         PSAD_DIR
+         PSAD_RUN_DIR
+         PSAD_FIFO_DIR
+         PSAD_CONF_DIR
+         CONF_ARCHIVE_DIR
+         PSAD_ERR_DIR
+-    ) {
++    )) {
+         next if -d $config{$dir};
+         mkdir $config{$dir}, 0500 or
+             die "[*] Could not mkdir $config{$dir}: $!";
+@@ -9282,7 +9282,7 @@ sub disk_space_exceeded() {
+                 "on $config{'HOSTNAME'}!",
+                 '', $config{'EMAIL_ADDRESSES'},
+                 $cmds{'mail'});
+-            for my $pidname qw(psadwatchd kmsgsd) {
++            for my $pidname (qw(psadwatchd kmsgsd)) {
+                 my $pidfile = $pidfiles{$pidname};
+                 my $pid = &is_running($pidfile);
+                 if ($pid) {


More information about the scm-commits mailing list