[or-cvs] remember to lower-case the y in y.onion
Roger Dingledine
arma at seul.org
Sat Apr 3 00:27:35 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
rendcommon.c
Log Message:
remember to lower-case the y in y.onion
Index: rendcommon.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendcommon.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- rendcommon.c 2 Apr 2004 23:30:53 -0000 1.8
+++ rendcommon.c 3 Apr 2004 00:27:33 -0000 1.9
@@ -254,19 +254,26 @@
/* ==== 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.
+ * 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 = strchr(address,'.');
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 */
- 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 */
+ }
+failed:
/* otherwise, return to previous state and return -1 */
*s = '.';
return -1;
More information about the tor-commits
mailing list