aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-08-01 11:44:52 -0400
committerNick Mathewson <nickm@torproject.org>2013-08-15 12:03:37 -0400
commit4526c3e0b617bd179bb0728ac2ea438e9a2276ed (patch)
tree9a533b4a54c1699ccb4973fad2bfa3a21a5600c2 /src/or
parentb64351ed17f3d30425e1e007de50ef66c2b6c789 (diff)
downloadtor-4526c3e0b617bd179bb0728ac2ea438e9a2276ed.tar.gz
tor-4526c3e0b617bd179bb0728ac2ea438e9a2276ed.zip
Unit test for basic ext_or_cookie authentication backend
Diffstat (limited to 'src/or')
-rw-r--r--src/or/ext_orport.c8
-rw-r--r--src/or/ext_orport.h8
2 files changed, 12 insertions, 4 deletions
diff --git a/src/or/ext_orport.c b/src/or/ext_orport.c
index f4df1b7484..ec7c6c5a8b 100644
--- a/src/or/ext_orport.c
+++ b/src/or/ext_orport.c
@@ -105,11 +105,11 @@ connection_ext_or_transition(or_connection_t *conn)
/** If true, we've set ext_or_auth_cookie to a secret code and stored
* it to disk. */
-static int ext_or_auth_cookie_is_set = 0;
+STATIC int ext_or_auth_cookie_is_set = 0;
/** If ext_or_auth_cookie_is_set, a secret cookie that we've stored to disk
* and which we're using to authenticate controllers. (If the controller can
* read it off disk, it has permission to connect.) */
-static char ext_or_auth_cookie[EXT_OR_PORT_AUTH_COOKIE_LEN] = {0};
+STATIC char ext_or_auth_cookie[EXT_OR_PORT_AUTH_COOKIE_LEN] = {0};
/** Helper: Return a newly allocated string containing a path to the
* file where we store our authentication cookie. */
@@ -198,10 +198,10 @@ connection_ext_or_auth_neg_auth_type(connection_t *conn)
}
/** DOCDOC */
-static int
+STATIC int
handle_client_auth_nonce(const char *client_nonce, size_t client_nonce_len,
char **client_hash_out,
- char**reply_out, size_t *reply_len_out)
+ char **reply_out, size_t *reply_len_out)
{
char server_hash[EXT_OR_PORT_AUTH_HASH_LEN] = {0};
char server_nonce[EXT_OR_PORT_AUTH_NONCE_LEN] = {0};
diff --git a/src/or/ext_orport.h b/src/or/ext_orport.h
index 35b92ad63f..2d15c18aad 100644
--- a/src/or/ext_orport.h
+++ b/src/or/ext_orport.h
@@ -27,6 +27,14 @@ STATIC int connection_write_ext_or_command(connection_t *conn,
uint16_t command,
const char *body,
size_t bodylen);
+STATIC int handle_client_auth_nonce(const char *client_nonce,
+ size_t client_nonce_len,
+ char **client_hash_out,
+ char **reply_out, size_t *reply_len_out);
+#ifdef TOR_UNIT_TESTS
+extern char ext_or_auth_cookie[];
+extern int ext_or_auth_cookie_is_set;
+#endif
#endif
#endif