get rid of p3authmgr

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2001 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-13 20:56:55 +00:00
parent 2917896834
commit c23407cae3
46 changed files with 254 additions and 874 deletions

View file

@ -30,7 +30,6 @@
#include <iomanip>
#include "pqi/pqistore.h"
#include "pqi/pqibin.h"
#include "pqi/p3authmgr.h"
const uint32_t BLOG_MAX_FWD_OFFSET = (60 * 60 * 24 * 2); /* 2 Days */
const uint32_t FRIEND_QBLOG_REPOST_PERIOD = 60; /* every minute for testing */

View file

@ -73,10 +73,9 @@ RsChannels *rsChannels = NULL;
p3Channels::p3Channels(uint16_t type, CacheStrapper *cs,
CacheTransfer *cft, RsFiles *files,
std::string srcdir, std::string storedir, std::string chanDir,
p3AuthMgr *mgr)
std::string srcdir, std::string storedir, std::string chanDir)
:p3GroupDistrib(type, cs, cft, srcdir, storedir,
CONFIG_TYPE_CHANNELS, CHANNEL_STOREPERIOD, CHANNEL_PUBPERIOD, mgr),
CONFIG_TYPE_CHANNELS, CHANNEL_STOREPERIOD, CHANNEL_PUBPERIOD),
mRsFiles(files),
mChannelsDir(chanDir)
{

View file

@ -39,7 +39,7 @@ class p3Channels: public p3GroupDistrib, public RsChannels
public:
p3Channels(uint16_t type, CacheStrapper *cs, CacheTransfer *cft, RsFiles *files,
std::string srcdir, std::string storedir, std::string channelsdir, p3AuthMgr *mgr);
std::string srcdir, std::string storedir, std::string channelsdir);
virtual ~p3Channels();
/****************************************/

View file

@ -29,7 +29,7 @@
#include "rsiface/rspeers.h"
#include "services/p3disc.h"
#include "pqi/p3authmgr.h"
#include "pqi/authssl.h"
#include "pqi/p3connmgr.h"
#include <iostream>
@ -79,8 +79,8 @@ const uint32_t P3DISC_FLAGS_ASK_VERSION = 0x0080;
******************************************************************************************
*****************************************************************************************/
p3disc::p3disc(p3AuthMgr *am, p3ConnectMgr *cm, pqipersongrp *pqih)
:p3Service(RS_SERVICE_TYPE_DISC), mAuthMgr(am), mConnMgr(cm), mPqiPersonGrp(pqih)
p3disc::p3disc(p3ConnectMgr *cm, pqipersongrp *pqih)
:p3Service(RS_SERVICE_TYPE_DISC), mConnMgr(cm), mPqiPersonGrp(pqih)
{
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
@ -91,7 +91,7 @@ p3disc::p3disc(p3AuthMgr *am, p3ConnectMgr *cm, pqipersongrp *pqih)
lastSentHeartbeatTime = 0;
//add own version to versions map
versions[mAuthMgr->OwnId()] = RsUtil::retroshareVersion();
versions[getAuthSSL()->OwnId()] = RsUtil::retroshareVersion();
return;
}
@ -516,7 +516,7 @@ void p3disc::sendPeerDetails(std::string to, std::string about)
unsigned char **binptr = (unsigned char **) &(di -> certDER.bin_data);
mAuthMgr->SaveCertificateToBinary(about, binptr, &certLen);
getAuthSSL()->SaveCertificateToBinary(about, binptr, &certLen);
#ifdef P3DISC_DEBUG
std::cerr << "Saved certificate to binary in p3discReply. Length=" << certLen << std::endl ;
#endif
@ -565,7 +565,7 @@ void p3disc::sendPeerIssuer(std::string to, std::string about)
#endif
}
std::string aboutIssuerId = mAuthMgr->getIssuerName(about);
std::string aboutIssuerId = getAuthSSL()->getIssuerName(about);
if (aboutIssuerId == "")
{
/* major error! */
@ -579,7 +579,7 @@ void p3disc::sendPeerIssuer(std::string to, std::string about)
// Set Target as input cert.
di -> PeerId(to);
di -> issuerCert = mAuthMgr->SaveCertificateToString(aboutIssuerId);
di -> issuerCert = getAuthSSL()->SaveCertificateToString(aboutIssuerId);
#ifdef P3DISC_DEBUG
std::cerr << "Saved certificate to string in RsDiscIssuer. " << std::endl ;
@ -719,7 +719,7 @@ void p3disc::recvPeerFriendMsg(RsDiscReply *item)
uint8_t *certptr = (uint8_t *) item->certDER.bin_data;
uint32_t len = item->certDER.bin_len;
bool loaded = mAuthMgr->LoadCertificateFromBinary(certptr, len, peerId);
bool loaded = getAuthSSL()->LoadCertificateFromBinary(certptr, len, peerId);
uint32_t type = 0;
uint32_t flags = 0;
@ -732,7 +732,7 @@ void p3disc::recvPeerFriendMsg(RsDiscReply *item)
{
std::cerr << " Found a peer that trust me: " << peerId << " (" << rsPeers->getPeerName(peerId) << ")" << std::endl ;
flags |= RS_NET_FLAGS_TRUSTS_ME;
mAuthMgr->addTrustingPeer(peerId) ;
getAuthSSL()->addTrustingPeer(peerId) ;
}
/* generate type */
@ -804,7 +804,7 @@ void p3disc::recvPeerIssuerMsg(RsDiscIssuer *item)
/* load certificate */
std::string peerId;
bool loaded = mAuthMgr->LoadCertificateFromString(item->issuerCert, peerId);
bool loaded = getAuthSSL()->LoadCertificateFromString(item->issuerCert, peerId);
/* cleanup (handled by caller) */

View file

@ -38,7 +38,6 @@
#include "pqi/pqipersongrp.h"
class p3ConnectMgr;
class p3AuthMgr;
#include "pqi/pqimonitor.h"
#include "serialiser/rsdiscitems.h"
@ -72,7 +71,6 @@ class autoneighbour: public autoserver
};
class p3AuthMgr;
class p3ConnectMgr;
@ -81,7 +79,7 @@ class p3disc: public p3Service, public pqiMonitor
public:
p3disc(p3AuthMgr *am, p3ConnectMgr *cm, pqipersongrp *persGrp);
p3disc(p3ConnectMgr *cm, pqipersongrp *persGrp);
/************* from pqiMonitor *******************/
virtual void statusChange(const std::list<pqipeer> &plist);
@ -123,7 +121,6 @@ int idServers();
private:
p3AuthMgr *mAuthMgr;
p3ConnectMgr *mConnMgr;
pqipersongrp *mPqiPersonGrp;
time_t lastSentHeartbeatTime;

View file

@ -34,6 +34,7 @@
#include "util/rsdir.h"
#include "pqi/pqinotify.h"
#include "pqi/pqibin.h"
#include "pqi/authssl.h"
/*****
* #define DISTRIB_DEBUG 1
@ -49,13 +50,11 @@ p3GroupDistrib::p3GroupDistrib(uint16_t subtype,
CacheStrapper *cs, CacheTransfer *cft,
std::string sourcedir, std::string storedir,
uint32_t configId,
uint32_t storePeriod, uint32_t pubPeriod,
p3AuthMgr *mgr)
uint32_t storePeriod, uint32_t pubPeriod)
:CacheSource(subtype, true, cs, sourcedir),
CacheStore(subtype, true, cs, cft, storedir),
p3Config(configId), nullService(subtype),
mAuthMgr(mgr),
p3Config(configId), nullService(subtype),
mStorePeriod(storePeriod),
mPubPeriod(pubPeriod),
mLastPublishTime(0),
@ -67,7 +66,7 @@ p3GroupDistrib::p3GroupDistrib(uint16_t subtype,
/* force publication of groups (cleared if local cache file found) */
mGroupsRepublish = true;
mOwnId = mAuthMgr->OwnId();
mOwnId = getAuthSSL()->OwnId();
return;
}
@ -1729,10 +1728,10 @@ std::string p3GroupDistrib::publishMsg(RsDistribMsg *msg, bool personalSign)
{
unsigned int siglen = EVP_PKEY_size(publishKey);
unsigned char sigbuf[siglen];
if (mAuthMgr->SignDataBin(data, size, sigbuf, &siglen))
if (getAuthGPG()->SignDataBin(data, size, sigbuf, &siglen))
{
signedMsg->personalSignature.signData.setBinData(sigbuf, siglen);
signedMsg->personalSignature.keyId = mAuthMgr->OwnId();
signedMsg->personalSignature.keyId = getAuthGPG()->PGPOwnId();
}
}
@ -2451,7 +2450,7 @@ bool p3GroupDistrib::locked_validateDistribSignedMsg(
std::cerr << std::endl;
#endif
if (mAuthMgr->isValid(newMsg->personalSignature.keyId))
if (getAuthGPG()->isPGPValid(newMsg->personalSignature.keyId))
{
#ifdef DISTRIB_DEBUG
std::cerr << "p3GroupDistrib::locked_validateDistribSignedMsg() Peer Known";

View file

@ -29,7 +29,6 @@
#include "pqi/pqi.h"
#include "pqi/pqistore.h"
#include "pqi/p3cfgmgr.h"
#include "pqi/p3authmgr.h"
#include "services/p3service.h"
#include "dbase/cachestrapper.h"
#include "serialiser/rsforumitems.h"
@ -212,8 +211,7 @@ class p3GroupDistrib: public CacheSource, public CacheStore, public p3Config, pu
CacheStrapper *cs, CacheTransfer *cft,
std::string sourcedir, std::string storedir,
uint32_t configId,
uint32_t storePeriod, uint32_t pubPeriod,
p3AuthMgr *mgr);
uint32_t storePeriod, uint32_t pubPeriod);
/***************************************************************************************/

View file

@ -24,6 +24,7 @@
*/
#include "services/p3forums.h"
#include "pqi/authssl.h"
uint32_t convertToInternalFlags(uint32_t extFlags);
uint32_t convertToExternalFlags(uint32_t intFlags);
@ -76,11 +77,9 @@ RsForums *rsForums = NULL;
#define FORUM_PUBPERIOD 600 /* 10 minutes ... (max = 455 days) */
p3Forums::p3Forums(uint16_t type, CacheStrapper *cs, CacheTransfer *cft,
std::string srcdir, std::string storedir,
p3AuthMgr *mgr)
std::string srcdir, std::string storedir)
:p3GroupDistrib(type, cs, cft, srcdir, storedir,
CONFIG_TYPE_FORUMS, FORUM_STOREPERIOD, FORUM_PUBPERIOD,
mgr),
CONFIG_TYPE_FORUMS, FORUM_STOREPERIOD, FORUM_PUBPERIOD),
mForumsChanged(false)
{
//loadDummyData();
@ -298,7 +297,7 @@ std::string p3Forums::createForumMsg(std::string fId, std::string pId,
fmsg->msg = msg;
if (signIt)
{
fmsg->srcId = mAuthMgr->OwnId();
fmsg->srcId = getAuthSSL()->OwnId();
}
fmsg->timestamp = time(NULL);

View file

@ -73,7 +73,7 @@ class p3Forums: public p3GroupDistrib, public RsForums
public:
p3Forums(uint16_t type, CacheStrapper *cs, CacheTransfer *cft,
std::string srcdir, std::string storedir, p3AuthMgr *mgr);
std::string srcdir, std::string storedir);
virtual ~p3Forums();
void loadDummyData();

View file

@ -26,7 +26,7 @@
#include "services/p3photoservice.h"
#include "pqi/pqibin.h"
#include "pqi/p3authmgr.h"
#include "pqi/authssl.h"
#include "util/rsdir.h"
@ -55,7 +55,7 @@ p3PhotoService::p3PhotoService(uint16_t type, CacheStrapper *cs, CacheTransfer *
{ RsStackMutex stack(mPhotoMtx); /********** STACK LOCKED MTX ******/
mOwnId = getAuthMgr()->OwnId();
mOwnId = getAuthSSL()->OwnId();
}
// createDummyData();

View file

@ -28,7 +28,7 @@
#include <iomanip>
#include "pqi/pqibin.h"
#include "pqi/p3authmgr.h"
#include "pqi/authssl.h"
const uint32_t RANK_MAX_FWD_OFFSET = (60 * 60 * 24 * 2); /* 2 Days */

View file

@ -30,7 +30,7 @@
#include "services/p3tunnel.h"
#include "pqi/pqissltunnel.h"
#include "pqi/p3authmgr.h"
#include "pqi/authssl.h"
#include "pqi/p3connmgr.h"
#include <errno.h>
@ -39,8 +39,8 @@
#include "util/rsprint.h"
#include "util/rsversion.h"
p3tunnel::p3tunnel(p3AuthMgr *am, p3ConnectMgr *cm, pqipersongrp *perGrp)
:p3Service(RS_SERVICE_TYPE_TUNNEL), mAuthMgr(am), mConnMgr(cm), mPqiPersonGrp(perGrp)
p3tunnel::p3tunnel(p3ConnectMgr *cm, pqipersongrp *perGrp)
:p3Service(RS_SERVICE_TYPE_TUNNEL), mConnMgr(cm), mPqiPersonGrp(perGrp)
{
RsStackMutex stack(mTunnelMtx); /********** STACK LOCKED MTX ******/

View file

@ -34,11 +34,11 @@
#include "pqi/pqi.h"
class p3ConnectMgr;
class p3AuthMgr;
#include "pqi/pqimonitor.h"
#include "services/p3service.h"
#include "serialiser/rstunnelitems.h"
#include "pqi/authssl.h"
class p3tunnel: public p3Service, public pqiMonitor
{
@ -46,7 +46,7 @@ class p3tunnel: public p3Service, public pqiMonitor
virtual void statusChange(const std::list<pqipeer> &plist);
p3tunnel(p3AuthMgr *am, p3ConnectMgr *cm, pqipersongrp *persGrp);
p3tunnel(p3ConnectMgr *cm, pqipersongrp *persGrp);
int tick();
@ -69,7 +69,6 @@ void recvTunnelData(RsTunnelDataItem *item);
private:
p3AuthMgr *mAuthMgr;
p3ConnectMgr *mConnMgr;
pqipersongrp *mPqiPersonGrp;
std::string ownId;