mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #1623 from G10h4ck/fix_crash_in_p3banlist
Protect p3BanList::isAddressAccepted with mutex
This commit is contained in:
commit
9f95649bbc
@ -306,18 +306,23 @@ bool p3BanList::acceptedBanRanges_locked(const BanListPeer& blp)
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool p3BanList::isAddressAccepted(
|
||||
const sockaddr_storage& dAddr, uint32_t checking_flags,
|
||||
uint32_t& check_result )
|
||||
{
|
||||
check_result = RSBANLIST_CHECK_RESULT_NOCHECK;
|
||||
if(!mIPFilteringEnabled) return true;
|
||||
|
||||
sockaddr_storage addr; sockaddr_storage_copy(dAddr, addr);
|
||||
|
||||
if(!sockaddr_storage_ipv6_to_ipv4(addr)) return true;
|
||||
if(sockaddr_storage_isLoopbackNet(addr)) return true;
|
||||
|
||||
|
||||
RS_STACK_MUTEX(mBanMtx);
|
||||
|
||||
if(!mIPFilteringEnabled) return true;
|
||||
|
||||
#ifdef DEBUG_BANLIST
|
||||
std::cerr << "isAddressAccepted(): tested addr=" << sockaddr_storage_iptostring(addr) << ", checking flags=" << checking_flags ;
|
||||
#endif
|
||||
@ -409,6 +414,7 @@ bool p3BanList::isAddressAccepted(
|
||||
check_result = RSBANLIST_CHECK_RESULT_ACCEPTED;
|
||||
return true ;
|
||||
}
|
||||
|
||||
void p3BanList::getWhiteListedIps(std::list<BanListPeer> &lst)
|
||||
{
|
||||
RS_STACK_MUTEX(mBanMtx) ;
|
||||
@ -582,11 +588,6 @@ int p3BanList::tick()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int p3BanList::status()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void p3BanList::getDhtInfo()
|
||||
{
|
||||
// Get the list of masquerading peers from the DHT. Add them as potential IPs to be banned.
|
||||
|
@ -105,7 +105,6 @@ public:
|
||||
|
||||
*/
|
||||
virtual int tick();
|
||||
virtual int status();
|
||||
|
||||
int sendPackets();
|
||||
bool processIncoming();
|
||||
|
Loading…
Reference in New Issue
Block a user