summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-01-11 15:55:21 -0500
committerNick Mathewson <nickm@torproject.org>2012-01-11 15:56:14 -0500
commit2cddd1d69f58234799f3c46de81a2aa98c349fe9 (patch)
treee1ed2bc58f4378deed4c28ade00ab916aee20218
parent411cf8f71455926db119259545ac8d5c80a5fb58 (diff)
downloadtor-2cddd1d69f58234799f3c46de81a2aa98c349fe9.tar.gz
tor-2cddd1d69f58234799f3c46de81a2aa98c349fe9.zip
Move logging of bad hostnames into parse_extended_hostname
This fixes bug 3325, where a bad .exit would get logged as a bad .onion
-rw-r--r--changes/bug33253
-rw-r--r--src/or/connection_edge.c10
2 files changed, 11 insertions, 2 deletions
diff --git a/changes/bug3325 b/changes/bug3325
new file mode 100644
index 0000000000..d32b54834e
--- /dev/null
+++ b/changes/bug3325
@@ -0,0 +1,3 @@
+ o Minor bugfixes:
+ - When logging about a disallowed .exit name, do not also call it
+ an "invalid onion address". Fixes bug 3325; bugfix on 0.2.2.9-alpha.
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index aba9ba2727..76a7e391f4 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1894,8 +1894,6 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
remapped_to_exit || options->AllowDotExit);
if (addresstype == BAD_HOSTNAME) {
- log_warn(LD_APP, "Invalid onion hostname %s; rejecting",
- safe_str_client(socks->address));
control_event_client_status(LOG_WARN, "SOCKS_BAD_HOSTNAME HOSTNAME=%s",
escaped(socks->address));
connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
@@ -3410,9 +3408,15 @@ connection_ap_can_use_exit(const entry_connection_t *conn, const node_t *exit)
/** If address is of the form "y.onion" with a well-formed handle y:
* Put a NUL after y, lower-case it, and return ONION_HOSTNAME.
*
+ * If address is of the form "y.onion" with a badly-formed handle y:
+ * Return BAD_HOSTNAME and log a message.
+ *
* If address is of the form "y.exit" and <b>allowdotexit</b> is true:
* Put a NUL after y and return EXIT_HOSTNAME.
*
+ * If address is of the form "y.exit" and <b>allowdotexit</b> is false:
+ * Return BAD_HOSTNAME and log a message.
+ *
* Otherwise:
* Return NORMAL_HOSTNAME and change nothing.
*/
@@ -3451,6 +3455,8 @@ parse_extended_hostname(char *address, int allowdotexit)
failed:
/* otherwise, return to previous state and return 0 */
*s = '.';
+ log_warn(LD_APP, "Invalid onion hostname %s; rejecting",
+ safe_str_client(address));
return BAD_HOSTNAME;
}