|
@@ -339,7 +339,7 @@ connection_tls_finish_handshake(connection_t *conn) {
|
|
conn->state = OR_CONN_STATE_OPEN;
|
|
conn->state = OR_CONN_STATE_OPEN;
|
|
connection_watch_events(conn, POLLIN);
|
|
connection_watch_events(conn, POLLIN);
|
|
log_fn(LOG_DEBUG,"tls handshake done. verifying.");
|
|
log_fn(LOG_DEBUG,"tls handshake done. verifying.");
|
|
- if (! tor_tls_peer_has_cert(conn->tls)) {
|
|
+ if (! tor_tls_peer_has_cert(conn->tls)) {
|
|
if (server_mode(options)) {
|
|
if (server_mode(options)) {
|
|
conn->receiver_bucket = conn->bandwidth = DEFAULT_BANDWIDTH_OP;
|
|
conn->receiver_bucket = conn->bandwidth = DEFAULT_BANDWIDTH_OP;
|
|
return 0;
|
|
return 0;
|
|
@@ -348,7 +348,7 @@ connection_tls_finish_handshake(connection_t *conn) {
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
+
|
|
if (tor_tls_get_peer_cert_nickname(conn->tls, nickname, MAX_NICKNAME_LEN)) {
|
|
if (tor_tls_get_peer_cert_nickname(conn->tls, nickname, MAX_NICKNAME_LEN)) {
|
|
log_fn(LOG_WARN,"Other side (%s:%d) has a cert without a valid nickname. Closing.",
|
|
log_fn(LOG_WARN,"Other side (%s:%d) has a cert without a valid nickname. Closing.",
|
|
conn->address, conn->port);
|
|
conn->address, conn->port);
|
|
@@ -366,6 +366,12 @@ connection_tls_finish_handshake(connection_t *conn) {
|
|
crypto_pk_get_digest(identity_rcvd, digest_rcvd);
|
|
crypto_pk_get_digest(identity_rcvd, digest_rcvd);
|
|
crypto_free_pk_env(identity_rcvd);
|
|
crypto_free_pk_env(identity_rcvd);
|
|
|
|
|
|
|
|
+ if (crypto_pk_cmp_keys(get_identity_key(), identity_rcvd)<0) {
|
|
|
|
+ conn->circ_id_type = CIRC_ID_TYPE_LOWER;
|
|
|
|
+ } else {
|
|
|
|
+ conn->circ_id_type = CIRC_ID_TYPE_HIGHER;
|
|
|
|
+ }
|
|
|
|
+
|
|
router = router_get_by_nickname(nickname);
|
|
router = router_get_by_nickname(nickname);
|
|
if(router &&
|
|
if(router &&
|
|
router->is_verified &&
|
|
router->is_verified &&
|
|
@@ -394,6 +400,7 @@ connection_tls_finish_handshake(connection_t *conn) {
|
|
if (!server_mode(options)) {
|
|
if (!server_mode(options)) {
|
|
conn->receiver_bucket = conn->bandwidth = DEFAULT_BANDWIDTH_OP;
|
|
conn->receiver_bucket = conn->bandwidth = DEFAULT_BANDWIDTH_OP;
|
|
}
|
|
}
|
|
|
|
+
|
|
directory_set_dirty();
|
|
directory_set_dirty();
|
|
circuit_n_conn_done(conn, 1);
|
|
circuit_n_conn_done(conn, 1);
|
|
|
|
|