diff options
author | John Brooks <john.brooks@dereferenced.net> | 2016-02-19 16:32:25 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-05-09 14:30:34 -0400 |
commit | 162aa14eef69bc97233d6b2c47bc1317e30f9364 (patch) | |
tree | c8b768498d077a262e491b0fe4725933893b5160 /src/or/rendcommon.c | |
parent | dcc11674db53cc89228ec2e8d49f30bdf6c9b8a3 (diff) | |
download | tor-162aa14eef69bc97233d6b2c47bc1317e30f9364.tar.gz tor-162aa14eef69bc97233d6b2c47bc1317e30f9364.zip |
Move rend client name checks to one function
Diffstat (limited to 'src/or/rendcommon.c')
-rw-r--r-- | src/or/rendcommon.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index a9fdf84c04..dfa6c1e8be 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -750,6 +750,22 @@ rend_valid_descriptor_id(const char *query) return 0; } +/** Return true iff <b>client_name</b> is a syntactically valid name + * for rendezvous client authentication. */ +int +rend_valid_client_name(const char *client_name) +{ + size_t len = strlen(client_name); + if (len < 1 || len > REND_CLIENTNAME_MAX_LEN) { + return 0; + } + if (strspn(client_name, REND_LEGAL_CLIENTNAME_CHARACTERS) != len) { + return 0; + } + + return 1; +} + /** Called when we get a rendezvous-related relay cell on circuit * <b>circ</b>. Dispatch on rendezvous relay command. */ void |