[or-cvs] Hidden service operators had a bug in version 1 style INTRO...

Roger Dingledine arma at seul.org
Mon Nov 1 21:46:29 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	or.h rendclient.c rendservice.c 
Log Message:
Hidden service operators had a bug in version 1 style INTRODUCE cells
that made them fail. Fix the bug, and revert clients to use version 0
until 0.0.9pre4 is obsolete.


Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.451
retrieving revision 1.452
diff -u -d -r1.451 -r1.452
--- or.h	1 Nov 2004 20:41:47 -0000	1.451
+++ or.h	1 Nov 2004 21:46:27 -0000	1.452
@@ -128,7 +128,7 @@
 #define DEFAULT_BANDWIDTH_OP (1024 * 1000)
 #define MAX_NICKNAME_LEN 19
 /* Hex digest plus dollar sign. */
-#define MAX_HEX_NICKNAME_LEN HEX_DIGEST_LEN+1
+#define MAX_HEX_NICKNAME_LEN (HEX_DIGEST_LEN+1)
 #define MAX_DIR_SIZE 500000
 
 #ifdef TOR_PERF

Index: rendclient.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendclient.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- rendclient.c	24 Oct 2004 19:08:07 -0000	1.58
+++ rendclient.c	1 Nov 2004 21:46:27 -0000	1.59
@@ -92,11 +92,20 @@
   }
 
   /* write the remaining items into tmp */
+#if 0 /* switch over when 0.0.9pre4 is obsolete */
   tmp[0] = 1; /* version 1 of the cell format */
   strncpy(tmp+1, rendcirc->build_state->chosen_exit_name, (MAX_HEX_NICKNAME_LEN+1)); /* nul pads */
   memcpy(tmp+1+MAX_HEX_NICKNAME_LEN+1, rendcirc->rend_cookie, REND_COOKIE_LEN);
+#else
+  strncpy(tmp, rendcirc->build_state->chosen_exit_name, (MAX_NICKNAME_LEN+1)); /* nul pads */
+  memcpy(tmp+MAX_NICKNAME_LEN+1, rendcirc->rend_cookie, REND_COOKIE_LEN);
+#endif
   if (crypto_dh_get_public(cpath->handshake_state,
+#if 0
                            tmp+1+MAX_HEX_NICKNAME_LEN+1+REND_COOKIE_LEN,
+#else
+                           tmp+MAX_NICKNAME_LEN+1+REND_COOKIE_LEN,
+#endif
                            DH_KEY_LEN)<0) {
     log_fn(LOG_WARN, "Couldn't extract g^x");
     goto err;
@@ -105,7 +114,11 @@
   /*XXX maybe give crypto_pk_public_hybrid_encrypt a max_len arg,
    * to avoid buffer overflows? */
   r = crypto_pk_public_hybrid_encrypt(entry->parsed->pk, tmp,
+#if 0
                            1+MAX_HEX_NICKNAME_LEN+1+REND_COOKIE_LEN+DH_KEY_LEN,
+#else
+                           MAX_NICKNAME_LEN+1+REND_COOKIE_LEN+DH_KEY_LEN,
+#endif
                                       payload+DIGEST_LEN,
                                       PK_PKCS1_OAEP_PADDING, 0);
   if (r<0) {

Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- rendservice.c	30 Oct 2004 05:04:52 -0000	1.98
+++ rendservice.c	1 Nov 2004 21:46:27 -0000	1.99
@@ -418,8 +418,7 @@
     return -1;
   }
   if ((version == 0 && !is_legal_nickname(rp_nickname)) ||
-      (version == 1 && !is_legal_nickname_or_hexdigest(rp_nickname)) ||
-      (int)strspn(buf,LEGAL_NICKNAME_CHARACTERS) != ptr-buf) {
+      (version == 1 && !is_legal_nickname_or_hexdigest(rp_nickname))) {
     log_fn(LOG_WARN, "Bad nickname in INTRODUCE2 cell.");
     return -1;
   }



More information about the tor-commits mailing list