bugfix: nobody ever implemented EVENT_ADDRMAP for control protocol

version 0, so don't let version 0 controllers ask for it.


svn:r5107
This commit is contained in:
Roger Dingledine 2005-09-21 23:30:15 +00:00
parent f99b91505b
commit f011b12df2

View File

@ -71,6 +71,7 @@ const char control_c_id[] = "$Id$";
#define EVENT_NOTICE_MSG 0x0009 #define EVENT_NOTICE_MSG 0x0009
#define EVENT_WARN_MSG 0x000A #define EVENT_WARN_MSG 0x000A
#define EVENT_ERR_MSG 0x000B #define EVENT_ERR_MSG 0x000B
#define LAST_V0_EVENT 0x000B
#define EVENT_ADDRMAP 0x000C #define EVENT_ADDRMAP 0x000C
#define _EVENT_MAX 0x000C #define _EVENT_MAX 0x000C
@ -522,7 +523,7 @@ send_control0_event(uint16_t event, uint32_t len, const char *body)
size_t buflen; size_t buflen;
char *buf; char *buf;
tor_assert(event >= _EVENT_MIN && event <= _EVENT_MAX); tor_assert(event >= _EVENT_MIN && event <= LAST_V0_EVENT);
buflen = len + 2; buflen = len + 2;
buf = tor_malloc_zero(buflen); buf = tor_malloc_zero(buflen);
@ -837,7 +838,7 @@ handle_control_setevents(connection_t *conn, uint32_t len, const char *body)
for (; len; len -= 2, body += 2) { for (; len; len -= 2, body += 2) {
event_code = ntohs(get_uint16(body)); event_code = ntohs(get_uint16(body));
if (event_code < _EVENT_MIN || event_code > _EVENT_MAX) { if (event_code < _EVENT_MIN || event_code > LAST_V0_EVENT) {
send_control0_error(conn, ERR_UNRECOGNIZED_EVENT_CODE, send_control0_error(conn, ERR_UNRECOGNIZED_EVENT_CODE,
"Unrecognized event code"); "Unrecognized event code");
return 0; return 0;