home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / cops_104.zip / cops_104 / cops_filter < prev    next >
Text File  |  1992-03-10  |  2KB  |  70 lines

  1. #
  2. #  cops_filter
  3. #
  4. #  An awk program to help filter out spurious warning messages.  Similar
  5. # to "carp.anlz", but instead of filtering out things on a network
  6. # level (or at least multi-host), as carp does, it filters out individual
  7. # host warnings.  Also, carp.anlz filters post facto and doesn't modify
  8. # the report files; this filters before the report is printed and influences
  9. # the final cops report.  See readme.cops_filter for more information.
  10. #
  11.  
  12. #
  13. #  EXCEPTION LIST:
  14. /Warning!/ {
  15.     # if (warning) print "FIRST:", warning_msg
  16.     if (warning) print warning_msg
  17.     warning = skip_next = 0
  18.  
  19. #
  20. #  You can clump all the warnings together, which can be a pain
  21. # to keep track of matching parens, backslashes, and curly braces
  22. # (especially if you're changing the first or last entry in the long
  23. # if statement...):
  24. #
  25. #    if (($0 ~ /Warning!  \/usr\/spool\/mail is _World_ writable!/) || \
  26. #        ($0 ~ /Warning!  \/etc\/mtab is _World_ writable!/) || \
  27. #        ($0 ~ /Warning!  YPassword/) || \
  28. #        ($0 ~ /Warning!  \/etc\/tmp is _World_ writable!/) || \
  29. #        ($0 ~ /Warning!  \/etc\/utmp is _World_ writable!/) || \
  30. #        ($0 ~ /Warning!  \/usr\/adm\/snm is _World_ writable!/)) {
  31. #        skip_next = 1
  32. #        next
  33. #        }
  34.  
  35. #  Alternately, you can do each one separately:
  36. #
  37. #    if ($0 ~ /Warning!  \/usr\/spool\/mail is _World_ writable!/) {
  38. #        skip_next = 1
  39. #        next
  40. #        }
  41. #    if ($0 ~ /Warning!  \/etc\/sm.* is _World_ writable!/) {
  42. #        skip_next = 1
  43. #        next
  44. #        }
  45. #    if ($0 ~ /Warning! ypadmin should be in \/etc\/ftpusers!/) {
  46. #        skip_next = 1
  47. #        next
  48. #        }
  49.  
  50.     warning = 1
  51.     warning_msg = $0
  52.     }
  53.  
  54. #  this catches the second line of multi line warnings
  55. ! /Warning!/ {
  56.     # if it's the second line, print the first line (caught above)
  57.     if (warning)
  58.         print warning_msg
  59.     warning = 0
  60.  
  61.     # print the second line or just normal lines
  62.     if (!skip_next && $0 !~ /\*\*\*\*/)
  63.         print $0
  64.     }
  65.  
  66. # don't want to blow away verbose information headers
  67. /\*\*\*\*/ {
  68.     print $0
  69.     }
  70.