mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 07:07:52 +01:00
let alice recognize a y.onion address and, uhm, do something
svn:r1422
This commit is contained in:
parent
d13857a3f0
commit
36ff23209b
3 changed files with 35 additions and 3 deletions
|
@ -696,6 +696,7 @@ static void connection_edge_consider_sending_sendme(connection_t *conn) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* return -1 if an unexpected error with conn, else 0. */
|
||||||
static int connection_ap_handshake_process_socks(connection_t *conn) {
|
static int connection_ap_handshake_process_socks(connection_t *conn) {
|
||||||
socks_request_t *socks;
|
socks_request_t *socks;
|
||||||
int sockshere;
|
int sockshere;
|
||||||
|
@ -724,9 +725,27 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
|
||||||
return sockshere;
|
return sockshere;
|
||||||
} /* else socks handshake is done, continue processing */
|
} /* else socks handshake is done, continue processing */
|
||||||
|
|
||||||
|
/* this call _modifies_ socks->address iff it's a hidden-service request */
|
||||||
|
if (rend_parse_rendezvous_address(socks->address) < 0) {
|
||||||
|
/* normal request */
|
||||||
conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
|
conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
|
||||||
/* attaching to a dirty circuit is fine */
|
/* attaching to a dirty circuit is fine */
|
||||||
return connection_ap_handshake_attach_circuit(conn,0);
|
return connection_ap_handshake_attach_circuit(conn,0);
|
||||||
|
} else {
|
||||||
|
/* it's a hidden-service request */
|
||||||
|
const char *descp;
|
||||||
|
int desc_len;
|
||||||
|
|
||||||
|
/* see if we already have it cached */
|
||||||
|
if (rend_cache_lookup(socks->address, &descp, &desc_len) == 1) {
|
||||||
|
/* then pick and launch a rendezvous circuit */
|
||||||
|
/* go into some other state */
|
||||||
|
} else {
|
||||||
|
/* initiate a dir hidserv desc lookup */
|
||||||
|
/* go into a state where you'll be notified of the answer */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int connection_ap_handshake_attach_circuit(connection_t *conn,
|
static int connection_ap_handshake_attach_circuit(connection_t *conn,
|
||||||
|
|
|
@ -1012,6 +1012,8 @@ void rend_cache_clean(void);
|
||||||
int rend_cache_lookup(char *query, const char **desc, int *desc_len);
|
int rend_cache_lookup(char *query, const char **desc, int *desc_len);
|
||||||
int rend_cache_store(char *desc, int desc_len);
|
int rend_cache_store(char *desc, int desc_len);
|
||||||
|
|
||||||
|
int rend_parse_rendezvous_address(char *address);
|
||||||
|
|
||||||
/********************************* rendservice.c ***************************/
|
/********************************* rendservice.c ***************************/
|
||||||
|
|
||||||
int rend_config_services(or_options_t *options);
|
int rend_config_services(or_options_t *options);
|
||||||
|
|
|
@ -244,4 +244,15 @@ int rend_cache_store(char *desc, int desc_len)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ==== General utility functions for rendezvous. */
|
||||||
|
|
||||||
|
/* If address is of the form "y.onion" with a well-formed handle y,
|
||||||
|
* then put a '\0' after y and return 0.
|
||||||
|
* Else return -1 and change nothing.
|
||||||
|
*/
|
||||||
|
int rend_parse_rendezvous_address(char *address) {
|
||||||
|
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue