[tor-bugs] #18760 [Tor]: I'd like to customize rejection message from dir auths to relay
Tor Bug Tracker & Wiki
blackhole at torproject.org
Wed Apr 13 00:01:35 UTC 2016
#18760: I'd like to customize rejection message from dir auths to relay
--------------------------+------------------------------
Reporter: arma | Owner:
Type: enhancement | Status: new
Priority: Medium | Milestone: Tor: 0.2.???
Component: Tor | Version:
Severity: Normal | Resolution:
Keywords: 029-proposed | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor:
--------------------------+------------------------------
Comment (by arma):
For posterity, here was the patch I was running on moria1 before this one:
{{{
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index f012b7b..062d077 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -61,8 +61,8 @@ struct authdir_config_t;
static uint32_t
dirserv_get_status_impl(const char *fp, const char *nickname,
uint32_t addr, uint16_t or_port,
- const char *platform, const char **msg,
- int severity);
+ const char *platform, const char *contact_info,
+ const char **msg, int severity);
static void clear_cached_dir(cached_dir_t *d);
static const signed_descriptor_t *get_signed_descriptor_by_fp(
const char *fp,
@@ -295,7 +295,8 @@ dirserv_router_get_status(const routerinfo_t *router,
const char **msg,
return dirserv_get_status_impl(d, router->nickname,
router->addr, router->or_port,
- router->platform, msg, severity);
+ router->platform, router->contact_info,
+ msg, severity);
}
/** Return true if there is no point in downloading the router described
by
@@ -307,7 +308,7 @@ dirserv_would_reject_router(const routerstatus_t *rs)
res = dirserv_get_status_impl(rs->identity_digest, rs->nickname,
rs->addr, rs->or_port,
- NULL, NULL, LOG_DEBUG);
+ NULL, NULL, NULL, LOG_DEBUG);
return (res & FP_REJECT) != 0;
}
@@ -322,7 +323,8 @@ dirserv_would_reject_router(const routerstatus_t *rs)
static uint32_t
dirserv_get_status_impl(const char *id_digest, const char *nickname,
uint32_t addr, uint16_t or_port,
- const char *platform, const char **msg, int
severity)
+ const char *platform, const char *contact_info,
+ const char **msg, int severity)
{
uint32_t result = 0;
router_status_t *status_by_digest;
@@ -364,10 +366,16 @@ dirserv_get_status_impl(const char *id_digest, const
char *nickname,
}
if (!authdir_policy_permits_address(addr, or_port)) {
- log_fn(severity, LD_DIRSERV, "Rejecting '%s' because of address
'%s'",
- nickname, fmt_addr32(addr));
- if (msg)
- *msg = "Authdir is rejecting routers in this range.";
+ log_fn(severity, LD_DIRSERV,
+ "Rejecting '%s' because of address '%s' (contactinfo %s)",
+ nickname, fmt_addr32(addr),
+ contact_info ? escaped(contact_info) : "not set");
+ if (msg) {
+ if (!contact_info)
+ *msg = "Suspicious relay, no ContactInfo set -- please contact
us?";
+ else
+ *msg = "Authdir is rejecting routers in this range.";
+ }
return FP_REJECT;
}
if (!authdir_policy_valid_address(addr, or_port)) {
}}}
(It didn't really accomplish my goal in this case, since all the jerk
relays I was trying to reach had set their ContactInfo -- but set it to
something generic and useless.)
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18760#comment:9>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list