removed pqisecurity dummy functions. It is a packet filter which was never implemented. It's job is now done by service permissions.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8506 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-06-17 08:49:43 +00:00
parent 8234155f5e
commit edf6b3e495
11 changed files with 13 additions and 180 deletions

View file

@ -373,7 +373,6 @@ HEADERS += pqi/authssl.h \
pqi/pqinetwork.h \ pqi/pqinetwork.h \
pqi/pqiperson.h \ pqi/pqiperson.h \
pqi/pqipersongrp.h \ pqi/pqipersongrp.h \
pqi/pqisecurity.h \
pqi/pqiservice.h \ pqi/pqiservice.h \
pqi/pqissl.h \ pqi/pqissl.h \
pqi/pqissllistener.h \ pqi/pqissllistener.h \
@ -525,7 +524,6 @@ SOURCES += pqi/authgpg.cc \
pqi/pqinetwork.cc \ pqi/pqinetwork.cc \
pqi/pqiperson.cc \ pqi/pqiperson.cc \
pqi/pqipersongrp.cc \ pqi/pqipersongrp.cc \
pqi/pqisecurity.cc \
pqi/pqiservice.cc \ pqi/pqiservice.cc \
pqi/pqissl.cc \ pqi/pqissl.cc \
pqi/pqissllistener.cc \ pqi/pqissllistener.cc \

View file

@ -39,17 +39,10 @@ static const float PQI_HANDLER_NB_PRIORITY_RATIO = 2 ;
#define RSITEM_DEBUG 1 #define RSITEM_DEBUG 1
****/ ****/
pqihandler::pqihandler(SecurityPolicy *Global) : coreMtx("pqihandler") pqihandler::pqihandler() : coreMtx("pqihandler")
{ {
RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/ RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/
// The global security....
// if something is disabled here...
// cannot be enabled by module.
globsec = Global;
pqioutput(PQL_DEBUG_BASIC, pqihandlerzone, "New pqihandler()\nSecurity Policy: " + secpolicy_print(globsec));
// setup minimal total+individual rates. // setup minimal total+individual rates.
rateIndiv_out = 0.01; rateIndiv_out = 0.01;
rateIndiv_in = 0.01; rateIndiv_in = 0.01;
@ -188,16 +181,6 @@ bool pqihandler::AddSearchModule(SearchModule *mod)
return false; return false;
} }
// check security.
if (mod -> sp == NULL)
{
// create policy.
mod -> sp = secpolicy_create();
}
// limit to what global security allows.
secpolicy_limit(globsec, mod -> sp);
// store. // store.
mods[mod->peerid] = mod; mods[mod->peerid] = mod;
return true; return true;
@ -282,9 +265,6 @@ int pqihandler::locked_HandleRsItem(RsItem *item, int allowglobal,uint32_t& comp
return -1; return -1;
} }
// check security... is output allowed.
if(0 < secpolicy_check((it -> second) -> sp, 0, PQI_OUTGOING))
{
std::string out = "pqihandler::HandleRsItem() sending to chan: " + it -> first.toStdString(); std::string out = "pqihandler::HandleRsItem() sending to chan: " + it -> first.toStdString();
pqioutput(PQL_DEBUG_BASIC, pqihandlerzone, out); pqioutput(PQL_DEBUG_BASIC, pqihandlerzone, out);
#ifdef DEBUG_TICK #ifdef DEBUG_TICK
@ -295,21 +275,6 @@ int pqihandler::locked_HandleRsItem(RsItem *item, int allowglobal,uint32_t& comp
((it -> second) -> pqi) -> SendItem(item,computed_size); ((it -> second) -> pqi) -> SendItem(item,computed_size);
return 1; return 1;
} }
else
{
std::string out = "pqihandler::HandleRsItem() Sec not approved";
pqioutput(PQL_DEBUG_BASIC, pqihandlerzone, out);
#ifdef DEBUG_TICK
std::cerr << out << std::endl;
#endif
delete item;
return -1;
}
// if successfully sent to at least one.
return 1;
}
int pqihandler::SendRsRawItem(RsRawItem *ns) int pqihandler::SendRsRawItem(RsRawItem *ns)
{ {

View file

@ -27,7 +27,6 @@
#define MRK_PQI_HANDLER_HEADER #define MRK_PQI_HANDLER_HEADER
#include "pqi/pqi.h" #include "pqi/pqi.h"
#include "pqi/pqisecurity.h"
#include "pqi/pqiqos.h" #include "pqi/pqiqos.h"
#include "util/rsthreads.h" #include "util/rsthreads.h"
@ -42,7 +41,6 @@ class SearchModule
public: public:
RsPeerId peerid; RsPeerId peerid;
PQInterface *pqi; PQInterface *pqi;
SecurityPolicy *sp;
}; };
// Presents a P3 Face to the world! // Presents a P3 Face to the world!
@ -51,7 +49,7 @@ class SearchModule
class pqihandler: public P3Interface, public pqiPublisher class pqihandler: public P3Interface, public pqiPublisher
{ {
public: public:
pqihandler(SecurityPolicy *Global); pqihandler();
/**** Overloaded from pqiPublisher ****/ /**** Overloaded from pqiPublisher ****/
virtual bool sendItem(RsRawItem *item) virtual bool sendItem(RsRawItem *item)
@ -99,7 +97,6 @@ class pqihandler: public P3Interface, public pqiPublisher
RsMutex coreMtx; /* MUTEX */ RsMutex coreMtx; /* MUTEX */
std::map<RsPeerId, SearchModule *> mods; std::map<RsPeerId, SearchModule *> mods;
SecurityPolicy *globsec;
std::list<RsItem *> in_service; std::list<RsItem *> in_service;

View file

@ -139,8 +139,8 @@ int pqipersongrp::tickServiceSend()
// init // init
pqipersongrp::pqipersongrp(p3ServiceControl *ctrl, SecurityPolicy *glob, unsigned long flags) pqipersongrp::pqipersongrp(p3ServiceControl *ctrl, unsigned long flags)
:pqihandler(glob), p3ServiceServer(this, ctrl), pqil(NULL), initFlags(flags) :pqihandler(), p3ServiceServer(this, ctrl), pqil(NULL), initFlags(flags)
{ {
} }
@ -417,7 +417,6 @@ int pqipersongrp::addPeer(const RsPeerId& id)
sm = new SearchModule(); sm = new SearchModule();
sm -> peerid = id; sm -> peerid = id;
sm -> pqi = pqip; sm -> pqi = pqip;
sm -> sp = secpolicy_create();
// reset it to start it working. // reset it to start it working.
pqioutput(PQL_WARNING, pqipersongrpzone, "pqipersongrp::addPeer() => reset() called to initialise new person"); pqioutput(PQL_WARNING, pqipersongrpzone, "pqipersongrp::addPeer() => reset() called to initialise new person");
@ -445,7 +444,6 @@ int pqipersongrp::removePeer(const RsPeerId& id)
if (it != mods.end()) if (it != mods.end())
{ {
SearchModule *mod = it->second; SearchModule *mod = it->second;
secpolicy_delete(mod -> sp);
pqiperson *p = (pqiperson *) mod -> pqi; pqiperson *p = (pqiperson *) mod -> pqi;
p -> stoplistening(); p -> stoplistening();
pqioutput(PQL_WARNING, pqipersongrpzone, "pqipersongrp::removePeer() => reset() called before deleting person"); pqioutput(PQL_WARNING, pqipersongrpzone, "pqipersongrp::removePeer() => reset() called before deleting person");

View file

@ -50,7 +50,7 @@ class RsPeerCryptoParams ;
class pqipersongrp: public pqihandler, public pqiMonitor, public p3ServiceServer, public pqiNetListener class pqipersongrp: public pqihandler, public pqiMonitor, public p3ServiceServer, public pqiNetListener
{ {
public: public:
pqipersongrp(p3ServiceControl *ctrl, SecurityPolicy *, unsigned long flags); pqipersongrp(p3ServiceControl *ctrl, unsigned long flags);
/*************************** Setup *************************/ /*************************** Setup *************************/
/* pqilistener */ /* pqilistener */
@ -129,8 +129,8 @@ virtual int checkOutgoingRsItem(RsItem *item, int global)
class pqipersongrpDummy: public pqipersongrp class pqipersongrpDummy: public pqipersongrp
{ {
public: public:
pqipersongrpDummy(p3ServiceControl *ctrl, SecurityPolicy *pol, unsigned long flags) pqipersongrpDummy(p3ServiceControl *ctrl, unsigned long flags)
:pqipersongrp(ctrl, pol, flags) { return; } :pqipersongrp(ctrl, flags) { return; }
protected: protected:

View file

@ -1,70 +0,0 @@
/*
* "$Id: pqisecurity.cc,v 1.3 2007-02-18 21:46:49 rmf24 Exp $"
*
* 3P/PQI network interface for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include "pqi/pqisecurity.h"
#include <stdlib.h> // malloc
// Can keep the structure hidden....
// but won't at the moment.
// functions for checking what is allowed...
// currently these are all dummies.
std::string secpolicy_print(SecurityPolicy *)
{
return std::string("secpolicy_print() Implement Me Please!");
}
SecurityPolicy * secpolicy_create()
{
return (SecurityPolicy *) malloc(sizeof(SecurityPolicy));
}
int secpolicy_delete(SecurityPolicy *p)
{
free(p);
return 1;
}
int secpolicy_limit(SecurityPolicy */*limiter*/,
SecurityPolicy */*alter*/)
{
return 1;
}
int secpolicy_check(SecurityPolicy *, int /*type_transaction*/,
int /*direction*/)
{
return 1;
}

View file

@ -1,55 +0,0 @@
/*
* "$Id: pqisecurity.h,v 1.3 2007-02-18 21:46:49 rmf24 Exp $"
*
* 3P/PQI network interface for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#ifndef MRK_PQI_SECURITY_HEADER
#define MRK_PQI_SECURITY_HEADER
#define PQI_INCOMING 2
#define PQI_OUTGOING 5
#include <string>
//structure.
typedef struct sec_policy
{
int searchable; // flags indicate how searchable we are..
} SecurityPolicy;
// functions for checking what is allowed...
//
std::string secpolicy_print(SecurityPolicy *);
SecurityPolicy * secpolicy_create();
int secpolicy_delete(SecurityPolicy *);
int secpolicy_limit(SecurityPolicy *limiter,
SecurityPolicy *alter);
int secpolicy_check(SecurityPolicy *, int type_transaction,
int direction);
#endif

View file

@ -37,8 +37,8 @@ class pqissl ;
class pqisslpersongrp: public pqipersongrp class pqisslpersongrp: public pqipersongrp
{ {
public: public:
pqisslpersongrp(p3ServiceControl *ctrl, SecurityPolicy *pol, unsigned long flags, p3PeerMgr *pm) pqisslpersongrp(p3ServiceControl *ctrl, unsigned long flags, p3PeerMgr *pm)
:pqipersongrp(ctrl, pol, flags), mPeerMgr(pm) { return; } :pqipersongrp(ctrl, flags), mPeerMgr(pm) { return; }
protected: protected:

View file

@ -1222,8 +1222,7 @@ int RsServer::StartupRetroShare()
p3ServiceControl *serviceCtrl = new p3ServiceControl(mLinkMgr); p3ServiceControl *serviceCtrl = new p3ServiceControl(mLinkMgr);
rsServiceControl = serviceCtrl; rsServiceControl = serviceCtrl;
SecurityPolicy *none = secpolicy_create(); pqih = new pqisslpersongrp(serviceCtrl, flags, mPeerMgr);
pqih = new pqisslpersongrp(serviceCtrl, none, flags, mPeerMgr);
//pqih = new pqipersongrpDummy(none, flags); //pqih = new pqipersongrpDummy(none, flags);
/****** New Ft Server **** !!! */ /****** New Ft Server **** !!! */
@ -1776,7 +1775,6 @@ int RsServer::StartupRetroShare()
mod -> peerid = ownId; mod -> peerid = ownId;
mod -> pqi = ploop; mod -> pqi = ploop;
mod -> sp = secpolicy_create();
pqih->AddSearchModule(mod); pqih->AddSearchModule(mod);

View file

@ -11,6 +11,7 @@
#include "util/rsprint.h" #include "util/rsprint.h"
#include "pqi/p3dhtmgr.h" #include "pqi/p3dhtmgr.h"
#include "pqi/p3connmgr.h" #include "pqi/p3connmgr.h"
#error secpolicy was removed, also remove it from test to fix compile
#include "pqi/pqisecurity.h" #include "pqi/pqisecurity.h"
#include "pqi/pqipersongrp.h" #include "pqi/pqipersongrp.h"
@ -287,7 +288,7 @@ int main()
connMgr.setUpnpMgr(NULL); connMgr.setUpnpMgr(NULL);
/************ ADD pqipersongrp as pqimonitor *****************/ /************ ADD pqipersongrp as pqimonitor *****************/
#error secpolicy was removed, should remove it from tests too
SecurityPolicy *pol = secpolicy_create(); SecurityPolicy *pol = secpolicy_create();
unsigned long flags = 0; unsigned long flags = 0;
pqipersongrp *pqipg = new pqipersongrpDummy(pol, flags); pqipersongrp *pqipg = new pqipersongrpDummy(pol, flags);

View file

@ -31,6 +31,7 @@ ServiceTest::ServiceTest()
{ {
mConnMgr = new p3ConnectMgr(); mConnMgr = new p3ConnectMgr();
#error secpolicy was removed, should remove it from tests too
SecurityPolicy *none = secpolicy_create(); SecurityPolicy *none = secpolicy_create();
mPersonGrp = new pqisslpersongrp(none, NULL); mPersonGrp = new pqisslpersongrp(none, NULL);
mPeers = new p3Peers(mConnMgr); mPeers = new p3Peers(mConnMgr);