[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] bugfix: nobody ever implemented EVENT_ADDRMAP for control p...



Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	control.c 
Log Message:
bugfix: nobody ever implemented EVENT_ADDRMAP for control protocol
version 0, so don't let version 0 controllers ask for it.


Index: control.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- control.c	21 Sep 2005 23:13:29 -0000	1.131
+++ control.c	21 Sep 2005 23:30:15 -0000	1.132
@@ -71,6 +71,7 @@
 #define EVENT_NOTICE_MSG      0x0009
 #define EVENT_WARN_MSG        0x000A
 #define EVENT_ERR_MSG         0x000B
+#define LAST_V0_EVENT         0x000B
 #define EVENT_ADDRMAP         0x000C
 #define _EVENT_MAX            0x000C
 
@@ -522,7 +523,7 @@
   size_t buflen;
   char *buf;
 
-  tor_assert(event >= _EVENT_MIN && event <= _EVENT_MAX);
+  tor_assert(event >= _EVENT_MIN && event <= LAST_V0_EVENT);
 
   buflen = len + 2;
   buf = tor_malloc_zero(buflen);
@@ -837,7 +838,7 @@
 
     for (; len; len -= 2, body += 2) {
       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,
                             "Unrecognized event code");
         return 0;