mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-15 08:39:08 -05:00
Added feed item to notify a blacklisted ip address.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8346 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bfe59bedf0
commit
9bef4502b1
17 changed files with 1324 additions and 106 deletions
|
|
@ -188,10 +188,10 @@ bool p3Notify::GetFeedItem(RsFeedItem &item)
|
|||
}
|
||||
|
||||
|
||||
bool p3Notify::AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3, const std::string& id4)
|
||||
bool p3Notify::AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3, const std::string& id4, uint32_t result1)
|
||||
{
|
||||
RsStackMutex stack(noteMtx); /************* LOCK MUTEX ************/
|
||||
pendingNewsFeed.push_back(RsFeedItem(type, id1, id2, id3, id4));
|
||||
pendingNewsFeed.push_back(RsFeedItem(type, id1, id2, id3, id4, result1));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class p3Notify: public RsNotify
|
|||
bool AddPopupMessage(uint32_t ptype, const std::string& name, const std::string& title, const std::string& msg);
|
||||
bool AddSysMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg);
|
||||
bool AddLogMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg);
|
||||
bool AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2 = "", const std::string& id3 = "", const std::string& id4 = "");
|
||||
bool AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2 = "", const std::string& id3 = "", const std::string& id4 = "", uint32_t result1 = 0);
|
||||
bool ClearFeedItems(uint32_t type);
|
||||
|
||||
// Notifications of clients. Can be called from anywhere inside libretroshare.
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@
|
|||
#include <retroshare/rsdht.h>
|
||||
#include <retroshare/rsbanlist.h>
|
||||
|
||||
#include "rsserver/p3face.h"
|
||||
|
||||
const int pqisslzone = 37714;
|
||||
|
||||
/*********
|
||||
|
|
@ -1316,6 +1318,7 @@ int pqissl::Authorise_SSL_Connection()
|
|||
if(!rsBanList->isAddressAccepted(remote_addr,RSBANLIST_CHECKING_FLAGS_BLACKLIST,&check_result))
|
||||
{
|
||||
std::cerr << "(SS) connection attempt from banned IP address. Refusing it. Reason: " << check_result << ". Attack??" << std::endl;
|
||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_IP_BLACKLISTED, PeerId().toStdString(), sockaddr_storage_iptostring(remote_addr), "", "", check_result);
|
||||
reset_locked();
|
||||
return 0 ;
|
||||
}
|
||||
|
|
@ -1359,6 +1362,7 @@ int pqissl::accept_locked(SSL *ssl, int fd, const struct sockaddr_storage &forei
|
|||
{
|
||||
std::cerr << "(SS) refusing incoming SSL connection from blacklisted foreign address " << sockaddr_storage_iptostring(foreign_addr)
|
||||
<< ". Reason: " << check_result << "." << std::endl;
|
||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_IP_BLACKLISTED, PeerId().toStdString(), sockaddr_storage_iptostring(foreign_addr), "", "", check_result);
|
||||
reset_locked();
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ const uint32_t RS_FEED_ITEM_SEC_WRONG_SIGNATURE = RS_FEED_TYPE_SECURITY | 0
|
|||
const uint32_t RS_FEED_ITEM_SEC_BAD_CERTIFICATE = RS_FEED_TYPE_SECURITY | 0x0006;
|
||||
const uint32_t RS_FEED_ITEM_SEC_INTERNAL_ERROR = RS_FEED_TYPE_SECURITY | 0x0007;
|
||||
const uint32_t RS_FEED_ITEM_SEC_MISSING_CERTIFICATE = RS_FEED_TYPE_SECURITY | 0x0008;
|
||||
const uint32_t RS_FEED_ITEM_SEC_IP_BLACKLISTED = RS_FEED_TYPE_SECURITY | 0x0010;
|
||||
|
||||
const uint32_t RS_FEED_ITEM_CHANNEL_NEW = RS_FEED_TYPE_CHANNEL | 0x0001;
|
||||
//const uint32_t RS_FEED_ITEM_CHANNEL_UPDATE = RS_FEED_TYPE_CHANNEL | 0x0002;
|
||||
|
|
@ -147,13 +148,14 @@ const uint32_t NOTIFY_HASHTYPE_SAVE_FILE_INDEX = 4; /* Hashing file */
|
|||
class RsFeedItem
|
||||
{
|
||||
public:
|
||||
RsFeedItem(uint32_t type, const std::string& id1, const std::string& id2 = "", const std::string& id3 = "", const std::string& id4 = "")
|
||||
:mType(type), mId1(id1), mId2(id2), mId3(id3), mId4(id4) {}
|
||||
RsFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3, const std::string& id4, uint32_t result1)
|
||||
:mType(type), mId1(id1), mId2(id2), mId3(id3), mId4(id4), mResult1(result1) {}
|
||||
|
||||
RsFeedItem() :mType(0) { return; }
|
||||
RsFeedItem() :mType(0), mResult1(0) { return; }
|
||||
|
||||
uint32_t mType;
|
||||
std::string mId1, mId2, mId3, mId4;
|
||||
uint32_t mResult1;
|
||||
};
|
||||
|
||||
// This class implements a generic notify client. To have your own components being notified by
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue