diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-03-18 14:48:30 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-03-18 14:48:30 +0000 |
commit | 726141b4daff23c9b270620e3791cf9d171a22ad (patch) | |
tree | f9ce5ecd8453ac4369ca332d382c32f071767901 | |
parent | 2d179e35ab05c58eb67ea870c634555243976160 (diff) | |
download | tor-726141b4daff23c9b270620e3791cf9d171a22ad.tar.gz tor-726141b4daff23c9b270620e3791cf9d171a22ad.zip |
r18915@catbus: nickm | 2008-03-18 10:48:18 -0400
Fix unittests and router generation behavior on 0.2.0 branch. backport of r14084. fixes bug 631.
svn:r14095
-rw-r--r-- | src/common/tortls.c | 6 | ||||
-rw-r--r-- | src/or/router.c | 3 | ||||
-rw-r--r-- | src/or/test.c | 6 |
3 files changed, 7 insertions, 8 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c index 4e254c3ada..f673846c83 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -992,8 +992,7 @@ tor_tls_renegotiate(tor_tls_t *tls) if (tls->state != TOR_TLS_ST_RENEGOTIATE) { int r = SSL_renegotiate(tls->ssl); if (r <= 0) { - return tor_tls_get_error(tls, r, CATCH_SYSCALL|CATCH_ZERO, - "renegotiating", LOG_WARN); + return tor_tls_get_error(tls, r, 0, "renegotiating", LOG_WARN); } tls->state = TOR_TLS_ST_RENEGOTIATE; } @@ -1002,8 +1001,7 @@ tor_tls_renegotiate(tor_tls_t *tls) tls->state = TOR_TLS_ST_OPEN; return TOR_TLS_DONE; } else - return tor_tls_get_error(tls, r, CATCH_SYSCALL|CATCH_ZERO, - "renegotiating handshake", LOG_INFO); + return tor_tls_get_error(tls, r, 0, "renegotiating handshake", LOG_INFO); } /** Shut down an open tls connection <b>tls</b>. When finished, returns diff --git a/src/or/router.c b/src/or/router.c index c6f1195366..271dc7f549 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1686,7 +1686,8 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router, } /* Write the exit policy to the end of 's'. */ - if (dns_seems_to_be_broken()) { + if (dns_seems_to_be_broken() || + !router->exit_policy || !smartlist_len(router->exit_policy)) { /* DNS is screwed up; don't claim to be an exit. */ strlcat(s+written, "reject *:*\n", maxlen-written); written += strlen("reject *:*\n"); diff --git a/src/or/test.c b/src/or/test.c index 814f8c4f71..712e3d483d 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -2298,7 +2298,7 @@ test_dir_format(void) strlcat(buf2, pk1_str, sizeof(buf2)); strlcat(buf2, "signing-key\n", sizeof(buf2)); strlcat(buf2, pk2_str, sizeof(buf2)); - strlcat(buf2, "router-signature\n", sizeof(buf2)); + strlcat(buf2, "reject *:*\nrouter-signature\n", sizeof(buf2)); buf[strlen(buf2)] = '\0'; /* Don't compare the sig; it's never the same * twice */ @@ -2316,7 +2316,7 @@ test_dir_format(void) test_eq(rp1->bandwidthcapacity, r1->bandwidthcapacity); test_assert(crypto_pk_cmp_keys(rp1->onion_pkey, pk1) == 0); test_assert(crypto_pk_cmp_keys(rp1->identity_pkey, pk2) == 0); - test_assert(rp1->exit_policy == NULL); + test_assert(smartlist_len(rp1->exit_policy) == 1); #if 0 /* XXX Once we have exit policies, test this again. XXX */ @@ -2996,7 +2996,7 @@ test_policies(void) compare_addr_to_addr_policy(0, 2, policy)); test_assert(ADDR_POLICY_REJECTED == compare_addr_to_addr_policy(0xc0a80102, 2, policy)); - test_assert(ADDR_POLICY_REJECTED == + test_assert(ADDR_POLICY_ACCEPTED == compare_addr_to_addr_policy(0x01020304u, 2, NULL)); policy2 = NULL; |