~ubuntu-branches/ubuntu/lucid/logwatch/lucid-201001130053

« back to all changes in this revision

Viewing changes to scripts/services/pop3

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2008-07-05 11:49:54 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080705114954-9naedpe6wrk3k7xt
Tags: 7.3.6.cvs20080702-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Use postfix rather than exim4.
  - Update maintainers according to spec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
##########################################################################
2
 
# $Id: pop3,v 1.5 2005/04/20 17:55:17 bjorn Exp $
 
2
# $Id: pop3,v 1.8 2008/06/30 23:07:51 kirk Exp $
3
3
##########################################################################
4
4
 
5
5
########################################################
6
 
# Logwatch was written and is maintained by:
7
 
#    Kirk Bauer <kirk@kaybee.org>
8
 
#
9
6
# The pop-3 script was written by:
10
7
#    Pawe� Go�aszewski <blues@gda.pl>
11
 
#
12
8
########################################################
13
9
 
 
10
#######################################################
 
11
## Copyright (c) 2008 Pawe� Go�aszewski
 
12
## Covered under the included MIT/X-Consortium License:
 
13
##    http://www.opensource.org/licenses/mit-license.php
 
14
## All modifications and contributions by other persons to
 
15
## this script are assumed to have been donated to the
 
16
## Logwatch project and thus assume the above copyright
 
17
## and licensing terms.  If you want to make contributions
 
18
## under your own copyright or a different license this
 
19
## must be explicitly stated in the contribution an the
 
20
## Logwatch project reserves the right to not accept such
 
21
## contributions.  If you have made significant
 
22
## contributions to this script and want to claim
 
23
## copyright please contact logwatch-devel@logwatch.org.
 
24
#########################################################
 
25
 
14
26
my $Debug = $ENV{'LOGWATCH_DEBUG'};
15
27
my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'};
16
28
 
28
40
   my $IPv4Addr;
29
41
   my $Addr = $_[0];
30
42
   if ( ($IPv4Addr) = ($Addr =~ /::ffff:([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/ ) ) {
31
 
#      print "$IPv4Addr\n";
32
43
      return $IPv4Addr;
33
 
      
34
44
      }
35
45
   else {
36
 
#      print $Addr;
37
46
      return $Addr;
38
 
      
39
47
      }
40
48
}
41
49
   
78
86
   } elsif (
79
87
      (($User, $Host) = ( $ThisLine =~ /^user (.*?) authenticated - (.*)$/ )) or
80
88
      (($User, $Host) = ( $ThisLine =~ /^fork_child: \[\d\].*\((.*)\): began session for `(.*)' with .*; child PID is \d+$/ ))
81
 
      or (($User, $Host) = ( $ThisLine =~ /^LOGIN, user=(.*?), ip=\[(.*)\]$/ ))
 
89
      or (($User, $Host) = ( $ThisLine =~ /^LOGIN, user=([^ ,]+), ip=\[([^ ,]+)\](?:, port=\[\d+\])?$/ ))
82
90
   ) {
83
91
      $Login{$User}{$Host}++;
84
92
   } elsif ( ($User,$Downloaded,$DownloadSize,$Left,$LeftSize) = ( $ThisLine =~ /^Stats: (.*?) (.*?) (.*?) (.*?) (.*?)$/) ) {
103
111
      $Logout{$User}{$Host}++;
104
112
      $Logout2{$User}++;
105
113
      $Connection{$Host}++;
106
 
   } elsif (($dummy, $User, $Host, $DownloadSize1, $DownloadSize2) = ( $ThisLine =~ /^(LOGOUT|TIMEOUT|DISCONNECTED), user=(.*?), ip=\[(.*)\], top=(\d+), retr=(\d+)/o)) {
 
114
   } elsif (($dummy, $User, $Host, $DownloadSize1, $DownloadSize2) = ( $ThisLine =~ /^(LOGOUT|TIMEOUT|DISCONNECTED), user=(.*?), ip=\[([^ ,]+)\](?:, port=\[\d+\])?, top=(\d+), retr=(\d+)/o)) {
107
115
      $DownloadedMessagesSize{$User} += $DownloadSize1 + $DownloadSize2;
108
116
      $Logout{$User}{$Host}++;
109
117
      $Logout2{$User}++;