mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
Remove the AUTHDIR_NEWDESCS feature: nobody is using it any more
If somebody asks for it, log a warning. Closes ticket 22377.
This commit is contained in:
parent
f9cd870f50
commit
408ed52e3d
4
changes/ticket22377
Normal file
4
changes/ticket22377
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
o Removed features:
|
||||||
|
- The controller API no longer includes an AUTHDIR_NEWDESCS event:
|
||||||
|
nobody was using it any longer. Closes ticket 22377.
|
||||||
|
|
@ -1154,7 +1154,6 @@ static const struct control_event_t control_event_table[] = {
|
|||||||
{ EVENT_ERR_MSG, "ERR" },
|
{ EVENT_ERR_MSG, "ERR" },
|
||||||
{ EVENT_NEW_DESC, "NEWDESC" },
|
{ EVENT_NEW_DESC, "NEWDESC" },
|
||||||
{ EVENT_ADDRMAP, "ADDRMAP" },
|
{ EVENT_ADDRMAP, "ADDRMAP" },
|
||||||
{ EVENT_AUTHDIR_NEWDESCS, "AUTHDIR_NEWDESCS" },
|
|
||||||
{ EVENT_DESCCHANGED, "DESCCHANGED" },
|
{ EVENT_DESCCHANGED, "DESCCHANGED" },
|
||||||
{ EVENT_NS, "NS" },
|
{ EVENT_NS, "NS" },
|
||||||
{ EVENT_STATUS_GENERAL, "STATUS_GENERAL" },
|
{ EVENT_STATUS_GENERAL, "STATUS_GENERAL" },
|
||||||
@ -1194,7 +1193,10 @@ handle_control_setevents(control_connection_t *conn, uint32_t len,
|
|||||||
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
|
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
|
||||||
SMARTLIST_FOREACH_BEGIN(events, const char *, ev)
|
SMARTLIST_FOREACH_BEGIN(events, const char *, ev)
|
||||||
{
|
{
|
||||||
if (!strcasecmp(ev, "EXTENDED")) {
|
if (!strcasecmp(ev, "EXTENDED") ||
|
||||||
|
!strcasecmp(ev, "AUTHDIR_NEWDESCS")) {
|
||||||
|
log_warn(LD_CONTROL, "The \"%s\" SETEVENTS argument is no longer "
|
||||||
|
"supported.", ev);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
@ -6053,47 +6055,6 @@ control_event_address_mapped(const char *from, const char *to, time_t expires,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The authoritative dirserver has received a new descriptor that
|
|
||||||
* has passed basic syntax checks and is properly self-signed.
|
|
||||||
*
|
|
||||||
* Notify any interested party of the new descriptor and what has
|
|
||||||
* been done with it, and also optionally give an explanation/reason. */
|
|
||||||
int
|
|
||||||
control_event_or_authdir_new_descriptor(const char *action,
|
|
||||||
const char *desc, size_t desclen,
|
|
||||||
const char *msg)
|
|
||||||
{
|
|
||||||
char firstline[1024];
|
|
||||||
char *buf;
|
|
||||||
size_t totallen;
|
|
||||||
char *esc = NULL;
|
|
||||||
size_t esclen;
|
|
||||||
|
|
||||||
if (!EVENT_IS_INTERESTING(EVENT_AUTHDIR_NEWDESCS))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
tor_snprintf(firstline, sizeof(firstline),
|
|
||||||
"650+AUTHDIR_NEWDESC=\r\n%s\r\n%s\r\n",
|
|
||||||
action,
|
|
||||||
msg ? msg : "");
|
|
||||||
|
|
||||||
/* Escape the server descriptor properly */
|
|
||||||
esclen = write_escaped_data(desc, desclen, &esc);
|
|
||||||
|
|
||||||
totallen = strlen(firstline) + esclen + 1;
|
|
||||||
buf = tor_malloc(totallen);
|
|
||||||
strlcpy(buf, firstline, totallen);
|
|
||||||
strlcpy(buf+strlen(firstline), esc, totallen);
|
|
||||||
send_control_event_string(EVENT_AUTHDIR_NEWDESCS,
|
|
||||||
buf);
|
|
||||||
send_control_event_string(EVENT_AUTHDIR_NEWDESCS,
|
|
||||||
"650 OK\r\n");
|
|
||||||
tor_free(esc);
|
|
||||||
tor_free(buf);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Cached liveness for network liveness events and GETINFO
|
/** Cached liveness for network liveness events and GETINFO
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ void connection_control_closed(control_connection_t *conn);
|
|||||||
|
|
||||||
int connection_control_process_inbuf(control_connection_t *conn);
|
int connection_control_process_inbuf(control_connection_t *conn);
|
||||||
|
|
||||||
#define EVENT_AUTHDIR_NEWDESCS 0x000D
|
|
||||||
#define EVENT_NS 0x000F
|
#define EVENT_NS 0x000F
|
||||||
int control_event_is_interesting(int event);
|
int control_event_is_interesting(int event);
|
||||||
|
|
||||||
@ -64,10 +63,6 @@ int control_event_descriptors_changed(smartlist_t *routers);
|
|||||||
int control_event_address_mapped(const char *from, const char *to,
|
int control_event_address_mapped(const char *from, const char *to,
|
||||||
time_t expires, const char *error,
|
time_t expires, const char *error,
|
||||||
const int cached);
|
const int cached);
|
||||||
int control_event_or_authdir_new_descriptor(const char *action,
|
|
||||||
const char *desc,
|
|
||||||
size_t desclen,
|
|
||||||
const char *msg);
|
|
||||||
int control_event_my_descriptor_changed(void);
|
int control_event_my_descriptor_changed(void);
|
||||||
int control_event_network_liveness_update(int liveness);
|
int control_event_network_liveness_update(int liveness);
|
||||||
int control_event_networkstatus_changed(smartlist_t *statuses);
|
int control_event_networkstatus_changed(smartlist_t *statuses);
|
||||||
@ -169,8 +164,8 @@ void control_free_all(void);
|
|||||||
#define EVENT_WARN_MSG 0x000A
|
#define EVENT_WARN_MSG 0x000A
|
||||||
#define EVENT_ERR_MSG 0x000B
|
#define EVENT_ERR_MSG 0x000B
|
||||||
#define EVENT_ADDRMAP 0x000C
|
#define EVENT_ADDRMAP 0x000C
|
||||||
/* Exposed above */
|
/* There was an AUTHDIR_NEWDESCS event, but it no longer exists. We
|
||||||
// #define EVENT_AUTHDIR_NEWDESCS 0x000D
|
can reclaim 0x000D. */
|
||||||
#define EVENT_DESCCHANGED 0x000E
|
#define EVENT_DESCCHANGED 0x000E
|
||||||
/* Exposed above */
|
/* Exposed above */
|
||||||
// #define EVENT_NS 0x000F
|
// #define EVENT_NS 0x000F
|
||||||
|
@ -673,9 +673,6 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
|
|||||||
ri->nickname, source, (int)ri->cache_info.signed_descriptor_len,
|
ri->nickname, source, (int)ri->cache_info.signed_descriptor_len,
|
||||||
MAX_DESCRIPTOR_UPLOAD_SIZE);
|
MAX_DESCRIPTOR_UPLOAD_SIZE);
|
||||||
*msg = "Router descriptor was too large.";
|
*msg = "Router descriptor was too large.";
|
||||||
control_event_or_authdir_new_descriptor("REJECTED",
|
|
||||||
ri->cache_info.signed_descriptor_body,
|
|
||||||
desclen, *msg);
|
|
||||||
r = ROUTER_AUTHDIR_REJECTS;
|
r = ROUTER_AUTHDIR_REJECTS;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -694,9 +691,6 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
|
|||||||
router_describe(ri), source);
|
router_describe(ri), source);
|
||||||
*msg = "Not replacing router descriptor; no information has changed since "
|
*msg = "Not replacing router descriptor; no information has changed since "
|
||||||
"the last one with this identity.";
|
"the last one with this identity.";
|
||||||
control_event_or_authdir_new_descriptor("DROPPED",
|
|
||||||
ri->cache_info.signed_descriptor_body,
|
|
||||||
desclen, *msg);
|
|
||||||
r = ROUTER_IS_ALREADY_KNOWN;
|
r = ROUTER_IS_ALREADY_KNOWN;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -709,9 +703,6 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
|
|||||||
if (ed25519_validate_pubkey(pkey) < 0) {
|
if (ed25519_validate_pubkey(pkey) < 0) {
|
||||||
log_warn(LD_DIRSERV, "Received bad key from %s (source %s)",
|
log_warn(LD_DIRSERV, "Received bad key from %s (source %s)",
|
||||||
router_describe(ri), source);
|
router_describe(ri), source);
|
||||||
control_event_or_authdir_new_descriptor("REJECTED",
|
|
||||||
ri->cache_info.signed_descriptor_body,
|
|
||||||
desclen, *msg);
|
|
||||||
routerinfo_free(ri);
|
routerinfo_free(ri);
|
||||||
return ROUTER_AUTHDIR_REJECTS;
|
return ROUTER_AUTHDIR_REJECTS;
|
||||||
}
|
}
|
||||||
@ -749,14 +740,11 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
|
|||||||
r = router_add_to_routerlist(ri, msg, 0, 0);
|
r = router_add_to_routerlist(ri, msg, 0, 0);
|
||||||
if (!WRA_WAS_ADDED(r)) {
|
if (!WRA_WAS_ADDED(r)) {
|
||||||
/* unless the routerinfo was fine, just out-of-date */
|
/* unless the routerinfo was fine, just out-of-date */
|
||||||
if (WRA_WAS_REJECTED(r))
|
|
||||||
control_event_or_authdir_new_descriptor("REJECTED", desc, desclen, *msg);
|
|
||||||
log_info(LD_DIRSERV,
|
log_info(LD_DIRSERV,
|
||||||
"Did not add descriptor from '%s' (source: %s): %s.",
|
"Did not add descriptor from '%s' (source: %s): %s.",
|
||||||
nickname, source, *msg ? *msg : "(no message)");
|
nickname, source, *msg ? *msg : "(no message)");
|
||||||
} else {
|
} else {
|
||||||
smartlist_t *changed;
|
smartlist_t *changed;
|
||||||
control_event_or_authdir_new_descriptor("ACCEPTED", desc, desclen, *msg);
|
|
||||||
|
|
||||||
changed = smartlist_new();
|
changed = smartlist_new();
|
||||||
smartlist_add(changed, ri);
|
smartlist_add(changed, ri);
|
||||||
|
Loading…
Reference in New Issue
Block a user