~ubuntu-branches/ubuntu/lucid/logwatch/lucid-201002122348

« back to all changes in this revision

Viewing changes to scripts/services/sudo

  • 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: sudo,v 1.11 2006/04/12 23:17:09 bjorn Exp $
 
2
# $Id: sudo,v 1.14 2008/03/24 23:31:27 kirk Exp $
3
3
###########################################################################
4
4
# $Log: sudo,v $
 
5
# Revision 1.14  2008/03/24 23:31:27  kirk
 
6
# added copyright/license notice to each script
 
7
#
 
8
# Revision 1.13  2007/11/25 20:07:49  bjorn
 
9
# Filtering a pam_unix message, by Ivana Varekova.
 
10
#
 
11
# Revision 1.12  2007/09/02 01:36:21  mrc
 
12
#  - Patch to allow dot (.) in user names from Matthew Joyce
 
13
#
5
14
# Revision 1.11  2006/04/12 23:17:09  bjorn
6
15
# Added %OtherList, and handles some errors.
7
16
#
19
28
#       30: Include the TTY on the directory line
20
29
###########################################################################
21
30
 
 
31
#######################################################
 
32
## Copyright (c) 2008 Kirk Bauer
 
33
## Covered under the included MIT/X-Consortium License:
 
34
##    http://www.opensource.org/licenses/mit-license.php
 
35
## All modifications and contributions by other persons to
 
36
## this script are assumed to have been donated to the
 
37
## Logwatch project and thus assume the above copyright
 
38
## and licensing terms.  If you want to make contributions
 
39
## under your own copyright or a different license this
 
40
## must be explicitly stated in the contribution an the
 
41
## Logwatch project reserves the right to not accept such
 
42
## contributions.  If you have made significant
 
43
## contributions to this script and want to claim
 
44
## copyright please contact logwatch-devel@logwatch.org.
 
45
#########################################################
 
46
 
22
47
use strict;
23
48
my %OtherList;
24
49
 
31
56
my ($user, $error, $tty, $dir, $euser, $cmd, $args);
32
57
 
33
58
while (defined(my $ThisLine = <STDIN>)) {
34
 
   if ( ($user, $error, $tty, $dir, $euser, $cmd, $args) = $ThisLine =~ m/^\s*(\w+) : (.*; )?TTY=(\S+) ; PWD=(.*?) ; USER=(\S+) ; COMMAND=(\S+)( ?.*)/) {
 
59
   if ($ThisLine =~ /pam_unix\(sudo:auth\): authentication failure; logname=\S* uid=[0-9]* euid=[0-9]* tty=\S* ruser=\S* rhost=\S*  user=\S*/
 
60
      )
 
61
       # this log is parsed in pam_unix section
 
62
   {    
 
63
     # Ignore
 
64
   } elsif ( ($user, $error, $tty, $dir, $euser, $cmd, $args) = $ThisLine =~ m/^\s*(\S+) : (.*; )?TTY=(\S+) ; PWD=(.*?) ; USER=(\S+) ; COMMAND=(\S+)( ?.*)/) {
35
65
      push @{$byUser{$user}{$euser}}, [$error . $cmd,$args, $dir, $tty];
36
66
      $byUserSum{$user}{$euser}{$cmd} += 1;
37
 
   } elsif ( ($user,$euser) = $ThisLine =~ /^\s*(\w+) : no passwd entry for (\w+)\!$/) {
 
67
   } elsif ( ($user,$euser) = $ThisLine =~ /^\s*(\S+) : no passwd entry for (\S+)\!$/) {
38
68
      push @{$byUser{$user}{$euser . " (No such user)"}}, ["No password entry"];
39
69
   } else {
40
70
   chomp($ThisLine);