tor-commits
Threads by month
- ----- 2026 -----
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
March 2012
- 19 participants
- 1205 discussions
[torspec/master] Introduce proposal that specifies transport proxy control.
by nickm@torproject.org 15 Mar '12
by nickm@torproject.org 15 Mar '12
15 Mar '12
commit 435b5bc38a05f711b1b9f09dd1f49076c6c1de6e
Author: George Kadianakis <desnacked(a)riseup.net>
Date: Wed Mar 14 14:23:34 2012 -0700
Introduce proposal that specifies transport proxy control.
---
proposals/xxx-transport-control-ports.txt | 185 +++++++++++++++++++++++++++++
1 files changed, 185 insertions(+), 0 deletions(-)
diff --git a/proposals/xxx-transport-control-ports.txt b/proposals/xxx-transport-control-ports.txt
new file mode 100644
index 0000000..61f6b3e
--- /dev/null
+++ b/proposals/xxx-transport-control-ports.txt
@@ -0,0 +1,185 @@
+Filename: xxx-transport-control-ports.txt
+Title: Extended ORPort and TransportControlPort
+Author: George Kadianakis, Nick Mathewson
+Created: 14 Mar 2012
+Status: Open
+Target: 0.2.4.x
+
+1. Overview
+
+ Proposal 180 defined Tor pluggable transports, a way to decouple
+ protocol-level obfuscation from the core Tor protocol in order to
+ better resist client-bridge censorship. This is achieved by
+ introducing pluggable transport proxies, programs that obfuscate Tor
+ traffic to resist DPI detection.
+
+ Proposal 180 defined a way for pluggable transport proxies to
+ communicate with local Tor clients and bridges, so as to exchange
+ traffic. This document extends this communication protocol, so that
+ pluggable transport proxies can exchange arbitrary operational
+ information and metadata with Tor clients and bridges.
+
+2. Motivation
+
+ The communication protocol specified in Proposal 180 gives a way
+ for transport proxies to announce the IP address of their clients
+ to tor. Still, modern pluggable transports might have more (?)
+ needs than this. For example:
+
+ 1. Tor might want to inform pluggable transport proxies on how to
+ rate-limit incoming or outgoing connections.
+
+ 2. Server pluggable transport proxies might want to pass client
+ information to an anti-active-probing system controlled by tor.
+
+ 3. Tor might want to temporarily stop a transport proxy from
+ obfuscating traffic.
+
+ To satisfy the above use cases, there must be real-time
+ communication between the tor process and the pluggable transport
+ proxy. To achieve this, this proposal refactors the Extended ORPort
+ protocol specified in Proposal 180, and introduces a new port,
+ TransportControlPort, whose sole role is the exchange of control
+ information between transport proxies and tor.
+
+ Specifically, transports proxies deliver each connection to the
+ "Extended ORPort", where they provide metadata and agree on an
+ identifier for each tunneled connection. Once this handshake
+ occurs, the OR protocol proceeds unchanged.
+
+ Additionally, each transport maintains a single connection to Tor's
+ "TransportControlPort", where it receives instructions from Tor
+ about rate-limiting on individual connections.
+
+3. The new port protocols
+
+3.1. The new extended ORPort protocol
+
+ The extended server port protocol is as follows:
+
+ COMMAND [2 bytes, big-endian]
+ BODYLEN [2 bytes, big-endian]
+ BODY [BODYLEN bytes]
+
+ Commands sent from the transport proxy to the bridge are:
+
+ [0x0000] DONE: There is no more information to give. The next
+ bytes sent by the transport will be those tunneled over it.
+ (body ignored)
+
+ [0x0001] USERADDR: an address:port string that represents the user's
+ address.
+
+ Replies sent from tor to the proxy are:
+
+ [0x1000] OKAY: Send the user's traffic. (body ignored)
+
+ [0x1001] DENY: Tor would prefer not to get more traffic from
+ this address for a while. (body ignored)
+
+ [0x1002] CONTROL: a NUL-terminated "identifier" string. The
+ pluggable transport proxy must use the "identifier" to access
+ the TransportControlPort. See the 'Association and identifier
+ creation' section below.
+
+ Parties should ignore command codes that they do not understand.
+
+3.2. The new TransportControlPort protocol
+
+ The TransportControlPort protocol is as follows:
+
+ CONNECTIONID[16 bytes, big-endian]
+ COMMAND [2 bytes, big-endian]
+ BODYLEN [2 bytes, big-endian]
+ BODY [BODYLEN bytes]
+
+ Commands sent from the transport proxy to the bridge:
+
+ [0x0001] RATE_LIMITED: Message confirming that the rate limiting
+ request of the bridge was carried out successfully (body
+ ignored). See the 'Rate Limiting' section below.
+
+ [0x0002] NOT_RATE_LIMITED: Message notifying that the transport
+ proxy failed to carry out the rate limiting request of the
+ bridge (body ignored). See the 'Rate Limiting' section below.
+
+ Configuration commands sent from the bridge to the transport
+ proxy are:
+
+ [0x1001] NOT_ALLOWED: Message notifying that the CONNECTIONID
+ could not be matched with an authorized connection ID. The
+ bridge SHOULD shutdown the connection.
+
+ [0x1001] RATE_LIMIT: Carries information on how the pluggable
+ transport proxy should rate-limit its traffic. See the 'Rate
+ Limiting' section below.
+
+ CONNECTIONID should carry the connection identifier described in the
+ 'Association and identifier creation' section.
+
+ Parties should ignore command codes that they do not understand.
+
+3.3. Association and identifier creation
+
+ For Tor and a transport proxy to communicate using the
+ TransportControlPort, an identifier must have already been negotiated
+ using the 'CONTROL' command of Extended ORPort.
+
+ The TransportControlPort identifier should not be predictable by a
+ user who hasn't received a 'CONTROL' command from the Extended
+ ORPort. For this reason, the TransportControlPort identifier should
+ not be cryptographically-weak or deterministically created.
+
+ Tor MUST create its identifiers by generating 16 bytes of random
+ data.
+
+4. Configuration commands
+
+4.1. Rate Limiting
+
+ A Tor relay should be able to inform a transport proxy in real-time
+ about its rate-limiting needs.
+
+ This can be achieved by using the TransportControlPort and sending a
+ 'RATE_LIMIT' command to the transport proxy.
+
+ The body of the 'RATE_LIMIT' command should contain two integers,
+ 4 bytes each, in big-endian format. The two numbers should represent
+ the bandwidth rate and bandwidth burst respectively in 'bytes per
+ second' which the transport proxy must set as its overall
+ rate-limiting setting.
+
+ When the transport proxy sets the appropriate rate limiting, it
+ should send back a 'RATE_LIMITED' command. If it fails while setting
+ up rate limiting, it should send back a 'NOT_RATE_LIMITED' command.
+
+ After sending a 'RATE_LIMIT' command. the tor bridge MAY want to
+ stop pushing data to the transport proxy, till it receives a
+ 'RATE_LIMITED' command. If, instead, it receives a 'NOT_RATE_LIMITED'
+ command it MAY want to shutdown its connections to the transport
+ proxy.
+
+5. Security Considerations
+
+ Extended ORPort or TransportControlPort do _not_ provide link
+ confidentiality, authentication or integrity. Sensitive data, like
+ cryptographic material, should not be transferred through them.
+
+ An attacker with superuser access, is able to sniff network traffic,
+ and capture TransportControlPort identifiers and any data passed
+ through those ports.
+
+ Tor SHOULD issue a warning if the bridge operator tries to bind
+ Extended ORPort or TransportControlPort to a non-localhost address.
+
+ Pluggable transport proxies SHOULD issue a warning if they are
+ instructed to connect to a non-localhost Extended ORPort or
+ TransportControlPort.
+
+6. Future
+
+ In the future, we might have pluggable transports which require the
+ _client_ transport proxy to use the TransportControlPort and exchange
+ control information with the Tor client. The current proposal doesn't
+ yet support this, but we should not add functionality that will
+ prevent it from being possible.
1
0
[torspec/master] Add "Extended ORPort and TransportControlPort" as proposal 196.
by nickm@torproject.org 15 Mar '12
by nickm@torproject.org 15 Mar '12
15 Mar '12
commit 739d70b160f51a12c06cd315546198c2a1b4be3e
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Thu Mar 15 18:14:28 2012 -0400
Add "Extended ORPort and TransportControlPort" as proposal 196.
---
proposals/000-index.txt | 2 +
proposals/196-transport-control-ports.txt | 185 +++++++++++++++++++++++++++++
proposals/xxx-transport-control-ports.txt | 185 -----------------------------
3 files changed, 187 insertions(+), 185 deletions(-)
diff --git a/proposals/000-index.txt b/proposals/000-index.txt
index fc5c508..4507a18 100644
--- a/proposals/000-index.txt
+++ b/proposals/000-index.txt
@@ -116,6 +116,7 @@ Proposals by number:
193 Safe cookie authentication for Tor controllers [OPEN]
194 Mnemonic .onion URLs [OPEN]
195 TLS certificate normalization for Tor 0.2.4.x [DRAFT]
+196 Extended ORPort and TransportControlPort [OPEN]
Proposals by status:
@@ -152,6 +153,7 @@ Proposals by status:
192 Automatically retrieve and store information about bridges [for 0.2.[45].x]
193 Safe cookie authentication for Tor controllers
194 Mnemonic .onion URLs
+ 196 Extended ORPort and TransportControlPort [for 0.2.4.x]
ACCEPTED:
117 IPv6 exits [for 0.2.3.x]
140 Provide diffs between consensuses
diff --git a/proposals/196-transport-control-ports.txt b/proposals/196-transport-control-ports.txt
new file mode 100644
index 0000000..549e8ce
--- /dev/null
+++ b/proposals/196-transport-control-ports.txt
@@ -0,0 +1,185 @@
+Filename: 196-transport-control-ports.txt
+Title: Extended ORPort and TransportControlPort
+Author: George Kadianakis, Nick Mathewson
+Created: 14 Mar 2012
+Status: Open
+Target: 0.2.4.x
+
+1. Overview
+
+ Proposal 180 defined Tor pluggable transports, a way to decouple
+ protocol-level obfuscation from the core Tor protocol in order to
+ better resist client-bridge censorship. This is achieved by
+ introducing pluggable transport proxies, programs that obfuscate Tor
+ traffic to resist DPI detection.
+
+ Proposal 180 defined a way for pluggable transport proxies to
+ communicate with local Tor clients and bridges, so as to exchange
+ traffic. This document extends this communication protocol, so that
+ pluggable transport proxies can exchange arbitrary operational
+ information and metadata with Tor clients and bridges.
+
+2. Motivation
+
+ The communication protocol specified in Proposal 180 gives a way
+ for transport proxies to announce the IP address of their clients
+ to tor. Still, modern pluggable transports might have more (?)
+ needs than this. For example:
+
+ 1. Tor might want to inform pluggable transport proxies on how to
+ rate-limit incoming or outgoing connections.
+
+ 2. Server pluggable transport proxies might want to pass client
+ information to an anti-active-probing system controlled by tor.
+
+ 3. Tor might want to temporarily stop a transport proxy from
+ obfuscating traffic.
+
+ To satisfy the above use cases, there must be real-time
+ communication between the tor process and the pluggable transport
+ proxy. To achieve this, this proposal refactors the Extended ORPort
+ protocol specified in Proposal 180, and introduces a new port,
+ TransportControlPort, whose sole role is the exchange of control
+ information between transport proxies and tor.
+
+ Specifically, transports proxies deliver each connection to the
+ "Extended ORPort", where they provide metadata and agree on an
+ identifier for each tunneled connection. Once this handshake
+ occurs, the OR protocol proceeds unchanged.
+
+ Additionally, each transport maintains a single connection to Tor's
+ "TransportControlPort", where it receives instructions from Tor
+ about rate-limiting on individual connections.
+
+3. The new port protocols
+
+3.1. The new extended ORPort protocol
+
+ The extended server port protocol is as follows:
+
+ COMMAND [2 bytes, big-endian]
+ BODYLEN [2 bytes, big-endian]
+ BODY [BODYLEN bytes]
+
+ Commands sent from the transport proxy to the bridge are:
+
+ [0x0000] DONE: There is no more information to give. The next
+ bytes sent by the transport will be those tunneled over it.
+ (body ignored)
+
+ [0x0001] USERADDR: an address:port string that represents the user's
+ address.
+
+ Replies sent from tor to the proxy are:
+
+ [0x1000] OKAY: Send the user's traffic. (body ignored)
+
+ [0x1001] DENY: Tor would prefer not to get more traffic from
+ this address for a while. (body ignored)
+
+ [0x1002] CONTROL: a NUL-terminated "identifier" string. The
+ pluggable transport proxy must use the "identifier" to access
+ the TransportControlPort. See the 'Association and identifier
+ creation' section below.
+
+ Parties should ignore command codes that they do not understand.
+
+3.2. The new TransportControlPort protocol
+
+ The TransportControlPort protocol is as follows:
+
+ CONNECTIONID[16 bytes, big-endian]
+ COMMAND [2 bytes, big-endian]
+ BODYLEN [2 bytes, big-endian]
+ BODY [BODYLEN bytes]
+
+ Commands sent from the transport proxy to the bridge:
+
+ [0x0001] RATE_LIMITED: Message confirming that the rate limiting
+ request of the bridge was carried out successfully (body
+ ignored). See the 'Rate Limiting' section below.
+
+ [0x0002] NOT_RATE_LIMITED: Message notifying that the transport
+ proxy failed to carry out the rate limiting request of the
+ bridge (body ignored). See the 'Rate Limiting' section below.
+
+ Configuration commands sent from the bridge to the transport
+ proxy are:
+
+ [0x1001] NOT_ALLOWED: Message notifying that the CONNECTIONID
+ could not be matched with an authorized connection ID. The
+ bridge SHOULD shutdown the connection.
+
+ [0x1001] RATE_LIMIT: Carries information on how the pluggable
+ transport proxy should rate-limit its traffic. See the 'Rate
+ Limiting' section below.
+
+ CONNECTIONID should carry the connection identifier described in the
+ 'Association and identifier creation' section.
+
+ Parties should ignore command codes that they do not understand.
+
+3.3. Association and identifier creation
+
+ For Tor and a transport proxy to communicate using the
+ TransportControlPort, an identifier must have already been negotiated
+ using the 'CONTROL' command of Extended ORPort.
+
+ The TransportControlPort identifier should not be predictable by a
+ user who hasn't received a 'CONTROL' command from the Extended
+ ORPort. For this reason, the TransportControlPort identifier should
+ not be cryptographically-weak or deterministically created.
+
+ Tor MUST create its identifiers by generating 16 bytes of random
+ data.
+
+4. Configuration commands
+
+4.1. Rate Limiting
+
+ A Tor relay should be able to inform a transport proxy in real-time
+ about its rate-limiting needs.
+
+ This can be achieved by using the TransportControlPort and sending a
+ 'RATE_LIMIT' command to the transport proxy.
+
+ The body of the 'RATE_LIMIT' command should contain two integers,
+ 4 bytes each, in big-endian format. The two numbers should represent
+ the bandwidth rate and bandwidth burst respectively in 'bytes per
+ second' which the transport proxy must set as its overall
+ rate-limiting setting.
+
+ When the transport proxy sets the appropriate rate limiting, it
+ should send back a 'RATE_LIMITED' command. If it fails while setting
+ up rate limiting, it should send back a 'NOT_RATE_LIMITED' command.
+
+ After sending a 'RATE_LIMIT' command. the tor bridge MAY want to
+ stop pushing data to the transport proxy, till it receives a
+ 'RATE_LIMITED' command. If, instead, it receives a 'NOT_RATE_LIMITED'
+ command it MAY want to shutdown its connections to the transport
+ proxy.
+
+5. Security Considerations
+
+ Extended ORPort or TransportControlPort do _not_ provide link
+ confidentiality, authentication or integrity. Sensitive data, like
+ cryptographic material, should not be transferred through them.
+
+ An attacker with superuser access, is able to sniff network traffic,
+ and capture TransportControlPort identifiers and any data passed
+ through those ports.
+
+ Tor SHOULD issue a warning if the bridge operator tries to bind
+ Extended ORPort or TransportControlPort to a non-localhost address.
+
+ Pluggable transport proxies SHOULD issue a warning if they are
+ instructed to connect to a non-localhost Extended ORPort or
+ TransportControlPort.
+
+6. Future
+
+ In the future, we might have pluggable transports which require the
+ _client_ transport proxy to use the TransportControlPort and exchange
+ control information with the Tor client. The current proposal doesn't
+ yet support this, but we should not add functionality that will
+ prevent it from being possible.
diff --git a/proposals/xxx-transport-control-ports.txt b/proposals/xxx-transport-control-ports.txt
deleted file mode 100644
index 61f6b3e..0000000
--- a/proposals/xxx-transport-control-ports.txt
+++ /dev/null
@@ -1,185 +0,0 @@
-Filename: xxx-transport-control-ports.txt
-Title: Extended ORPort and TransportControlPort
-Author: George Kadianakis, Nick Mathewson
-Created: 14 Mar 2012
-Status: Open
-Target: 0.2.4.x
-
-1. Overview
-
- Proposal 180 defined Tor pluggable transports, a way to decouple
- protocol-level obfuscation from the core Tor protocol in order to
- better resist client-bridge censorship. This is achieved by
- introducing pluggable transport proxies, programs that obfuscate Tor
- traffic to resist DPI detection.
-
- Proposal 180 defined a way for pluggable transport proxies to
- communicate with local Tor clients and bridges, so as to exchange
- traffic. This document extends this communication protocol, so that
- pluggable transport proxies can exchange arbitrary operational
- information and metadata with Tor clients and bridges.
-
-2. Motivation
-
- The communication protocol specified in Proposal 180 gives a way
- for transport proxies to announce the IP address of their clients
- to tor. Still, modern pluggable transports might have more (?)
- needs than this. For example:
-
- 1. Tor might want to inform pluggable transport proxies on how to
- rate-limit incoming or outgoing connections.
-
- 2. Server pluggable transport proxies might want to pass client
- information to an anti-active-probing system controlled by tor.
-
- 3. Tor might want to temporarily stop a transport proxy from
- obfuscating traffic.
-
- To satisfy the above use cases, there must be real-time
- communication between the tor process and the pluggable transport
- proxy. To achieve this, this proposal refactors the Extended ORPort
- protocol specified in Proposal 180, and introduces a new port,
- TransportControlPort, whose sole role is the exchange of control
- information between transport proxies and tor.
-
- Specifically, transports proxies deliver each connection to the
- "Extended ORPort", where they provide metadata and agree on an
- identifier for each tunneled connection. Once this handshake
- occurs, the OR protocol proceeds unchanged.
-
- Additionally, each transport maintains a single connection to Tor's
- "TransportControlPort", where it receives instructions from Tor
- about rate-limiting on individual connections.
-
-3. The new port protocols
-
-3.1. The new extended ORPort protocol
-
- The extended server port protocol is as follows:
-
- COMMAND [2 bytes, big-endian]
- BODYLEN [2 bytes, big-endian]
- BODY [BODYLEN bytes]
-
- Commands sent from the transport proxy to the bridge are:
-
- [0x0000] DONE: There is no more information to give. The next
- bytes sent by the transport will be those tunneled over it.
- (body ignored)
-
- [0x0001] USERADDR: an address:port string that represents the user's
- address.
-
- Replies sent from tor to the proxy are:
-
- [0x1000] OKAY: Send the user's traffic. (body ignored)
-
- [0x1001] DENY: Tor would prefer not to get more traffic from
- this address for a while. (body ignored)
-
- [0x1002] CONTROL: a NUL-terminated "identifier" string. The
- pluggable transport proxy must use the "identifier" to access
- the TransportControlPort. See the 'Association and identifier
- creation' section below.
-
- Parties should ignore command codes that they do not understand.
-
-3.2. The new TransportControlPort protocol
-
- The TransportControlPort protocol is as follows:
-
- CONNECTIONID[16 bytes, big-endian]
- COMMAND [2 bytes, big-endian]
- BODYLEN [2 bytes, big-endian]
- BODY [BODYLEN bytes]
-
- Commands sent from the transport proxy to the bridge:
-
- [0x0001] RATE_LIMITED: Message confirming that the rate limiting
- request of the bridge was carried out successfully (body
- ignored). See the 'Rate Limiting' section below.
-
- [0x0002] NOT_RATE_LIMITED: Message notifying that the transport
- proxy failed to carry out the rate limiting request of the
- bridge (body ignored). See the 'Rate Limiting' section below.
-
- Configuration commands sent from the bridge to the transport
- proxy are:
-
- [0x1001] NOT_ALLOWED: Message notifying that the CONNECTIONID
- could not be matched with an authorized connection ID. The
- bridge SHOULD shutdown the connection.
-
- [0x1001] RATE_LIMIT: Carries information on how the pluggable
- transport proxy should rate-limit its traffic. See the 'Rate
- Limiting' section below.
-
- CONNECTIONID should carry the connection identifier described in the
- 'Association and identifier creation' section.
-
- Parties should ignore command codes that they do not understand.
-
-3.3. Association and identifier creation
-
- For Tor and a transport proxy to communicate using the
- TransportControlPort, an identifier must have already been negotiated
- using the 'CONTROL' command of Extended ORPort.
-
- The TransportControlPort identifier should not be predictable by a
- user who hasn't received a 'CONTROL' command from the Extended
- ORPort. For this reason, the TransportControlPort identifier should
- not be cryptographically-weak or deterministically created.
-
- Tor MUST create its identifiers by generating 16 bytes of random
- data.
-
-4. Configuration commands
-
-4.1. Rate Limiting
-
- A Tor relay should be able to inform a transport proxy in real-time
- about its rate-limiting needs.
-
- This can be achieved by using the TransportControlPort and sending a
- 'RATE_LIMIT' command to the transport proxy.
-
- The body of the 'RATE_LIMIT' command should contain two integers,
- 4 bytes each, in big-endian format. The two numbers should represent
- the bandwidth rate and bandwidth burst respectively in 'bytes per
- second' which the transport proxy must set as its overall
- rate-limiting setting.
-
- When the transport proxy sets the appropriate rate limiting, it
- should send back a 'RATE_LIMITED' command. If it fails while setting
- up rate limiting, it should send back a 'NOT_RATE_LIMITED' command.
-
- After sending a 'RATE_LIMIT' command. the tor bridge MAY want to
- stop pushing data to the transport proxy, till it receives a
- 'RATE_LIMITED' command. If, instead, it receives a 'NOT_RATE_LIMITED'
- command it MAY want to shutdown its connections to the transport
- proxy.
-
-5. Security Considerations
-
- Extended ORPort or TransportControlPort do _not_ provide link
- confidentiality, authentication or integrity. Sensitive data, like
- cryptographic material, should not be transferred through them.
-
- An attacker with superuser access, is able to sniff network traffic,
- and capture TransportControlPort identifiers and any data passed
- through those ports.
-
- Tor SHOULD issue a warning if the bridge operator tries to bind
- Extended ORPort or TransportControlPort to a non-localhost address.
-
- Pluggable transport proxies SHOULD issue a warning if they are
- instructed to connect to a non-localhost Extended ORPort or
- TransportControlPort.
-
-6. Future
-
- In the future, we might have pluggable transports which require the
- _client_ transport proxy to use the TransportControlPort and exchange
- control information with the Tor client. The current proposal doesn't
- yet support this, but we should not add functionality that will
- prevent it from being possible.
1
0
[translation/https_everywhere] Update translations for https_everywhere
by translation@torproject.org 15 Mar '12
by translation@torproject.org 15 Mar '12
15 Mar '12
commit 84bef06178b092c2bd181f5a5d96c2e76f250e0c
Author: Translation commit bot <translation(a)torproject.org>
Date: Thu Mar 15 21:15:46 2012 +0000
Update translations for https_everywhere
---
ar/https-everywhere.dtd | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ar/https-everywhere.dtd b/ar/https-everywhere.dtd
index b246753..4a906fd 100644
--- a/ar/https-everywhere.dtd
+++ b/ar/https-everywhere.dtd
@@ -7,7 +7,7 @@
<!ENTITY https-everywhere.about.thanks "شكراً لكل من">
<!ENTITY https-everywhere.about.contribute "إن أعجبتك إضافة HTTPS Everywhere، فكر بـ">
<!ENTITY https-everywhere.about.donate_tor "التبرع لتور">
-<!ENTITY https-everywhere.about.tor_lang_code "en">
+<!ENTITY https-everywhere.about.tor_lang_code "ar">
<!ENTITY https-everywhere.about.donate_eff "التبرع للـ EFF">
<!ENTITY https-everywhere.menu.about "عن HTTPS في كل مكان">
1
0
[translation/https_everywhere] Update translations for https_everywhere
by translation@torproject.org 15 Mar '12
by translation@torproject.org 15 Mar '12
15 Mar '12
commit 63dfd42017b456c4e37e0af91a86b3cf52295a69
Author: Translation commit bot <translation(a)torproject.org>
Date: Thu Mar 15 20:45:53 2012 +0000
Update translations for https_everywhere
---
ar/https-everywhere.dtd | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/ar/https-everywhere.dtd b/ar/https-everywhere.dtd
index 4fd5164..b246753 100644
--- a/ar/https-everywhere.dtd
+++ b/ar/https-everywhere.dtd
@@ -1,23 +1,23 @@
-<!ENTITY https-everywhere.about.title "حول HTTPS Everywhere">
-<!ENTITY https-everywhere.about.ext_name "HTTPS Everywhere">
-<!ENTITY https-everywhere.about.ext_description "شفر الإنترنت! استخدم تقنية HTTPS للأمان على العديد من المواقع.">
-<!ENTITY https-everywhere.about.version "الإصدار">
-<!ENTITY https-everywhere.about.created_by "أنشئت من قبل">
-<!ENTITY https-everywhere.about.librarians "Ruleset Librarians">
+<!ENTITY https-everywhere.about.title "عن HTTPS في كل مكان">
+<!ENTITY https-everywhere.about.ext_name "HTTPS في كل مكان">
+<!ENTITY https-everywhere.about.ext_description "عَمِّ الإنترنت! استخدم تلقائيا تقنية HTTPS للأمان مع الكثير من المواقع.">
+<!ENTITY https-everywhere.about.version "النسخة">
+<!ENTITY https-everywhere.about.created_by "أنشأه">
+<!ENTITY https-everywhere.about.librarians "جامعيْ القواعد">
<!ENTITY https-everywhere.about.thanks "شكراً لكل من">
<!ENTITY https-everywhere.about.contribute "إن أعجبتك إضافة HTTPS Everywhere، فكر بـ">
<!ENTITY https-everywhere.about.donate_tor "التبرع لتور">
<!ENTITY https-everywhere.about.tor_lang_code "en">
<!ENTITY https-everywhere.about.donate_eff "التبرع للـ EFF">
-<!ENTITY https-everywhere.menu.about "حول HTTPS في كل مكان">
-<!ENTITY https-everywhere.menu.observatory "خيارات SSL Observatory">
+<!ENTITY https-everywhere.menu.about "عن HTTPS في كل مكان">
+<!ENTITY https-everywhere.menu.observatory "خيارات مرصد SSL">
<!ENTITY https-everywhere.menu.globalEnable "فعّل HTTPS Everywhere">
-<!ENTITY https-everywhere.menu.globalDisable "أوقف HTTPS Everywhere">
+<!ENTITY https-everywhere.menu.globalDisable "عطّل HTTPS في كل مكان">
-<!ENTITY https-everywhere.prefs.title "خيارات HTTPS Everywhere">
+<!ENTITY https-everywhere.prefs.title "خيارات HTTPS في كل مكان">
<!ENTITY https-everywhere.prefs.enable_all "فعّل الكل">
-<!ENTITY https-everywhere.prefs.disable_all "عطل الكل">
+<!ENTITY https-everywhere.prefs.disable_all "عطّل الكل">
<!ENTITY https-everywhere.prefs.reset_defaults "استعادة الإعدادات الافتراضية">
<!ENTITY https-everywhere.prefs.search "بحث">
<!ENTITY https-everywhere.prefs.site "موقع">
@@ -26,12 +26,12 @@
<!ENTITY https-everywhere.prefs.enabled "مفعّل">
<!ENTITY https-everywhere.prefs.ruleset_howto "يمكنك تعلم كيفية كتابة rulesets خاصة بك(لإضافة الدعم لمواقع أخرى)">
<!ENTITY https-everywhere.prefs.here_link "هنا">
-<!ENTITY https-everywhere.prefs.toggle "تبديل الإعداد">
+<!ENTITY https-everywhere.prefs.toggle "بدّل">
<!ENTITY https-everywhere.prefs.reset_default "استعادة الإعداد الافتراضي">
<!ENTITY https-everywhere.prefs.view_xml_source "">
-<!ENTITY https-everywhere.source.downloading "">
-<!ENTITY https-everywhere.source.filename "">
-<!ENTITY https-everywhere.source.unable_to_download "">
+<!ENTITY https-everywhere.source.downloading "يّنزّل">
+<!ENTITY https-everywhere.source.filename "اسم الملف">
+<!ENTITY https-everywhere.source.unable_to_download "تعذّر تنزيل المصدر.">
1
0
[translation/https_everywhere_completed] Update translations for https_everywhere_completed
by translation@torproject.org 15 Mar '12
by translation@torproject.org 15 Mar '12
15 Mar '12
commit 7969a9fe68994d48c5b7cf038e82a364361dddda
Author: Translation commit bot <translation(a)torproject.org>
Date: Thu Mar 15 14:45:34 2012 +0000
Update translations for https_everywhere_completed
---
it/https-everywhere.dtd | 4 ++--
it/https-everywhere.properties | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/it/https-everywhere.dtd b/it/https-everywhere.dtd
index 5e664de..34101b3 100644
--- a/it/https-everywhere.dtd
+++ b/it/https-everywhere.dtd
@@ -5,7 +5,7 @@
<!ENTITY https-everywhere.about.created_by "Creato da">
<!ENTITY https-everywhere.about.librarians "Libreria regole">
<!ENTITY https-everywhere.about.thanks "Grazie a">
-<!ENTITY https-everywhere.about.contribute "Se ti piace HTTPS Everywhere, considera anche">
+<!ENTITY https-everywhere.about.contribute "Se ti piace HTTPS Everywhere, considera anche">
<!ENTITY https-everywhere.about.donate_tor "Donazioni a Tor">
<!ENTITY https-everywhere.about.tor_lang_code "it">
<!ENTITY https-everywhere.about.donate_eff "Donazioni a EFF">
@@ -22,7 +22,7 @@
<!ENTITY https-everywhere.prefs.search "Cerca">
<!ENTITY https-everywhere.prefs.site "Sito">
<!ENTITY https-everywhere.prefs.notes "Note">
-<!ENTITY https-everywhere.prefs.list_caption "Quale regola di reindirizzamento HTTPS ">
+<!ENTITY https-everywhere.prefs.list_caption "Quale regola di reindirizzamento HTTPS dovrebbe essere applicata?">
<!ENTITY https-everywhere.prefs.enabled "Abilitato">
<!ENTITY https-everywhere.prefs.ruleset_howto "Puoi imparare a scrivere i tuoi set di regole ( per aggiungere supporto ad altri siti)">
<!ENTITY https-everywhere.prefs.here_link "qui">
diff --git a/it/https-everywhere.properties b/it/https-everywhere.properties
new file mode 100644
index 0000000..8ffda9a
--- /dev/null
+++ b/it/https-everywhere.properties
@@ -0,0 +1,2 @@
+https-everywhere.menu.globalEnable = Abilita HTTPS Everywhere
+https-everywhere.menu.globalDisable = Disabilita HTTPS Everywhere
1
0
[translation/https_everywhere] Update translations for https_everywhere
by translation@torproject.org 15 Mar '12
by translation@torproject.org 15 Mar '12
15 Mar '12
commit df1233ff55c4e13078718a6b77370d40add2436d
Author: Translation commit bot <translation(a)torproject.org>
Date: Thu Mar 15 14:45:32 2012 +0000
Update translations for https_everywhere
---
it/https-everywhere.dtd | 4 ++--
it/https-everywhere.properties | 5 ++---
it/ssl-observatory.dtd | 13 +++++++------
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/it/https-everywhere.dtd b/it/https-everywhere.dtd
index 5e664de..34101b3 100644
--- a/it/https-everywhere.dtd
+++ b/it/https-everywhere.dtd
@@ -5,7 +5,7 @@
<!ENTITY https-everywhere.about.created_by "Creato da">
<!ENTITY https-everywhere.about.librarians "Libreria regole">
<!ENTITY https-everywhere.about.thanks "Grazie a">
-<!ENTITY https-everywhere.about.contribute "Se ti piace HTTPS Everywhere, considera anche">
+<!ENTITY https-everywhere.about.contribute "Se ti piace HTTPS Everywhere, considera anche">
<!ENTITY https-everywhere.about.donate_tor "Donazioni a Tor">
<!ENTITY https-everywhere.about.tor_lang_code "it">
<!ENTITY https-everywhere.about.donate_eff "Donazioni a EFF">
@@ -22,7 +22,7 @@
<!ENTITY https-everywhere.prefs.search "Cerca">
<!ENTITY https-everywhere.prefs.site "Sito">
<!ENTITY https-everywhere.prefs.notes "Note">
-<!ENTITY https-everywhere.prefs.list_caption "Quale regola di reindirizzamento HTTPS ">
+<!ENTITY https-everywhere.prefs.list_caption "Quale regola di reindirizzamento HTTPS dovrebbe essere applicata?">
<!ENTITY https-everywhere.prefs.enabled "Abilitato">
<!ENTITY https-everywhere.prefs.ruleset_howto "Puoi imparare a scrivere i tuoi set di regole ( per aggiungere supporto ad altri siti)">
<!ENTITY https-everywhere.prefs.here_link "qui">
diff --git a/it/https-everywhere.properties b/it/https-everywhere.properties
index 5db4f1b..8ffda9a 100644
--- a/it/https-everywhere.properties
+++ b/it/https-everywhere.properties
@@ -1,3 +1,2 @@
-# https-everywhere.menu.globalEnable = Enable HTTPS Everywhere
-# https-everywhere.menu.globalDisable = Disable HTTPS Everywhere
-
+https-everywhere.menu.globalEnable = Abilita HTTPS Everywhere
+https-everywhere.menu.globalDisable = Disabilita HTTPS Everywhere
diff --git a/it/ssl-observatory.dtd b/it/ssl-observatory.dtd
index 8daef7e..7d13c1a 100644
--- a/it/ssl-observatory.dtd
+++ b/it/ssl-observatory.dtd
@@ -1,9 +1,10 @@
<!-- Observatory popup window -->
-<!ENTITY ssl-observatory.popup.details "">
-<!ENTITY ssl-observatory.popup.later "">
-<!ENTITY ssl-observatory.popup.no "">
+<!ENTITY ssl-observatory.popup.details "Dettagli e informazioni sulla privacy">
+<!ENTITY ssl-observatory.popup.later "Chiedimelo piu' tardi">
+<!ENTITY ssl-observatory.popup.no "No">
-<!ENTITY ssl-observatory.popup.text "">
+<!ENTITY ssl-observatory.popup.text "HTTPS Everywhere può individuare attacchi al tuo browser
+inviando all'Observatory il certificato ricevuto.">
<!--<!ENTITY ssl-observatory.popup.text
"EFF's SSL Observatory can detect attacks against HTTPS websites by collecting
@@ -11,9 +12,9 @@ and auditing the certificates being presented to your browser. Would you like
to turn it on?">-->
<!ENTITY ssl-observatory.popup.title
-"">
+"Abilita HTTPS Everywhere all'uso di SSL Observatory">
-<!ENTITY ssl-observatory.popup.yes "">
+<!ENTITY ssl-observatory.popup.yes "Si'">
<!-- Observatory preferences dialog -->
1
0
commit b836b71e323d74b72a5911f3237b28fff2ab4548
Author: Tomás Touceda <chiiph(a)torproject.org>
Date: Thu Mar 15 11:12:10 2012 -0300
Add a changes file
---
changes/featImprovedBootstrap | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/changes/featImprovedBootstrap b/changes/featImprovedBootstrap
new file mode 100644
index 0000000..2c9976b
--- /dev/null
+++ b/changes/featImprovedBootstrap
@@ -0,0 +1 @@
+ o Improve the bootstrap behavior for the new async TorControl.
\ No newline at end of file
1
0
[vidalia/alpha] Improve the bootstrap procedure to play better with the async TorControl
by chiiph@torproject.org 15 Mar '12
by chiiph@torproject.org 15 Mar '12
15 Mar '12
commit decef1ded8096ecdf15c3e2c140b315e09b4cc61
Author: Tomás Touceda <chiiph(a)torproject.org>
Date: Thu Mar 15 11:10:46 2012 -0300
Improve the bootstrap procedure to play better with the async TorControl
---
src/torcontrol/ControlConnection.cpp | 42 +++---
src/torcontrol/TorControl.cpp | 89 ++++++++++-
src/torcontrol/TorControl.h | 45 ++++--
src/torcontrol/TorProcess.cpp | 28 ++--
src/vidalia/MainWindow.cpp | 295 +++++++++++++++++++++-------------
src/vidalia/MainWindow.h | 16 +-
6 files changed, 345 insertions(+), 170 deletions(-)
diff --git a/src/torcontrol/ControlConnection.cpp b/src/torcontrol/ControlConnection.cpp
index 21cb527..af3d2d3 100644
--- a/src/torcontrol/ControlConnection.cpp
+++ b/src/torcontrol/ControlConnection.cpp
@@ -1,10 +1,10 @@
/*
** 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
+** 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.torproject.org/projects/vidalia.html. No part of Vidalia,
-** including this file, may be copied, modified, propagated, or distributed
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
** except according to the terms described in the LICENSE file.
*/
@@ -44,6 +44,9 @@ ControlConnection::~ControlConnection()
{
/* Clean up after the send waiter */
delete _sendWaiter;
+ delete _sock;
+ delete _connectTimer;
+ _sock = 0;
}
/** Connect to the specified Tor control interface. */
@@ -75,7 +78,7 @@ ControlConnection::connect(const QString &addr)
"control thread is already running.");
return;
}
-
+
_path = addr;
_connectAttempt = 0;
setStatus(Connecting);
@@ -92,7 +95,7 @@ ControlConnection::connect()
_connectAttempt++;
tc::debug("Connecting to Tor (Attempt %1 of %2)").arg(_connectAttempt)
.arg(MAX_CONNECT_ATTEMPTS);
-
+
switch(_method) {
case ControlMethod::Socket:
_sock->connectToServer(_path);
@@ -115,7 +118,7 @@ ControlConnection::disconnect()
while (!_recvQueue.isEmpty()) {
ReceiveWaiter *w = _recvQueue.dequeue();
- w->setResult(false, ControlReply(),
+ w->setResult(false, ControlReply(),
tr("Control socket is not connected."));
QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
@@ -135,9 +138,6 @@ ControlConnection::disconnect()
}
_sock->disconnect(this);
- delete _sock;
- delete _connectTimer;
- _sock = 0;
}
/** Called when the control socket is connected. This method checks that the
@@ -278,10 +278,10 @@ bool
ControlConnection::send(const ControlCommand &cmd, QString *errmsg)
{
if (!_sock || !_sock->isConnected()) {
- return err(errmsg, tr("Control socket is not connected."));
+ return err(errmsg, tr("Control socket is not connected."));
}
QCoreApplication::postEvent(_sock, new SendCommandEvent(cmd, _sendWaiter));
-
+
return _sendWaiter->getResult(errmsg);
}
@@ -291,21 +291,21 @@ ControlConnection::onReadyRead()
{
ReceiveWaiter *waiter;
QString errmsg;
-
+
while (_sock->canReadLine()) {
ControlReply reply;
if (_sock->readReply(reply, &errmsg)) {
if (reply.getStatus() == "650") {
/* Asynchronous event message */
tc::debug("Control Event: %1").arg(reply.toString());
-
+
if (_events) {
_events->handleEvent(reply);
}
} else {
/* Response to a previous command */
tc::debug("Control Reply: %1").arg(reply.toString());
-
+
if (!_recvQueue.isEmpty()) {
waiter = _recvQueue.dequeue();
waiter->setResult(true, reply);
@@ -327,14 +327,14 @@ ControlConnection::run()
_connectTimer = new QTimer();
_connectTimer->setSingleShot(true);
-
+
QObject::connect(_sock, SIGNAL(readyRead()), this, SLOT(onReadyRead()),
Qt::DirectConnection);
QObject::connect(_sock, SIGNAL(disconnected()), this, SLOT(onDisconnected()),
Qt::DirectConnection);
QObject::connect(_sock, SIGNAL(connected()), this, SLOT(onConnected()),
Qt::DirectConnection);
- QObject::connect(_sock, SIGNAL(error(QAbstractSocket::SocketError)),
+ QObject::connect(_sock, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(onError(QAbstractSocket::SocketError)),
Qt::DirectConnection);
QObject::connect(_connectTimer, SIGNAL(timeout()), this, SLOT(connect()),
@@ -349,8 +349,8 @@ ControlConnection::run()
* ControlConnection::ReceiveWaiter
*/
/** Waits for and gets the reply from a control command. */
-bool
-ControlConnection::ReceiveWaiter::getResult(ControlReply *reply,
+bool
+ControlConnection::ReceiveWaiter::getResult(ControlReply *reply,
QString *errmsg)
{
while(_status == Waiting)
@@ -364,9 +364,9 @@ ControlConnection::ReceiveWaiter::getResult(ControlReply *reply,
}
/** Sets the result and reply from a control command. */
-void
-ControlConnection::ReceiveWaiter::setResult(bool success,
- const ControlReply &reply,
+void
+ControlConnection::ReceiveWaiter::setResult(bool success,
+ const ControlReply &reply,
const QString &errmsg)
{
_status = (success ? Success : Failed);
diff --git a/src/torcontrol/TorControl.cpp b/src/torcontrol/TorControl.cpp
index 9cdf6ad..0ad9db6 100644
--- a/src/torcontrol/TorControl.cpp
+++ b/src/torcontrol/TorControl.cpp
@@ -3,8 +3,8 @@
** 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.torproject.org/projects/vidalia.html. No part of Vidalia,
-** including this file, may be copied, modified, propagated, or distributed
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
** except according to the terms described in the LICENSE file.
*/
@@ -26,7 +26,7 @@
/** Default constructor */
TorControl::TorControl(ControlMethod::Method method)
-{
+ : QObject(), _shouldContinue(true), _reason("") {
#define RELAY_SIGNAL(src, sig) \
QObject::connect((src), (sig), this, (sig))
@@ -83,6 +83,12 @@ TorControl::TorControl(ControlMethod::Method method)
QObject::connect(_torProcess, SIGNAL(log(QString, QString)),
this, SLOT(onLogStdout(QString, QString)));
+ QObject::connect(_torProcess, SIGNAL(startFailed(QString)),
+ this, SLOT(torStartFailed(QString)));
+ QObject::connect(_controlConn, SIGNAL(connectFailed(QString)),
+ this, SLOT(torConnectFailed(QString)));
+
+
#if defined(Q_OS_WIN32)
_torService = new TorService(this);
RELAY_SIGNAL(_torService, SIGNAL(started()));
@@ -127,6 +133,33 @@ TorControl::start(const QString &tor, const QStringList &args)
}
}
+/** Returns true if the process is running */
+bool
+TorControl::torStarted()
+{
+ return _torProcess->state() == QProcess::Running;
+}
+
+/** Called when starting the tor process failed */
+void
+TorControl::torStartFailed(QString errmsg)
+{
+ _shouldContinue = false;
+ _reason = tr("Start failed: %1").arg(errmsg);
+}
+
+/** Returns true if the bootstrap should continue. If it returns
+ * false, it also sets the errmsg to the last error */
+bool
+TorControl::shouldContinue(QString *errmsg)
+{
+ if(not errmsg)
+ errmsg = new QString();
+
+ *errmsg = _reason;
+ return _shouldContinue;
+}
+
/** Stop the Tor process. */
bool
TorControl::stop(QString *errmsg)
@@ -157,10 +190,26 @@ TorControl::onStopped(int exitCode, QProcess::ExitStatus exitStatus)
if (_controlConn->status() == ControlConnection::Connecting)
_controlConn->cancelConnect();
+ if (exitStatus == QProcess::CrashExit || exitCode != 0) {
+ _shouldContinue = false;
+ _reason = tr("Process finished: ExitCode=%1").arg(exitCode);
+ }
+
emit stopped();
+ disconnect();
emit stopped(exitCode, exitStatus);
}
+/** Returns true if the tor process has finished, along with its exit
+ * code and status */
+bool
+TorControl::finished(int *exitCode, QProcess::ExitStatus *exitStatus)
+{
+ *exitCode = _torProcess->exitCode();
+ *exitStatus = _torProcess->exitStatus();
+ return _torProcess->state() == QProcess::NotRunning;
+}
+
/** Detects if the Tor process is running under Vidalia. Returns true if
* Vidalia owns the Tor process, or false if it was an independent Tor. */
bool
@@ -209,6 +258,14 @@ TorControl::connect(const QString &path)
_controlConn->connect(path);
}
+/** Called when the connection to tor has failed */
+void
+TorControl::torConnectFailed(QString errmsg)
+{
+ _shouldContinue = false;
+ _reason = tr("Connection failed: %1").arg(errmsg);
+}
+
/** Disconnect from Tor's control port */
void
TorControl::disconnect()
@@ -217,6 +274,7 @@ TorControl::disconnect()
_controlConn->disconnect();
}
+/** Emits the proper bootstrapStatusChanged */
void
TorControl::getBootstrapPhase()
{
@@ -257,6 +315,9 @@ TorControl::onDisconnected()
/* Tor isn't running, so it has no version */
_torVersion = QString();
+ _shouldContinue = false;
+ _reason = tr("Disconnected");
+
/* Let interested parties know we lost our control connection */
emit disconnected();
}
@@ -307,6 +368,9 @@ TorControl::authenticate(const QByteArray cookie, QString *errmsg)
if (!send(cmd, reply, &str)) {
emit authenticationFailed(str);
+ _shouldContinue = false;
+ _reason = str;
+
return err(errmsg, str);
}
onAuthenticated();
@@ -326,6 +390,9 @@ TorControl::authenticate(const QString &password, QString *errmsg)
if (!send(cmd, reply, &str)) {
emit authenticationFailed(str);
+ _shouldContinue = false;
+ _reason = str;
+
return err(errmsg, str);
}
onAuthenticated();
@@ -403,6 +470,7 @@ TorControl::useFeature(const QString &feature, QString *errmsg)
return send(cmd, errmsg);
}
+/** Returns the current BootstrapStatus */
BootstrapStatus
TorControl::bootstrapStatus(QString *errmsg)
{
@@ -906,7 +974,7 @@ TorControl::loadConf(const QString &contents, QString *errmsg)
{
ControlCommand cmd("+LOADCONF");
ControlReply reply;
-
+
cmd.addArgument(contents + ".");
return send(cmd, reply, errmsg);
}
@@ -963,6 +1031,7 @@ TorControl::resetConf(QString key, QString *errmsg)
return resetConf(QStringList() << key, errmsg);
}
+/** Returns true if microdescriptors are used */
bool
TorControl::useMicrodescriptors(QString *errmsg)
{
@@ -1131,8 +1200,8 @@ TorControl::closeStream(const StreamId &streamId, QString *errmsg)
return send(cmd, errmsg);
}
- /** Gets a list of address mappings of the type specified by <b>type</b>
- * (defaults to <i>AddressMapAll</i>. */
+/** Gets a list of address mappings of the type specified by <b>type</b>
+ * (defaults to <i>AddressMapAll</i>. */
AddressMap
TorControl::getAddressMap(AddressMap::AddressMapType type, QString *errmsg)
{
@@ -1180,3 +1249,11 @@ TorControl::takeOwnership(QString *errmsg)
ControlCommand cmd("TAKEOWNERSHIP");
return send(cmd, errmsg);
}
+
+/** Clear the error state for shouldContinue(errmsg) */
+void
+TorControl::clearErrState()
+{
+ _shouldContinue = true;
+ _reason = "";
+}
diff --git a/src/torcontrol/TorControl.h b/src/torcontrol/TorControl.h
index 96c7bd2..6432c83 100644
--- a/src/torcontrol/TorControl.h
+++ b/src/torcontrol/TorControl.h
@@ -1,14 +1,14 @@
/*
** 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
+** 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.torproject.org/projects/vidalia.html. No part of Vidalia,
-** including this file, may be copied, modified, propagated, or distributed
+** http://www.torproject.org/projects/vidalia.html. 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 TorControl.h
** \brief Object for interacting with the Tor process and control interface
*/
@@ -49,7 +49,7 @@ typedef QHash<QString,QString> DescriptorAnnotations;
class TorControl : public QObject
{
Q_OBJECT
-
+
public:
/** Default constructor */
TorControl(ControlMethod::Method method = ControlMethod::Port);
@@ -58,6 +58,9 @@ public:
/** Start the Tor process */
void start(const QString &tor, const QStringList &args);
+ /** Returns true if the process is running */
+ bool torStarted();
+
/** Stop the Tor process */
bool stop(QString *errmsg = 0);
/** Detect if the Tor process is running */
@@ -71,6 +74,7 @@ public:
/** Connect to Tor's control socket */
void connect(const QHostAddress &address, quint16 port);
void connect(const QString &path);
+
/** Disconnect from Tor's control socket */
void disconnect();
/** Check if we're connected to Tor's control socket */
@@ -79,14 +83,14 @@ public:
bool authenticate(const QByteArray cookie, QString *errmsg = 0);
/** Sends an authentication password to Tor. */
bool authenticate(const QString &password = QString(), QString *errmsg = 0);
-
+
/** Sends a PROTOCOLINFO command to Tor and parses the response. */
ProtocolInfo protocolInfo(QString *errmsg = 0);
/** Returns the Tor software's current bootstrap phase and status. */
BootstrapStatus bootstrapStatus(QString *errmsg = 0);
- /** Returns true if Tor either has an open circuit or (on Tor >=
+ /** Returns true if Tor either has an open circuit or (on Tor >=
* 0.2.0.1-alpha) has previously decided it's able to establish a circuit. */
bool isCircuitEstablished();
@@ -106,11 +110,11 @@ public:
/** Sends a signal to Tor */
bool signal(TorSignal::Signal sig, QString *errmsg = 0);
-
+
/** Returns an address on which Tor is listening for application
* requests. If none are available, a null QHostAddress is returned. */
QHostAddress getSocksAddress(QString *errmsg = 0);
- /** Returns a (possibly empty) list of all currently configured
+ /** Returns a (possibly empty) list of all currently configured
* SocksListenAddress entries. */
QStringList getSocksAddressList(QString *errmsg = 0);
/** Returns a valid SOCKS port for Tor, or 0 if Tor is not accepting
@@ -162,7 +166,7 @@ public:
/** Sends a GETCONF message to Tor with the single key and returns a QString
* containing the value returned by Tor */
QString getHiddenServiceConf(const QString &key, QString *errmsg = 0);
-
+
/** Asks Tor to save the current configuration to its torrc */
bool saveConf(QString *errmsg = 0);
/** Tells Tor to reset the given configuration keys back to defaults. */
@@ -200,7 +204,7 @@ public:
CircuitList getCircuits(QString *errmsg = 0);
/** Gets a list of current streams. */
StreamList getStreams(QString *errmsg = 0);
-
+
/** Gets a list of address mappings of the type specified by <b>type</b>
* (defaults to <i>AddressMapAll</i>. */
AddressMap getAddressMap(
@@ -216,6 +220,15 @@ public:
/** Takes ownership of the tor process it's communicating to */
bool takeOwnership(QString *errmsg);
+ /** Clear the error state for shouldContinue(errmsg) */
+ void clearErrState();
+ /** Returns true if the bootstrap should continue. If it returns
+ * false, it also sets the errmsg to the last error */
+ bool shouldContinue(QString *errmsg = 0);
+ /** Returns true if the tor process has finished, along with its exit
+ * code and status */
+ bool finished(int *exitCode, QProcess::ExitStatus *exitStatus);
+
public slots:
/** Closes the circuit specified by <b>circId</b>. If <b>ifUnused</b> is
* true, then the circuit will not be closed unless it is unused. */
@@ -313,7 +326,7 @@ signals:
/** Emitted when Tor decides the client's external IP address has changed
* to <b>ip</b>. If <b>hostname</b> is non-empty, Tor obtained the new
- * value for <b>ip</b> by resolving <b>hostname</b>.
+ * value for <b>ip</b> by resolving <b>hostname</b>.
*/
void externalAddressChanged(const QHostAddress &ip, const QString &hostname);
@@ -338,7 +351,7 @@ signals:
*/
void dnsUseless();
- /** Indicates Tor has started testing the reachability of its OR port
+ /** Indicates Tor has started testing the reachability of its OR port
* using the IP address <b>ip</b> and port <b>port</b>.
*/
void checkingOrPortReachability(const QHostAddress &ip, quint16 port);
@@ -396,6 +409,9 @@ private:
TorService* _torService;
#endif
+ bool _shouldContinue;
+ QString _reason;
+
/** Send a message to Tor and read the response */
bool send(ControlCommand cmd, ControlReply &reply, QString *errmsg = 0);
/** Send a message to Tor and discard the response */
@@ -412,6 +428,9 @@ private slots:
void onDisconnected();
void onLogStdout(const QString &severity, const QString &message);
void onAuthenticated();
+
+ void torStartFailed(QString errmsg);
+ void torConnectFailed(QString errmsg);
};
#endif
diff --git a/src/torcontrol/TorProcess.cpp b/src/torcontrol/TorProcess.cpp
index 7275f7a..84dfcb3 100644
--- a/src/torcontrol/TorProcess.cpp
+++ b/src/torcontrol/TorProcess.cpp
@@ -1,14 +1,14 @@
/*
** 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
+** 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.torproject.org/projects/vidalia.html. No part of Vidalia,
-** including this file, may be copied, modified, propagated, or distributed
+** http://www.torproject.org/projects/vidalia.html. 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 TorProcess.cpp
** \brief Starts and stops a Tor process
*/
@@ -31,9 +31,9 @@ TorProcess::TorProcess(QObject *parent)
: QProcess(parent)
{
openStdout();
- connect(this, SIGNAL(readyReadStandardOutput()),
+ connect(this, SIGNAL(readyReadStandardOutput()),
this, SLOT(onReadyRead()));
- connect(this, SIGNAL(error(QProcess::ProcessError)),
+ connect(this, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(onError(QProcess::ProcessError)));
}
@@ -53,7 +53,7 @@ TorProcess::formatArguments(const QStringList &args)
* signal started() will be emitted. If Tor fails to start,
* startFailed(errmsg) will be emitted, with an appropriate error message. */
void
-TorProcess::start(const QString &app, const QStringList &args)
+TorProcess::start(const QString &app, const QStringList &args)
{
QString exe = app;
#if defined(Q_OS_WIN32)
@@ -61,12 +61,12 @@ TorProcess::start(const QString &app, const QStringList &args)
* quoted before being passed to it. */
exe = "\"" + exe + "\"";
#endif
-
+
/* Attempt to start Tor with the given command-line arguments */
QStringList env = QProcess::systemEnvironment();
#if !defined(Q_OS_WIN32)
/* Add "/usr/sbin" to an existing $PATH
- * XXX What if they have no path? Would always just making one with
+ * XXX What if they have no path? Would always just making one with
* "/usr/sbin" smart? Should we add anything else? */
for (int i = 0; i < env.size(); i++) {
QString envVar = env.at(i);
@@ -93,7 +93,7 @@ TorProcess::stop(QString *errmsg)
tc::debug("Stopping the Tor process.");
/* Tell the process to stop */
#if defined(Q_OS_WIN32)
- /* Tor on Windows doesn't understand a WM_CLOSE message (which is what
+ /* Tor on Windows doesn't understand a WM_CLOSE message (which is what
* QProcess::terminate() sends it), so we have to kill it harshly. */
kill();
#else
@@ -103,7 +103,7 @@ TorProcess::stop(QString *errmsg)
if (!waitForFinished(5000)) {
tc::error("Tor failed to stop: %1").arg(errorString());
if (errmsg) {
- *errmsg =
+ *errmsg =
tr("Process %1 failed to stop. [%2]").arg(pid()).arg(errorString());
}
return false;
@@ -149,7 +149,7 @@ TorProcess::onReadyRead()
{
int i, j;
QString line;
-
+
while (canReadLine()) {
line = readLine();
if (!line.isEmpty()) {
@@ -171,11 +171,11 @@ TorProcess::onError(QProcess::ProcessError error)
{
if (error == QProcess::FailedToStart) {
tc::error("The Tor process failed to start: %1").arg(errorString());
- /* Tor didn't start, so let everyone know why. */
- emit startFailed(errorString());
} else {
tc::error("Tor process error: %1").arg(errorString());
}
+ /* Tor didn't start, so let everyone know why. */
+ emit startFailed(errorString());
}
/** Returns the version reported by the Tor executable specified in
diff --git a/src/vidalia/MainWindow.cpp b/src/vidalia/MainWindow.cpp
index 4307f05..0861b0c 100644
--- a/src/vidalia/MainWindow.cpp
+++ b/src/vidalia/MainWindow.cpp
@@ -3,8 +3,8 @@
** 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.torproject.org/projects/vidalia.html. No part of Vidalia,
-** including this file, may be copied, modified, propagated, or distributed
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
** except according to the terms described in the LICENSE file.
*/
@@ -105,10 +105,12 @@ void qt_mac_set_dock_menu(QMenu *menu);
MainWindow::MainWindow()
: VidaliaWindow("MainWindow")
{
+ _pressedStop = false;
+
_startedWithPrevious = false;
/* Create a new TorControl object, used to communicate with Tor */
- _torControl = Vidalia::torControl();
+ _torControl = Vidalia::torControl();
_engine = new PluginEngine();
@@ -239,9 +241,9 @@ MainWindow::createToolBar()
tool->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
}
-/** Creates a QMenu object that contains QActions which compose the system
+/** Creates a QMenu object that contains QActions which compose the system
* tray menu. */
-QMenu*
+QMenu*
MainWindow::createTrayMenu()
{
QMenu *menu = new QMenu(this);
@@ -255,7 +257,7 @@ MainWindow::createTrayMenu()
menu->addAction(_actionShowControlPanel);
menu->addMenu(&_reattachMenu);
-
+
#if !defined(Q_WS_MAC)
/* These aren't added to the dock menu on Mac, since they are in the
* standard Mac locations in the menu bar. */
@@ -398,18 +400,6 @@ MainWindow::createConnections()
connect(vApp, SIGNAL(running()), this, SLOT(running()));
connect(vApp, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));
- connect(_torControl, SIGNAL(started()), this, SLOT(started()));
- connect(_torControl, SIGNAL(startFailed(QString)),
- this, SLOT(startFailed(QString)));
- connect(_torControl, SIGNAL(stopped(int, QProcess::ExitStatus)),
- this, SLOT(stopped(int, QProcess::ExitStatus)));
- connect(_torControl, SIGNAL(connected()), this, SLOT(connected()));
- connect(_torControl, SIGNAL(disconnected()), this, SLOT(disconnected()));
- connect(_torControl, SIGNAL(connectFailed(QString)),
- this, SLOT(connectFailed(QString)));
- connect(_torControl, SIGNAL(authenticated()), this, SLOT(authenticated()));
- connect(_torControl, SIGNAL(authenticationFailed(QString)),
- this, SLOT(authenticationFailed(QString)));
connect(_torControl, SIGNAL(clockSkewed(int, QString)),
this, SLOT(clockSkewed(int, QString)));
@@ -422,8 +412,6 @@ MainWindow::createConnections()
_torControl->setEvent(TorEvents::ClientStatus);
connect(_torControl, SIGNAL(bootstrapStatusChanged(BootstrapStatus)),
this, SLOT(bootstrapStatusChanged(BootstrapStatus)));
- connect(_torControl, SIGNAL(circuitEstablished()),
- this, SLOT(circuitEstablished()));
connect(_torControl, SIGNAL(dangerousPort(quint16, bool)),
this, SLOT(warnDangerousPort(quint16, bool)));
@@ -458,7 +446,7 @@ MainWindow::createConnections()
this, SLOT(upnpError(UPNPControl::UPNPError)));
#endif
- connect(_engine, SIGNAL(pluginTab(VidaliaTab *)),
+ connect(_engine, SIGNAL(pluginTab(VidaliaTab *)),
this, SLOT(addTab(VidaliaTab *)));
}
@@ -468,16 +456,17 @@ MainWindow::createConnections()
void
MainWindow::close()
{
+ _pressedStop = true;
+ QCoreApplication::processEvents();
+
if (_torControl->isVidaliaRunningTor()) {
/* If we're running a server currently, ask if we want to do a delayed
* shutdown. If we do, then close Vidalia only when Tor stops. Otherwise,
* kill Tor and bail now. */
ServerSettings settings(_torControl);
if (_torControl->isConnected() && settings.isServerEnabled()) {
- connect(_torControl, SIGNAL(stopped()), vApp, SLOT(quit()));
- if (!stop())
- QObject::disconnect(_torControl, SIGNAL(stopped()), vApp, SLOT(quit()));
- return;
+ if(!stop())
+ return;
}
}
vApp->quit();
@@ -545,7 +534,7 @@ MainWindow::aboutToQuit()
vNotice("Cleaning up before exiting.");
if (_torControl->isVidaliaRunningTor()) {
- /* Kill our Tor process now */
+ /* Kill our Tor process now */
_torControl->stop();
}
@@ -559,12 +548,14 @@ MainWindow::aboutToQuit()
/** Attempts to start Tor. If Tor fails to start, then startFailed() will be
* called with an error message containing the reason. */
-void
+void
MainWindow::start()
{
TorSettings settings;
QStringList args;
+ _torControl->clearErrState();
+
updateTorStatus(Starting);
// Disable autoconfiguration if there are missing config data
@@ -579,12 +570,12 @@ MainWindow::start()
if(settings.getControlMethod() == ControlMethod::Port) {
if(!settings.autoControlPort() && net_test_connect(settings.getControlAddress(),
settings.getControlPort())) {
- started();
+ connectToTor();
return;
}
} else {
if (socket_test_connect(settings.getSocketPath())) {
- started();
+ connectToTor();
return;
}
}
@@ -602,7 +593,7 @@ MainWindow::start()
}
}
}
-
+
if(_torControl->getTorVersion() >= 0x020309) {
if (!torrc_defaults.isEmpty()) {
args << "--defaults-torrc" << torrc_defaults;
@@ -619,7 +610,7 @@ MainWindow::start()
/* Specify Tor's data directory, if different from the default */
QString dataDirectory = settings.getDataDirectory();
QString expDataDirectory = expand_filename(dataDirectory);
-
+
if(settings.getControlMethod() == ControlMethod::Port) {
if(settings.autoControlPort()) {
QString portconf = QString("%1/port.conf").arg(expDataDirectory);
@@ -637,8 +628,9 @@ MainWindow::start()
}
}
- args << "__OwningControllerProcess" << QString::number(QCoreApplication::applicationPid());
-
+ if (_torControl->getTorVersion() < 0x02021c)
+ args << "__OwningControllerProcess" << QString::number(QCoreApplication::applicationPid());
+
/* Add the control port authentication arguments */
switch (settings.getAuthenticationMethod()) {
case TorSettings::PasswordAuth:
@@ -664,15 +656,36 @@ MainWindow::start()
_isIntentionalExit = true;
/* Kick off the Tor process */
_torControl->start(settings.getExecutable(), args);
+
+ QString errmsg;
+ while(not _torControl->torStarted()) {
+ QCoreApplication::processEvents();
+ if(not _torControl->shouldContinue(&errmsg) and not _pressedStop) {
+ startFailed(errmsg);
+
+ int exitCode;
+ QProcess::ExitStatus exitStatus;
+
+ if(_torControl->finished(&exitCode, &exitStatus))
+ stopped(exitCode, exitStatus);
+
+ return;
+ } else if(_pressedStop) {
+ return;
+ }
+ }
+ connectToTor();
}
/** Slot: Called when the Tor process is started. It will connect the control
* socket and set the icons and tooltips accordingly. */
-void
-MainWindow::started()
+void
+MainWindow::connectToTor()
{
TorSettings settings;
+ _torControl->clearErrState();
+
updateTorStatus(Started);
/* Now that Tor is running, we want to know if it dies when we didn't want
@@ -741,6 +754,26 @@ MainWindow::started()
Vidalia::torrc()->apply(Vidalia::torControl());
}
setStartupProgress(STARTUP_PROGRESS_CONNECTING, tr("Connecting to Tor"));
+
+ QString errmsg;
+ while(not _torControl->isConnected()) {
+ QCoreApplication::processEvents();
+ if(not _torControl->shouldContinue(&errmsg) and not _pressedStop) {
+ connectFailed(errmsg);
+
+ int exitCode;
+ QProcess::ExitStatus exitStatus;
+
+ if(_torControl->finished(&exitCode, &exitStatus))
+ stopped(exitCode, exitStatus);
+
+ return;
+ } else if(_pressedStop) {
+ return;
+ }
+ }
+
+ authenticate();
}
/** Disconnects the control socket and stops the Tor process. */
@@ -753,6 +786,9 @@ MainWindow::stop()
bool rc;
VidaliaSettings settings;
+ _pressedStop = true;
+ QCoreApplication::processEvents();
+
/* If we're running a server, give users the option of terminating
* gracefully so clients have time to find new servers. */
if (server.isServerEnabled() && !_delayedShutdownStarted) {
@@ -765,8 +801,8 @@ MainWindow::stop()
"open connections from clients.\n\n"
"Would you like to shutdown gracefully and "
"give clients time to find a new relay?"),
- VMessageBox::Yes|VMessageBox::Default,
- VMessageBox::No,
+ VMessageBox::Yes|VMessageBox::Default,
+ VMessageBox::No,
VMessageBox::Cancel|VMessageBox::Escape,
"Remember this answer", &settings, SETTING_REMEMBER_SHUTDOWN);
}
@@ -775,8 +811,8 @@ MainWindow::stop()
else if (response == VMessageBox::Cancel)
return false;
}
-
- prevStatus = updateTorStatus(Stopping);
+
+ prevStatus = updateTorStatus(Stopping);
if (_delayedShutdownStarted) {
/* Start a delayed shutdown */
rc = _torControl->signal(TorSignal::Shutdown, &errmsg);
@@ -785,15 +821,22 @@ MainWindow::stop()
_isIntentionalExit = true;
rc = _torControl->stop(&errmsg);
}
-
+
+ int exitCode;
+ QProcess::ExitStatus exitStatus;
+
+ while(not _torControl->finished(&exitCode, &exitStatus)) {
+ QCoreApplication::processEvents();
+ }
+
if (!rc) {
/* We couldn't tell Tor to stop, for some reason. */
int response = VMessageBox::warning(this, tr("Error Shutting Down"),
- p(tr("Vidalia was unable to stop the Tor software."))
+ p(tr("Vidalia was unable to stop the Tor software."))
+ p(errmsg),
- VMessageBox::Ok|VMessageBox::Default|VMessageBox::Escape,
+ VMessageBox::Ok|VMessageBox::Default|VMessageBox::Escape,
VMessageBox::Help);
-
+
if (response == VMessageBox::Help) {
/* Show some troubleshooting help */
showHelpDialog("troubleshooting.stop");
@@ -803,12 +846,17 @@ MainWindow::stop()
_delayedShutdownStarted = false;
updateTorStatus(prevStatus);
}
+
+ stopped(exitCode, exitStatus);
+
+ _pressedStop = false;
+
return rc;
}
/** Slot: Called when the Tor process has exited. It will adjust the tray
* icons and tooltips accordingly. */
-void
+void
MainWindow::stopped(int exitCode, QProcess::ExitStatus exitStatus)
{
updateTorStatus(Stopped);
@@ -825,7 +873,7 @@ MainWindow::stopped(int exitCode, QProcess::ExitStatus exitStatus)
"unexpectedly.\n\n"
"Please check the message log for recent "
"warning or error messages."),
- VMessageBox::Ok|VMessageBox::Escape,
+ VMessageBox::Ok|VMessageBox::Escape,
VMessageBox::ShowLog|VMessageBox::Default,
VMessageBox::Help);
if (ret == VMessageBox::ShowLog)
@@ -834,6 +882,9 @@ MainWindow::stopped(int exitCode, QProcess::ExitStatus exitStatus)
showHelpDialog("troubleshooting.torexited");
}
}
+ QObject::disconnect(_torControl, SIGNAL(stopped(int, QProcess::ExitStatus)),
+ this, SLOT(stopped(int, QProcess::ExitStatus)));
+ QObject::disconnect(_torControl, SIGNAL(disconnected()), this, SLOT(disconnected()));
}
/** Called when the Tor process fails to start, for example, because the path
@@ -857,7 +908,7 @@ MainWindow::startFailed(QString errmsg)
start();
return;
}
-
+
updateTorStatus(Stopped);
/* Display an error message and see if the user wants some help */
@@ -879,22 +930,15 @@ MainWindow::startFailed(QString errmsg)
}
}
-/** Called when the control socket has successfully connected to Tor. */
-void
-MainWindow::connected()
-{
- authenticate();
-}
-
/** Called when the connection to the control socket fails. The reason will be
* given in the errmsg parameter. */
void
MainWindow::connectFailed(QString errmsg)
{
/* Ok, ok. It really isn't going to connect. I give up. */
- int response = VMessageBox::warning(this,
+ int response = VMessageBox::warning(this,
tr("Connection Error"), p(errmsg),
- VMessageBox::Ok|VMessageBox::Default|VMessageBox::Escape,
+ VMessageBox::Ok|VMessageBox::Default|VMessageBox::Escape,
VMessageBox::Retry, VMessageBox::Help);
@@ -917,6 +961,9 @@ void
MainWindow::authenticated()
{
TorSettings settings;
+
+ _torControl->clearErrState();
+
if(settings.autoControlPort()) {
// We want to remember the ports if it's on auto
QString control_str = "", socks_str = "";
@@ -930,7 +977,7 @@ MainWindow::authenticated()
if(socks_parts.size() > 1)
socks_str = socks_parts[1];
}
-
+
_previousControlPort = control_str;
_previousSocksPort = socks_str;
} else {
@@ -943,14 +990,14 @@ MainWindow::authenticated()
QString errmsg;
updateTorStatus(Authenticated);
-
+
/* If Tor doesn't have bootstrapping events, then update the current
* status string and bump the progress bar along a bit. */
if (_torControl->getTorVersion() < 0x020101) {
setStartupProgress(STARTUP_PROGRESS_CIRCUITBUILD,
tr("Connecting to the Tor network"));
}
-
+
/* Let people click on their beloved "New Circuit" button */
_actionNewIdentity->setEnabled(true);
@@ -970,10 +1017,6 @@ MainWindow::authenticated()
/* Configure UPnP port forwarding if needed */
serverSettings.configurePortForwarding();
- /* Check if Tor has a circuit established */
- if (_torControl->isCircuitEstablished()) {
- circuitEstablished();
- }
/* Check the status of Tor's version */
if (_torControl->getTorVersion() >= 0x020001)
checkTorVersion();
@@ -982,6 +1025,25 @@ MainWindow::authenticated()
if (status.isValid())
bootstrapStatusChanged(status);
}
+
+ /* Check if Tor has a circuit established */
+ while(not _torControl->isCircuitEstablished()) {
+ QCoreApplication::processEvents();
+ if(not _torControl->shouldContinue(&errmsg) and not _pressedStop) {
+ startFailed(errmsg);
+
+ int exitCode;
+ QProcess::ExitStatus exitStatus;
+
+ if(_torControl->finished(&exitCode, &exitStatus))
+ stopped(exitCode, exitStatus);
+ return;
+ } else if(_pressedStop) {
+ return;
+ }
+ }
+
+ circuitEstablished();
}
/** Called when Vidalia fails to authenticate to Tor. The failure reason is
@@ -990,7 +1052,7 @@ void
MainWindow::authenticationFailed(QString errmsg)
{
bool retry = false;
-
+
vWarn("Authentication failed: %1").arg(errmsg);
/* Parsing log messages is evil, but we're left with little option */
@@ -1009,7 +1071,7 @@ MainWindow::authenticationFailed(QString errmsg)
break;
}
}
-
+
dlg.setResetEnabled(torPid > 0);
int ret = dlg.exec();
@@ -1026,9 +1088,9 @@ MainWindow::authenticationFailed(QString errmsg)
}
}
}
-
+
if (_torControl->isRunning())
- if (_isVidaliaRunningTor)
+ if (_isVidaliaRunningTor)
stop();
else
disconnect();
@@ -1093,7 +1155,7 @@ void
MainWindow::bootstrapStatusChanged(const BootstrapStatus &bs)
{
int percentComplete = STARTUP_PROGRESS_BOOTSTRAPPING + bs.percentComplete();
- bool warn = (bs.severity() == tc::WarnSeverity &&
+ bool warn = (bs.severity() == tc::WarnSeverity &&
bs.recommendedAction() != BootstrapStatus::RecommendIgnore);
QString description;
@@ -1190,6 +1252,9 @@ MainWindow::circuitEstablished()
}
}
#endif
+ connect(_torControl, SIGNAL(stopped(int, QProcess::ExitStatus)),
+ this, SLOT(stopped(int, QProcess::ExitStatus)));
+ connect(_torControl, SIGNAL(disconnected()), this, SLOT(disconnected()));
}
/** Called when Tor thinks the user has tried to connect to a port that
@@ -1217,7 +1282,7 @@ MainWindow::warnDangerousPort(quint16 port, bool rejected)
case 109:
case 110:
case 143:
- application = tr("(probably an email client)");
+ application = tr("(probably an email client)");
break;
default:
@@ -1284,18 +1349,20 @@ MainWindow::warnDangerousPort(quint16 port, bool rejected)
/** Attempts to authenticate to Tor's control port, depending on the
* authentication method specified in TorSettings::getAuthenticationMethod().
*/
-bool
+void
MainWindow::authenticate()
{
TorSettings::AuthenticationMethod authMethod;
TorSettings settings;
ProtocolInfo pi;
-
+
+ _torControl->clearErrState();
+
updateTorStatus(Authenticating);
setStartupProgress(STARTUP_PROGRESS_AUTHENTICATING,
tr("Authenticating to Tor"));
- authMethod = settings.getAuthenticationMethod();
+ authMethod = settings.getAuthenticationMethod();
pi = _torControl->protocolInfo();
QStringList authMethods;
if (!pi.isEmpty()) {
@@ -1308,30 +1375,40 @@ MainWindow::authenticate()
authMethod = TorSettings::NullAuth;
}
+ QString errmsg;
+
if (authMethod == TorSettings::CookieAuth) {
- if(!tryCookie(pi)) {
- if(authMethods.contains("HASHEDPASSWORD") and !tryHashed()) {
- goto cancel;
- } else {
- return true;
- }
+ if(tryCookie(pi)) {
+ authenticated();
+ return;
} else {
- return true;
+ if(authMethods.contains("HASHEDPASSWORD")) {
+ if(tryHashed()) {
+ authenticated();
+ return;
+ }
+ }
+ _torControl->shouldContinue(&errmsg);
+ authenticationFailed(errmsg);
+ return;
}
} else if (authMethod == TorSettings::PasswordAuth) {
- return tryHashed();
+ if(tryHashed()) {
+ authenticated();
+ return;
+ }
+ _torControl->shouldContinue(&errmsg);
+ authenticationFailed(errmsg);
+ return;
}
/* No authentication. Send an empty password. */
vNotice("Authenticating using 'null' authentication.");
- return _torControl->authenticate(QString(""));
-
-cancel:
- vWarn("Cancelling control authentication attempt.");
- if (_isVidaliaRunningTor)
- stop();
- else
- disconnect();
- return false;
+ if(_torControl->authenticate(QString("")))
+ authenticated();
+ else {
+ _torControl->shouldContinue(&errmsg);
+ authenticationFailed(errmsg);
+ }
}
bool
@@ -1351,7 +1428,7 @@ MainWindow::tryCookie(const ProtocolInfo &pi)
"'control_auth_cookie' yourself?")),
VMessageBox::Browse|VMessageBox::Default,
VMessageBox::Cancel|VMessageBox::Escape);
-
+
if (ret == VMessageBox::Cancel)
return false;
QString cookieDir = QFileDialog::getOpenFileName(this,
@@ -1425,14 +1502,14 @@ MainWindow::loadControlCookie(QString cookiePath)
QString dataDir = settings.getDataDirectory();
if (!dataDir.isEmpty())
pathList << dataDir;
-
+
#if defined(Q_WS_WIN)
pathList << expand_filename("%APPDATA%\\Tor");
#else
pathList << expand_filename("~/.tor");
#endif
}
-
+
/* Search for the cookie file */
foreach (QString path, pathList) {
QString cookieFile = QFileInfo(path).isFile() ?
@@ -1440,7 +1517,7 @@ MainWindow::loadControlCookie(QString cookiePath)
vDebug("Checking for authentication cookie in '%1'").arg(cookieFile);
if (!QFileInfo(cookieFile).exists())
continue;
-
+
authCookie.setFileName(cookieFile);
if (authCookie.open(QIODevice::ReadOnly)) {
vInfo("Reading authentication cookie from '%1'").arg(cookieFile);
@@ -1462,7 +1539,7 @@ MainWindow::updateTorStatus(TorStatus status)
QString statusText, actionText;
QString trayIconFile, statusIconFile;
TorStatus prevStatus = _status;
-
+
vNotice("Tor status changed from '%1' to '%2'.")
.arg(toString(prevStatus)).arg(toString(status));
_status = status;
@@ -1488,14 +1565,14 @@ MainWindow::updateTorStatus(TorStatus status)
_actionRestartTor->setEnabled(false);
_actionReloadConfig->setEnabled(false);
if (_delayedShutdownStarted) {
- statusText = tr("Your relay is shutting down.\n"
+ statusText = tr("Your relay is shutting down.\n"
"Click 'Stop' again to stop your relay now.");
} else {
statusText = tr("Tor is shutting down");
}
trayIconFile = IMG_TOR_STOPPING;
statusIconFile = IMG_TOR_STOPPING_48;
-
+
} else if (status == Started) {
actionText = tr("Stop Tor");
_actionRestartTor->setEnabled(true);
@@ -1503,7 +1580,7 @@ MainWindow::updateTorStatus(TorStatus status)
_actionStartStopTor->setEnabled(true);
_actionStartStopTor->setIcon(QIcon(IMG_STOP_TOR_16));
_actionStartStopTor->setText(actionText);
-
+
/* XXX: This might need to be smarter if we ever start connecting other
* slots to these triggered() and clicked() signals. */
QObject::disconnect(_actionStartStopTor, SIGNAL(triggered()), this, 0);
@@ -1594,7 +1671,7 @@ MainWindow::sighup()
if (!rc) {
int response = VMessageBox::warning(this, tr("Error reloading configuration"),
- p(tr("Vidalia was unable to reload Tor's configuration."))
+ p(tr("Vidalia was unable to reload Tor's configuration."))
+ p(errmsg),
VMessageBox::Ok);
}
@@ -1635,7 +1712,7 @@ MainWindow::disconnected()
* connection as "Tor is stopped". */
updateTorStatus(Stopped);
}
-
+
/*XXX We should warn here if we get disconnected when we didn't intend to */
_actionNewIdentity->setEnabled(false);
_isVidaliaRunningTor = false;
@@ -1659,7 +1736,7 @@ MainWindow::newIdentity()
QString errmsg;
/* Send the NEWNYM signal. If message balloons are supported and the NEWNYM
- * is successful, we will show the result as a balloon. Otherwise, we'll
+ * is successful, we will show the result as a balloon. Otherwise, we'll
* just use a message box. */
if (_torControl->signal(TorSignal::NewNym, &errmsg)) {
/* NEWNYM signal was successful */
@@ -1670,7 +1747,7 @@ MainWindow::newIdentity()
/* Disable the New Identity button for MIN_NEWIDENTITY_INTERVAL */
_actionNewIdentity->setEnabled(false);
- QTimer::singleShot(MIN_NEWIDENTITY_INTERVAL,
+ QTimer::singleShot(MIN_NEWIDENTITY_INTERVAL,
this, SLOT(enableNewIdentity()));
if (QSystemTrayIcon::supportsMessages())
@@ -1679,7 +1756,7 @@ MainWindow::newIdentity()
VMessageBox::information(this, title, message, VMessageBox::Ok);
} else {
/* NEWNYM signal failed */
- VMessageBox::warning(this,
+ VMessageBox::warning(this,
tr("Failed to Create New Identity"), errmsg, VMessageBox::Ok);
}
}
@@ -1788,8 +1865,8 @@ MainWindow::addTab(VidaliaTab *tab)
return;
/** Exception for tabs that need to be always created */
- if (tab != _messageLog &&
- tab != &_statusTab &&
+ if (tab != _messageLog &&
+ tab != &_statusTab &&
tab != &_netViewer &&
tab != _graph)
tab->deleteLater();
@@ -1832,8 +1909,8 @@ MainWindow::delTab(int index)
VidaliaTab *tab = qobject_cast<VidaliaTab*>(ui.tabWidget->widget(index));
// if it isn't one of the tabs that's supposed to be open at every moment
- if (tab != _messageLog &&
- tab != &_statusTab &&
+ if (tab != _messageLog &&
+ tab != &_statusTab &&
tab != &_netViewer &&
tab != _graph) {
QObject::disconnect(ui.tabWidget->widget(index), 0, 0, 0);
@@ -1850,13 +1927,13 @@ MainWindow::showStatusTab()
addTab(&_statusTab);
}
-void
+void
MainWindow::showMessageLogTab()
{
addTab(_messageLog);
}
-void
+void
MainWindow::showBandwidthTab()
{
addTab(_graph);
@@ -1888,7 +1965,7 @@ MainWindow::showHelpDialog(const QString &topic)
helpBrowser->showWindow(topic);
}
-void
+void
MainWindow::showNetViewerTab()
{
addTab(&_netViewer);
@@ -2051,7 +2128,7 @@ MainWindow::installUpdatesFailed(const QString &errmsg)
VMessageBox::warning(this, tr("Installation Failed"),
p(tr("Vidalia was unable to install your software updates."))
- + p(tr("The following error occurred:"))
+ + p(tr("The following error occurred:"))
+ p(errmsg),
VMessageBox::Ok);
diff --git a/src/vidalia/MainWindow.h b/src/vidalia/MainWindow.h
index 7cd86d7..6e60bb7 100644
--- a/src/vidalia/MainWindow.h
+++ b/src/vidalia/MainWindow.h
@@ -3,8 +3,8 @@
** 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.torproject.org/projects/vidalia.html. No part of Vidalia,
-** including this file, may be copied, modified, propagated, or distributed
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
** except according to the terms described in the LICENSE file.
*/
@@ -73,13 +73,13 @@ private slots:
/** Called when the Tor process fails to start. */
void startFailed(QString errmsg);
/** Called when the Tor process has successfully started. */
- void started();
+ void connectToTor();
/** Called when the user selects "Stop" form the menu. */
bool stop();
/** Called when the Tor process has exited, either expectedly or not. */
void stopped(int errorCode, QProcess::ExitStatus exitStatus);
/** Called when the control socket has connected to Tor. */
- void connected();
+ //void connected();
/** Called when the control connection fails. */
void connectFailed(QString errmsg);
/** Called when Vidalia wants to disconnect from a Tor it did not start. */
@@ -145,7 +145,7 @@ private slots:
/** Displays the debug output dialog for plugins */
void showDebugDialog();
-
+
/** Adds a new tab to the MainWindow */
void addTab(VidaliaTab *tab);
/** Deletes the tab at index if it exists and it isn't the Status tab */
@@ -224,7 +224,7 @@ private:
/** Converts a TorStatus enum value to a string for debug logging purposes. */
QString toString(TorStatus status);
/** Authenticates Vidalia to Tor's control port. */
- bool authenticate();
+ void authenticate();
/** Searches for and attempts to load the control authentication cookie.
* This assumes the cookie is named 'control_auth_cookie'. If
* <b>cookiePath</b> is empty, this method will search some default locations
@@ -305,10 +305,12 @@ private:
PluginEngine *_engine;
QStringList _tabMap; /**< Map to handle opened tabs */
QStringList _detachedTabMap; /**< Map to handle detached tabs */
-
+
bool _startedWithPrevious; /**< True if Vidalia tried to start Tor with the previous ports */
QString _previousControlPort; /**< Holds the previous controlport used */
QString _previousSocksPort; /**< Holds the previous socksport used */
+
+ bool _pressedStop; /**< True if the user has pressed the Stop Tor button */
};
#endif
1
0
15 Mar '12
commit 6fa82f268a15d81cffd325e2cdabb7cfe07e6618
Merge: d7c2674 b836b71
Author: Tomás Touceda <chiiph(a)torproject.org>
Date: Thu Mar 15 11:13:05 2012 -0300
Merge branch 'featImprovedBootstrap' into alpha
changes/featImprovedBootstrap | 1 +
src/torcontrol/ControlConnection.cpp | 42 +++---
src/torcontrol/TorControl.cpp | 83 +++++++++-
src/torcontrol/TorControl.h | 45 ++++--
src/torcontrol/TorProcess.cpp | 28 ++--
src/vidalia/MainWindow.cpp | 295 +++++++++++++++++++++-------------
src/vidalia/MainWindow.h | 16 +-
7 files changed, 343 insertions(+), 167 deletions(-)
1
0
commit 384430e33087746232aa463401c01a6845eee0c1
Author: Tomás Touceda <chiiph(a)torproject.org>
Date: Mon Mar 12 19:14:12 2012 -0300
Add missing DefaultSettings.* files
---
src/vidalia/config/DefaultSettings.cpp | 20 +++++++++++++++++
src/vidalia/config/DefaultSettings.h | 37 ++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/src/vidalia/config/DefaultSettings.cpp b/src/vidalia/config/DefaultSettings.cpp
new file mode 100644
index 0000000..db89d60
--- /dev/null
+++ b/src/vidalia/config/DefaultSettings.cpp
@@ -0,0 +1,20 @@
+#include "DefaultSettings.h"
+#include "Vidalia.h"
+
+DefaultSettings::DefaultSettings()
+{
+ _settings = new QSettings(Vidalia::dataDirectory() + "/vidalia.defaults.conf",
+ QSettings::InitFormat);
+}
+
+DefaultSettings::~DefaultSettings()
+{
+ delete _settings;
+}
+
+QVariant
+DefaultSettings::getDefault(const QString &key,
+ const QVariant &defaultVal = QVariant()) const
+{
+ return _settings->value(key, defaultVal);
+}
diff --git a/src/vidalia/config/DefaultSettings.h b/src/vidalia/config/DefaultSettings.h
new file mode 100644
index 0000000..4710b98
--- /dev/null
+++ b/src/vidalia/config/DefaultSettings.h
@@ -0,0 +1,37 @@
+/*
+** 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.torproject.org/projects/vidalia.html. 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 DefaultSettings.h
+** \brief
+*/
+
+#ifndef _DEFAULTSETTINGS_H
+#define _DEFAULTSETTINGS_H
+
+#include <QSettings>
+
+class DefaultSettings
+{
+ public:
+ /** Default constructor. */
+ DefaultSettings();
+ /** Default desrtuctor */
+ ~DefaultSettings();
+
+ /** Return the stored default value */
+ QVariant getDefault(const QString &key,
+ const QVariant &defaultVal = QVariant()) const;
+
+ private:
+ QSettings *_settings;
+};
+
+#endif
1
0