mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
removed all permission system. Kept the use-as-direct-source option.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7904 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a018f17af7
commit
64f8b4c539
8 changed files with 55 additions and 221 deletions
|
@ -73,26 +73,21 @@ const uint32_t RS_PEER_STATE_ONLINE = 0x0002;
|
|||
const uint32_t RS_PEER_STATE_CONNECTED = 0x0004;
|
||||
const uint32_t RS_PEER_STATE_UNREACHABLE= 0x0008;
|
||||
|
||||
// Service permission flags.
|
||||
// Service option flags.
|
||||
//
|
||||
const ServicePermissionFlags RS_SERVICE_PERM_NONE ( 0x00000000 ) ;
|
||||
const ServicePermissionFlags RS_SERVICE_PERM_TURTLE ( 0x00000001 ) ;
|
||||
const ServicePermissionFlags RS_SERVICE_PERM_DISCOVERY ( 0x00000002 ) ;
|
||||
const ServicePermissionFlags RS_SERVICE_PERM_DISTRIB ( 0x00000004 ) ;
|
||||
const ServicePermissionFlags RS_SERVICE_PERM_DIRECT_DL ( 0x00000008 ) ;
|
||||
const ServicePermissionFlags RS_SERVICE_PERM_ALL = RS_SERVICE_PERM_TURTLE | RS_SERVICE_PERM_DISCOVERY
|
||||
| RS_SERVICE_PERM_DISTRIB | RS_SERVICE_PERM_DIRECT_DL;
|
||||
const ServicePermissionFlags RS_SERVICE_PERM_ALL = RS_SERVICE_PERM_DIRECT_DL ;
|
||||
|
||||
// ...
|
||||
|
||||
/* Connect state */
|
||||
const uint32_t RS_PEER_CONNECTSTATE_OFFLINE = 0;
|
||||
|
||||
const uint32_t RS_PEER_CONNECTSTATE_TRYING_TCP = 2;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_TRYING_UDP = 3;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TCP = 4;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UDP = 5;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TOR = 6;
|
||||
|
||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 7;
|
||||
|
||||
/* Error codes for certificate cleaning and cert parsing. Numbers should not overlap. */
|
||||
|
@ -215,10 +210,10 @@ class RsPeerDetails
|
|||
|
||||
bool accept_connection;
|
||||
|
||||
/* Peer permission flags. What services the peer can use (Only valid if friend).*/
|
||||
ServicePermissionFlags service_perm_flags ;
|
||||
/* Peer permission flags. What services the peer can use (Only valid if friend).*/
|
||||
ServicePermissionFlags service_perm_flags ;
|
||||
|
||||
/* Network details (only valid if friend) */
|
||||
/* Network details (only valid if friend) */
|
||||
uint32_t state;
|
||||
|
||||
std::string connectAddr ; // current address if connected.
|
||||
|
@ -326,7 +321,7 @@ class RsPeers
|
|||
virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen) = 0;
|
||||
|
||||
/* Add/Remove Friends */
|
||||
virtual bool addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePermissionFlags flags = RS_SERVICE_PERM_ALL) = 0;
|
||||
virtual bool addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePermissionFlags flags = RS_SERVICE_PERM_ALL) = 0;
|
||||
virtual bool removeFriend(const RsPgpId& pgp_id) = 0;
|
||||
virtual bool removeFriendLocation(const RsPeerId& sslId) = 0;
|
||||
|
||||
|
@ -397,11 +392,11 @@ class RsPeers
|
|||
//
|
||||
virtual FileSearchFlags computePeerPermissionFlags(const RsPeerId& peer_id,FileStorageFlags file_sharing_flags,const std::list<std::string>& file_parent_groups) = 0;
|
||||
|
||||
/* Service permission flags */
|
||||
/* Service permission flags */
|
||||
|
||||
virtual ServicePermissionFlags servicePermissionFlags(const RsPgpId& gpg_id) = 0;
|
||||
virtual ServicePermissionFlags servicePermissionFlags(const RsPeerId& ssl_id) = 0;
|
||||
virtual void setServicePermissionFlags(const RsPgpId& gpg_id,const ServicePermissionFlags& flags) = 0;
|
||||
virtual ServicePermissionFlags servicePermissionFlags(const RsPgpId& gpg_id) = 0;
|
||||
virtual ServicePermissionFlags servicePermissionFlags(const RsPeerId& ssl_id) = 0;
|
||||
virtual void setServicePermissionFlags(const RsPgpId& gpg_id,const ServicePermissionFlags& flags) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -274,25 +274,10 @@ int p3discovery2::handleIncoming()
|
|||
if (NULL != (contact = dynamic_cast<RsDiscContactItem *> (item)))
|
||||
{
|
||||
if (item->PeerId() == contact->sslId) /* self describing */
|
||||
{
|
||||
recvOwnContactInfo(item->PeerId(), contact);
|
||||
}
|
||||
else if (rsPeers->servicePermissionFlags(item->PeerId()) & RS_SERVICE_PERM_DISCOVERY)
|
||||
{
|
||||
processContactInfo(item->PeerId(), contact);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* not allowed */
|
||||
delete item;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
processContactInfo(item->PeerId(), contact);
|
||||
|
||||
/* any other packets should be dropped if they don't have permission */
|
||||
if(!(rsPeers->servicePermissionFlags(item->PeerId()) & RS_SERVICE_PERM_DISCOVERY))
|
||||
{
|
||||
delete item;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -795,15 +780,6 @@ void p3discovery2::sendContactInfo_locked(const PGPID &aboutId, const SSLID &toI
|
|||
std::cerr << "p3discovery2::sendContactInfo_locked() aboutPGPId: " << aboutId << " toId: " << toId;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if (!(rsPeers->servicePermissionFlags(toId) & RS_SERVICE_PERM_DISCOVERY))
|
||||
{
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << "p3discovery2::sendContactInfo_locked() discovery disabled for SSLID: " << toId;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<PGPID, DiscPgpInfo>::const_iterator it;
|
||||
it = mFriendList.find(aboutId);
|
||||
if (it == mFriendList.end())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue