[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r9211: Remove dead code; make targets of addressmap commands/config (in tor/trunk: . src/common src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r9211: Remove dead code; make targets of addressmap commands/config (in tor/trunk: . src/common src/or)
- From: nickm@xxxxxxxx
- Date: Fri, 29 Dec 2006 00:52:49 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Fri, 29 Dec 2006 00:53:27 -0500
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2006-12-29 00:51:50 -0500 (Fri, 29 Dec 2006)
New Revision: 9211
Modified:
tor/trunk/
tor/trunk/src/common/util.c
tor/trunk/src/common/util.h
tor/trunk/src/or/config.c
tor/trunk/src/or/connection_edge.c
tor/trunk/src/or/control.c
tor/trunk/src/or/directory.c
tor/trunk/src/or/or.h
tor/trunk/src/or/rephist.c
Log:
r11749@Kushana: nickm | 2006-12-29 00:51:42 -0500
Remove dead code; make targets of addressmap commands/configs use AllowNonRFC953Hostnames
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r11749] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/src/common/util.c
===================================================================
--- tor/trunk/src/common/util.c 2006-12-29 05:07:25 UTC (rev 9210)
+++ tor/trunk/src/common/util.c 2006-12-29 05:51:50 UTC (rev 9211)
@@ -1899,27 +1899,6 @@
return tor_strdup(buf);
}
-/* Return true iff <b>name</b> looks like it might be a hostname,
- * nickname, key, or IP address of some kind, suitable for the
- * controller's "mapaddress" command. */
-int
-is_plausible_address(const char *name)
-{
-// const char *cp;
- tor_assert(name);
- /* We could check better here. */
- if (!*name)
- return 0;
-#if 0
- for (cp=name; *cp; cp++) {
- if (*cp != '.' && *cp != '-' && !TOR_ISALNUM(*cp))
- return 0;
- }
-#endif
-
- return 1;
-}
-
/**
* Set *<b>addr</b> to the host-order IPv4 address (if any) of whatever
* interface connects to the internet. This address should only be used in
Modified: tor/trunk/src/common/util.h
===================================================================
--- tor/trunk/src/common/util.h 2006-12-29 05:07:25 UTC (rev 9210)
+++ tor/trunk/src/common/util.h 2006-12-29 05:51:50 UTC (rev 9211)
@@ -202,7 +202,6 @@
#define INET_NTOA_BUF_LEN 16
int tor_inet_ntoa(struct in_addr *in, char *buf, size_t buf_len);
char *tor_dup_addr(uint32_t addr) ATTR_MALLOC;
-int is_plausible_address(const char *name);
int get_interface_address(int severity, uint32_t *addr);
/* Process helpers */
Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c 2006-12-29 05:07:25 UTC (rev 9210)
+++ tor/trunk/src/or/config.c 2006-12-29 05:51:50 UTC (rev 9211)
@@ -2286,10 +2286,8 @@
if (options->NatdPort == 0 && options->NatdListenAddress != NULL)
REJECT("NatdPort must be defined if NatdListenAddress is defined.");
-#if 0 /* don't complain, since a standard configuration does this! */
- if (options->SocksPort == 0 && options->SocksListenAddress != NULL)
- REJECT("SocksPort must be defined if SocksListenAddress is defined.");
-#endif
+ /* Don't gripe about SocksPort 0 with SocksListenAddress set; a standard
+ * configuration does this. */
for (i = 0; i < 3; ++i) {
int is_socks = i==0;
@@ -3090,11 +3088,8 @@
if (smartlist_len(elts) >= 2) {
from = smartlist_get(elts,0);
to = smartlist_get(elts,1);
- if (!is_plausible_address(from)) {
+ if (address_is_invalid_destination(to)) {
log_warn(LD_CONFIG,
- "Skipping invalid argument '%s' to MapAddress", from);
- } else if (!is_plausible_address(to)) {
- log_warn(LD_CONFIG,
"Skipping invalid argument '%s' to MapAddress", to);
} else {
addressmap_register(from, tor_strdup(to), 0);
Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c 2006-12-29 05:07:25 UTC (rev 9210)
+++ tor/trunk/src/or/connection_edge.c 2006-12-29 05:51:50 UTC (rev 9211)
@@ -1085,7 +1085,7 @@
/** Return 1 if <b>address</b> has funny characters in it like
* colons. Return 0 if it's fine.
*/
-static int
+int
address_is_invalid_destination(const char *address)
{
if (get_options()->AllowNonRFC953Hostnames)
@@ -2091,18 +2091,6 @@
tor_free(address);
return 0;
}
-#if 0
- if (!tor_strisprint(address)) {
- log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
- "Non-printing characters in address %s in relay "
- "begin cell. Closing.", escaped(address));
- end_payload[0] = END_STREAM_REASON_TORPROTOCOL;
- relay_send_command_from_edge(rh.stream_id, circ, RELAY_COMMAND_END,
- end_payload, 1, NULL);
- tor_free(address);
- return 0;
- }
-#endif
if (or_circ && or_circ->is_first_hop) {
/* Don't let clients use us as a single-hop proxy; it attracts attackers
* and users who'd be better off with, well, single-hop proxies.
@@ -2478,12 +2466,6 @@
tor_assert(conn->socks_request);
tor_assert(exit);
-#if 0
- log_fn(LOG_DEBUG,"considering nickname %s, for address %s / port %d:",
- exit->nickname, safe_str(conn->socks_request->address),
- conn->socks_request->port);
-#endif
-
/* If a particular exit node has been requested for the new connection,
* make sure the exit node of the existing circuit matches exactly.
*/
Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c 2006-12-29 05:07:25 UTC (rev 9210)
+++ tor/trunk/src/or/control.c 2006-12-29 05:51:50 UTC (rev 9211)
@@ -1340,19 +1340,9 @@
const char *to = smartlist_get(elts,1);
size_t anslen = strlen(line)+512;
char *ans = tor_malloc(anslen);
- if (!is_plausible_address(from)) {
+ if (address_is_invalid_destination(to)) {
if (!v0) {
tor_snprintf(ans, anslen,
- "512-syntax error: invalid address '%s'", from);
- smartlist_add(reply, ans);
- } else
- tor_free(ans); /* don't respond if v0 */
- log_warn(LD_CONTROL,
- "Skipping invalid argument '%s' in MapAddress msg",
- from);
- } else if (!is_plausible_address(to)) {
- if (!v0) {
- tor_snprintf(ans, anslen,
"512-syntax error: invalid address '%s'", to);
smartlist_add(reply, ans);
} else
Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c 2006-12-29 05:07:25 UTC (rev 9210)
+++ tor/trunk/src/or/directory.c 2006-12-29 05:51:50 UTC (rev 9211)
@@ -1836,12 +1836,6 @@
log_fn(LOG_PROTOCOL_WARN, LD_DIRSERV,
"Rejected rend descriptor (length %d) from %s.",
(int)body_len, conn->_base.address);
-#if 0
- if (body_len <= 1024) {
- base16_encode(tmp, sizeof(tmp), body, body_len);
- log_notice(LD_DIRSERV,"Body was: %s", escaped(tmp));
- }
-#endif
write_http_status_line(conn, 400, "Invalid service descriptor rejected");
} else {
write_http_status_line(conn, 200, "Service descriptor stored");
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2006-12-29 05:07:25 UTC (rev 9210)
+++ tor/trunk/src/or/or.h 2006-12-29 05:51:50 UTC (rev 9211)
@@ -2088,6 +2088,8 @@
int reason);
int connection_ap_process_transparent(edge_connection_t *conn);
+int address_is_invalid_destination(const char *address);
+
void addressmap_init(void);
void addressmap_clean(time_t now);
void addressmap_clear_configured(void);
Modified: tor/trunk/src/or/rephist.c
===================================================================
--- tor/trunk/src/or/rephist.c 2006-12-29 05:07:25 UTC (rev 9210)
+++ tor/trunk/src/or/rephist.c 2006-12-29 05:51:50 UTC (rev 9211)
@@ -882,14 +882,6 @@
rep_hist_note_used_port(80, now);
}
-#if 0
-int
-rep_hist_get_predicted_resolve(time_t now)
-{
- return 0;
-}
-#endif
-
/** The last time at which we needed an internal circ. */
static time_t predicted_internal_time = 0;
/** The last time we needed an internal circ with good uptime. */