-warn if permissions are insufficient to run test
authorChristian Grothoff <christian@grothoff.org>
Thu, 26 Jan 2012 22:54:59 +0000 (22:54 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 26 Jan 2012 22:54:59 +0000 (22:54 +0000)
src/vpn/test_gnunet_vpn.c

index ea96ce59b5c540c2e39ad6b81c0bf945b3d54709..2ef5f96e96fb9b3981918e25d6136f0d2c689464 100644 (file)
@@ -475,6 +475,18 @@ main (int argc, char *const *argv)
   struct GNUNET_GETOPT_CommandLineOption options[] = {
     GNUNET_GETOPT_OPTION_END
   };
+
+  if ( (GNUNET_YES !=
+       GNUNET_OS_check_helper_binary ("gnunet-helper-vpn")) ||
+       (GNUNET_YES !=
+       GNUNET_OS_check_helper_binary ("gnunet-helper-exit")) )
+  {
+    fprintf (stderr,
+            "WARNING: gnunet-helper-{exit,vpn} binaries in $PATH are not SUID, refusing to run test (as it would have to fail).\n");
+    fprintf (stderr,
+            "Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is problematic) or permissions (run 'make install' as root) to fix this!\n");
+    return 0;
+  }
   bin = argv[0];
   if (NULL != strstr (bin, "lt-"))
     bin = strstr (bin, "lt-") + 4;