summaryrefslogtreecommitdiff
path: root/src/or/routerparse.c
diff options
context:
space:
mode:
authorJohn Brooks <john.brooks@dereferenced.net>2016-02-19 16:32:25 -0700
committerNick Mathewson <nickm@torproject.org>2016-05-09 14:30:34 -0400
commit162aa14eef69bc97233d6b2c47bc1317e30f9364 (patch)
treec8b768498d077a262e491b0fe4725933893b5160 /src/or/routerparse.c
parentdcc11674db53cc89228ec2e8d49f30bdf6c9b8a3 (diff)
downloadtor-162aa14eef69bc97233d6b2c47bc1317e30f9364.tar.gz
tor-162aa14eef69bc97233d6b2c47bc1317e30f9364.zip
Move rend client name checks to one function
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r--src/or/routerparse.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 35f76cdc3e..b1ac3dfee2 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -5300,7 +5300,6 @@ rend_parse_client_keys(strmap_t *parsed_clients, const char *ckstr)
current_entry = eat_whitespace(ckstr);
while (!strcmpstart(current_entry, "client-name ")) {
rend_authorized_client_t *parsed_entry;
- size_t len;
/* Determine end of string. */
const char *eos = strstr(current_entry, "\nclient-name ");
if (!eos)
@@ -5329,12 +5328,10 @@ rend_parse_client_keys(strmap_t *parsed_clients, const char *ckstr)
tor_assert(tok == smartlist_get(tokens, 0));
tor_assert(tok->n_args == 1);
- len = strlen(tok->args[0]);
- if (len < 1 || len > 19 ||
- strspn(tok->args[0], REND_LEGAL_CLIENTNAME_CHARACTERS) != len) {
+ if (!rend_valid_client_name(tok->args[0])) {
log_warn(LD_CONFIG, "Illegal client name: %s. (Length must be "
- "between 1 and 19, and valid characters are "
- "[A-Za-z0-9+-_].)", tok->args[0]);
+ "between 1 and %d, and valid characters are "
+ "[A-Za-z0-9+-_].)", tok->args[0], REND_CLIENTNAME_MAX_LEN);
goto err;
}
/* Check if client name is duplicate. */