gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r19406 - gnunet/src/vpn


From: gnunet
Subject: [GNUnet-SVN] r19406 - gnunet/src/vpn
Date: Wed, 25 Jan 2012 21:15:58 +0100

Author: grothoff
Date: 2012-01-25 21:15:58 +0100 (Wed, 25 Jan 2012)
New Revision: 19406

Modified:
   gnunet/src/vpn/gnunet-helper-vpn.c
   gnunet/src/vpn/gnunet-service-vpn.c
   gnunet/src/vpn/test_gnunet_vpn.c
Log:
-terminate test after a while, check for SUID helper

Modified: gnunet/src/vpn/gnunet-helper-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-helper-vpn.c  2012-01-25 20:05:32 UTC (rev 19405)
+++ gnunet/src/vpn/gnunet-helper-vpn.c  2012-01-25 20:15:58 UTC (rev 19406)
@@ -45,6 +45,12 @@
 #include "gnunet_protocols.h"
 
 /**
+ * Should we print (interesting|debug) messages that can happen during
+ * normal operation?
+ */
+#define DEBUG GNUNET_NO
+
+/**
  * Maximum size of a GNUnet message (GNUNET_SERVER_MAX_MESSAGE_SIZE)
  */
 #define MAX_SIZE 65536
@@ -420,7 +426,10 @@
 
         if (-1 == written)
         {
-          fprintf (stderr, "write-error to stdout: %s\n", strerror (errno));
+#if !DEBUG
+         if (errno != EPIPE)
+#endif
+           fprintf (stderr, "write-error to stdout: %s\n", strerror (errno));
           shutdown (fd_tun, SHUT_RD);
           shutdown (1, SHUT_WR);
           read_open = 0;
@@ -451,7 +460,9 @@
         }
         else if (0 == bufin_size)
         {
+#if DEBUG
           fprintf (stderr, "EOF on stdin\n");
+#endif
           shutdown (0, SHUT_RD);
           shutdown (fd_tun, SHUT_WR);
           write_open = 0;

Modified: gnunet/src/vpn/gnunet-service-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-service-vpn.c 2012-01-25 20:05:32 UTC (rev 19405)
+++ gnunet/src/vpn/gnunet-service-vpn.c 2012-01-25 20:15:58 UTC (rev 19406)
@@ -285,6 +285,11 @@
 
 
 /**
+ * Return value from 'main'.
+ */
+static int global_ret;
+
+/**
  * Configuration we use.
  */
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -3002,6 +3007,15 @@
   struct in_addr v4;
   struct in6_addr v6;
 
+  if (GNUNET_YES !=
+      GNUNET_OS_check_helper_binary ("gnunet-helper-vpn"))
+  {
+    fprintf (stderr,
+            "`%s' is not SUID, refusing to run.\n",
+            "gnunet-helper-vpn");
+    global_ret = 1;
+    return;
+  }
   cfg = cfg_;
   stats = GNUNET_STATISTICS_create ("vpn", cfg);
   if (GNUNET_OK !=
@@ -3112,7 +3126,7 @@
   return (GNUNET_OK ==
           GNUNET_SERVICE_run (argc, argv, "vpn", 
                              GNUNET_SERVICE_OPTION_NONE,
-                              &run, NULL)) ? 0 : 1;
+                              &run, NULL)) ? global_ret : 1;
 }
 
 /* end of gnunet-service-vpn.c */

Modified: gnunet/src/vpn/test_gnunet_vpn.c
===================================================================
--- gnunet/src/vpn/test_gnunet_vpn.c    2012-01-25 20:05:32 UTC (rev 19405)
+++ gnunet/src/vpn/test_gnunet_vpn.c    2012-01-25 20:15:58 UTC (rev 19406)
@@ -35,6 +35,8 @@
 
 #define VERBOSE GNUNET_NO
 
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 45)
+
 struct PeerContext
 {
   struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -387,7 +389,7 @@
                                  GNUNET_YES,
                                  GNUNET_TIME_UNIT_FOREVER_ABS,
                                  &allocation_cb, NULL);
-  ctrl_c_task_id = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
+  ctrl_c_task_id = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
                                                 &ctrl_c_shutdown,
                                                 NULL);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]