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

[tor-commits] [tor/master] Restrict fuzzing to the directory headers



commit 584d723e04751330a677e7ce3673fc665713ea0a
Author: teor <teor2345@xxxxxxxxx>
Date:   Mon Dec 12 22:53:11 2016 +1100

    Restrict fuzzing to the directory headers
---
 src/or/directory.c | 12 ++++++------
 src/or/directory.h | 12 ++++++++----
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/or/directory.c b/src/or/directory.c
index 4581163..012d440 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -2895,9 +2895,9 @@ static const url_table_ent_t url_table[] = {
  * conn-\>outbuf.  If the request is unrecognized, send a 404.
  * Return 0 if we handled this successfully, or -1 if we need to close
  * the connection. */
-STATIC int
-directory_handle_command_get(dir_connection_t *conn, const char *headers,
-                             const char *req_body, size_t req_body_len)
+MOCK_IMPL(STATIC int,
+directory_handle_command_get,(dir_connection_t *conn, const char *headers,
+                              const char *req_body, size_t req_body_len))
 {
   char *url, *url_mem, *header;
   time_t if_modified_since = 0;
@@ -3705,9 +3705,9 @@ handle_post_hs_descriptor(const char *url, const char *body)
  * service descriptor.  On finding one, process it and write a
  * response into conn-\>outbuf.  If the request is unrecognized, send a
  * 400.  Always return 0. */
-static int
-directory_handle_command_post(dir_connection_t *conn, const char *headers,
-                              const char *body, size_t body_len)
+MOCK_IMPL(STATIC int,
+directory_handle_command_post,(dir_connection_t *conn, const char *headers,
+                               const char *body, size_t body_len))
 {
   char *url = NULL;
   const or_options_t *options = get_options();
diff --git a/src/or/directory.h b/src/or/directory.h
index 15010d6..8be1f8e 100644
--- a/src/or/directory.h
+++ b/src/or/directory.h
@@ -158,10 +158,14 @@ STATIC int directory_handle_command(dir_connection_t *conn);
 STATIC int parse_http_url(const char *headers, char **url);
 STATIC dirinfo_type_t dir_fetch_type(int dir_purpose, int router_purpose,
                                      const char *resource);
-STATIC int directory_handle_command_get(dir_connection_t *conn,
-                                        const char *headers,
-                                        const char *req_body,
-                                        size_t req_body_len);
+MOCK_DECL(STATIC int, directory_handle_command_get,(dir_connection_t *conn,
+                                                    const char *headers,
+                                                    const char *req_body,
+                                                    size_t req_body_len));
+MOCK_DECL(STATIC int, directory_handle_command_post,(dir_connection_t *conn,
+                                                     const char *headers,
+                                                     const char *body,
+                                                     size_t body_len));
 STATIC int download_status_schedule_get_delay(download_status_t *dls,
                                               const smartlist_t *schedule,
                                               int min_delay, int max_delay,



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits