[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r3722: Tolerate bridge addresses that do not specify a port number, (in vidalia/trunk: . src/vidalia/config)
Author: edmanm
Date: 2009-04-15 13:50:36 -0400 (Wed, 15 Apr 2009)
New Revision: 3722
Modified:
vidalia/trunk/CHANGELOG
vidalia/trunk/src/vidalia/config/networkpage.cpp
Log:
Tolerate bridge addresses that do not specify a port number, since Tor
now defaults to using port 443 in such cases.
Modified: vidalia/trunk/CHANGELOG
===================================================================
--- vidalia/trunk/CHANGELOG 2009-04-13 01:46:50 UTC (rev 3721)
+++ vidalia/trunk/CHANGELOG 2009-04-15 17:50:36 UTC (rev 3722)
@@ -1,4 +1,6 @@
0.2.1 xx-xxx-2009
+ o Tolerate bridge addresses that do not specify a port number, since Tor
+ now defaults to using port 443 in such cases.
o Renamed the 'make win32-installer' CMake target to 'make dist-win32'
for consistency with our 'make dist-osx' target.
o Fix a couple bugs in the WiX-based Windows installer related to building
Modified: vidalia/trunk/src/vidalia/config/networkpage.cpp
===================================================================
--- vidalia/trunk/src/vidalia/config/networkpage.cpp 2009-04-13 01:46:50 UTC (rev 3721)
+++ vidalia/trunk/src/vidalia/config/networkpage.cpp 2009-04-15 17:50:36 UTC (rev 3722)
@@ -18,6 +18,7 @@
#include <QIntValidator>
#include <QClipboard>
#include <QHostAddress>
+#include <QRegExp>
#include <networksettings.h>
#include <vmessagebox.h>
#include <vidalia.h>
@@ -150,18 +151,23 @@
return false;
QString s = parts.at(0);
- if (s.contains(":")) {
+ QRegExp re("(\\d{1,3}\\.){3}\\d{1,3}(:\\d{1,5})?");
+ if (re.exactMatch(s)) {
if (s.endsWith(":"))
return false;
int index = s.indexOf(":");
QString host = s.mid(0, index);
- QString port = s.mid(index + 1);
if (QHostAddress(host).isNull()
- || QHostAddress(host).protocol() != QAbstractSocket::IPv4Protocol
- || port.toUInt() < 1
- || port.toUInt() > 65535)
+ || QHostAddress(host).protocol() != QAbstractSocket::IPv4Protocol) {
return false;
+ }
+ if (index > 0) {
+ QString port = s.mid(index + 1);
+ if (port.toUInt() < 1 || port.toUInt() > 65535)
+ return false;
+ }
+
temp = s;
if (parts.size() > 1) {
QString fp = static_cast<QStringList>(parts.mid(1)).join("");