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

[vidalia-svn] r1817: Chop out all the control protocol version checking stuff. Tr (in trunk: . src/control)



Author: edmanm
Date: 2007-08-02 00:03:02 -0400 (Thu, 02 Aug 2007)
New Revision: 1817

Modified:
   trunk/
   trunk/src/control/controlsocket.cpp
   trunk/src/control/controlsocket.h
Log:
 r1963@adrastea:  edmanm | 2007-08-02 00:02:49 -0400
 Chop out all the control protocol version checking stuff. Try to do that on a
 new Tor with some authentication set and you can kiss your control socket
 bye-bye. If anyone is still running an old Tor that doesn't support the V1 control
 protocol, then they're insane and should upgrade.



Property changes on: trunk
___________________________________________________________________
 svk:merge ticket from /vidalia/local/trunk [r1963] on 54b3572a-7227-0410-958f-53ecd705b71a

Modified: trunk/src/control/controlsocket.cpp
===================================================================
--- trunk/src/control/controlsocket.cpp	2007-07-23 03:13:02 UTC (rev 1816)
+++ trunk/src/control/controlsocket.cpp	2007-08-02 04:03:02 UTC (rev 1817)
@@ -53,8 +53,6 @@
 bool
 ControlSocket::connect(QHostAddress addr, quint16 port, QString *errmsg)
 {
-  ProtocolVersion version;
-
   /* Connect the control socket. */
   vNotice("Connecting to Tor's control port on %1:%2").arg(addr.toString())
                                                       .arg(port);
@@ -66,26 +64,6 @@
                                             .arg(port)
                                             .arg(errorString()));
   }
-  
-  /* Verify that Tor is speaking a protocol version we understand. */
-  blockSignals(true);
-  version = protocolVersion();
-  blockSignals(false);
-  if (version != Version1) {
-    disconnect();
-    vWarn("Unsupported Tor protocol version '%1'").arg(version);
-    if (version == VersionUnknown) {
-      return err(errmsg, tr("Vidalia was unable to determine Tor's control "
-                            "protocol version. Verify that your control port number "
-                            "is set correctly and you are running a recent "
-                            "version of Tor."));
-    } else {
-      return err(errmsg, tr("Vidalia only supports Version 1 of Tor's control "
-                            "protocol (version %1 detected).\n"
-                            "Upgrade to a newer version of Tor.").arg(version));
-    }
-  }
-  /* Ok, now we're really connected */
   return true;
 }
 
@@ -112,30 +90,6 @@
   return (isValid() && state() == QAbstractSocket::ConnectedState);
 }
 
-/** Determines which version of Tor's control protocol is being spoken. */
-ControlSocket::ProtocolVersion
-ControlSocket::protocolVersion()
-{
-  QByteArray versionData;
-
-  /* Send a special little bit of data and wait for the response */
-  if (!write("\0\0\r\n", 4)) {
-    return VersionUnknown;
-  }
-  while (bytesAvailable() < 4) {
-    if (!waitForReadyRead(-1)) {
-      vWarn("Reading failed while determining control protocol version: %1")
-                                                         .arg(errorString());
-      return VersionUnknown;
-    }
-  }
-
-  /* If the response starts with a "\0\0", that means it is V0 of the control
-   * protocol. Otherwise, it is V1. */
-  versionData = readAll();
-  return (!qstrlen(versionData.data()) ? Version0 : Version1);
-}
-
 /** Send a control command to Tor on the control socket, conforming to Tor's
  * Control Protocol V1:
  *

Modified: trunk/src/control/controlsocket.h
===================================================================
--- trunk/src/control/controlsocket.h	2007-07-23 03:13:02 UTC (rev 1816)
+++ trunk/src/control/controlsocket.h	2007-08-02 04:03:02 UTC (rev 1817)
@@ -62,17 +62,6 @@
   bool readLineData(QString &line, QString *errmsg = 0);
   /** Reads a line of data from the socket (blocking) */
   bool readLine(QString &line, QString *errmsg = 0);
-
-private:
-  /** Specifies a version of Tor's Control Protocol */
-  enum ProtocolVersion {
-    VersionUnknown = -1,  /**< Unknown version. */
-    Version0 = 0,         /**< Protocol V0 (deprecated) */
-    Version1 = 1          /**< Protocol V1 */
-  };
-  /** Returns the version of Tor's control protocol being spoken on this
-   * socket. */
-  ProtocolVersion protocolVersion();
 };
 
 #endif