_("need a valid IPv4 or IPv6 address\n"));
GNUNET_free_non_null (dns_exit);
}
- binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-dns");
+ binary = GNUNET_OS_get_suid_binary_path (cfg, "gnunet-helper-dns");
+
if (GNUNET_YES !=
GNUNET_OS_check_helper_binary (binary,
GNUNET_YES,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No entry 'IFNAME' in configuration!\n");
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
return;
}
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No entry 'IPV6ADDR' in configuration!\n");
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
return;
}
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No entry 'IPV6PREFIX' in configuration!\n");
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
return;
}
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No entry 'IPV4ADDR' in configuration!\n");
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
return;
}
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No entry 'IPV4MASK' in configuration!\n");
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
return;
}
helper_argv[7] = NULL;
hijacker = GNUNET_HELPER_start (GNUNET_NO,
- "gnunet-helper-dns",
+ binary,
helper_argv,
&process_helper_messages,
NULL, NULL);
+ GNUNET_free (binary);
}
&max_connections))
max_connections = 1024;
parse_ip_options ();
+ binary = GNUNET_OS_get_suid_binary_path (cfg, "gnunet-helper-exit");
if ( (ipv4_exit) || (ipv6_exit) )
{
- binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-exit");
if (GNUNET_YES !=
GNUNET_OS_check_helper_binary (binary,
GNUNET_YES,
global_ret = 1;
return;
}
- GNUNET_free (binary);
}
if (! (ipv4_enabled || ipv6_enabled))
{
+ GNUNET_free (binary);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("No useful service enabled. Exiting.\n"));
GNUNET_SCHEDULER_shutdown ();
cadet_handle = GNUNET_CADET_connect (cfg);
if (NULL == cadet_handle)
{
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
return;
}
if (GNUNET_OK !=
setup_exit_helper_args ())
{
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
return;
}
}
}
helper_handle = GNUNET_HELPER_start (GNUNET_NO,
- "gnunet-helper-exit",
+ binary,
exit_argv,
&message_token,
NULL,
NULL);
+ GNUNET_free (binary);
}
sizeof (*s4)));
pos->hc = GN_start_gnunet_nat_server_ (&s4->sin_addr,
&reversal_callback,
- pos);
+ pos,
+ cfg);
}
}
}
GNUNET_break_op (AF_INET == r4.sin_family);
ret = GN_request_connection_reversal (&l4.sin_addr,
ntohs (l4.sin_port),
- &r4.sin_addr);
+ &r4.sin_addr,
+ cfg);
if (GNUNET_OK != ret)
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Connection reversal request failed\n"));
* stdout file handle (for reading) for the gnunet-helper-nat-server process
*/
const struct GNUNET_DISK_FileHandle *server_stdout_handle;
+
+ /**
+ * Handle to the GNUnet configuration
+ */
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
};
ia,
sizeof (ia)));
/* Start the server process */
- binary
- = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-server");
+ binary = GNUNET_OS_get_suid_binary_path (h->cfg, "gnunet-helper-nat-server");
if (GNUNET_YES !=
GNUNET_OS_check_helper_binary (binary,
GNUNET_YES,
* @param internal_address
* @param cb function to call if we receive a request
* @param cb_cls closure for @a cb
+ * @param cfg Handle to the GNUnet configuration
* @return NULL on error
*/
struct HelperContext *
GN_start_gnunet_nat_server_ (const struct in_addr *internal_address,
GN_ReversalCallback cb,
- void *cb_cls)
+ void *cb_cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct HelperContext *h;
h->cb = cb;
h->cb_cls = cb_cls;
h->internal_address = *internal_address;
+ h->cfg = cfg;
restart_nat_server (h);
if (NULL == h->server_stdout)
{
* @param internal_address out internal address to use
* @param internal_port port to use
* @param remote_v4 the address of the peer (IPv4-only)
+ * @param cfg handle to the GNUnet configuration
* @return #GNUNET_SYSERR on error,
* #GNUNET_OK otherwise
*/
int
GN_request_connection_reversal (const struct in_addr *internal_address,
uint16_t internal_port,
- const struct in_addr *remote_v4)
+ const struct in_addr *remote_v4,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
char intv4[INET_ADDRSTRLEN];
char remv4[INET_ADDRSTRLEN];
intv4,
remv4,
internal_port);
- binary
- = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-client");
+ binary = GNUNET_OS_get_suid_binary_path (cfg, "gnunet-helper-nat-client");
proc
= GNUNET_OS_start_process (GNUNET_NO,
0,
* @param internal_address
* @param cb function to call if we receive a request
* @param cb_cls closure for @a cb
+ * @param cfg handle to the GNUnet configuration
* @return NULL on error
*/
struct HelperContext *
GN_start_gnunet_nat_server_ (const struct in_addr *internal_address,
GN_ReversalCallback cb,
- void *cb_cls);
+ void *cb_cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
* @param internal_address out internal address to use
* @param internal_port internal port to use
* @param remote_v4 the address of the peer (IPv4-only)
+ * @param cfg handle to the GNUnet configuration
* @return #GNUNET_SYSERR on error,
* #GNUNET_OK otherwise
*/
int
GN_request_connection_reversal (const struct in_addr *internal_address,
uint16_t internal_port,
- const struct in_addr *sa);
+ const struct in_addr *remote_v4,
+ const struct GNUNET_CONFIGURATION_Handle *cfg);
/* end of gnunet-service-nat_helper.h */
struct in6_addr v6;
char *binary;
- binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-vpn");
+ cfg = cfg_;
+ binary = GNUNET_OS_get_suid_binary_path (cfg, "gnunet-helper-vpn");
if (GNUNET_YES !=
GNUNET_OS_check_helper_binary (binary,
anything either */
return;
}
- GNUNET_free (binary);
- cfg = cfg_;
stats = GNUNET_STATISTICS_create ("vpn", cfg);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg,
GNUNET_CONFIGURATION_get_value_string (cfg, "VPN", "IFNAME", &ifname))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "VPN", "IFNAME");
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
return;
}
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV6ADDR",
_("Must specify valid IPv6 address"));
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
GNUNET_free_non_null (ipv6addr);
return;
&ipv6prefix_s))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV6PREFIX");
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
GNUNET_free_non_null (ipv6prefix_s);
return;
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV4MASK",
_("Must specify valid IPv6 mask"));
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
return;
}
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV4ADDR",
_("Must specify valid IPv4 address"));
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
GNUNET_free_non_null (ipv4addr);
return;
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV4MASK",
_("Must specify valid IPv4 mask"));
+ GNUNET_free (binary);
GNUNET_SCHEDULER_shutdown ();
GNUNET_free_non_null (ipv4mask);
return;
cadet_handle = GNUNET_CADET_connect (cfg_);
// FIXME never opens ports???
helper_handle = GNUNET_HELPER_start (GNUNET_NO,
- "gnunet-helper-vpn", vpn_argv,
- &message_token, NULL, NULL);
+ binary,
+ vpn_argv,
+ &message_token,
+ NULL,
+ NULL);
+ GNUNET_free (binary);
GNUNET_SCHEDULER_add_shutdown (&cleanup,
NULL);
}