[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [vidalia/master] Add more checks to make the controlport auto config better
commit 0bd00acdb7bdefc5df31f20c0579632cf3ec0875
Author: Tomás Touceda <chiiph@xxxxxxxxxxxxxx>
Date: Mon Aug 29 18:41:12 2011 -0300
Add more checks to make the controlport auto config better
It checks if DataDirectory is empty, and disables the feature in such case.
It also checks the tor version and doesn't let the user save the
configuration if she hasn't added a DataDirectory when "Configure
ControlPort automatically" is checked.
---
src/vidalia/MainWindow.cpp | 8 ++++++++
src/vidalia/config/AdvancedPage.cpp | 16 +++++++++++++++-
2 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/src/vidalia/MainWindow.cpp b/src/vidalia/MainWindow.cpp
index b159d2e..4e86811 100644
--- a/src/vidalia/MainWindow.cpp
+++ b/src/vidalia/MainWindow.cpp
@@ -995,6 +995,14 @@ MainWindow::start()
updateTorStatus(Starting);
+ // Disable autoconfiguration if there are missing config data
+ if(settings.autoControlPort()) {
+ if(settings.getDataDirectory().isEmpty()) {
+ vWarn("Disabling ControlPort autoconfiguration. DataDirectory is empty!");
+ settings.setAutoControlPort(false);
+ }
+ }
+
/* Check if Tor is already running separately */
if(settings.getControlMethod() == ControlMethod::Port) {
if(!settings.autoControlPort() && net_test_connect(settings.getControlAddress(),
diff --git a/src/vidalia/config/AdvancedPage.cpp b/src/vidalia/config/AdvancedPage.cpp
index 12842bc..865516d 100644
--- a/src/vidalia/config/AdvancedPage.cpp
+++ b/src/vidalia/config/AdvancedPage.cpp
@@ -121,6 +121,16 @@ AdvancedPage::save(QString &errmsg)
QHostAddress controlAddress(ui.lineControlAddress->text());
QString path(ui.lineSocketPath->text());
+ if(ui.chkAuto->isChecked()) {
+ if(ui.lineTorDataDirectory->text().isEmpty()) {
+ errmsg = tr("You've checked the autoconfiguration option for the ControlPort, but"
+ " provided no Data Directory. Please add one, or uncheck the"
+ " \"Configure ControlPort automatically\" option.");
+ return false;
+ }
+ _settings->setAutoControlPort(true);
+ }
+
/* Validate the control settings */
if(ui.rdoControlPort->isChecked()) {
if (controlAddress.isNull()) {
@@ -190,7 +200,6 @@ AdvancedPage::save(QString &errmsg)
_settings->setControlPort(ui.lineControlPort->text().toUShort());
}
_settings->setSocketPath(ui.lineSocketPath->text());
- _settings->setAutoControlPort(ui.chkAuto->isChecked());
_settings->setAuthenticationMethod(authMethod);
_settings->setUseRandomPassword(ui.chkRandomPassword->isChecked());
@@ -233,6 +242,11 @@ AdvancedPage::load()
ui.chkUseService->setChecked(s.isInstalled());
#endif
#endif
+
+ if(Vidalia::torControl()->getTorVersion() < 0x2021a) { // 0x2021a == 0.2.2.26
+ ui.chkAuto->setChecked(false);
+ ui.chkAuto->setVisible(false);
+ }
}
/** Called when the user selects a different authentication method from the
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits