diff options
author | Roger Dingledine <arma@torproject.org> | 2004-04-03 01:59:53 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-04-03 01:59:53 +0000 |
commit | 8c19d6e3d7944f267ac420ed42731c10e632e7d1 (patch) | |
tree | 59240eddc57411bc78f6813fe40902d57b387405 /src/or/rendclient.c | |
parent | 15036380a8477db073eb1b865cddd6e923857285 (diff) | |
download | tor-8c19d6e3d7944f267ac420ed42731c10e632e7d1.tar tor-8c19d6e3d7944f267ac420ed42731c10e632e7d1.tar.gz |
alice can intercept y.onion requests, do a lookup on them via tor,
and receive a 404
svn:r1455
Diffstat (limited to 'src/or/rendclient.c')
-rw-r--r-- | src/or/rendclient.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c index bd775b4f6..dbd7ba128 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -54,6 +54,7 @@ void rend_client_desc_fetched(char *query, int success) { continue; /* great, this guy was waiting */ if(success) { + log_fn(LOG_INFO,"Rend desc retrieved. Launching rend circ."); conn->purpose = AP_PURPOSE_RENDPOINT_WAIT; if (connection_ap_handshake_attach_circuit(conn) < 0) { /* it will never work */ @@ -67,6 +68,37 @@ void rend_client_desc_fetched(char *query, int success) { } } +int rend_cmp_service_ids(char *one, char *two) { + return strcasecmp(one,two); +} + +/* If address is of the form "y.onion" with a well-formed handle y, + * then put a '\0' after y, lower-case it, and return 0. + * Else return -1 and change nothing. + */ +int rend_parse_rendezvous_address(char *address) { + char *s; + char query[REND_SERVICE_ID_LEN+1]; + + s = strrchr(address,'.'); + if(!s) return -1; /* no dot */ + if (strcasecmp(s+1,"onion")) + return -1; /* not .onion */ + + *s = 0; /* null terminate it */ + if(strlcpy(query, address, REND_SERVICE_ID_LEN+1) >= REND_SERVICE_ID_LEN+1) + goto failed; + tor_strlower(query); + if(rend_valid_service_id(query)) { + tor_strlower(address); + return 0; /* success */ + } +failed: + /* otherwise, return to previous state and return -1 */ + *s = '.'; + return -1; +} + /* Local Variables: mode:c |