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

[tor-commits] [tor/master] Changed a couple of 180 spec stuff according to #3578.



commit 684aca7faffea93a8e3dcb2a582aa10797f71e7d
Author: George Kadianakis <desnacked@xxxxxxxxx>
Date:   Thu Jul 14 01:03:35 2011 +0200

    Changed a couple of 180 spec stuff according to #3578.
    
    * Restored "proxy" in external ServerTransportPlugin lines.
    * Changed the extended OR port and ORPort env. vars to addr:port.
---
 src/or/circuitbuild.c         |    2 +-
 src/or/config.c               |  108 ++++++++++++++++++++---------------------
 src/or/pluggable_transports.c |    4 +-
 3 files changed, 56 insertions(+), 58 deletions(-)

diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index f9b5c38..003f579 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -4610,7 +4610,7 @@ transport_get_by_name(const char *name)
 
   if (!transport_list)
     return NULL;
-
+  
   SMARTLIST_FOREACH_BEGIN(transport_list, const transport_t *, transport) {
     if (!strcmp(transport->name, name))
       return transport;
diff --git a/src/or/config.c b/src/or/config.c
index 111b28b..5f2f11d 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1224,7 +1224,6 @@ options_act(or_options_t *old_options)
     }
   }
 
-  clear_transport_list();
   if (options->ServerTransportPlugin) {
     for (cl = options->ServerTransportPlugin; cl; cl = cl->next) {
       if (parse_server_transport_line(cl->value, 0)<0) {
@@ -4732,26 +4731,10 @@ parse_client_transport_line(const char *line, int validate_only)
     goto err;
   }
 
-  if (!is_managed) {
-    addrport = smartlist_get(items, 0);
-    smartlist_del_keeporder(items, 0);
-
-    if (tor_addr_port_parse(addrport, &addr, &port)<0) {
-      log_warn(LD_CONFIG, "Error parsing transport "
-               "address '%s'", addrport);
-      goto err;
-    }
-    if (!port) {
-      log_warn(LD_CONFIG,
-               "Transport address '%s' has no port.", addrport);
-      goto err;
-    }
-  }
-
-  if (!validate_only) {
-    if (is_managed) { /* if it's managed, and we are planning on
-                         launching the proxy, use the rest of the line
-                         as the argv. */
+  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 */
       char **tmp;
       char *tmp_arg;
       proxy_argv = tor_malloc_zero(sizeof(char*)*(smartlist_len(items)+1));
@@ -4769,12 +4752,29 @@ parse_client_transport_line(const char *line, int validate_only)
                  proxy_argv[0]);
         goto err;
       }
-    } else { /* external */
+    }
+  } else { /* external */
+    addrport = smartlist_get(items, 0);
+    smartlist_del_keeporder(items, 0);
+
+    if (tor_addr_port_parse(addrport, &addr, &port)<0) {
+      log_warn(LD_CONFIG, "Error parsing transport "
+               "address '%s'", addrport);
+      goto err;
+    }
+    if (!port) {
+      log_warn(LD_CONFIG,
+               "Transport address '%s' has no port.", addrport);
+      goto err;
+    }
+
+    if (!validate_only) {
       if (transport_add_from_config(&addr, port, name,
                                     socks_ver) < 0) {
         goto err;
       }
-      log_debug(LD_DIR, "Transport %s found at %s:%d", name,
+
+      log_debug(LD_DIR, "Transport '%s' found at %s:%d", name,
                 fmt_addr(&addr), (int)port);
     }
   }
@@ -4805,7 +4805,7 @@ parse_server_transport_line(const char *line, int validate_only)
   smartlist_t *items = NULL;
   int r;
   char *name=NULL;
-  char *field2=NULL;
+  char *type=NULL;
   char *addrport=NULL;
   tor_addr_t addr;
   uint16_t port = 0;
@@ -4826,38 +4826,20 @@ parse_server_transport_line(const char *line, int validate_only)
   name = smartlist_get(items, 0);
   smartlist_del_keeporder(items, 0);
 
-  /* field2 is either <addr:port> or "exec" */
-  field2 = smartlist_get(items, 0);
+  type = smartlist_get(items, 0);
   smartlist_del_keeporder(items, 0);
 
-  if (!(strstr(field2, ".") || strstr(field2, ":"))) { /* managed proxy */
-    if (strcmp(field2, "exec")) {
-      log_warn(LD_CONFIG, "Unrecognizable field '%s' in "
-               "ServerTransportPlugin line", field2);
-      goto err;
-    }
+  if (!strcmp(type, "exec")) {
     is_managed=1;
+  } else if (!strcmp(type, "proxy")) {
+    is_managed=0;
+  } else {
+    log_warn(LD_CONFIG, "Strange ServerTransportPlugin type '%s'", type);
+    goto err;
   }
 
-  if (!is_managed) {
-    addrport = field2;
-
-    if (tor_addr_port_parse(addrport, &addr, &port)<0) {
-      log_warn(LD_CONFIG, "Error parsing transport "
-               "address '%s'", addrport);
-      goto err;
-    }
-    if (!port) {
-      log_warn(LD_CONFIG,
-               "Transport address '%s' has no port.", addrport);
-      goto err;
-    }
-  }
-
-  if (!validate_only) {
-    if (is_managed) { /* if it's managed, and we are planning on
-                         launching the proxy, use the rest of the line
-                         as the argv. */
+  if (is_managed) { /* managed */
+    if (!validate_only) {
       char **tmp;
       char *tmp_arg;
       proxy_argv = tor_malloc_zero(sizeof(char*)*(smartlist_len(items)+1));
@@ -4870,13 +4852,29 @@ parse_server_transport_line(const char *line, int validate_only)
       }
       *tmp = NULL; /*terminated with NUL pointer, just like execve() likes it*/
 
-      if (pt_managed_launch_server_proxy(name, proxy_argv) < 0) {
+      if (pt_managed_launch_server_proxy(name, proxy_argv) < 0) { /* launch it! */
         log_warn(LD_CONFIG, "Error while launching managed proxy at '%s'",
                  proxy_argv[0]);
         goto err;
       }
-    } else {
-      log_warn(LD_DIR, "Transport %s at %s:%d", name,
+    }
+  } else { /* external */
+    addrport = smartlist_get(items, 0);
+    smartlist_del_keeporder(items, 0);
+
+    if (tor_addr_port_parse(addrport, &addr, &port)<0) {
+      log_warn(LD_CONFIG, "Error parsing transport "
+               "address '%s'", addrport);
+      goto err;
+    }
+    if (!port) {
+      log_warn(LD_CONFIG,
+               "Transport address '%s' has no port.", addrport);
+      goto err;
+    }
+
+    if (!validate_only) {
+      log_warn(LD_DIR, "Transport '%s' at %s:%d.", name,
                fmt_addr(&addr), (int)port);
     }
   }
@@ -4891,7 +4889,7 @@ parse_server_transport_line(const char *line, int validate_only)
   SMARTLIST_FOREACH(items, char*, s, tor_free(s));
   smartlist_free(items);
   tor_free(name);
-  tor_free(field2);
+  tor_free(type);
   return r;
 }
 
diff --git a/src/or/pluggable_transports.c b/src/or/pluggable_transports.c
index 5448c40..49b0e13 100644
--- a/src/or/pluggable_transports.c
+++ b/src/or/pluggable_transports.c
@@ -565,10 +565,10 @@ set_environ(char ***envp, const char *method, int is_server)
   tor_asprintf(tmp++, "TOR_PT_MANAGED_TRANSPORT_VER=1"); /* temp */
   if (is_server) {
     /* ASN check for ORPort values, should we be here if it's 0? */
-    tor_asprintf(tmp++, "TOR_PT_ORPORT=%d", options->ORPort);
+    tor_asprintf(tmp++, "TOR_PT_ORPORT=127.0.0.1:%d", options->ORPort); /* temp */
     tor_asprintf(tmp++, "TOR_PT_SERVER_BINDADDR=127.0.0.1:0");
     tor_asprintf(tmp++, "TOR_PT_SERVER_TRANSPORTS=%s", method);
-    tor_asprintf(tmp++, "TOR_PT_EXTENDED_SERVER_PORT=4200");
+    tor_asprintf(tmp++, "TOR_PT_EXTENDED_SERVER_PORT=127.0.0.1:4200"); /* temp*/
   } else {
     tor_asprintf(tmp++, "TOR_PT_CLIENT_TRANSPORTS=%s", method);
   }



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