#!/usr/bin/perl -w
##########################################################################
# $Id: modprobe,v 1.5 2002/03/28 05:00:00 kirk Exp $
##########################################################################
# $Log: modprobe,v $
# Revision 1.5  2002/03/28 05:00:00  kirk
# - Implemented several bug fixes and patches that have been sent in
# - Fixed a possible root exploit using a race condition in /tmp
# - Fixed bugs 46371, 56191, 58578, 61202, 61829, 61831, 61832 from bugzilla.redhat.com
#
# Revision 1.4  2000/09/22 14:47:04  kirk
# *** empty log message ***
#
# Revision 1.3  1998/02/23 01:16:57  kirk
# Getting ready for a first distribution
#
# Revision 1.2  1998/02/23 00:53:43  kirk
# Finished init and modprobe, and added mountd
#
# Revision 1.1  1998/02/22 03:07:53  kirk
# Re-organization
#
# Revision 1.2  1998/02/12 06:07:17  kirk
# Fixed a few things...
#
# Revision 1.1  1998/02/12 03:54:27  kirk
# Started modprobe filter...
#
##########################################################################

########################################################
# This was written and is maintained by:
#    Kirk Bauer <kirk@kaybee.org>
#
# Please send all comments, suggestions, bug reports,
#    etc, to kirk@kaybee.org.
#
########################################################

#$Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'};

while (defined($ThisLine = <STDIN>)) {
   chomp($ThisLine);
   if ( $ThisLine =~ s/^modprobe: Can\'t locate module ([\w-]+)\s*$/$1/ ) {
      $Modules{$ThisLine}++;
   }
   else {
      $OtherList{$ThisLine}++;
   }
}

if ( ($#OtherList >= 0) or (keys(%Modules)) ) {

   print "\n\n --------------------- ModProbe Begin ------------------------ \n";

   print "\nCan't locate these modules:\n";
   foreach $ThisOne (keys %Modules) {
      print "   " . $ThisOne . ": " . $Modules{$ThisOne} . " Time(s)\n";
   }
   if (keys %OtherList) {
      print "\n**Unmatched Entries**\n";
      foreach $line (sort {$a cmp $b} keys %OtherList) {
         print "$line: $OtherList{$line} Time(s)\n";
      }
   }

   print "\n\n ---------------------- ModProbe End ------------------------- \n\n";

}

exit(0);



