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 / docs / readme.C2 / passwd.chk < prev    next >
Text File  |  1992-03-10  |  2KB  |  85 lines

  1. #!/bin/sh
  2. #
  3. #   passwd.chk
  4. #
  5. #  Check passsword file -- /etc/passswd -- for incorrect number of fields,
  6. # duplicate uid's, non-alphanumeric uids, and non-numeric group id's.
  7. #
  8. #
  9. ECHO=/bin/echo
  10. RM=/bin/rm
  11. TEST=/bin/test
  12. YPCAT=/usr/bin/ypcat
  13.  
  14. #
  15. # Enhanced Security Features added by Pete Troxell:
  16. #
  17. #   Used for Sun C2 security password adjunct file.  FALSE (default) will flag
  18. # valid SUN C2 passwd syntax as an error, TRUE attempts to validate it. When 
  19. # using this option, the script must be executed as root or su since the file
  20. # /etc/security/passwd.adjunct is read protected from everybody except root.
  21. #
  22. SUN_SECURITY=FALSE
  23.  
  24. #
  25. # Enable/Disable testing of the Yellow Pages password file(s)
  26. #
  27. TEST_YP=FALSE
  28.  
  29. #
  30. # Important files:
  31. #
  32. etc_passwd=/etc/passwd
  33. etc_secure_passwd=/etc/security/passwd.adjunct
  34. yp_passwd=./pwd$$
  35. yp_secure_passwd=./spwd$$
  36.  
  37. yp=false
  38. yp_secure=false
  39.  
  40. #
  41. # Testing $yp_passwd for potential problems....
  42. #
  43. if $TEST -f $YPCAT -a $TEST_YP = "TRUE"
  44.     then
  45. if $TEST -s $YPCAT
  46.     then
  47.     $YPCAT passwd > $yp_passwd 2>/dev/null
  48.     if $TEST $? -eq 0
  49.         then
  50.         yp=true
  51.     fi
  52.     if $TEST $yp = "true" -a $SUN_SECURITY = "TRUE"
  53.         then
  54.         $YPCAT -t passwd.adjunct.byname > $yp_secure_passwd 2>/dev/null
  55.         if $TEST $? -eq 0
  56.             then
  57.             yp_secure=true
  58.         fi
  59.     fi
  60. fi
  61. fi
  62.  
  63. #
  64. # Test the system password file
  65. #
  66. passwd.file.chk $etc_passwd $etc_secure_passwd $SUN_SECURITY
  67.  
  68. #
  69. # Test yellow pages password file
  70. #
  71. if $TEST "$yp" = "true"
  72.     then
  73.     $ECHO
  74.     $ECHO "***** Testing the Yellow Pages password file(s) *****"
  75.     $ECHO
  76.     passwd.file.chk $yp_passwd $yp_secure_passwd $SUN_SECURITY
  77.     fi
  78.  
  79. #
  80. # Clean up after ourselfs
  81. #
  82. $RM -f $yp_passwd
  83. $RM -f $yp_secure_passwd
  84. # end
  85.