gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r19407 - gnunet/src/exit


From: gnunet
Subject: [GNUnet-SVN] r19407 - gnunet/src/exit
Date: Wed, 25 Jan 2012 21:16:08 +0100

Author: grothoff
Date: 2012-01-25 21:16:08 +0100 (Wed, 25 Jan 2012)
New Revision: 19407

Modified:
   gnunet/src/exit/gnunet-daemon-exit.c
   gnunet/src/exit/gnunet-helper-exit.c
Log:
-check for SUID helper

Modified: gnunet/src/exit/gnunet-daemon-exit.c
===================================================================
--- gnunet/src/exit/gnunet-daemon-exit.c        2012-01-25 20:15:58 UTC (rev 
19406)
+++ gnunet/src/exit/gnunet-daemon-exit.c        2012-01-25 20:16:08 UTC (rev 
19407)
@@ -220,6 +220,11 @@
 
 
 /**
+ * Return value from 'main'.
+ */
+static int global_ret;
+
+/**
  * The handle to the configuration used throughout the process
  */
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -2970,6 +2975,15 @@
   char *ipv4addr;
   char *ipv4mask;
 
+  if (GNUNET_YES !=
+      GNUNET_OS_check_helper_binary ("gnunet-helper-exit"))
+  {
+    fprintf (stderr,
+            "`%s' is not SUID, refusing to run.\n",
+            "gnunet-helper-exit");
+    global_ret = 1;
+    return;
+  }
   cfg = cfg_;
   stats = GNUNET_STATISTICS_create ("exit", cfg);
   ipv4_exit = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "EXIT_IPV4");
@@ -3151,7 +3165,7 @@
           GNUNET_PROGRAM_run (argc, argv, "gnunet-daemon-exit",
                               gettext_noop
                               ("Daemon to run to provide an IP exit node for 
the VPN"),
-                              options, &run, NULL)) ? 0 : 1;
+                              options, &run, NULL)) ? global_ret : 1;
 }
 
 

Modified: gnunet/src/exit/gnunet-helper-exit.c
===================================================================
--- gnunet/src/exit/gnunet-helper-exit.c        2012-01-25 20:15:58 UTC (rev 
19406)
+++ gnunet/src/exit/gnunet-helper-exit.c        2012-01-25 20:16:08 UTC (rev 
19407)
@@ -180,7 +180,8 @@
 
   if (-1 == ioctl (fd, TUNSETIFF, (void *) &ifr))
   {
-    fprintf (stderr, "Error with ioctl on `%s': %s\n", "/dev/net/tun",
+    fprintf (stderr, 
+            "Error with ioctl on `%s': %s\n", "/dev/net/tun",
              strerror (errno));
     (void) close (fd);
     return -1;




reply via email to

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