Ticket #20527: 0001-Do-escape-rendservice-directories-before-printing-th.patch

File 0001-Do-escape-rendservice-directories-before-printing-th.patch, 4.8 KB (added by twim, 3 years ago)
  • src/or/rendservice.c

    From afa2faaba392fb1c487d09f826df7b05cc9350d8 Mon Sep 17 00:00:00 2001
    From: Ivan Markin <twim@riseup.net>
    Date: Tue, 1 Nov 2016 18:55:03 -0100
    Subject: [PATCH] Do escape rendservice directories before printing them
    
    ---
     src/or/rendservice.c | 21 ++++++++++++---------
     1 file changed, 12 insertions(+), 9 deletions(-)
    
    diff --git a/src/or/rendservice.c b/src/or/rendservice.c
    index d6bd5b1..0dcf3ce 100644
    a b rend_add_service(rend_service_t *service) 
    287287    }
    288288    smartlist_add(rend_service_list, service);
    289289    log_debug(LD_REND,"Configuring service with directory \"%s\"",
    290               service->directory);
     290              rend_service_escaped_dir(service));
    291291    for (i = 0; i < smartlist_len(service->ports); ++i) {
    292292      p = smartlist_get(service->ports, i);
    293293      if (!(p->is_unix_addr)) {
    rend_config_services(const or_options_t *options, int validate_only) 
    504504      }
    505505      log_info(LD_CONFIG,
    506506               "HiddenServiceAllowUnknownPorts=%d for %s",
    507                (int)service->allow_unknown_ports, service->directory);
     507               (int)service->allow_unknown_ports,
     508               rend_service_escaped_dir(service));
    508509    } else if (!strcasecmp(line->key,
    509510                           "HiddenServiceDirGroupReadable")) {
    510511        service->dir_group_readable = (int)tor_parse_long(line->value,
    rend_config_services(const or_options_t *options, int validate_only) 
    518519        }
    519520        log_info(LD_CONFIG,
    520521                 "HiddenServiceDirGroupReadable=%d for %s",
    521                  service->dir_group_readable, service->directory);
     522                 service->dir_group_readable, rend_service_escaped_dir(service));
    522523    } else if (!strcasecmp(line->key, "HiddenServiceMaxStreams")) {
    523524      service->max_streams_per_circuit = (int)tor_parse_long(line->value,
    524525                                                    10, 0, 65535, &ok, NULL);
    rend_config_services(const or_options_t *options, int validate_only) 
    531532      }
    532533      log_info(LD_CONFIG,
    533534               "HiddenServiceMaxStreams=%d for %s",
    534                service->max_streams_per_circuit, service->directory);
     535               service->max_streams_per_circuit, rend_service_escaped_dir(service));
    535536    } else if (!strcasecmp(line->key, "HiddenServiceMaxStreamsCloseCircuit")) {
    536537      service->max_streams_close_circuit = (int)tor_parse_long(line->value,
    537538                                                        10, 0, 1, &ok, NULL);
    rend_config_services(const or_options_t *options, int validate_only) 
    545546      }
    546547      log_info(LD_CONFIG,
    547548               "HiddenServiceMaxStreamsCloseCircuit=%d for %s",
    548                (int)service->max_streams_close_circuit, service->directory);
     549               (int)service->max_streams_close_circuit,
     550               rend_service_escaped_dir(service));
    549551    } else if (!strcasecmp(line->key, "HiddenServiceNumIntroductionPoints")) {
    550552      service->n_intro_points_wanted =
    551553        (unsigned int) tor_parse_long(line->value, 10,
    rend_config_services(const or_options_t *options, int validate_only) 
    561563        return -1;
    562564      }
    563565      log_info(LD_CONFIG, "HiddenServiceNumIntroductionPoints=%d for %s",
    564                service->n_intro_points_wanted, service->directory);
     566               service->n_intro_points_wanted, rend_service_escaped_dir(service));
    565567    } else if (!strcasecmp(line->key, "HiddenServiceAuthorizeClient")) {
    566568      /* Parse auth type and comma-separated list of client names and add a
    567569       * rend_authorized_client_t for each client to the service's list
    rend_service_load_all_keys(const smartlist_t *service_list) 
    11881190    if (s->private_key)
    11891191      continue;
    11901192    log_info(LD_REND, "Loading hidden-service keys from \"%s\"",
    1191              s->directory);
     1193             rend_service_escaped_dir(s));
    11921194
    11931195    if (rend_service_load_keys(s) < 0)
    11941196      return -1;
    rend_service_load_keys(rend_service_t *s) 
    12661268  if (s->dir_group_readable) {
    12671269    /* Only new dirs created get new opts, also enforce group read. */
    12681270    if (chmod(s->directory, 0750)) {
    1269       log_warn(LD_FS,"Unable to make %s group-readable.", s->directory);
     1271      log_warn(LD_FS,"Unable to make %s group-readable.",
     1272      rend_service_escaped_dir(s));
    12701273    }
    12711274  }
    12721275#endif
    rend_service_dump_stats(int severity) 
    40104013  for (i=0; i < smartlist_len(rend_service_list); ++i) {
    40114014    service = smartlist_get(rend_service_list, i);
    40124015    tor_log(severity, LD_GENERAL, "Service configured in \"%s\":",
    4013         service->directory);
     4016        rend_service_escaped_dir(service));
    40144017    for (j=0; j < smartlist_len(service->intro_nodes); ++j) {
    40154018      intro = smartlist_get(service->intro_nodes, j);
    40164019      safe_name = safe_str_client(intro->extend_info->nickname);