diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-04-23 14:26:02 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-04-23 14:26:02 +0000 |
commit | 5827e2e216ad759f240a0c332848cadf65794742 (patch) | |
tree | 0290c3e0f18d499ad77d106f622a28e395241dc8 /src/or | |
parent | ad4eca60ec0839abdaff69a0a896436cbd5b30d6 (diff) | |
download | tor-5827e2e216ad759f240a0c332848cadf65794742.tar.gz tor-5827e2e216ad759f240a0c332848cadf65794742.zip |
Fix "JAP-client" hideous ASN1 bug, twice. (Fix1: check more thoroughly for TLS errors when handling certs. Fix2: stop assert(0)ing on uncaught TLS errors.)debian-version-0.1.0.3-rc-200504231430-1
svn:r4085
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/buffers.c | 3 | ||||
-rw-r--r-- | src/or/connection_or.c | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index fe6b8d739d..7edc2cdf34 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -224,7 +224,7 @@ int read_to_buf_tls(tor_tls *tls, size_t at_most, buf_t *buf) { (int)buf_datalen(buf), (int)tor_tls_get_pending_bytes(tls), (int)at_most); - assert_no_tls_errors(); + check_no_tls_errors(); r = tor_tls_read(tls, buf->mem+buf->datalen, at_most); if (r<0) return r; @@ -281,6 +281,7 @@ int flush_buf_tls(tor_tls *tls, buf_t *buf, size_t *buf_flushlen) /* we want to let tls write even if flushlen is zero, because it might * have a partial record pending */ + check_no_tls_errors(); r = tor_tls_write(tls, buf->mem, *buf_flushlen); if (r < 0) { return r; diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 4f8943e60a..4c9163e696 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -378,6 +378,7 @@ int connection_tls_start_handshake(connection_t *conn, int receiving) { * Return -1 if <b>conn</b> is broken, else return 0. */ int connection_tls_continue_handshake(connection_t *conn) { + check_no_tls_errors(); switch (tor_tls_handshake(conn->tls)) { case TOR_TLS_ERROR: case TOR_TLS_CLOSE: @@ -442,16 +443,19 @@ connection_tls_finish_handshake(connection_t *conn) { conn->state = OR_CONN_STATE_OPEN; connection_watch_events(conn, EV_READ); log_fn(LOG_DEBUG,"tls handshake done. verifying."); + check_no_tls_errors(); if (! tor_tls_peer_has_cert(conn->tls)) { log_fn(LOG_INFO,"Peer didn't send a cert! Closing."); /* XXX we should handle this case rather than just closing. */ return -1; } + check_no_tls_errors(); if (tor_tls_get_peer_cert_nickname(conn->tls, nickname, sizeof(nickname))) { log_fn(LOG_WARN,"Other side (%s:%d) has a cert without a valid nickname. Closing.", conn->address, conn->port); return -1; } + check_no_tls_errors(); log_fn(LOG_DEBUG, "Other side (%s:%d) claims to be router '%s'", conn->address, conn->port, nickname); @@ -460,6 +464,7 @@ connection_tls_finish_handshake(connection_t *conn) { nickname, conn->address, conn->port); return -1; } + check_no_tls_errors(); #if 0 if (tor_tls_check_lifetime(conn->tls, LOOSE_CERT_ALLOW_SKEW)<0) { log_fn(LOG_WARN,"Other side '%s' (%s:%d) has a very highly skewed clock, or an expired certificate. Closing.", |