diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-10-31 15:05:56 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-10-31 15:05:56 -0400 |
commit | d73c671d6d9a60d9318814b7f95ede320e5d58b2 (patch) | |
tree | 02d7d57df2312221259e4fd0da3044a050496361 /src/test/test_policy.c | |
parent | becc95783979cf1879e6390aad80781d0ce3ea66 (diff) | |
download | tor-d73c671d6d9a60d9318814b7f95ede320e5d58b2.tar.gz tor-d73c671d6d9a60d9318814b7f95ede320e5d58b2.zip |
policy_is_reject_star():
ome policies are default-reject, some default-accept. But
policy_is_reject_star() assumed they were all default_reject. Fix
that!
Also, document that policy_is_reject_star() treats a NULL policy as
empty. This allows us to simplify the checks in
parse_reachable_addresses() by quite a bit.
Fxes bug 20306; bugfix on 0.2.8.2-alpha.
Diffstat (limited to 'src/test/test_policy.c')
-rw-r--r-- | src/test/test_policy.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/test/test_policy.c b/src/test/test_policy.c index 0d4a3b104f..22f473f278 100644 --- a/src/test/test_policy.c +++ b/src/test/test_policy.c @@ -258,14 +258,16 @@ test_policies_general(void *arg) tt_assert(!cmp_addr_policies(policy2, policy2)); tt_assert(!cmp_addr_policies(NULL, NULL)); - tt_assert(!policy_is_reject_star(policy2, AF_INET)); - tt_assert(policy_is_reject_star(policy, AF_INET)); - tt_assert(policy_is_reject_star(policy10, AF_INET)); - tt_assert(!policy_is_reject_star(policy10, AF_INET6)); - tt_assert(policy_is_reject_star(policy11, AF_INET)); - tt_assert(policy_is_reject_star(policy11, AF_INET6)); - tt_assert(policy_is_reject_star(NULL, AF_INET)); - tt_assert(policy_is_reject_star(NULL, AF_INET6)); + tt_assert(!policy_is_reject_star(policy2, AF_INET, 1)); + tt_assert(policy_is_reject_star(policy, AF_INET, 1)); + tt_assert(policy_is_reject_star(policy10, AF_INET, 1)); + tt_assert(!policy_is_reject_star(policy10, AF_INET6, 1)); + tt_assert(policy_is_reject_star(policy11, AF_INET, 1)); + tt_assert(policy_is_reject_star(policy11, AF_INET6, 1)); + tt_assert(policy_is_reject_star(NULL, AF_INET, 1)); + tt_assert(policy_is_reject_star(NULL, AF_INET6, 1)); + tt_assert(!policy_is_reject_star(NULL, AF_INET, 0)); + tt_assert(!policy_is_reject_star(NULL, AF_INET6, 0)); addr_policy_list_free(policy); policy = NULL; |