aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-25 20:16:08 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-25 20:16:08 +0000
commitf46035b9126e0bfe6521f2f3e7b66fa6e0bc93d3 (patch)
treea099c5d2a8b3704892738898fc610f341cf7278d
parent9935d917ca2a9a34e9c6d1aa744744eaeb6dfd2e (diff)
downloadgnunet-f46035b9126e0bfe6521f2f3e7b66fa6e0bc93d3.tar.gz
gnunet-f46035b9126e0bfe6521f2f3e7b66fa6e0bc93d3.zip
-check for SUID helper
-rw-r--r--src/exit/gnunet-daemon-exit.c16
-rw-r--r--src/exit/gnunet-helper-exit.c3
2 files changed, 17 insertions, 2 deletions
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index dc9991422..86a24ff1c 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -220,6 +220,11 @@ struct TunnelState
220 220
221 221
222/** 222/**
223 * Return value from 'main'.
224 */
225static int global_ret;
226
227/**
223 * The handle to the configuration used throughout the process 228 * The handle to the configuration used throughout the process
224 */ 229 */
225static const struct GNUNET_CONFIGURATION_Handle *cfg; 230static const struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -2970,6 +2975,15 @@ run (void *cls, char *const *args GNUNET_UNUSED,
2970 char *ipv4addr; 2975 char *ipv4addr;
2971 char *ipv4mask; 2976 char *ipv4mask;
2972 2977
2978 if (GNUNET_YES !=
2979 GNUNET_OS_check_helper_binary ("gnunet-helper-exit"))
2980 {
2981 fprintf (stderr,
2982 "`%s' is not SUID, refusing to run.\n",
2983 "gnunet-helper-exit");
2984 global_ret = 1;
2985 return;
2986 }
2973 cfg = cfg_; 2987 cfg = cfg_;
2974 stats = GNUNET_STATISTICS_create ("exit", cfg); 2988 stats = GNUNET_STATISTICS_create ("exit", cfg);
2975 ipv4_exit = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "EXIT_IPV4"); 2989 ipv4_exit = GNUNET_CONFIGURATION_get_value_yesno (cfg, "exit", "EXIT_IPV4");
@@ -3151,7 +3165,7 @@ main (int argc, char *const *argv)
3151 GNUNET_PROGRAM_run (argc, argv, "gnunet-daemon-exit", 3165 GNUNET_PROGRAM_run (argc, argv, "gnunet-daemon-exit",
3152 gettext_noop 3166 gettext_noop
3153 ("Daemon to run to provide an IP exit node for the VPN"), 3167 ("Daemon to run to provide an IP exit node for the VPN"),
3154 options, &run, NULL)) ? 0 : 1; 3168 options, &run, NULL)) ? global_ret : 1;
3155} 3169}
3156 3170
3157 3171
diff --git a/src/exit/gnunet-helper-exit.c b/src/exit/gnunet-helper-exit.c
index 76d14d5bc..db1401e89 100644
--- a/src/exit/gnunet-helper-exit.c
+++ b/src/exit/gnunet-helper-exit.c
@@ -180,7 +180,8 @@ init_tun (char *dev)
180 180
181 if (-1 == ioctl (fd, TUNSETIFF, (void *) &ifr)) 181 if (-1 == ioctl (fd, TUNSETIFF, (void *) &ifr))
182 { 182 {
183 fprintf (stderr, "Error with ioctl on `%s': %s\n", "/dev/net/tun", 183 fprintf (stderr,
184 "Error with ioctl on `%s': %s\n", "/dev/net/tun",
184 strerror (errno)); 185 strerror (errno));
185 (void) close (fd); 186 (void) close (fd);
186 return -1; 187 return -1;