Print this page
XXX Remove nawk(1)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sendmail/cf/sh/check-permissions.sh
          +++ new/usr/src/cmd/sendmail/cf/sh/check-permissions.sh
↓ open down ↓ 22 lines elided ↑ open up ↑
  23   23  # Check :include: aliases (in files configured in sendmail.cf) and .forward
  24   24  # files to make sure the files and their parent directory paths all have
  25   25  # proper permissions.  And check the master alias file(s) too.
  26   26  #
  27   27  # See http://www.sendmail.org/vendor/sun/migration.html#Security for details.
  28   28  #
  29   29  # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  30   30  # Use is subject to license terms.
  31   31  #
  32   32  # %W% (Sun) %G%
  33      -# ident "%Z%%M% %I%     %E% SMI"
  34   33  
  35   34  PATH=/bin
  36   35  
  37   36  # Check the group- and world-writable bits on the given file.
  38   37  
  39   38  analyze() {
  40   39          case "`ls -Lldn $1`" in
  41   40                  ?????w??w?*) 
  42   41                          echo $2: $1 is group and world writable
  43   42                          bogus_dirs=true ;;
↓ open down ↓ 52 lines elided ↑ open up ↑
  96   95          sed 's/,.*$//'`
  97   96  do
  98   97          break_down $i
  99   98  done
 100   99  
 101  100  # Check .forward files as well.  If the argument "ALL" is given, do it for
 102  101  # everyone.  If no argument to the script is given, just do it for the current
 103  102  # user.  O/w, do it for all arguments.
 104  103  
 105  104  if [ $# -eq 0 ] ; then
 106      -        arg=`id | nawk -F'(' '{n = split($2,id,")"); print id[1]}'`
      105 +        arg=`id | /usr/xpg4/bin/awk -F'(' '{n = split($2,id,")"); print id[1]}'`
 107  106  elif [ $1 = "ALL" ] ; then
 108  107          arg=""
 109  108  else
 110  109          arg="$*"
 111  110  fi
 112  111  
 113      -for i in `getent passwd $arg | nawk -F: '{print $6}'`
      112 +for i in `getent passwd $arg | /usr/xpg4/bin/awk -F: '{print $6}'`
 114  113  do
 115  114          if [ -f $i/.forward ] ; then
 116  115                  break_down $i/.forward
 117  116          fi
 118  117  done
 119  118  
 120  119  $bogus_dirs || echo "No unsafe directories found."
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX