From 735f68454793309b9367864f219eb6368c809281 Mon Sep 17 00:00:00 2001 From: maksis Date: Tue, 2 Feb 2016 17:42:30 +0200 Subject: [PATCH] Squashed 'airdcpp-core/' changes from ac6079f..e1fc1e4 e1fc1e4 Make the encryption warning less dramatic a6b2e10 Merge branch 'master' of https://github.com/airdcpp/airgit 08804af Display Tlsv1.0 correctly instead of SSLv3 in encryption information 704b9ee API: serialize correct folder count for directory bundles 2a5e958 Warn about outdated cryptography when joining an ADCS hub git-subtree-dir: airdcpp-core git-subtree-split: e1fc1e47592138929f2ece000bfe1e4b1ef8e737 --- airdcpp/AdcHub.cpp | 16 +++++++++++++--- airdcpp/QueueManager.cpp | 6 ++++++ airdcpp/QueueManager.h | 3 +++ airdcpp/SSLSocket.cpp | 12 +++--------- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/airdcpp/AdcHub.cpp b/airdcpp/AdcHub.cpp index 0eb91aaa..67124851 100644 --- a/airdcpp/AdcHub.cpp +++ b/airdcpp/AdcHub.cpp @@ -256,7 +256,7 @@ void AdcHub::handle(AdcCommand::INF, AdcCommand& c) noexcept { u->getUser()->setFlag(User::ASCH); } - if(u->getUser() == getMyIdentity().getUser()) { + if (u->getUser() == getMyIdentity().getUser()) { State oldState = getConnectState(); if (oldState != STATE_NORMAL) { setConnectState(STATE_NORMAL); @@ -267,8 +267,18 @@ void AdcHub::handle(AdcCommand::INF, AdcCommand& c) noexcept { setMyIdentity(u->getIdentity()); updateCounts(false); - if (oldState != STATE_NORMAL && u->getIdentity().getAdcConnectionSpeed(false) == 0) - statusMessage("WARNING: This hub is not displaying the connection speed fields, which prevents the client from choosing the best sources for downloads. Please advise the hub owner to fix this.", LogMessage::SEV_WARNING); + if (oldState != STATE_NORMAL) { + if (u->getIdentity().getAdcConnectionSpeed(false) == 0) { + statusMessage("WARNING: This hub is not displaying the connection speed fields, which prevents the client from choosing the best sources for downloads. Please advise the hub owner to fix this.", LogMessage::SEV_WARNING); + } + + if (isSecure()) { + auto encryption = getEncryptionInfo(); + if (encryption.find("TLSv1.2") == string::npos) { + statusMessage("This hub uses an outdated cryptographic protocol that has known security issues", LogMessage::SEV_WARNING); + } + } + } //we have to update the modes in case our connectivity changed diff --git a/airdcpp/QueueManager.cpp b/airdcpp/QueueManager.cpp index da416080..19a11cfa 100644 --- a/airdcpp/QueueManager.cpp +++ b/airdcpp/QueueManager.cpp @@ -488,6 +488,12 @@ void QueueManager::on(TimerManagerListener::Minute, uint64_t aTick) noexcept { } } +void QueueManager::getBundleContent(const BundlePtr& aBundle, size_t& files_, size_t& directories_) const noexcept { + RLock l(cs); + files_ = aBundle->getQueueItems().size() + aBundle->getFinishedFiles().size(); + directories_ = aBundle->isFileBundle() ? 0 : aBundle->getDirectories().size() - 1; +} + bool QueueManager::hasDownloadedBytes(const string& aTarget) throw(QueueException) { RLock l(cs); auto q = fileQueue.findFile(aTarget); diff --git a/airdcpp/QueueManager.h b/airdcpp/QueueManager.h index 2a0d90fc..ec8ac116 100644 --- a/airdcpp/QueueManager.h +++ b/airdcpp/QueueManager.h @@ -68,6 +68,9 @@ class QueueManager : public Singleton, public Speaker st(buf, ' '); - std::string ret = st.getTokens()[1] + " / " + st.getTokens()[0]; - delete[] buf; - return ret; + string cipher = SSL_get_cipher_name(ssl); + string protocol = SSL_get_version(ssl); + return protocol + " / " + cipher; } ByteVector SSLSocket::getKeyprint() const noexcept {