[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] let alice recognize a y.onion address and, uhm, do something



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

Modified Files:
	connection_edge.c or.h rendcommon.c 
Log Message:
let alice recognize a y.onion address and, uhm, do something


Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- connection_edge.c	1 Apr 2004 01:57:22 -0000	1.122
+++ connection_edge.c	1 Apr 2004 02:41:41 -0000	1.123
@@ -696,6 +696,7 @@
   }
 }
 
+/* return -1 if an unexpected error with conn, else 0. */
 static int connection_ap_handshake_process_socks(connection_t *conn) {
   socks_request_t *socks;
   int sockshere;
@@ -724,9 +725,27 @@
     return sockshere;
   } /* else socks handshake is done, continue processing */
 
-  conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
-  /* attaching to a dirty circuit is fine */
-  return connection_ap_handshake_attach_circuit(conn,0);
+  /* 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;
+    /* attaching to a dirty circuit is fine */
+    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,

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.271
retrieving revision 1.272
diff -u -d -r1.271 -r1.272
--- or.h	1 Apr 2004 01:57:22 -0000	1.271
+++ or.h	1 Apr 2004 02:41:41 -0000	1.272
@@ -1012,6 +1012,8 @@
 int rend_cache_lookup(char *query, const char **desc, int *desc_len);
 int rend_cache_store(char *desc, int desc_len);
 
+int rend_parse_rendezvous_address(char *address);
+
 /********************************* rendservice.c ***************************/
 
 int rend_config_services(or_options_t *options);

Index: rendcommon.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendcommon.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- rendcommon.c	31 Mar 2004 04:10:10 -0000	1.3
+++ rendcommon.c	1 Apr 2004 02:41:41 -0000	1.4
@@ -244,4 +244,15 @@
   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;
+}