[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/release-0.4.5] config: Catch missing Bridge for ClientTransportPlugin



commit ee6ad0e592c9b6239066697ae8aff83136edc2ed
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date:   Tue Dec 8 10:01:23 2020 -0500

    config: Catch missing Bridge for ClientTransportPlugin
    
    When making sure we have a Bridge line with a ClientTransportPlugin, we
    now check in the managed proxy list and so we can catch any missing
    ClientTransportPlugin for a Bridge line.
    
    Fixes #40106
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxxxxxxx>
---
 changes/ticket40106             |  5 +++++
 src/app/config/config.c         |  3 ++-
 src/feature/client/transports.c | 22 ++++++++++++++++++++++
 src/feature/client/transports.h |  1 +
 4 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/changes/ticket40106 b/changes/ticket40106
new file mode 100644
index 0000000000..d007cf535e
--- /dev/null
+++ b/changes/ticket40106
@@ -0,0 +1,5 @@
+  o Minor bugfixes (config, bridge):
+    - Really fix the case where torrc has a missing ClientTransportPlugin but
+      configured with a Bridge line and UseBridges. Previously, we failed to
+      also look at the managed proxy list and thus it would fail for the
+      "exec" case. Fixes bug 40106; bugfix on 0.4.5.1-alpha.
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 79b67e7a90..d8bc5f6025 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -2198,7 +2198,8 @@ options_act,(const or_options_t *old_options))
    * validation time. */
   SMARTLIST_FOREACH_BEGIN(bridge_list_get(), const bridge_info_t *, bi) {
     const char *bi_transport_name = bridget_get_transport_name(bi);
-    if (bi_transport_name && !transport_get_by_name(bi_transport_name)) {
+    if (bi_transport_name && (!transport_get_by_name(bi_transport_name) &&
+                          !managed_proxy_has_transport(bi_transport_name))) {
       log_warn(LD_CONFIG, "Bridge line with transport %s is missing a "
                           "ClientTransportPlugin line", bi_transport_name);
       return -1;
diff --git a/src/feature/client/transports.c b/src/feature/client/transports.c
index d1c807189a..4b05d55494 100644
--- a/src/feature/client/transports.c
+++ b/src/feature/client/transports.c
@@ -368,6 +368,28 @@ static int unconfigured_proxies_n = 0;
 /** Boolean: True iff we might need to restart some proxies. */
 static int check_if_restarts_needed = 0;
 
+/** Return true iff we have a managed_proxy_t in the global list is for the
+ * given transport name. */
+bool
+managed_proxy_has_transport(const char *transport_name)
+{
+  tor_assert(transport_name);
+
+  if (!managed_proxy_list) {
+    return false;
+  }
+
+  SMARTLIST_FOREACH_BEGIN(managed_proxy_list, const managed_proxy_t *, mp) {
+    SMARTLIST_FOREACH_BEGIN(mp->transports_to_launch, const char *, name) {
+      if (!strcasecmp(name, transport_name)) {
+        return true;
+      }
+    } SMARTLIST_FOREACH_END(name);
+  } SMARTLIST_FOREACH_END(mp);
+
+  return false;
+}
+
 /** Return true if there are still unconfigured managed proxies, or proxies
  * that need restarting. */
 int
diff --git a/src/feature/client/transports.h b/src/feature/client/transports.h
index 3aff1cb248..47b118e77b 100644
--- a/src/feature/client/transports.h
+++ b/src/feature/client/transports.h
@@ -41,6 +41,7 @@ void transport_free_(transport_t *transport);
 #define transport_free(tr) FREE_AND_NULL(transport_t, transport_free_, (tr))
 
 MOCK_DECL(transport_t*, transport_get_by_name, (const char *name));
+bool managed_proxy_has_transport(const char *transport_name);
 
 MOCK_DECL(void, pt_kickstart_proxy,
           (const smartlist_t *transport_list, char **proxy_argv,



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits