]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge remote-tracking branch 'public/bug10801_024'
authorNick Mathewson <nickm@torproject.org>
Sat, 5 Apr 2014 18:50:57 +0000 (14:50 -0400)
committerNick Mathewson <nickm@torproject.org>
Sat, 5 Apr 2014 18:50:57 +0000 (14:50 -0400)
Conflicts:
src/common/address.c
src/or/config.c

1  2 
src/common/address.c
src/common/address.h
src/or/config.c
src/test/test_addr.c

index cc3e31f65ffc8916996eea90cdf0e96a71235c5a,84565582ec805955f1ce2a26f680d69994d08f8f..e5930dedca93cbbcab4737e3817f2bc5e4aefc3c
@@@ -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
Simple merge
diff --cc src/or/config.c
index 4a6b30172c013484e46d1054319296cd2224da3a,fc959f7c3f2492f8c3a8cbc39558d1119c9bdef2..dbf643c53a732dfba224adcd96aa47f4f3ce6b5c
@@@ -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;
Simple merge