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

[or-cvs] r13093: Add connection_dir_is_encrypted() so that we can refrain fro (in tor/trunk: . doc src/or)



Author: nickm
Date: 2008-01-10 12:48:36 -0500 (Thu, 10 Jan 2008)
New Revision: 13093

Modified:
   tor/trunk/
   tor/trunk/doc/TODO
   tor/trunk/src/or/directory.c
   tor/trunk/src/or/or.h
Log:
 r17553@catbus:  nickm | 2008-01-10 12:18:27 -0500
 Add connection_dir_is_encrypted() so that we can refrain from sending bridge descriptors over an unencrypted link.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r17553] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO	2008-01-10 17:48:32 UTC (rev 13092)
+++ tor/trunk/doc/TODO	2008-01-10 17:48:36 UTC (rev 13093)
@@ -27,9 +27,7 @@
     - FAQ entry which is wrong
   - Make BEGIN_DIR mandatory for asking questions of bridge authorities?
     (but only for bridge descriptors. not for ordinary cache stuff.)
-N   - add a bit in the dir_connection_t. or check whether the linked conn
-      field is set. or whatever is smart. add a macro
-      dir-connection-is-encrypted.
+    o Implement connection_dir_is_encrypted().
     - set up a filter to not answer any bridge descriptors on a
       non-encrypted request
   o write a tor-gencert man page

Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2008-01-10 17:48:32 UTC (rev 13092)
+++ tor/trunk/src/or/directory.c	2008-01-10 17:48:36 UTC (rev 13093)
@@ -718,6 +718,19 @@
   }
 }
 
+/** Return true iff anything we say on <b>conn</b> is being encrypted before
+ * we send it to the client/server. */
+int
+connection_dir_is_encrypted(dir_connection_t *conn)
+{
+  /* Right now it's sufficient to see if conn is or has been linked, since
+   * the only thing it could be linked to is an edge connection on a
+   * circuit, and the only way it could have been unlinked is at the edge
+   * connection getting closed.
+   */
+  return TO_CONN(conn)->linked;
+}
+
 /** Queue an appropriate HTTP command on conn-\>outbuf.  The other args
  * are as in directory_initiate_command.
  */

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2008-01-10 17:48:32 UTC (rev 13092)
+++ tor/trunk/src/or/or.h	2008-01-10 17:48:36 UTC (rev 13093)
@@ -3018,6 +3018,7 @@
 int parse_http_response(const char *headers, int *code, time_t *date,
                         compress_method_t *compression, char **response);
 
+int connection_dir_is_encrypted(dir_connection_t *conn);
 int connection_dir_reached_eof(dir_connection_t *conn);
 int connection_dir_process_inbuf(dir_connection_t *conn);
 int connection_dir_finished_flushing(dir_connection_t *conn);