mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
r11749@Kushana: nickm | 2006-12-29 00:51:42 -0500
Remove dead code; make targets of addressmap commands/configs use AllowNonRFC953Hostnames svn:r9211
This commit is contained in:
parent
0e172d9f6e
commit
6fbf17e7b0
@ -1899,27 +1899,6 @@ tor_dup_addr(uint32_t addr)
|
|||||||
return tor_strdup(buf);
|
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
|
* 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
|
* interface connects to the internet. This address should only be used in
|
||||||
|
@ -202,7 +202,6 @@ int addr_mask_get_bits(uint32_t mask);
|
|||||||
#define INET_NTOA_BUF_LEN 16
|
#define INET_NTOA_BUF_LEN 16
|
||||||
int tor_inet_ntoa(struct in_addr *in, char *buf, size_t buf_len);
|
int tor_inet_ntoa(struct in_addr *in, char *buf, size_t buf_len);
|
||||||
char *tor_dup_addr(uint32_t addr) ATTR_MALLOC;
|
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);
|
int get_interface_address(int severity, uint32_t *addr);
|
||||||
|
|
||||||
/* Process helpers */
|
/* Process helpers */
|
||||||
|
@ -2286,10 +2286,8 @@ options_validate(or_options_t *old_options, or_options_t *options,
|
|||||||
if (options->NatdPort == 0 && options->NatdListenAddress != NULL)
|
if (options->NatdPort == 0 && options->NatdListenAddress != NULL)
|
||||||
REJECT("NatdPort must be defined if NatdListenAddress is defined.");
|
REJECT("NatdPort must be defined if NatdListenAddress is defined.");
|
||||||
|
|
||||||
#if 0 /* don't complain, since a standard configuration does this! */
|
/* Don't gripe about SocksPort 0 with SocksListenAddress set; a standard
|
||||||
if (options->SocksPort == 0 && options->SocksListenAddress != NULL)
|
* configuration does this. */
|
||||||
REJECT("SocksPort must be defined if SocksListenAddress is defined.");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = 0; i < 3; ++i) {
|
for (i = 0; i < 3; ++i) {
|
||||||
int is_socks = i==0;
|
int is_socks = i==0;
|
||||||
@ -3090,10 +3088,7 @@ config_register_addressmaps(or_options_t *options)
|
|||||||
if (smartlist_len(elts) >= 2) {
|
if (smartlist_len(elts) >= 2) {
|
||||||
from = smartlist_get(elts,0);
|
from = smartlist_get(elts,0);
|
||||||
to = smartlist_get(elts,1);
|
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,
|
log_warn(LD_CONFIG,
|
||||||
"Skipping invalid argument '%s' to MapAddress", to);
|
"Skipping invalid argument '%s' to MapAddress", to);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1085,7 +1085,7 @@ addressmap_register_virtual_address(int type, char *new_address)
|
|||||||
/** Return 1 if <b>address</b> has funny characters in it like
|
/** Return 1 if <b>address</b> has funny characters in it like
|
||||||
* colons. Return 0 if it's fine.
|
* colons. Return 0 if it's fine.
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
address_is_invalid_destination(const char *address)
|
address_is_invalid_destination(const char *address)
|
||||||
{
|
{
|
||||||
if (get_options()->AllowNonRFC953Hostnames)
|
if (get_options()->AllowNonRFC953Hostnames)
|
||||||
@ -2091,18 +2091,6 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ)
|
|||||||
tor_free(address);
|
tor_free(address);
|
||||||
return 0;
|
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) {
|
if (or_circ && or_circ->is_first_hop) {
|
||||||
/* Don't let clients use us as a single-hop proxy; it attracts attackers
|
/* 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.
|
* and users who'd be better off with, well, single-hop proxies.
|
||||||
@ -2478,12 +2466,6 @@ connection_ap_can_use_exit(edge_connection_t *conn, routerinfo_t *exit)
|
|||||||
tor_assert(conn->socks_request);
|
tor_assert(conn->socks_request);
|
||||||
tor_assert(exit);
|
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,
|
/* If a particular exit node has been requested for the new connection,
|
||||||
* make sure the exit node of the existing circuit matches exactly.
|
* make sure the exit node of the existing circuit matches exactly.
|
||||||
*/
|
*/
|
||||||
|
@ -1340,17 +1340,7 @@ handle_control_mapaddress(control_connection_t *conn, uint32_t len,
|
|||||||
const char *to = smartlist_get(elts,1);
|
const char *to = smartlist_get(elts,1);
|
||||||
size_t anslen = strlen(line)+512;
|
size_t anslen = strlen(line)+512;
|
||||||
char *ans = tor_malloc(anslen);
|
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) {
|
if (!v0) {
|
||||||
tor_snprintf(ans, anslen,
|
tor_snprintf(ans, anslen,
|
||||||
"512-syntax error: invalid address '%s'", to);
|
"512-syntax error: invalid address '%s'", to);
|
||||||
|
@ -1836,12 +1836,6 @@ directory_handle_command_post(dir_connection_t *conn, char *headers,
|
|||||||
log_fn(LOG_PROTOCOL_WARN, LD_DIRSERV,
|
log_fn(LOG_PROTOCOL_WARN, LD_DIRSERV,
|
||||||
"Rejected rend descriptor (length %d) from %s.",
|
"Rejected rend descriptor (length %d) from %s.",
|
||||||
(int)body_len, conn->_base.address);
|
(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");
|
write_http_status_line(conn, 400, "Invalid service descriptor rejected");
|
||||||
} else {
|
} else {
|
||||||
write_http_status_line(conn, 200, "Service descriptor stored");
|
write_http_status_line(conn, 200, "Service descriptor stored");
|
||||||
|
@ -2088,6 +2088,8 @@ int connection_ap_detach_retriable(edge_connection_t *conn,
|
|||||||
int reason);
|
int reason);
|
||||||
int connection_ap_process_transparent(edge_connection_t *conn);
|
int connection_ap_process_transparent(edge_connection_t *conn);
|
||||||
|
|
||||||
|
int address_is_invalid_destination(const char *address);
|
||||||
|
|
||||||
void addressmap_init(void);
|
void addressmap_init(void);
|
||||||
void addressmap_clean(time_t now);
|
void addressmap_clean(time_t now);
|
||||||
void addressmap_clear_configured(void);
|
void addressmap_clear_configured(void);
|
||||||
|
@ -882,14 +882,6 @@ rep_hist_note_used_resolve(time_t now)
|
|||||||
rep_hist_note_used_port(80, now);
|
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. */
|
/** The last time at which we needed an internal circ. */
|
||||||
static time_t predicted_internal_time = 0;
|
static time_t predicted_internal_time = 0;
|
||||||
/** The last time we needed an internal circ with good uptime. */
|
/** The last time we needed an internal circ with good uptime. */
|
||||||
|
Loading…
Reference in New Issue
Block a user