mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-14 07:03:44 +01:00
remember to lower-case the y in y.onion
svn:r1449
This commit is contained in:
parent
2202c2c7ec
commit
06c812c2de
@ -254,19 +254,26 @@ int rend_cache_store(char *desc, int desc_len)
|
|||||||
/* ==== General utility functions for rendezvous. */
|
/* ==== General utility functions for rendezvous. */
|
||||||
|
|
||||||
/* If address is of the form "y.onion" with a well-formed handle y,
|
/* If address is of the form "y.onion" with a well-formed handle y,
|
||||||
* then put a '\0' after y and return 0.
|
* then put a '\0' after y, lower-case it, and return 0.
|
||||||
* Else return -1 and change nothing.
|
* Else return -1 and change nothing.
|
||||||
*/
|
*/
|
||||||
int rend_parse_rendezvous_address(char *address) {
|
int rend_parse_rendezvous_address(char *address) {
|
||||||
char *s;
|
char *s;
|
||||||
|
char query[REND_SERVICE_ID_LEN+1];
|
||||||
|
|
||||||
s = strchr(address,'.');
|
s = strchr(address,'.');
|
||||||
if(!s) return -1; /* no dot */
|
if(!s) return -1; /* no dot */
|
||||||
if(strcmp(s+1,"onion")) return -1; /* not .onion */
|
if(strcasecmp(s+1,"onion")) return -1; /* not .onion */
|
||||||
|
|
||||||
*s = 0; /* null terminate it */
|
*s = 0; /* null terminate it */
|
||||||
if(rend_valid_service_id(address))
|
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 */
|
return 0; /* success */
|
||||||
|
}
|
||||||
|
failed:
|
||||||
/* otherwise, return to previous state and return -1 */
|
/* otherwise, return to previous state and return -1 */
|
||||||
*s = '.';
|
*s = '.';
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user