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

[tor-commits] [tor/master] Ignore unknown lines from managed proxies.



commit a8a862c90989e8d81bcebab5bbe63d4984d00b96
Author: George Kadianakis <desnacked@xxxxxxxxxx>
Date:   Fri May 18 15:04:48 2012 +0300

    Ignore unknown lines from managed proxies.
---
 changes/bug5910     |    4 ++++
 src/or/transports.c |   13 ++-----------
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/changes/bug5910 b/changes/bug5910
new file mode 100644
index 0000000..712ed55
--- /dev/null
+++ b/changes/bug5910
@@ -0,0 +1,4 @@
+  o Minor bugfixes:
+    - Don't abort the managed proxy protocol if the managed proxy
+      sends us an unrecognized line; ignore it instead. Fixes bug
+      5910; bugfix on 0.2.3.9-alpha.
diff --git a/src/or/transports.c b/src/or/transports.c
index 5f650d1..a20decf 100644
--- a/src/or/transports.c
+++ b/src/or/transports.c
@@ -119,10 +119,6 @@ static INLINE void free_execve_args(char **arg);
 #define PROTO_CMETHODS_DONE "CMETHODS DONE"
 #define PROTO_SMETHODS_DONE "SMETHODS DONE"
 
-/* The smallest valid managed proxy protocol line that can
-   appear. It's the size of "VERSION 1" */
-#define SMALLEST_MANAGED_LINE_SIZE 9
-
 /** Number of environment variables for managed proxy clients/servers. */
 #define ENVIRON_SIZE_CLIENT 3
 #define ENVIRON_SIZE_SERVER 7 /* XXX known to be too high, but that's ok */
@@ -633,12 +629,6 @@ handle_proxy_line(const char *line, managed_proxy_t *mp)
   log_info(LD_GENERAL, "Got a line from managed proxy '%s': (%s)",
            mp->argv[0], line);
 
-  if (strlen(line) < SMALLEST_MANAGED_LINE_SIZE) {
-    log_warn(LD_GENERAL, "Managed proxy configuration line is too small. "
-             "Discarding");
-    goto err;
-  }
-
   if (!strcmpstart(line, PROTO_ENV_ERROR)) {
     if (mp->conf_state != PT_PROTO_LAUNCHED)
       goto err;
@@ -712,7 +702,8 @@ handle_proxy_line(const char *line, managed_proxy_t *mp)
     return;
   }
 
-  log_warn(LD_CONFIG, "Unknown line received by managed proxy. (%s)", line);
+  log_notice(LD_GENERAL, "Unknown line received by managed proxy (%s).", line);
+  return;
 
  err:
   mp->conf_state = PT_PROTO_BROKEN;

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits