diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 60ed15d0a..a103392eb 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -373,7 +373,6 @@ HEADERS += pqi/authssl.h \ pqi/pqinetwork.h \ pqi/pqiperson.h \ pqi/pqipersongrp.h \ - pqi/pqisecurity.h \ pqi/pqiservice.h \ pqi/pqissl.h \ pqi/pqissllistener.h \ @@ -525,7 +524,6 @@ SOURCES += pqi/authgpg.cc \ pqi/pqinetwork.cc \ pqi/pqiperson.cc \ pqi/pqipersongrp.cc \ - pqi/pqisecurity.cc \ pqi/pqiservice.cc \ pqi/pqissl.cc \ pqi/pqissllistener.cc \ diff --git a/libretroshare/src/pqi/pqihandler.cc b/libretroshare/src/pqi/pqihandler.cc index 45cd790c2..1c9c28e02 100644 --- a/libretroshare/src/pqi/pqihandler.cc +++ b/libretroshare/src/pqi/pqihandler.cc @@ -39,17 +39,10 @@ static const float PQI_HANDLER_NB_PRIORITY_RATIO = 2 ; #define RSITEM_DEBUG 1 ****/ -pqihandler::pqihandler(SecurityPolicy *Global) : coreMtx("pqihandler") +pqihandler::pqihandler() : coreMtx("pqihandler") { 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. rateIndiv_out = 0.01; rateIndiv_in = 0.01; @@ -188,16 +181,6 @@ bool pqihandler::AddSearchModule(SearchModule *mod) 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. mods[mod->peerid] = mod; return true; @@ -282,9 +265,6 @@ int pqihandler::locked_HandleRsItem(RsItem *item, int allowglobal,uint32_t& comp 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(); pqioutput(PQL_DEBUG_BASIC, pqihandlerzone, out); #ifdef DEBUG_TICK @@ -294,21 +274,6 @@ int pqihandler::locked_HandleRsItem(RsItem *item, int allowglobal,uint32_t& comp // if yes send on item. ((it -> second) -> pqi) -> SendItem(item,computed_size); 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) diff --git a/libretroshare/src/pqi/pqihandler.h b/libretroshare/src/pqi/pqihandler.h index 8b82e7bbf..ccb9fd9ad 100644 --- a/libretroshare/src/pqi/pqihandler.h +++ b/libretroshare/src/pqi/pqihandler.h @@ -27,7 +27,6 @@ #define MRK_PQI_HANDLER_HEADER #include "pqi/pqi.h" -#include "pqi/pqisecurity.h" #include "pqi/pqiqos.h" #include "util/rsthreads.h" @@ -42,7 +41,6 @@ class SearchModule public: RsPeerId peerid; PQInterface *pqi; - SecurityPolicy *sp; }; // Presents a P3 Face to the world! @@ -51,7 +49,7 @@ class SearchModule class pqihandler: public P3Interface, public pqiPublisher { public: - pqihandler(SecurityPolicy *Global); + pqihandler(); /**** Overloaded from pqiPublisher ****/ virtual bool sendItem(RsRawItem *item) @@ -99,7 +97,6 @@ class pqihandler: public P3Interface, public pqiPublisher RsMutex coreMtx; /* MUTEX */ std::map mods; - SecurityPolicy *globsec; std::list in_service; diff --git a/libretroshare/src/pqi/pqipersongrp.cc b/libretroshare/src/pqi/pqipersongrp.cc index bfa041c92..9336736b4 100644 --- a/libretroshare/src/pqi/pqipersongrp.cc +++ b/libretroshare/src/pqi/pqipersongrp.cc @@ -139,8 +139,8 @@ int pqipersongrp::tickServiceSend() // init -pqipersongrp::pqipersongrp(p3ServiceControl *ctrl, SecurityPolicy *glob, unsigned long flags) - :pqihandler(glob), p3ServiceServer(this, ctrl), pqil(NULL), initFlags(flags) +pqipersongrp::pqipersongrp(p3ServiceControl *ctrl, unsigned long flags) + :pqihandler(), p3ServiceServer(this, ctrl), pqil(NULL), initFlags(flags) { } @@ -417,7 +417,6 @@ int pqipersongrp::addPeer(const RsPeerId& id) sm = new SearchModule(); sm -> peerid = id; sm -> pqi = pqip; - sm -> sp = secpolicy_create(); // reset it to start it working. 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()) { SearchModule *mod = it->second; - secpolicy_delete(mod -> sp); pqiperson *p = (pqiperson *) mod -> pqi; p -> stoplistening(); pqioutput(PQL_WARNING, pqipersongrpzone, "pqipersongrp::removePeer() => reset() called before deleting person"); diff --git a/libretroshare/src/pqi/pqipersongrp.h b/libretroshare/src/pqi/pqipersongrp.h index 31ac19ec0..0703db8ff 100644 --- a/libretroshare/src/pqi/pqipersongrp.h +++ b/libretroshare/src/pqi/pqipersongrp.h @@ -50,7 +50,7 @@ class RsPeerCryptoParams ; class pqipersongrp: public pqihandler, public pqiMonitor, public p3ServiceServer, public pqiNetListener { public: - pqipersongrp(p3ServiceControl *ctrl, SecurityPolicy *, unsigned long flags); + pqipersongrp(p3ServiceControl *ctrl, unsigned long flags); /*************************** Setup *************************/ /* pqilistener */ @@ -129,8 +129,8 @@ virtual int checkOutgoingRsItem(RsItem *item, int global) class pqipersongrpDummy: public pqipersongrp { public: - pqipersongrpDummy(p3ServiceControl *ctrl, SecurityPolicy *pol, unsigned long flags) - :pqipersongrp(ctrl, pol, flags) { return; } + pqipersongrpDummy(p3ServiceControl *ctrl, unsigned long flags) + :pqipersongrp(ctrl, flags) { return; } protected: diff --git a/libretroshare/src/pqi/pqisecurity.cc b/libretroshare/src/pqi/pqisecurity.cc deleted file mode 100644 index 3308c7adc..000000000 --- a/libretroshare/src/pqi/pqisecurity.cc +++ /dev/null @@ -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 // 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; -} - - - diff --git a/libretroshare/src/pqi/pqisecurity.h b/libretroshare/src/pqi/pqisecurity.h deleted file mode 100644 index 7656927ad..000000000 --- a/libretroshare/src/pqi/pqisecurity.h +++ /dev/null @@ -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 - -//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 - diff --git a/libretroshare/src/pqi/pqisslpersongrp.h b/libretroshare/src/pqi/pqisslpersongrp.h index f9544a93a..5027abd66 100644 --- a/libretroshare/src/pqi/pqisslpersongrp.h +++ b/libretroshare/src/pqi/pqisslpersongrp.h @@ -37,8 +37,8 @@ class pqissl ; class pqisslpersongrp: public pqipersongrp { public: - pqisslpersongrp(p3ServiceControl *ctrl, SecurityPolicy *pol, unsigned long flags, p3PeerMgr *pm) - :pqipersongrp(ctrl, pol, flags), mPeerMgr(pm) { return; } + pqisslpersongrp(p3ServiceControl *ctrl, unsigned long flags, p3PeerMgr *pm) + :pqipersongrp(ctrl, flags), mPeerMgr(pm) { return; } protected: diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index f9147a7bb..735732668 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1222,8 +1222,7 @@ int RsServer::StartupRetroShare() p3ServiceControl *serviceCtrl = new p3ServiceControl(mLinkMgr); rsServiceControl = serviceCtrl; - SecurityPolicy *none = secpolicy_create(); - pqih = new pqisslpersongrp(serviceCtrl, none, flags, mPeerMgr); + pqih = new pqisslpersongrp(serviceCtrl, flags, mPeerMgr); //pqih = new pqipersongrpDummy(none, flags); /****** New Ft Server **** !!! */ @@ -1776,7 +1775,6 @@ int RsServer::StartupRetroShare() mod -> peerid = ownId; mod -> pqi = ploop; - mod -> sp = secpolicy_create(); pqih->AddSearchModule(mod); diff --git a/libretroshare/src/tests/pqi/conn_test.cc b/libretroshare/src/tests/pqi/conn_test.cc index f80a6b7c8..8a90b5694 100644 --- a/libretroshare/src/tests/pqi/conn_test.cc +++ b/libretroshare/src/tests/pqi/conn_test.cc @@ -11,6 +11,7 @@ #include "util/rsprint.h" #include "pqi/p3dhtmgr.h" #include "pqi/p3connmgr.h" +#error secpolicy was removed, also remove it from test to fix compile #include "pqi/pqisecurity.h" #include "pqi/pqipersongrp.h" @@ -287,7 +288,7 @@ int main() connMgr.setUpnpMgr(NULL); /************ ADD pqipersongrp as pqimonitor *****************/ - +#error secpolicy was removed, should remove it from tests too SecurityPolicy *pol = secpolicy_create(); unsigned long flags = 0; pqipersongrp *pqipg = new pqipersongrpDummy(pol, flags); diff --git a/libretroshare/src/tests/services/servicetest.cc b/libretroshare/src/tests/services/servicetest.cc index 88f556430..7ad3ee2d7 100644 --- a/libretroshare/src/tests/services/servicetest.cc +++ b/libretroshare/src/tests/services/servicetest.cc @@ -31,6 +31,7 @@ ServiceTest::ServiceTest() { mConnMgr = new p3ConnectMgr(); +#error secpolicy was removed, should remove it from tests too SecurityPolicy *none = secpolicy_create(); mPersonGrp = new pqisslpersongrp(none, NULL); mPeers = new p3Peers(mConnMgr);