* Return -1 if <b>conn</b> is broken, else return 0.
*/
int connection_tls_start_handshake(connection_t *conn, int receiving) {
+ int use_no_cert=0;
conn->state = OR_CONN_STATE_HANDSHAKING;
- conn->tls = tor_tls_new(conn->s, receiving);
+ if(receiving) { /* check if he's 0.0.7 and I'm unverified */
+ routerinfo_t *him, *me;
+ him = router_get_by_digest(conn->identity_digest);
+ me = router_get_my_routerinfo();
+
+ if(him && !strncmp(him->platform, "Tor 0.0.7", 9) &&
+ (!me || !me->is_verified)) {
+ log_fn(LOG_INFO,"He's running 0.0.7, and I'm unverified. Acting like OP.");
+ use_no_cert = 1;
+ }
+ }
+ conn->tls = tor_tls_new(conn->s, receiving, use_no_cert);
if(!conn->tls) {
log_fn(LOG_WARN,"tor_tls_new failed. Closing.");
return -1;
/** The last calculated bandwidth usage for our node. */
static int advertised_bw = 0;
-
/** Tuck <b>bw</b> away so we can produce it when somebody
* calls router_get_advertised_bandwidth() below.
*/
void router_set_advertised_bandwidth(int bw) {
advertised_bw = bw;
}
-
/** Return the value we tucked away above, or zero by default. */
int router_get_advertised_bandwidth(void) {
return advertised_bw;
/* Read an RSA secret key key from a file that was once named fname_old,
* but is now named fname_new. Rename the file from old to new as needed.
*/
-crypto_pk_env_t *init_key_from_file_name_changed(const char *fname_old,
- const char *fname_new)
+static crypto_pk_env_t *
+init_key_from_file_name_changed(const char *fname_old,
+ const char *fname_new)
{
int fs;
ri->exit_policy = NULL; /* zero it out first */
router_add_exit_policy_from_config(ri);
ri->is_trusted_dir = authdir_mode();
+ if(desc_routerinfo) /* inherit values */
+ ri->is_verified = desc_routerinfo->is_verified;
+
if (desc_routerinfo)
routerinfo_free(desc_routerinfo);
desc_routerinfo = ri;
running_routers_t *rr)
{
int n_routers, i;
- routerinfo_t *router;
+ routerinfo_t *router, *me = router_get_my_routerinfo();
if (!list)
return;
if (list->published_on >= rr->published_on)
if (list->running_routers_updated_on >= rr->published_on)
return;
+ if(me) /* learn if the dirservers think I'm verified */
+ router_update_status_from_smartlist(me,
+ rr->published_on,
+ rr->running_routers);
n_routers = smartlist_len(list->routers);
for (i=0; i<n_routers; ++i) {
router = smartlist_get(list->routers, i);
*/
int /* Should be static; exposed for unit tests */
router_parse_routerlist_from_directory(const char *str,
- routerlist_t **dest,
- crypto_pk_env_t *pkey)
+ routerlist_t **dest,
+ crypto_pk_env_t *pkey)
{
directory_token_t *tok;
char digest[DIGEST_LEN];
}
tok->n_args = 0; /* Don't free the strings in good_nickname_lst yet. */
+ /* Determine if my routerinfo is considered verified. */
+ {
+ routerinfo_t *me = router_get_my_routerinfo();
+ if(me)
+ router_update_status_from_smartlist(me, time(NULL), good_nickname_list);
+ }
+
/* Read the router list from s, advancing s up past the end of the last
* router. */
str = end;
if (router_parse_list_from_string(&str, &new_dir,
- good_nickname_list)) {
+ good_nickname_list)) {
log_fn(LOG_WARN, "Error reading routers from directory");
goto err;
}