Author: chiiph Date: 2011-03-19 21:56:43 +0000 (Sat, 19 Mar 2011) New Revision: 4533
Modified: vidalia/trunk/CMakeLists.txt vidalia/trunk/INSTALL vidalia/trunk/pkg/rpm/vidalia.spec.in vidalia/trunk/src/common/CMakeLists.txt vidalia/trunk/src/common/TorSslSocket.cpp vidalia/trunk/src/common/TorSslSocket.h Log: Remove OpenSSL dep
Modified: vidalia/trunk/CMakeLists.txt =================================================================== --- vidalia/trunk/CMakeLists.txt 2011-03-18 11:30:36 UTC (rev 4532) +++ vidalia/trunk/CMakeLists.txt 2011-03-19 21:56:43 UTC (rev 4533) @@ -52,9 +52,9 @@ if (WIN32) include(${CMAKE_SOURCE_DIR}/cmake/FindWiX.cmake) endif(WIN32) -if (MSVC OR UNIX) +if (MSVC) include(${CMAKE_SOURCE_DIR}/cmake/FindOpenSSL.cmake) -endif(MSVC OR UNIX) +endif(MSVC)
if(MSVC_IDE) set(CMAKE_SUPPRESS_REGENERATION TRUE)
Modified: vidalia/trunk/INSTALL =================================================================== --- vidalia/trunk/INSTALL 2011-03-18 11:30:36 UTC (rev 4532) +++ vidalia/trunk/INSTALL 2011-03-19 21:56:43 UTC (rev 4533) @@ -179,10 +179,6 @@ `cmake` commands above. Each of the configuration options can be specified on the command line and follows the format "-D <var>:<type>=<value>
- -DUSE_QSSLSOCKET=0 - - Disable building Vidalia with SSL support. - -DUSE_MINIUPNPC=0
Disable UPnP support in Vidalia. @@ -207,7 +203,8 @@
-DOPENSSL_LIBRARY_DIR=/path/to/openssl
- Specifies the location of OpenSSL's libraries. + Specifies the location of OpenSSL's libraries for building installer on + Windows.
-DCMAKE_INSTALL_PREFIX=/usr/local
Modified: vidalia/trunk/pkg/rpm/vidalia.spec.in =================================================================== --- vidalia/trunk/pkg/rpm/vidalia.spec.in 2011-03-18 11:30:36 UTC (rev 4532) +++ vidalia/trunk/pkg/rpm/vidalia.spec.in 2011-03-19 21:56:43 UTC (rev 4533) @@ -10,7 +10,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: desktop-file-utils -BuildRequires: openssl-devel BuildRequires: qt4-devel BuildRequires: cmake
@@ -95,7 +94,7 @@
%files %defattr(-,root,root,-) -%doc CHANGELOG CREDITS HACKING LICENSE LICENSE-GPLV2 LICENSE-GPLV3 LICENSE-OPENSSL README +%doc CHANGELOG CREDITS HACKING LICENSE LICENSE-GPLV2 LICENSE-GPLV3 README %{_bindir}/%{name} %{_mandir}/man1/%{name}* %{_datadir}/applications/%{name}.desktop
Modified: vidalia/trunk/src/common/CMakeLists.txt =================================================================== --- vidalia/trunk/src/common/CMakeLists.txt 2011-03-18 11:30:36 UTC (rev 4532) +++ vidalia/trunk/src/common/CMakeLists.txt 2011-03-19 21:56:43 UTC (rev 4533) @@ -20,11 +20,9 @@ procutil.cpp stringutil.cpp TorSocket.cpp - TorSslSocket.cpp ) qt4_wrap_cpp(common_SRCS TorSocket.h - TorSslSocket.h )
if(WIN32) @@ -40,7 +38,3 @@ ${QT_QTNETWORK_LIBRARY} )
-if(OPENSSL_LIBRARIES) - target_link_libraries(common ${OPENSSL_LIBRARIES}) -endif(OPENSSL_LIBRARIES) -
Modified: vidalia/trunk/src/common/TorSslSocket.cpp =================================================================== --- vidalia/trunk/src/common/TorSslSocket.cpp 2011-03-18 11:30:36 UTC (rev 4532) +++ vidalia/trunk/src/common/TorSslSocket.cpp 2011-03-19 21:56:43 UTC (rev 4533) @@ -1,160 +0,0 @@ -/* -** This file is part of Vidalia, and is subject to the license terms in the -** LICENSE file, found in the top level directory of this distribution. If you -** did not receive the LICENSE file with this file, you may obtain it from the -** Vidalia source package distributed by the Vidalia Project at -** http://www.vidalia-project.net/. No part of Vidalia, including this file, -** may be copied, modified, propagated, or distributed except according to the -** terms described in the LICENSE file. -*/ - -/* -** \file TorSslSocket.cpp -** \version $Id: /local/vidalia/trunk/src/util/torsocket.cpp 1564 2006-12-26T06:06:04.965088Z edmanm $ -** \brief A QSslSocket that makes encrypted requests over Tor -*/ - -#include "TorSslSocket.h" - -#include <QDataStream> -#include <QStringList> - -#define SOCKS_VERSION 0x04 /**< SOCKS version. */ -#define SOCKS_CONNECT 0x01 /**< SOCKS connect command ID. */ -#define SOCKS_FAKE_IP 0x00000001 /**< Bogus IP. */ -#define SOCKS_RESPONSE_LEN 0x08 /**< SOCKS server response length. */ -#define SOCKS_RESPONSE_VERSION 0x00 /**< SOCKS server response version. */ -#define SOCKS_CONNECT_STATUS_OK 0x5A /**< SOCKS server response status. */ - - -/** Constructor. */ -TorSslSocket::TorSslSocket(const QHostAddress &socksAddr, - quint16 socksPort, QObject *parent) -: QSslSocket(parent), - _socksAddr(socksAddr), - _socksPort(socksPort) -{ - QObject::connect(this, SIGNAL(sslErrors(QList<QSslError>)), - this, SLOT(onSslErrors(QList<QSslError>))); - QObject::connect(this, SIGNAL(error(QAbstractSocket::SocketError)), - this, SLOT(onError(QAbstractSocket::SocketError))); - QObject::connect(this, SIGNAL(readyRead()), - this, SLOT(onHandshakeResponse())); - QObject::connect(this, SIGNAL(connected()), - this, SLOT(connectedToProxy())); - QObject::connect(this, SIGNAL(encrypted()), - this, SLOT(onEncrypted())); -} - -/** Connects to the specified hostname and port via Tor. */ -void -TorSslSocket::connectToRemoteHost(const QString &remoteHost, quint16 remotePort, - bool encrypted) -{ - _remoteHost = remoteHost; - _remotePort = remotePort; - _encrypted = encrypted; - QTcpSocket::connectToHost(_socksAddr, _socksPort); -} - -/** Called when a connection error has occurred. */ -void -TorSslSocket::onError(QAbstractSocket::SocketError error) -{ - Q_UNUSED(error); - emit socketError(errorString()); -} - -/** Called when one or more SSL errors occur on the socket. */ -void -TorSslSocket::onSslErrors(const QList<QSslError> &errors) -{ - QStringList errorStrings; - foreach (QSslError error, errors) { - errorStrings << """ + error.errorString() + """; - } - emit socketError(errorStrings.join(",")); -} - -/** Called when a connection has been established to the proxy host and starts - * a Socks4a handshake. */ -void -TorSslSocket::connectedToProxy() -{ - sendSocksHandshake(_remoteHost, _remotePort); -} - -/** Called when an encrypted connection has been established to the remote - * host. */ -void -TorSslSocket::onEncrypted() -{ - emit connectedToRemoteHost(); -} - -/** Sends the first part of a Socks4a handshake, using the remote hostname and - * port specified in the previous call to connectToHost(). The message should - * be formatted as follows: - * - * 0x04 (socks version) - * 0x01 (connect) - * PORT (two bytes, most significant byte first) - * 0x00 0x00 0x00 0x01 (fake IP address: tells proxy to use SOCKS4a) - * 0x00 (empty username field) - * HOSTNAME (target hostname) - * 0x00 (marks the end of the hostname field) - */ -void -TorSslSocket::sendSocksHandshake(const QString &remoteHost, quint16 remotePort) -{ - QDataStream sock(this); - sock << (quint8)SOCKS_VERSION; - sock << (quint8)SOCKS_CONNECT; - sock << (quint16)remotePort; - sock << (quint32)SOCKS_FAKE_IP; - sock << (quint8)0; - sock.writeRawData(qPrintable(remoteHost), remoteHost.length()); - sock << (quint8)0; -} - -/** Handles the second half of the handshake, received from the SOCKS - * proxy server. The response should be formatted as follows: - * - * 0x00 (response version) - * STATUS (0x5A means success; other values mean failure) - * PORT (not set) - * ADDRESS (not set) - */ -void -TorSslSocket::onHandshakeResponse() -{ - QByteArray response; - if (bytesAvailable() >= SOCKS_RESPONSE_LEN) { - /* We've received our response, so stop waiting for it. */ - QObject::disconnect(this, SIGNAL(readyRead()), - this, SLOT(onHandshakeResponse())); - - /* Read the 8-byte response off the socket. */ - response = read(SOCKS_RESPONSE_LEN); - - /* Check to make sure we got a good response from the proxy. */ - if ((uchar)response[0] == (uchar)SOCKS_RESPONSE_VERSION && - (uchar)response[1] == (uchar)SOCKS_CONNECT_STATUS_OK) { - if (_encrypted) { - /* Connection status was okay, so start client encryption. */ - /* We first need to set the peer name to the intended remote host, - * otherwise Qt will use the proxy (e.g., 127.0.0.1) as the peer name - * when validating the server certificate. */ - setPeerName(_remoteHost); - startClientEncryption(); - } else { - /* Caller wanted an unencrypted, unauthenticated, uncool conn. */ - emit connectedToRemoteHost(); - } - } else { - /* Remote connection failed, so close the connection to the proxy. */ - disconnectFromHost(); - } - } -} -
Modified: vidalia/trunk/src/common/TorSslSocket.h =================================================================== --- vidalia/trunk/src/common/TorSslSocket.h 2011-03-18 11:30:36 UTC (rev 4532) +++ vidalia/trunk/src/common/TorSslSocket.h 2011-03-19 21:56:43 UTC (rev 4533) @@ -1,71 +0,0 @@ -/* -** This file is part of Vidalia, and is subject to the license terms in the -** LICENSE file, found in the top level directory of this distribution. If you -** did not receive the LICENSE file with this file, you may obtain it from the -** Vidalia source package distributed by the Vidalia Project at -** http://www.vidalia-project.net/. No part of Vidalia, including this file, -** may be copied, modified, propagated, or distributed except according to the -** terms described in the LICENSE file. -*/ - -/* -** \file TorSslSocket.h -** \version $Id: /local/vidalia/trunk/src/util/torsocket.h 1564 2006-12-26T06:06:04.965088Z edmanm $ -** \brief A QSslSocket that makes encrypted requests over Tor -*/ - -#ifndef _TORSSLSOCKET_H -#define _TORSSLSOCKET_H - -#include <QSslSocket> -#include <QHostAddress> - - -class TorSslSocket : public QSslSocket -{ - Q_OBJECT - -public: - /** Constructor. */ - TorSslSocket(const QHostAddress &socksAddr, - quint16 socksPort, QObject *parent = 0); - - /** Connects to the specified hostname and port via Tor. */ - void connectToRemoteHost(const QString &remoteHost, quint16 remotePort, - bool encrypted); - -signals: - /** Emitted when a connection has been established through Tor to the remote - * host specified in a prior call to connectToHost(). */ - void connectedToRemoteHost(); - /** Emitted when a connection error has occurred. */ - void socketError(QString errmsg); - -private slots: - /** Called when the socket is connected to the proxy and sends our - * half of a Socks4a handshake. */ - void connectedToProxy(); - /** Called when an encrypted connection has been established to the remote - * host. */ - void onEncrypted(); - /** Handles the server's response part of a Socks4a handshake. */ - void onHandshakeResponse(); - /** Called when a connection error has occurred. */ - void onError(QAbstractSocket::SocketError error); - /** Called when one or more SSL errors occur on the socket. */ - void onSslErrors(const QList<QSslError> &errors); - -private: - /** Sends the client part of a Socks4a handshake with a proxy server. */ - void sendSocksHandshake(const QString &remoteHost, quint16 remotePort); - - QHostAddress _socksAddr; /**< Address of Tor's SOCKS listener. */ - QString _remoteHost; /**< Remote hostname. */ - quint16 _socksPort; /**< Port of Tor's SOCKS listener. */ - quint16 _remotePort; /**< Remote host port. */ - bool _encrypted; /**< Set to true if the connection to the remote - host should be encrypted. */ -}; - -#endif -
tor-commits@lists.torproject.org