diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-11-01 16:31:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-11-01 16:31:23 +0000 |
commit | 1181d4edb8477bda88f106cb35e1ff18dfd7b5a8 (patch) | |
tree | cb944bfa8f01f9471d073530665ab85a3d041d3c /src/nat/nat.c | |
parent | f39b967ceb31232e42b4d98e97ce90e63a1f0946 (diff) | |
download | gnunet-1181d4edb8477bda88f106cb35e1ff18dfd7b5a8.tar.gz gnunet-1181d4edb8477bda88f106cb35e1ff18dfd7b5a8.zip |
-more libexec fixes
Diffstat (limited to 'src/nat/nat.c')
-rw-r--r-- | src/nat/nat.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/nat/nat.c b/src/nat/nat.c index 2379960bb..dd63224c0 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c | |||
@@ -821,6 +821,8 @@ nat_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
821 | static void | 821 | static void |
822 | start_gnunet_nat_server (struct GNUNET_NAT_Handle *h) | 822 | start_gnunet_nat_server (struct GNUNET_NAT_Handle *h) |
823 | { | 823 | { |
824 | char *binary; | ||
825 | |||
824 | if ((h->behind_nat == GNUNET_YES) && (h->enable_nat_server == GNUNET_YES) && | 826 | if ((h->behind_nat == GNUNET_YES) && (h->enable_nat_server == GNUNET_YES) && |
825 | (h->internal_address != NULL) && | 827 | (h->internal_address != NULL) && |
826 | (NULL != | 828 | (NULL != |
@@ -830,11 +832,13 @@ start_gnunet_nat_server (struct GNUNET_NAT_Handle *h) | |||
830 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting `%s' at `%s'\n", | 832 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting `%s' at `%s'\n", |
831 | "gnunet-helper-nat-server", h->internal_address); | 833 | "gnunet-helper-nat-server", h->internal_address); |
832 | /* Start the server process */ | 834 | /* Start the server process */ |
835 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-server"); | ||
833 | h->server_proc = | 836 | h->server_proc = |
834 | GNUNET_OS_start_process (GNUNET_NO, 0, NULL, h->server_stdout, | 837 | GNUNET_OS_start_process (GNUNET_NO, 0, NULL, h->server_stdout, |
835 | "gnunet-helper-nat-server", | 838 | binary, |
836 | "gnunet-helper-nat-server", | 839 | "gnunet-helper-nat-server", |
837 | h->internal_address, NULL); | 840 | h->internal_address, NULL); |
841 | GNUNET_free (binary); | ||
838 | if (h->server_proc == NULL) | 842 | if (h->server_proc == NULL) |
839 | { | 843 | { |
840 | LOG (GNUNET_ERROR_TYPE_WARNING, "nat", _("Failed to start %s\n"), | 844 | LOG (GNUNET_ERROR_TYPE_WARNING, "nat", _("Failed to start %s\n"), |
@@ -1066,6 +1070,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, int is_tcp, | |||
1066 | struct GNUNET_NAT_Handle *h; | 1070 | struct GNUNET_NAT_Handle *h; |
1067 | struct in_addr in_addr; | 1071 | struct in_addr in_addr; |
1068 | unsigned int i; | 1072 | unsigned int i; |
1073 | char *binary; | ||
1069 | 1074 | ||
1070 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1075 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1071 | "Registered with NAT service at port %u with %u IP bound local addresses\n", | 1076 | "Registered with NAT service at port %u with %u IP bound local addresses\n", |
@@ -1163,9 +1168,10 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, int is_tcp, | |||
1163 | } | 1168 | } |
1164 | 1169 | ||
1165 | /* Test for SUID binaries */ | 1170 | /* Test for SUID binaries */ |
1171 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-server"); | ||
1166 | if ((h->behind_nat == GNUNET_YES) && (GNUNET_YES == h->enable_nat_server) && | 1172 | if ((h->behind_nat == GNUNET_YES) && (GNUNET_YES == h->enable_nat_server) && |
1167 | (GNUNET_YES != | 1173 | (GNUNET_YES != |
1168 | GNUNET_OS_check_helper_binary ("gnunet-helper-nat-server"))) | 1174 | GNUNET_OS_check_helper_binary (binary))) |
1169 | { | 1175 | { |
1170 | h->enable_nat_server = GNUNET_NO; | 1176 | h->enable_nat_server = GNUNET_NO; |
1171 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1177 | LOG (GNUNET_ERROR_TYPE_WARNING, |
@@ -1173,9 +1179,11 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, int is_tcp, | |||
1173 | ("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"), | 1179 | ("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"), |
1174 | "gnunet-helper-nat-server"); | 1180 | "gnunet-helper-nat-server"); |
1175 | } | 1181 | } |
1182 | GNUNET_free (binary); | ||
1183 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-client"); | ||
1176 | if ((GNUNET_YES == h->enable_nat_client) && | 1184 | if ((GNUNET_YES == h->enable_nat_client) && |
1177 | (GNUNET_YES != | 1185 | (GNUNET_YES != |
1178 | GNUNET_OS_check_helper_binary ("gnunet-helper-nat-client"))) | 1186 | GNUNET_OS_check_helper_binary (binary))) |
1179 | { | 1187 | { |
1180 | h->enable_nat_client = GNUNET_NO; | 1188 | h->enable_nat_client = GNUNET_NO; |
1181 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1189 | LOG (GNUNET_ERROR_TYPE_WARNING, |
@@ -1183,7 +1191,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, int is_tcp, | |||
1183 | ("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"), | 1191 | ("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"), |
1184 | "gnunet-helper-nat-client"); | 1192 | "gnunet-helper-nat-client"); |
1185 | } | 1193 | } |
1186 | 1194 | GNUNET_free (binary); | |
1187 | start_gnunet_nat_server (h); | 1195 | start_gnunet_nat_server (h); |
1188 | 1196 | ||
1189 | /* FIXME: add support for UPnP, etc */ | 1197 | /* FIXME: add support for UPnP, etc */ |
@@ -1306,6 +1314,7 @@ GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h, | |||
1306 | char inet4[INET_ADDRSTRLEN]; | 1314 | char inet4[INET_ADDRSTRLEN]; |
1307 | char port_as_string[6]; | 1315 | char port_as_string[6]; |
1308 | struct GNUNET_OS_Process *proc; | 1316 | struct GNUNET_OS_Process *proc; |
1317 | char *binary; | ||
1309 | 1318 | ||
1310 | if (GNUNET_YES != h->enable_nat_client) | 1319 | if (GNUNET_YES != h->enable_nat_client) |
1311 | return GNUNET_NO; /* not permitted / possible */ | 1320 | return GNUNET_NO; /* not permitted / possible */ |
@@ -1327,11 +1336,13 @@ GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h, | |||
1327 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1336 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1328 | _("Running gnunet-helper-nat-client %s %s %u\n"), h->internal_address, | 1337 | _("Running gnunet-helper-nat-client %s %s %u\n"), h->internal_address, |
1329 | inet4, (unsigned int) h->adv_port); | 1338 | inet4, (unsigned int) h->adv_port); |
1339 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-client"); | ||
1330 | proc = | 1340 | proc = |
1331 | GNUNET_OS_start_process (GNUNET_NO, 0, NULL, NULL, | 1341 | GNUNET_OS_start_process (GNUNET_NO, 0, NULL, NULL, |
1332 | "gnunet-helper-nat-client", | 1342 | binary, |
1333 | "gnunet-helper-nat-client", h->internal_address, | 1343 | "gnunet-helper-nat-client", h->internal_address, |
1334 | inet4, port_as_string, NULL); | 1344 | inet4, port_as_string, NULL); |
1345 | GNUNET_free (binary); | ||
1335 | if (NULL == proc) | 1346 | if (NULL == proc) |
1336 | return GNUNET_SYSERR; | 1347 | return GNUNET_SYSERR; |
1337 | /* we know that the gnunet-helper-nat-client will terminate virtually | 1348 | /* we know that the gnunet-helper-nat-client will terminate virtually |