aboutsummaryrefslogtreecommitdiff
path: root/src/torcontrol.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-06-08 13:09:01 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-06-08 13:09:41 +0200
commit761cddb69029cbef1fc62267aeb2e4c17c6ed34d (patch)
tree8cb8a0276014e78f1b890120926a17a99376f07c /src/torcontrol.cpp
parent67c91f8c4cf738376f8b92429151494032bf9f91 (diff)
parent2e494489c35499dbe7891d4c07b4c35b178341d1 (diff)
downloadbitcoin-761cddb69029cbef1fc62267aeb2e4c17c6ed34d.tar.xz
Merge #7703: tor: Change auth order to only use password auth if -torpassword
2e49448 tor: Change auth order to only use HASHEDPASSWORD if -torpassword (Wladimir J. van der Laan)
Diffstat (limited to 'src/torcontrol.cpp')
-rw-r--r--src/torcontrol.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp
index 47d834c7b4..0d6b655675 100644
--- a/src/torcontrol.cpp
+++ b/src/torcontrol.cpp
@@ -574,7 +574,15 @@ void TorController::protocolinfo_cb(TorControlConnection& conn, const TorControl
* password: "password"
*/
std::string torpassword = GetArg("-torpassword", "");
- if (methods.count("NULL")) {
+ if (!torpassword.empty()) {
+ if (methods.count("HASHEDPASSWORD")) {
+ LogPrint("tor", "tor: Using HASHEDPASSWORD authentication\n");
+ boost::replace_all(torpassword, "\"", "\\\"");
+ conn.Command("AUTHENTICATE \"" + torpassword + "\"", boost::bind(&TorController::auth_cb, this, _1, _2));
+ } else {
+ LogPrintf("tor: Password provided with -torpassword, but HASHEDPASSWORD authentication is not available\n");
+ }
+ } else if (methods.count("NULL")) {
LogPrint("tor", "tor: Using NULL authentication\n");
conn.Command("AUTHENTICATE", boost::bind(&TorController::auth_cb, this, _1, _2));
} else if (methods.count("SAFECOOKIE")) {
@@ -595,13 +603,7 @@ void TorController::protocolinfo_cb(TorControlConnection& conn, const TorControl
}
}
} else if (methods.count("HASHEDPASSWORD")) {
- if (!torpassword.empty()) {
- LogPrint("tor", "tor: Using HASHEDPASSWORD authentication\n");
- boost::replace_all(torpassword, "\"", "\\\"");
- conn.Command("AUTHENTICATE \"" + torpassword + "\"", boost::bind(&TorController::auth_cb, this, _1, _2));
- } else {
- LogPrintf("tor: Password authentication required, but no password provided with -torpassword\n");
- }
+ LogPrintf("tor: The only supported authentication mechanism left is password, but no password provided with -torpassword\n");
} else {
LogPrintf("tor: No supported authentication method\n");
}