From: <arn...@us...> - 2007-12-04 21:17:21
|
Revision: 928 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=928&view=rev Author: arnetheduck Date: 2007-12-04 13:17:15 -0800 (Tue, 04 Dec 2007) Log Message: ----------- Adc fixes Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/AdcCommand.h dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/AdcHub.h dcplusplus/trunk/dcpp/BloomFilter.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-04 18:38:49 UTC (rev 927) +++ dcplusplus/trunk/changelog.txt 2007-12-04 21:17:15 UTC (rev 928) @@ -24,6 +24,7 @@ * Fixed socket ip bind (thanks garg's quasi-friend) * Finished UCMD extension draft implementation * Fixed status bars (poy) +* Fixed protocol error STA being sent as type C -- 0.703 2007-11-08 -- * Fixed invalid strings (thanks james ross) Modified: dcplusplus/trunk/dcpp/AdcCommand.h =================================================================== --- dcplusplus/trunk/dcpp/AdcCommand.h 2007-12-04 18:38:49 UTC (rev 927) +++ dcplusplus/trunk/dcpp/AdcCommand.h 2007-12-04 21:17:15 UTC (rev 928) @@ -106,7 +106,7 @@ C(CMD, 'C','M','D'); #undef C - static const uint32_t HUB_SID = 0x41414141; // AAAA in base32 + static const uint32_t HUB_SID = 0xffffffff; // No client will have this sid explicit AdcCommand(uint32_t aCmd, char aType = TYPE_CLIENT); explicit AdcCommand(uint32_t aCmd, const uint32_t aTarget, char aType); Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-04 18:38:49 UTC (rev 927) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-04 21:17:15 UTC (rev 928) @@ -45,7 +45,7 @@ const string AdcHub::TIGR_SUPPORT("ADTIGR"); const string AdcHub::UCM0_SUPPORT("ADUCM0"); -AdcHub::AdcHub(const string& aHubURL, bool secure) : Client(aHubURL, '\n', secure), sid(0) { +AdcHub::AdcHub(const string& aHubURL, bool secure) : Client(aHubURL, '\n', secure), oldPassword(false), sid(0) { TimerManager::getInstance()->addListener(this); } @@ -54,7 +54,6 @@ clearUsers(); } - OnlineUser& AdcHub::getUser(const uint32_t aSID, const CID& aCID) { OnlineUser* ou = findUser(aSID); if(ou) { @@ -208,6 +207,7 @@ socket->disconnect(false); return; } else if(!tigrOk) { + oldPassword = true; // What now? Some hubs fake BASE support without TIGR support =/ fire(ClientListener::StatusMessage(), this, "Hub probably uses an old version of ADC, please encourage the owner to upgrade"); } @@ -266,7 +266,7 @@ putUser(s); // No use to hammer if we're banned - if(s == sid && c.hasFlag("TL", 1)) { + if(s == sid && c.hasFlag("TL", 1)) { setAutoReconnect(false); } } @@ -295,7 +295,7 @@ } else if(protocol == SECURE_CLIENT_PROTOCOL_TEST && CryptoManager::getInstance()->TLSOk()) { secure = true; } else { - AdcCommand cmd(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown"); + AdcCommand cmd(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown", AdcCommand::TYPE_DIRECT); cmd.setTo(c.getFrom()); cmd.addParam("PR", protocol); @@ -334,7 +334,7 @@ } else if(protocol == SECURE_CLIENT_PROTOCOL_TEST && CryptoManager::getInstance()->TLSOk()) { secure = true; } else { - AdcCommand cmd(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown"); + AdcCommand cmd(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_UNSUPPORTED, "Protocol unknown", AdcCommand::TYPE_DIRECT); cmd.setTo(c.getFrom()); cmd.addParam("PR", protocol); @@ -460,7 +460,7 @@ if(state != STATE_NORMAL) return; - const string* proto = 0; + const string* proto; if(secure) { if(user.getUser()->isSet(User::NO_ADCS_0_10_PROTOCOL)) { /// @todo log @@ -468,7 +468,8 @@ } proto = &SECURE_CLIENT_PROTOCOL_TEST; } else { - if(user.getUser()->isSet(User::NO_ADC_1_0_PROTOCOL)) { + // dc++ <= 0.703 has a bug which makes it respond with CSTA to the hub if an unrecognised protocol is used *sigh* + if(true || user.getUser()->isSet(User::NO_ADC_1_0_PROTOCOL)) { if(user.getUser()->isSet(User::NO_ADC_0_10_PROTOCOL)) { /// @todo log return; @@ -547,8 +548,10 @@ AutoArray<uint8_t> buf(saltBytes); Encoder::fromBase32(salt.c_str(), buf, saltBytes); TigerHash th; - CID cid = getMyIdentity().getUser()->getCID(); - th.update(cid.data(), CID::SIZE); + if(oldPassword) { + CID cid = getMyIdentity().getUser()->getCID(); + th.update(cid.data(), CID::SIZE); + } th.update(pwd.data(), pwd.length()); th.update(buf, saltBytes); send(AdcCommand(AdcCommand::CMD_PAS, AdcCommand::TYPE_HUB).addParam(Encoder::toBase32(th.finalize(), TigerHash::HASH_SIZE))); @@ -659,8 +662,8 @@ send(cmd.toString(sid)); } -void AdcHub::on(Connected) throw() { - Client::on(Connected()); +void AdcHub::on(Connected c) throw() { + Client::on(c); lastInfoMap.clear(); sid = 0; @@ -674,8 +677,8 @@ send(cmd); } -void AdcHub::on(Line, const string& aLine) throw() { - Client::on(Line(), aLine); +void AdcHub::on(Line l, const string& aLine) throw() { + Client::on(l, aLine); if(BOOLSETTING(ADC_DEBUG)) { fire(ClientListener::StatusMessage(), this, "<ADC>" + aLine + "</ADC>"); @@ -683,13 +686,13 @@ dispatch(aLine); } -void AdcHub::on(Failed, const string& aLine) throw() { +void AdcHub::on(Failed f, const string& aLine) throw() { clearUsers(); - Client::on(Failed(), aLine); + Client::on(f, aLine); } -void AdcHub::on(Second, uint32_t aTick) throw() { - Client::on(Second(), aTick); +void AdcHub::on(Second s, uint32_t aTick) throw() { + Client::on(s, aTick); if(state == STATE_NORMAL && (aTick > (getLastActivity() + 120*1000)) ) { send("\n", 1); } Modified: dcplusplus/trunk/dcpp/AdcHub.h =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.h 2007-12-04 18:38:49 UTC (rev 927) +++ dcplusplus/trunk/dcpp/AdcHub.h 2007-12-04 21:17:15 UTC (rev 928) @@ -64,6 +64,7 @@ typedef unordered_map<uint32_t, OnlineUser*> SIDMap; typedef SIDMap::iterator SIDIter; + bool oldPassword; Socket udp; SIDMap users; StringMap lastInfoMap; Modified: dcplusplus/trunk/dcpp/BloomFilter.h =================================================================== --- dcplusplus/trunk/dcpp/BloomFilter.h 2007-12-04 18:38:49 UTC (rev 927) +++ dcplusplus/trunk/dcpp/BloomFilter.h 2007-12-04 21:17:15 UTC (rev 928) @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if !defined(BLOOM_FILTER_H) -#define BLOOM_FILTER_H +#ifndef DCPLUSPLUS_DCPP_BLOOM_FILTER_H +#define DCPLUSPLUS_DCPP_BLOOM_FILTER_H #include "ZUtils.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |