[tor-commits] [tor/master] Merge remote-tracking branch 'public/bug10801_024'

nickm at torproject.org nickm at torproject.org
Sat Apr 5 18:51:13 UTC 2014


commit 2ff664ee20836ecd7b9e3e9a368766b4125f21a8
Merge: d290e36 b3469e4
Author: Nick Mathewson <nickm at torproject.org>
Date:   Sat Apr 5 14:50:57 2014 -0400

    Merge remote-tracking branch 'public/bug10801_024'
    
    Conflicts:
    	src/common/address.c
    	src/or/config.c

 changes/bug10801     |    4 ++++
 src/common/address.c |   25 +++++++++++++++++----
 src/common/address.h |    3 ++-
 src/or/config.c      |   13 +++--------
 src/test/test_addr.c |   59 +++++++++++++++++++++++++++++++++++++++++++++-----
 5 files changed, 83 insertions(+), 21 deletions(-)

diff --cc src/common/address.c
index cc3e31f,8456558..e5930de
--- a/src/common/address.c
+++ b/src/common/address.c
@@@ -1450,8 -1438,11 +1450,11 @@@ get_interface_address6(int severity, sa
   * allocated string holding the address portion and *<b>port_out</b>
   * to the port.
   *
 - * Don't do DNS lookups and don't allow domain names in the <ip> field.
 + * Don't do DNS lookups and don't allow domain names in the "ip" field.
-  * Don't accept <b>addrport</b> of the form "ip" or "ip:0".
+  *
+  * If <b>default_port</b> is less than 0, don't accept <b>addrport</b> of the
 - * form "<ip>" or "<ip>:0".  Otherwise, accept those forms, and set
++ * form "ip" or "ip:0".  Otherwise, accept those forms, and set
+  * *<b>port_out</b> to <b>default_port</b>.
   *
   * Return 0 on success, -1 on failure. */
  int
diff --cc src/or/config.c
index 4a6b301,fc959f7..dbf643c
--- a/src/or/config.c
+++ b/src/or/config.c
@@@ -4529,49 -4163,19 +4529,42 @@@ parse_bridge_line(const char *line
        log_warn(LD_CONFIG, "Too few items to Bridge line.");
        goto err;
      }
 -    addrport = smartlist_get(items, 0);
 +    addrport = smartlist_get(items, 0); /* Next field is addrport then. */
      smartlist_del_keeporder(items, 0);
    } else {
 -    addrport = field1;
 +    addrport = field;
    }
  
-   /* Parse addrport. */
-   if (tor_addr_port_lookup(addrport,
-                            &bridge_line->addr, &bridge_line->port)<0) {
 -  if (tor_addr_port_parse(LOG_INFO, addrport, &addr, &port, 443)<0) {
++  if (tor_addr_port_parse(LOG_INFO, addrport,
++                          &bridge_line->addr, &bridge_line->port, 443)<0) {
      log_warn(LD_CONFIG, "Error parsing Bridge address '%s'", addrport);
      goto err;
    }
-   if (!bridge_line->port) {
-     log_info(LD_CONFIG,
-              "Bridge address '%s' has no port; using default port 443.",
-              addrport);
-     bridge_line->port = 443;
-   }
  
 +  /* If transports are enabled, next field could be a fingerprint or a
 +     socks argument. If transports are disabled, next field must be
 +     a fingerprint. */
    if (smartlist_len(items)) {
 -    fingerprint = smartlist_join_strings(items, "", 0, NULL);
 +    if (bridge_line->transport_name) { /* transports enabled: */
 +      field = smartlist_get(items, 0);
 +      smartlist_del_keeporder(items, 0);
 +
 +      /* If it's a key=value pair, then it's a SOCKS argument for the
 +         transport proxy... */
 +      if (string_is_key_value(LOG_DEBUG, field)) {
 +        bridge_line->socks_args = smartlist_new();
 +        smartlist_add(bridge_line->socks_args, field);
 +      } else { /* ...otherwise, it's the bridge fingerprint. */
 +        fingerprint = field;
 +      }
 +
 +    } else { /* transports disabled: */
 +      fingerprint = smartlist_join_strings(items, "", 0, NULL);
 +    }
 +  }
 +
 +  /* Handle fingerprint, if it was provided. */
 +  if (fingerprint) {
      if (strlen(fingerprint) != HEX_DIGEST_LEN) {
        log_warn(LD_CONFIG, "Key digest for Bridge is wrong length.");
        goto err;



More information about the tor-commits mailing list