diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-10-03 18:58:40 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-10-03 18:58:40 +0000 |
commit | 6e0b90a90276e90b8a0d7b5c683f4dc5d29fd33f (patch) | |
tree | cbbb20e7a573c31fde6b3251b14f0c2b2481c660 /src/or/test.c | |
parent | 246fecb585cef56af5a0c4bf08365d2d040c3c73 (diff) | |
download | tor-6e0b90a90276e90b8a0d7b5c683f4dc5d29fd33f.tar.gz tor-6e0b90a90276e90b8a0d7b5c683f4dc5d29fd33f.zip |
r8838@totoro: nickm | 2006-10-02 15:24:39 -0400
Partial implementation of revised nickname syntax for controllers. Implement ability to look up routers by "verbose" nicknames; add a per-v1-control-connection flag to turn the feature on in events. Needs testing, spec, ability to actually turn on the flag, double-checking that we wont overflow any nickname buffers, and changelog.
svn:r8582
Diffstat (limited to 'src/or/test.c')
-rw-r--r-- | src/or/test.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/or/test.c b/src/or/test.c index 4f9d79ccf5..147c5c209a 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -1269,19 +1269,40 @@ test_dir_format(void) test_assert( is_legal_nickname("a")); test_assert(!is_legal_nickname("")); test_assert(!is_legal_nickname("abcdefghijklmnopqrst")); /* 20 chars */ - test_assert(!is_legal_nickname("abcdefghijklmnopqrst")); /* 20 chars */ test_assert(!is_legal_nickname("hyphen-")); /* bad char */ test_assert( is_legal_nickname("abcdefghijklmnopqrs")); /* 19 chars */ test_assert(!is_legal_nickname("$AAAAAAAA01234AAAAAAAAAAAAAAAAAAAAAAAAAAA")); /* valid */ test_assert( is_legal_nickname_or_hexdigest( "$AAAAAAAA01234AAAAAAAAAAAAAAAAAAAAAAAAAAA")); + test_assert( is_legal_nickname_or_hexdigest( + "$AAAAAAAA01234AAAAAAAAAAAAAAAAAAAAAAAAAAA=fred")); + test_assert( is_legal_nickname_or_hexdigest( + "$AAAAAAAA01234AAAAAAAAAAAAAAAAAAAAAAAAAAA~fred")); /* too short */ test_assert(!is_legal_nickname_or_hexdigest( "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); /* illegal char */ test_assert(!is_legal_nickname_or_hexdigest( "$AAAAAAzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); + /* hex part too long */ + test_assert(!is_legal_nickname_or_hexdigest( + "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); + test_assert(!is_legal_nickname_or_hexdigest( + "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=fred")); + /* Bad nickname */ + test_assert(!is_legal_nickname_or_hexdigest( + "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=")); + test_assert(!is_legal_nickname_or_hexdigest( + "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA~")); + test_assert(!is_legal_nickname_or_hexdigest( + "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA~hyphen-")); + test_assert(!is_legal_nickname_or_hexdigest( + "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA~" + "abcdefghijklmnoppqrst")); + /* Bad extra char. */ + test_assert(!is_legal_nickname_or_hexdigest( + "$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA!")); test_assert(is_legal_nickname_or_hexdigest("xyzzy")); test_assert(is_legal_nickname_or_hexdigest("abcdefghijklmnopqrs")); test_assert(!is_legal_nickname_or_hexdigest("abcdefghijklmnopqrst")); |