Disable the SETROUTERPURPOSE controller command: it is now obsolete.

svn:r11891
This commit is contained in:
Roger Dingledine 2007-10-11 22:19:47 +00:00
parent 5c4a00e796
commit ad8757fbeb
4 changed files with 25 additions and 38 deletions

View File

@ -7,6 +7,8 @@ Changes in version 0.2.0.8-alpha - 2007-10-12
- Use annotations to record the time we received each descriptor. - Use annotations to record the time we received each descriptor.
- Use annotations to record the source for each descriptor. - Use annotations to record the source for each descriptor.
- Use annotations to record the purpose of each descriptor. - Use annotations to record the purpose of each descriptor.
- Disable the SETROUTERPURPOSE controller command: it is now
obsolete.
- Bridge authorities now write bridge descriptors to disk, meaning - Bridge authorities now write bridge descriptors to disk, meaning
we can export them to other programs and begin distributing them we can export them to other programs and begin distributing them
to blocked users. to blocked users.
@ -113,7 +115,7 @@ Changes in version 0.2.0.8-alpha - 2007-10-12
Bugfix in 0.2.0.7-alpha. Bugfix in 0.2.0.7-alpha.
- Fix a minor memory leak whenever we parse guards from our state - Fix a minor memory leak whenever we parse guards from our state
file. Bugfix on 0.2.0.7-alpha. file. Bugfix on 0.2.0.7-alpha.
- Fix a minor memory leak whenever we wrote out a file. Bugfix on - Fix a minor memory leak whenever we write out a file. Bugfix on
0.2.0.7-alpha. 0.2.0.7-alpha.
- Fix a minor memory leak whenever a controller sends the PROTOCOLINFO - Fix a minor memory leak whenever a controller sends the PROTOCOLINFO
command. Bugfix on 0.2.0.5-alpha. command. Bugfix on 0.2.0.5-alpha.

View File

@ -172,7 +172,7 @@ N . Cache for bridge descriptors
o Set annotations based on purpose o Set annotations based on purpose
o Preserve routers with unrecognized purpose. o Preserve routers with unrecognized purpose.
R - Stop setting the do-not-cache flag based on purpose. R - Stop setting the do-not-cache flag based on purpose.
- Disable and mark as obsolete the setrouterpurpose controller o Disable and mark as obsolete the setrouterpurpose controller
command. command.
- Bridges operators (rudimentary version) - Bridges operators (rudimentary version)
- Ability to act as dir cache without a dir port. - Ability to act as dir cache without a dir port.

View File

@ -590,6 +590,10 @@ $Id$
This changes the descriptor's purpose. See +POSTDESCRIPTOR below This changes the descriptor's purpose. See +POSTDESCRIPTOR below
for details. for details.
NOTE: This command was disabled and made obsolete as of Tor
0.2.0.8-alpha. It doesn't exist anymore, and is listed here only for
historical interest.
3.13. ATTACHSTREAM 3.13. ATTACHSTREAM
Sent from the client to the server. The syntax is: Sent from the client to the server. The syntax is:

View File

@ -116,8 +116,7 @@ static int handle_control_getinfo(control_connection_t *conn, uint32_t len,
static int handle_control_extendcircuit(control_connection_t *conn, static int handle_control_extendcircuit(control_connection_t *conn,
uint32_t len, uint32_t len,
const char *body); const char *body);
static int handle_control_setpurpose(control_connection_t *conn, static int handle_control_setcircuitpurpose(control_connection_t *conn,
int for_circuits,
uint32_t len, const char *body); uint32_t len, const char *body);
static int handle_control_attachstream(control_connection_t *conn, static int handle_control_attachstream(control_connection_t *conn,
uint32_t len, uint32_t len,
@ -262,7 +261,7 @@ control_event_is_interesting(int event)
} }
/** Append a NUL-terminated string <b>s</b> to the end of /** Append a NUL-terminated string <b>s</b> to the end of
* <b>conn</b>-\>outbuf * <b>conn</b>-\>outbuf.
*/ */
static INLINE void static INLINE void
connection_write_str_to_buf(const char *s, control_connection_t *conn) connection_write_str_to_buf(const char *s, control_connection_t *conn)
@ -448,7 +447,7 @@ connection_printf_to_buf(control_connection_t *conn, const char *format, ...)
connection_write_to_buf(buf, len, TO_CONN(conn)); connection_write_to_buf(buf, len, TO_CONN(conn));
} }
/** Send a "DONE" message down the control connection <b>conn</b> */ /** Send a "DONE" message down the control connection <b>conn</b>. */
static void static void
send_control_done(control_connection_t *conn) send_control_done(control_connection_t *conn)
{ {
@ -2039,53 +2038,36 @@ handle_control_extendcircuit(control_connection_t *conn, uint32_t len,
return 0; return 0;
} }
/** Called when we get a SETCIRCUITPURPOSE (if <b>for_circuits</b> /** Called when we get a SETCIRCUITPURPOSE message. If we can find the
* is 1) or SETROUTERPURPOSE message. If we can find * circuit and it's a valid purpose, change it. */
* the circuit/router and it's a valid purpose, change it. */
static int static int
handle_control_setpurpose(control_connection_t *conn, int for_circuits, handle_control_setcircuitpurpose(control_connection_t *conn,
uint32_t len, const char *body) uint32_t len, const char *body)
{ {
/* XXXX020 this should maybe be two functions; almost no code is acutally
shared. */
origin_circuit_t *circ = NULL; origin_circuit_t *circ = NULL;
routerinfo_t *ri = NULL;
uint8_t new_purpose; uint8_t new_purpose;
smartlist_t *args; smartlist_t *args;
const char *command =
for_circuits ? "SETCIRCUITPURPOSE" : "SETROUTERPURPOSE";
(void) len; /* body is nul-terminated, so it's safe to ignore the length. */ (void) len; /* body is nul-terminated, so it's safe to ignore the length. */
args = getargs_helper(command, conn, body, 2, -1); args = getargs_helper("SETCIRCUITPURPOSE", conn, body, 2, -1);
if (!args) if (!args)
goto done; goto done;
if (for_circuits) {
if (!(circ = get_circ(smartlist_get(args,0)))) { if (!(circ = get_circ(smartlist_get(args,0)))) {
connection_printf_to_buf(conn, "552 Unknown circuit \"%s\"\r\n", connection_printf_to_buf(conn, "552 Unknown circuit \"%s\"\r\n",
(char*)smartlist_get(args, 0)); (char*)smartlist_get(args, 0));
goto done; goto done;
} }
} else {
if (!(ri = router_get_by_nickname(smartlist_get(args,0), 0))) {
connection_printf_to_buf(conn, "552 Unknown router \"%s\"\r\n",
(char*)smartlist_get(args, 0));
goto done;
}
}
{ {
char *purp = smartlist_get(args,1); char *purp = smartlist_get(args,1);
if (get_purpose(&purp, for_circuits, &new_purpose) < 0) { if (get_purpose(&purp, 1, &new_purpose) < 0) {
connection_printf_to_buf(conn, "552 Unknown purpose \"%s\"\r\n", purp); connection_printf_to_buf(conn, "552 Unknown purpose \"%s\"\r\n", purp);
goto done; goto done;
} }
} }
if (for_circuits)
circ->_base.purpose = new_purpose; circ->_base.purpose = new_purpose;
else
ri->purpose = new_purpose;
connection_write_str_to_buf("250 OK\r\n", conn); connection_write_str_to_buf("250 OK\r\n", conn);
done: done:
@ -2695,11 +2677,10 @@ connection_control_process_inbuf(control_connection_t *conn)
if (handle_control_extendcircuit(conn, data_len, args)) if (handle_control_extendcircuit(conn, data_len, args))
return -1; return -1;
} else if (!strcasecmp(conn->incoming_cmd, "SETCIRCUITPURPOSE")) { } else if (!strcasecmp(conn->incoming_cmd, "SETCIRCUITPURPOSE")) {
if (handle_control_setpurpose(conn, 1, data_len, args)) if (handle_control_setcircuitpurpose(conn, data_len, args))
return -1; return -1;
} else if (!strcasecmp(conn->incoming_cmd, "SETROUTERPURPOSE")) { } else if (!strcasecmp(conn->incoming_cmd, "SETROUTERPURPOSE")) {
if (handle_control_setpurpose(conn, 0, data_len, args)) connection_write_str_to_buf("511 SETROUTERPURPOSE is obsolete.\r\n", conn);
return -1;
} else if (!strcasecmp(conn->incoming_cmd, "ATTACHSTREAM")) { } else if (!strcasecmp(conn->incoming_cmd, "ATTACHSTREAM")) {
if (handle_control_attachstream(conn, data_len, args)) if (handle_control_attachstream(conn, data_len, args))
return -1; return -1;