aboutsummaryrefslogtreecommitdiff
path: root/security/swatch
diff options
context:
space:
mode:
authorCheng-Lung Sung <clsung@FreeBSD.org>2007-02-22 09:58:40 +0000
committerCheng-Lung Sung <clsung@FreeBSD.org>2007-02-22 09:58:40 +0000
commit2f8e7a283ab64d83c00485885e88289fa3a25cd2 (patch)
tree85dc2b88024c347d0557f8475922b35d94fd414d /security/swatch
parent184cf29de32fe4e7b8301e556cb7644939b365fc (diff)
downloadports-2f8e7a283ab64d83c00485885e88289fa3a25cd2.tar.gz
ports-2f8e7a283ab64d83c00485885e88289fa3a25cd2.zip
Notes
Diffstat (limited to 'security/swatch')
-rw-r--r--security/swatch/files/patch-swatch-2126
1 files changed, 126 insertions, 0 deletions
diff --git a/security/swatch/files/patch-swatch-2 b/security/swatch/files/patch-swatch-2
new file mode 100644
index 000000000000..648d951ca6fa
--- /dev/null
+++ b/security/swatch/files/patch-swatch-2
@@ -0,0 +1,126 @@
+--- swatch.orig 2006-07-21 14:55:00.000000000 -0600
++++ swatch 2006-08-24 17:02:03.000000000 -0600
+@@ -404,12 +404,16 @@
+ \$/ = "$opt_input_record_separator";
+ my \$swatch_flush_interval = 300;
+ my \$swatch_last_flush = time;
++my \$tail_pid = -1;
+
+ use IO::Handle;
+ STDOUT->autoflush(1);
+
+ sub goodbye {
+ \$| = 0;
++ if( \$tail_pid != -1 ) {
++ kill('TERM', \$tail_pid);
++ }
+ ];
+
+ if ($opt_read_pipe) {
+@@ -517,7 +521,8 @@
+ }
+ $code = qq/
+ my \$filename = '$filename';
+-if (not open(TAIL, \"$tail_cmd_name $tail_cmd_args \$filename|\")) {
++\$tail_pid = open(TAIL, \"$tail_cmd_name $tail_cmd_args \$filename|\");
++if (not \$tail_pid) {
+ die "$0: cannot read run \\"$tail_cmd_name $tail_cmd_args \$filename\\": \$!\\n";
+ }
+
+@@ -543,6 +548,7 @@
+ my $code;
+ $code = q[
+ }
++## TODO: Add close !!!
+ ];
+ return $code;
+ }
+--- lib/Swatch/Throttle.pm.orig 2004-07-19 22:14:54.000000000 +0200
++++ lib/Swatch/Throttle.pm 2006-01-02 17:06:14.000000000 +0100
+@@ -95,6 +95,7 @@
+ @_
+ );
+
++ my @delay = split(/:/, "0:$opts{DELAY}");
+ my @dmyhms;
+ my $key;
+ my $cur_rec;
+@@ -134,30 +135,61 @@
+ $rec->{FIRST} = [ @dmyhms ];
+ $rec->{LAST} = [ @dmyhms ];
+ $rec->{HOLD_DHMS} = $opts{HOLD_DHMS} if defined $opts{HOLD_DHMS};
+- $rec->{COUNT} = 1;
++ $rec->{COUNT} = 0;
+ $LogRecords{$key} = $rec;
+- return $msg;
+- } else {
+- $cur_rec = $LogRecords{$key};
+- $cur_rec->{COUNT}++;
+- if (defined $opts{THRESHOLD} and $cur_rec->{COUNT} == $opts{THRESHOLD}) {
+- ## threshold exceeded ##
+- chomp $msg;
+- $msg = "$msg (threshold $opts{THRESHOLD} exceeded)";
+- $cur_rec->{COUNT} = 0;
+- } elsif (defined $opts{HOLD_DHMS}
+- and past_hold_time($cur_rec->{LAST},
+- \@dmyhms, $opts{HOLD_DHMS})) {
++ }
++
++ ## Get current record ##
++ $cur_rec = $LogRecords{$key};
++ $cur_rec->{COUNT}++;
++
++ ## delay only ##
++ if( defined $opts{DELAY} and not defined $opts{THRESHOLD} ) {
++ if( past_hold_time($cur_rec->{LAST}, [ @dmyhms ], [ @delay ]) ) {
+ ## hold time exceeded ##
+ chomp $msg;
+ $msg = "$msg (seen $cur_rec->{COUNT} times)";
+- $cur_rec->{COUNT} = 0;
++ $cur_rec->{COUNT} = 1;
+ $cur_rec->{LAST} = [ @dmyhms ];
+ } else {
+ $msg = '';
+ }
+- $LogRecords{$key} = $cur_rec if exists($LogRecords{$key}); ## save any new values ##
++
++ ## threshold only ##
++ } elsif( defined $opts{THRESHOLD} and not defined $opts{DELAY} ) {
++ if( $cur_rec->{COUNT} == $opts{THRESHOLD}) {
++ ## threshold exceeded ##
++ chomp $msg;
++ $msg = "$msg (threshold $opts{THRESHOLD} exceeded)";
++ $cur_rec->{COUNT} = 0;
++ } else {
++ $msg = '';
++ }
++
++ ## threshold AND delay ##
++ } elsif( defined $opts{THRESHOLD} and defined $opts{DELAY} ) {
++ if( not past_hold_time($cur_rec->{LAST}, [ @dmyhms ], [ @delay ]) ) {
++ if( $cur_rec->{COUNT} == $opts{THRESHOLD} ) {
++ ## threshold exceeded during delay ##
++ chomp $msg;
++ $msg = "$msg (threshold $opts{THRESHOLD} exceeded during delay $opts{DELAY})";
++
++ ## TODO: Tenir compte du parametre repeat ici ##
++ $cur_rec->{COUNT} = 0;
++ $cur_rec->{LAST} = [ @dmyhms ];
++ } else {
++ $msg = '';
++ }
++ } else {
++ $cur_rec->{COUNT} = 1;
++ $cur_rec->{LAST} = [ @dmyhms ];
++ $msg = '';
++ }
+ }
++
++ ## save any new values ##
++ $LogRecords{$key} = $cur_rec if exists($LogRecords{$key});
++
+ return $msg;
+ }
+
+
+