Ticket #25935: 0001-Allow-FQDN-in-config-file-DA-address-field.patch

File 0001-Allow-FQDN-in-config-file-DA-address-field.patch, 1.5 KB (added by somlo, 11 months ago)
  • src/or/config.c

    From 4b1e07b93bb69db1565baa1523b209f5437f4d2b Mon Sep 17 00:00:00 2001
    From: "Gabriel L. Somlo" <gsomlo@gmail.com>
    Date: Thu, 26 Apr 2018 09:53:31 -0400
    Subject: [PATCH 1/2] Allow FQDN in config file DA "address" field
    
    Currently, src/or/config.c:parse_dir_authority_line() hard-codes the
    weak assumption that the address component of a DirAuthority entry
    is a numeric dotted-quad IP address, and generates an error on most
    FQDN hostnames. The assumption is weak because if the FQDN begins
    with a digit (e.g., "2byfour.example.net"), parsing succeeds, and
    the FQDN is successfully resolved later on by addr_port_lookup().
    
    This patch explicitly permits any valid FQDN to be used for a DA's
    address by reserving the last two items in the smartlist for the
    "address:port" and "fingerprint" fields, respectively.
    ---
     src/or/config.c | 4 +---
     1 file changed, 1 insertion(+), 3 deletions(-)
    
    diff --git a/src/or/config.c b/src/or/config.c
    index 87a3588db..28b56369a 100644
    a b parse_dir_authority_line(const char *line, dirinfo_type_t required_type, 
    63046304    smartlist_del_keeporder(items, 0);
    63056305  }
    63066306
    6307   while (smartlist_len(items)) {
     6307  while (smartlist_len(items) > 2) {
    63086308    char *flag = smartlist_get(items, 0);
    6309     if (TOR_ISDIGIT(flag[0]))
    6310       break;
    63116309    if (!strcasecmp(flag, "hs") ||
    63126310               !strcasecmp(flag, "no-hs")) {
    63136311      log_warn(LD_CONFIG, "The DirAuthority options 'hs' and 'no-hs' are "