smack_set_direct.sh 1012 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. #
  3. # Copyright (c) 2009 Casey Schaufler under the terms of the
  4. # GNU General Public License version 2, as published by the
  5. # Free Software Foundation
  6. #
  7. # Test setting of the CIPSO direct level
  8. #
  9. # Environment:
  10. # CAP_MAC_ADMIN
  11. #
  12. export TCID=smack_set_direct
  13. export TST_TOTAL=1
  14. . test.sh
  15. . smack_common.sh
  16. not_start_value="17"
  17. start_value=$(cat "$smackfsdir/direct" 2>/dev/null)
  18. echo "$not_start_value" 2>/dev/null > "$smackfsdir/direct"
  19. direct_value=$(cat "$smackfsdir/direct" 2>/dev/null)
  20. if [ "$direct_value" != "$not_start_value" ]; then
  21. tst_brkm TFAIL "The CIPSO direct level reported is \"$direct_value\"," \
  22. "not the expected \"$not_start_value\"."
  23. fi
  24. echo "$start_value" 2>/dev/null> "$smackfsdir/direct"
  25. direct_value=$(cat "$smackfsdir/direct" 2>/dev/null)
  26. if [ "$direct_value" != "$start_value" ]; then
  27. tst_brkm TFAIL "The CIPSO direct level reported is \"$direct_value\"," \
  28. "not the expected \"$start_value\"."
  29. fi
  30. tst_resm TPASS "Test \"$TCID\" success."
  31. tst_exit