mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 06:33:44 +01:00
r7302@Kushana: nickm | 2006-08-10 01:48:44 -0700
Warn about open TransListenAddress values. svn:r7010
This commit is contained in:
parent
cd560d8528
commit
74df271e00
@ -2069,23 +2069,31 @@ options_validate(or_options_t *old_options, or_options_t *options,
|
|||||||
REJECT("SocksPort must be defined if SocksListenAddress is defined.");
|
REJECT("SocksPort must be defined if SocksListenAddress is defined.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* XXX TransListenAddress should be checked here as well */
|
for (i = 0; i < 2; ++i) {
|
||||||
if (options->SocksListenAddress) {
|
int is_socks = i==0;
|
||||||
config_line_t *line = NULL;
|
config_line_t *line, *opt, *old;
|
||||||
|
if (is_socks) {
|
||||||
|
opt = options->SocksListenAddress;
|
||||||
|
old = old_options->SocksListenAddress;
|
||||||
|
} else {
|
||||||
|
opt = options->TransListenAddress;
|
||||||
|
old = old_options->TransListenAddress;
|
||||||
|
}
|
||||||
|
const char *tp = is_socks ? "SOCKS proxy" : "transparent proxy";
|
||||||
|
|
||||||
|
for (line = opt; line; line = line->next) {
|
||||||
char *address = NULL;
|
char *address = NULL;
|
||||||
for (line = options->SocksListenAddress; line; line = line->next) {
|
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
uint32_t addr;
|
uint32_t addr;
|
||||||
if (parse_addr_port(LOG_WARN, line->value, &address, &addr, &port)<0)
|
if (parse_addr_port(LOG_WARN, line->value, &address, &addr, &port)<0)
|
||||||
continue; /* We'll warn about this later. */
|
continue; /* We'll warn about this later. */
|
||||||
if (!is_internal_IP(addr, 1) &&
|
if (!is_internal_IP(addr, 1) &&
|
||||||
(!old_options || !config_lines_eq(old_options->SocksListenAddress,
|
(!old_options || !config_lines_eq(old, opt))) {
|
||||||
options->SocksListenAddress))) {
|
|
||||||
log_warn(LD_CONFIG,
|
log_warn(LD_CONFIG,
|
||||||
"You specified a public address '%s' for a SOCKS listener. Other "
|
"You specified a public address '%s' for a %s listener. Other "
|
||||||
"people on the Internet might find your computer and use it as "
|
"people on the Internet might find your computer and use it as "
|
||||||
"an open SOCKS proxy. Please don't allow this unless you have "
|
"an open %s proxy. Please don't allow this unless you have "
|
||||||
"a good reason.", address);
|
"a good reason.", address, tp, tp);
|
||||||
}
|
}
|
||||||
tor_free(address);
|
tor_free(address);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user