[or-cvs] [tor/master 7/8] Make more arguments in control.c properly case-insensitive.

nickm at torproject.org nickm at torproject.org
Sat Feb 20 23:35:29 UTC 2010


Author: Nick Mathewson <nickm at torproject.org>
Date: Thu, 18 Feb 2010 12:32:11 -0500
Subject: Make more arguments in control.c properly case-insensitive.
Commit: 2d95e02914c07f9186a1745e135d26b4da02cdb1

---
 ChangeLog        |    2 ++
 src/or/control.c |   12 ++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 42f6aeb..a25db73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,8 @@ Changes in version 0.2.2.9-alpha - 2010-??-??
     - Avoid a bogus overlapped memcpy in tor_addr_copy().  Found by
       "memcpyfail".
     - Emit an GUARD DROPPED event for a case we missed.
+    - Make more fields in the controller protocol case-insensitive as
+      documented in control-spec.txt.
 
   o Code simplifications and refactoring:
     - Generate our manpage and HTML documentation using Asciidoc.  This
diff --git a/src/or/control.c b/src/or/control.c
index 835c3be..adf0611 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2003,12 +2003,12 @@ handle_control_getinfo(control_connection_t *conn, uint32_t len,
 static uint8_t
 circuit_purpose_from_string(const char *string)
 {
-  if (!strcmpstart(string, "purpose="))
+  if (!strcasecmpstart(string, "purpose="))
     string += strlen("purpose=");
 
-  if (!strcmp(string, "general"))
+  if (!strcasecmp(string, "general"))
     return CIRCUIT_PURPOSE_C_GENERAL;
-  else if (!strcmp(string, "controller"))
+  else if (!strcasecmp(string, "controller"))
     return CIRCUIT_PURPOSE_CONTROLLER;
   else
     return CIRCUIT_PURPOSE_UNKNOWN;
@@ -2071,7 +2071,7 @@ handle_control_extendcircuit(control_connection_t *conn, uint32_t len,
       purp = smartlist_get(args,2);
     }
 
-    if (purp && strcmpstart(purp, "purpose=") != 0)
+    if (purp && strcasecmpstart(purp, "purpose=") != 0)
       purp = NULL;
 
     if (purp) {
@@ -2351,9 +2351,9 @@ handle_control_postdescriptor(control_connection_t *conn, uint32_t len,
       }
     } else if (!strcasecmpstart(option, "cache=")) {
       option += strlen("cache=");
-      if (!strcmp(option, "no"))
+      if (!strcasecmp(option, "no"))
         cache = 0;
-      else if (!strcmp(option, "yes"))
+      else if (!strcasecmp(option, "yes"))
         cache = 1;
       else {
         connection_printf_to_buf(conn, "552 Unknown cache request \"%s\"\r\n",
-- 
1.6.5




More information about the tor-commits mailing list