From: Nick Mathewson Date: Sat, 5 Apr 2014 18:50:57 +0000 (-0400) Subject: Merge remote-tracking branch 'public/bug10801_024' X-Git-Tag: tor-0.2.5.4-alpha~73 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2ff664ee20836ecd7b9e3e9a368766b4125f21a8;p=thirdparty%2Ftor.git Merge remote-tracking branch 'public/bug10801_024' Conflicts: src/common/address.c src/or/config.c --- 2ff664ee20836ecd7b9e3e9a368766b4125f21a8 diff --cc src/common/address.c index cc3e31f65f,84565582ec..e5930dedca --- 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 *port_out * to the port. * - * Don't do DNS lookups and don't allow domain names in the field. + * Don't do DNS lookups and don't allow domain names in the "ip" field. - * Don't accept addrport of the form "ip" or "ip:0". + * + * If default_port is less than 0, don't accept addrport of the - * form "" or ":0". Otherwise, accept those forms, and set ++ * form "ip" or "ip:0". Otherwise, accept those forms, and set + * *port_out to default_port. * * Return 0 on success, -1 on failure. */ int diff --cc src/or/config.c index 4a6b30172c,fc959f7c3f..dbf643c53a --- 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;