|
@@ -4242,7 +4242,8 @@ parse_client_transport_line(const char *line, int validate_only)
|
|
|
int is_managed=0;
|
|
|
char **proxy_argv=NULL;
|
|
|
char **tmp=NULL;
|
|
|
- int proxy_argc,i;
|
|
|
+ int proxy_argc, i;
|
|
|
+ int is_useless_proxy=1;
|
|
|
|
|
|
int line_length;
|
|
|
|
|
@@ -4264,11 +4265,16 @@ parse_client_transport_line(const char *line, int validate_only)
|
|
|
smartlist_split_string(transport_list, transports, ",",
|
|
|
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
|
|
|
SMARTLIST_FOREACH_BEGIN(transport_list, const char *, transport_name) {
|
|
|
+ /* validate transport names */
|
|
|
if (!string_is_C_identifier(transport_name)) {
|
|
|
log_warn(LD_CONFIG, "Transport name is not a C identifier (%s).",
|
|
|
transport_name);
|
|
|
goto err;
|
|
|
}
|
|
|
+
|
|
|
+ /* see if we actually need the transports provided by this proxy */
|
|
|
+ if (!validate_only && transport_is_needed(transport_name))
|
|
|
+ is_useless_proxy = 0;
|
|
|
} SMARTLIST_FOREACH_END(transport_name);
|
|
|
|
|
|
/* field2 is either a SOCKS version or "exec" */
|
|
@@ -4287,9 +4293,15 @@ parse_client_transport_line(const char *line, int validate_only)
|
|
|
}
|
|
|
|
|
|
if (is_managed) { /* managed */
|
|
|
- if (!validate_only) { /* if we are not just validating, use the
|
|
|
- rest of the line as the argv of the proxy
|
|
|
- to be launched */
|
|
|
+ if (!validate_only && is_useless_proxy) {
|
|
|
+ log_warn(LD_GENERAL, "Pluggable transport proxy (%s) does not provide "
|
|
|
+ "any needed transports and will not be launched.", line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* If we are not just validating, use the rest of the line as the
|
|
|
+ argv of the proxy to be launched. Also, make sure that we are
|
|
|
+ only launching proxies that contribute useful transports. */
|
|
|
+ if (!validate_only && !is_useless_proxy) {
|
|
|
proxy_argc = line_length-2;
|
|
|
tor_assert(proxy_argc > 0);
|
|
|
proxy_argv = tor_malloc_zero(sizeof(char*)*(proxy_argc+1));
|