tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

test_switch_id.sh (1047B)


      1 #!/bin/sh
      2 
      3 if test "$(id -u)" != '0'; then
      4    echo "This test only works when run as root. Skipping." >&2
      5    exit 77
      6 fi
      7 
      8 if test "$(id -u nobody)" = ""; then
      9    echo "This test requires that your system have a 'nobody' user. Sorry." >&2
     10    exit 1
     11 fi
     12 
     13 if test "$OVERRIDE_GCDA_PERMISSIONS_HACK" = "yes"; then
     14  find src -type f -name '*gcda' -print0 | xargs -0 chmod 0666
     15 fi
     16 
     17 "${builddir:-.}/src/test/test-switch-id" nobody setuid          || exit 1
     18 "${builddir:-.}/src/test/test-switch-id" nobody root-bind-low   || exit 1
     19 "${builddir:-.}/src/test/test-switch-id" nobody setuid-strict   || exit 1
     20 "${builddir:-.}/src/test/test-switch-id" nobody built-with-caps || exit 0
     21 # ... Go beyond this point only if we were built with capability support.
     22 
     23 "${builddir:-.}/src/test/test-switch-id" nobody have-caps       || exit 1
     24 "${builddir:-.}/src/test/test-switch-id" nobody setuid-keepcaps || exit 1
     25 
     26 if test "$OVERRIDE_GCDA_PERMISSIONS_HACK" = "yes"; then
     27    find src -type f -name '*gcda' -print0 | xargs -0 chmod 0644
     28 fi
     29 
     30 echo "All okay"
     31 
     32 exit 0