Loading changes/ticket33368 0 → 100644 +3 −0 Original line number Diff line number Diff line o Minor features (client-only compilation): - Disable more code related to the ext_orport protocol when compiling without support for relay mode. Closes ticket 33368. src/app/main/shutdown.c +2 −1 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ tor_cleanup(void) /* Remove Extended ORPort cookie authentication file */ { char *cookie_fname = get_ext_or_auth_cookie_file_name(); if (cookie_fname) tor_remove_file(cookie_fname); tor_free(cookie_fname); } Loading src/core/or/connection_or.c +0 −69 Original line number Diff line number Diff line Loading @@ -109,10 +109,6 @@ TO_OR_CONN(connection_t *c) return DOWNCAST(or_connection_t, c); } /** Global map between Extended ORPort identifiers and OR * connections. */ static digestmap_t *orconn_ext_or_id_map = NULL; /** Clear clear conn->identity_digest and update other data * structures as appropriate.*/ void Loading Loading @@ -198,71 +194,6 @@ connection_or_set_identity_digest(or_connection_t *conn, channel_set_identity_digest(chan, rsa_digest, ed_id); } /** Remove the Extended ORPort identifier of <b>conn</b> from the * global identifier list. Also, clear the identifier from the * connection itself. */ void connection_or_remove_from_ext_or_id_map(or_connection_t *conn) { or_connection_t *tmp; if (!orconn_ext_or_id_map) return; if (!conn->ext_or_conn_id) return; tmp = digestmap_remove(orconn_ext_or_id_map, conn->ext_or_conn_id); if (!tor_digest_is_zero(conn->ext_or_conn_id)) tor_assert(tmp == conn); memset(conn->ext_or_conn_id, 0, EXT_OR_CONN_ID_LEN); } /** Return the connection whose ext_or_id is <b>id</b>. Return NULL if no such * connection is found. */ or_connection_t * connection_or_get_by_ext_or_id(const char *id) { if (!orconn_ext_or_id_map) return NULL; return digestmap_get(orconn_ext_or_id_map, id); } /** Deallocate the global Extended ORPort identifier list */ void connection_or_clear_ext_or_id_map(void) { digestmap_free(orconn_ext_or_id_map, NULL); orconn_ext_or_id_map = NULL; } /** Creates an Extended ORPort identifier for <b>conn</b> and deposits * it into the global list of identifiers. */ void connection_or_set_ext_or_identifier(or_connection_t *conn) { char random_id[EXT_OR_CONN_ID_LEN]; or_connection_t *tmp; if (!orconn_ext_or_id_map) orconn_ext_or_id_map = digestmap_new(); /* Remove any previous identifiers: */ if (conn->ext_or_conn_id && !tor_digest_is_zero(conn->ext_or_conn_id)) connection_or_remove_from_ext_or_id_map(conn); do { crypto_rand(random_id, sizeof(random_id)); } while (digestmap_get(orconn_ext_or_id_map, random_id)); if (!conn->ext_or_conn_id) conn->ext_or_conn_id = tor_malloc_zero(EXT_OR_CONN_ID_LEN); memcpy(conn->ext_or_conn_id, random_id, EXT_OR_CONN_ID_LEN); tmp = digestmap_set(orconn_ext_or_id_map, random_id, conn); tor_assert(!tmp); } /**************************************************************/ /** Map from a string describing what a non-open OR connection was doing when Loading src/core/proto/proto_ext_or.h +7 −0 Original line number Diff line number Diff line Loading @@ -24,4 +24,11 @@ struct ext_or_cmd_t { int fetch_ext_or_command_from_buf(struct buf_t *buf, struct ext_or_cmd_t **out); ext_or_cmd_t *ext_or_cmd_new(uint16_t len); #define ext_or_cmd_free(cmd) \ FREE_AND_NULL(ext_or_cmd_t, ext_or_cmd_free_, (cmd)) void ext_or_cmd_free_(ext_or_cmd_t *cmd); #endif /* !defined(TOR_PROTO_EXT_OR_H) */ src/feature/client/transports.c +4 −2 Original line number Diff line number Diff line Loading @@ -1420,8 +1420,10 @@ create_managed_proxy_environment(const managed_proxy_t *mp) smartlist_add_asprintf(envs, "TOR_PT_EXTENDED_SERVER_PORT=%s", ext_or_addrport_tmp); } if (cookie_file_loc) { smartlist_add_asprintf(envs, "TOR_PT_AUTH_COOKIE_FILE=%s", cookie_file_loc); } tor_free(ext_or_addrport_tmp); tor_free(cookie_file_loc); Loading Loading
changes/ticket33368 0 → 100644 +3 −0 Original line number Diff line number Diff line o Minor features (client-only compilation): - Disable more code related to the ext_orport protocol when compiling without support for relay mode. Closes ticket 33368.
src/app/main/shutdown.c +2 −1 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ tor_cleanup(void) /* Remove Extended ORPort cookie authentication file */ { char *cookie_fname = get_ext_or_auth_cookie_file_name(); if (cookie_fname) tor_remove_file(cookie_fname); tor_free(cookie_fname); } Loading
src/core/or/connection_or.c +0 −69 Original line number Diff line number Diff line Loading @@ -109,10 +109,6 @@ TO_OR_CONN(connection_t *c) return DOWNCAST(or_connection_t, c); } /** Global map between Extended ORPort identifiers and OR * connections. */ static digestmap_t *orconn_ext_or_id_map = NULL; /** Clear clear conn->identity_digest and update other data * structures as appropriate.*/ void Loading Loading @@ -198,71 +194,6 @@ connection_or_set_identity_digest(or_connection_t *conn, channel_set_identity_digest(chan, rsa_digest, ed_id); } /** Remove the Extended ORPort identifier of <b>conn</b> from the * global identifier list. Also, clear the identifier from the * connection itself. */ void connection_or_remove_from_ext_or_id_map(or_connection_t *conn) { or_connection_t *tmp; if (!orconn_ext_or_id_map) return; if (!conn->ext_or_conn_id) return; tmp = digestmap_remove(orconn_ext_or_id_map, conn->ext_or_conn_id); if (!tor_digest_is_zero(conn->ext_or_conn_id)) tor_assert(tmp == conn); memset(conn->ext_or_conn_id, 0, EXT_OR_CONN_ID_LEN); } /** Return the connection whose ext_or_id is <b>id</b>. Return NULL if no such * connection is found. */ or_connection_t * connection_or_get_by_ext_or_id(const char *id) { if (!orconn_ext_or_id_map) return NULL; return digestmap_get(orconn_ext_or_id_map, id); } /** Deallocate the global Extended ORPort identifier list */ void connection_or_clear_ext_or_id_map(void) { digestmap_free(orconn_ext_or_id_map, NULL); orconn_ext_or_id_map = NULL; } /** Creates an Extended ORPort identifier for <b>conn</b> and deposits * it into the global list of identifiers. */ void connection_or_set_ext_or_identifier(or_connection_t *conn) { char random_id[EXT_OR_CONN_ID_LEN]; or_connection_t *tmp; if (!orconn_ext_or_id_map) orconn_ext_or_id_map = digestmap_new(); /* Remove any previous identifiers: */ if (conn->ext_or_conn_id && !tor_digest_is_zero(conn->ext_or_conn_id)) connection_or_remove_from_ext_or_id_map(conn); do { crypto_rand(random_id, sizeof(random_id)); } while (digestmap_get(orconn_ext_or_id_map, random_id)); if (!conn->ext_or_conn_id) conn->ext_or_conn_id = tor_malloc_zero(EXT_OR_CONN_ID_LEN); memcpy(conn->ext_or_conn_id, random_id, EXT_OR_CONN_ID_LEN); tmp = digestmap_set(orconn_ext_or_id_map, random_id, conn); tor_assert(!tmp); } /**************************************************************/ /** Map from a string describing what a non-open OR connection was doing when Loading
src/core/proto/proto_ext_or.h +7 −0 Original line number Diff line number Diff line Loading @@ -24,4 +24,11 @@ struct ext_or_cmd_t { int fetch_ext_or_command_from_buf(struct buf_t *buf, struct ext_or_cmd_t **out); ext_or_cmd_t *ext_or_cmd_new(uint16_t len); #define ext_or_cmd_free(cmd) \ FREE_AND_NULL(ext_or_cmd_t, ext_or_cmd_free_, (cmd)) void ext_or_cmd_free_(ext_or_cmd_t *cmd); #endif /* !defined(TOR_PROTO_EXT_OR_H) */
src/feature/client/transports.c +4 −2 Original line number Diff line number Diff line Loading @@ -1420,8 +1420,10 @@ create_managed_proxy_environment(const managed_proxy_t *mp) smartlist_add_asprintf(envs, "TOR_PT_EXTENDED_SERVER_PORT=%s", ext_or_addrport_tmp); } if (cookie_file_loc) { smartlist_add_asprintf(envs, "TOR_PT_AUTH_COOKIE_FILE=%s", cookie_file_loc); } tor_free(ext_or_addrport_tmp); tor_free(cookie_file_loc); Loading