diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-03-23 08:40:11 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-03-23 08:40:11 +0000 |
commit | b9016bd18faa5d470fad0c57985449c5d5c6fcb6 (patch) | |
tree | 412b8ed38b1a60c6f2ebca9b27718d813f78409c /src/or/control.c | |
parent | 291548c4e434b15b6eb34b9cc9a155d9d11c0527 (diff) | |
download | tor-b9016bd18faa5d470fad0c57985449c5d5c6fcb6.tar tor-b9016bd18faa5d470fad0c57985449c5d5c6fcb6.tar.gz |
Fix several bugs (including some crashes) related to control interface; implement missing desc/name functionality.
svn:r3836
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/or/control.c b/src/or/control.c index 3114dbf2d..8eed8a682 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -329,7 +329,7 @@ handle_control_getconf(connection_t *conn, uint32_t body_len, const char *body) { int recognized = config_option_is_recognized(q); if (!recognized) { - send_control_error(conn, ERR_UNRECOGNIZED_CONFIG_KEY, body); + send_control_error(conn, ERR_UNRECOGNIZED_CONFIG_KEY, q); goto done; } else { struct config_line_t *answer = config_get_assigned_option(options,q); @@ -508,7 +508,7 @@ handle_control_mapaddress(connection_t *conn, uint32_t len, const char *body) } else if (!is_plausible_address(to)) { log_fn(LOG_WARN,"Skipping invalid argument '%s' in MapAddress msg",to); } else if (!strcmp(from, ".") || !strcmp(from, "0.0.0.0")) { - char *addr = addressmap_register_virtual_address( + const char *addr = addressmap_register_virtual_address( strcmp(from,".") ? RESOLVED_TYPE_HOSTNAME : RESOLVED_TYPE_IPV4, tor_strdup(to)); if (!addr) { @@ -518,7 +518,6 @@ handle_control_mapaddress(connection_t *conn, uint32_t len, const char *body) size_t anslen = strlen(addr)+strlen(to)+2; char *ans = tor_malloc(anslen); tor_snprintf(ans, anslen, "%s %s", addr, to); - tor_free(addr); smartlist_add(reply, ans); } } else { @@ -557,6 +556,10 @@ handle_getinfo_helper(const char *question, char **answer) routerinfo_t *ri = router_get_by_hexdigest(question+strlen("desc/id/")); if (ri && ri->signed_descriptor) *answer = tor_strdup(ri->signed_descriptor); + } else if (!strcmpstart(question, "desc/name/")) { + routerinfo_t *ri = router_get_by_nickname(question+strlen("desc/name/")); + if (ri && ri->signed_descriptor) + *answer = tor_strdup(ri->signed_descriptor); } else if (!strcmp(question, "network-status")) { if (list_server_status(NULL, answer) < 0) return -1; |