diff options
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/dirserv.c | 14 | ||||
-rw-r--r-- | src/or/policies.c | 2 | ||||
-rw-r--r-- | src/or/test.c | 12 |
3 files changed, 11 insertions, 17 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 75e9d0324e..5454b6d45c 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1974,15 +1974,13 @@ routerstatus_format_entry(char *buf, size_t buf_len, cp += strlen(cp); summary = policy_summarize(desc->exit_policy); - if (summary) { - r = tor_snprintf(cp, buf_len - (cp-buf), "p %s\n", summary); - if (r<0) { - log_warn(LD_BUG, "Not enough space in buffer."); - return -1; - } - cp += strlen(cp); - tor_free(summary); + r = tor_snprintf(cp, buf_len - (cp-buf), "p %s\n", summary); + if (r<0) { + log_warn(LD_BUG, "Not enough space in buffer."); + return -1; } + cp += strlen(cp); + tor_free(summary); } return 0; diff --git a/src/or/policies.c b/src/or/policies.c index cdc4e28b6d..a5f8a28460 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -1139,7 +1139,7 @@ policy_summarize(smartlist_t *policy) * that to build the result */ if (smartlist_len(accepts) == 0) { /* no exits at all */ - result = NULL; + result = tor_strdup("reject 1-65535"); goto cleanup; } if (smartlist_len(rejects) == 0) { /* no rejects at all */ diff --git a/src/or/test.c b/src/or/test.c index e4ae1e5c84..c74e23a519 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -3369,13 +3369,9 @@ test_policy_summary_helper(const char *policy_str, test_assert(0 == policies_parse_exit_policy(&line, &policy, 0, NULL)); summary = policy_summarize(policy); - if (expected_summary == NULL) - test_assert(summary == NULL); - else { - test_assert(summary != NULL); - test_streq(summary, expected_summary); - tor_free(summary); - }; + test_assert(summary != NULL); + test_streq(summary, expected_summary); + tor_free(summary); addr_policy_list_free(policy); } @@ -3474,7 +3470,7 @@ test_policies(void) /* no exits */ test_policy_summary_helper("accept 11.0.0.0/9:80," "reject *:*", - NULL); + "reject 1-65535"); /* port merging */ test_policy_summary_helper("accept *:80," "accept *:81," |