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

@ -504,8 +504,8 @@ void CacheStore::locked_storeCacheEntry(const CacheData &data)
* *
********************************* CacheStrapper ********************************/ ********************************* CacheStrapper ********************************/
CacheStrapper::CacheStrapper(p3AuthMgr *am, p3ConnectMgr *cm) CacheStrapper::CacheStrapper(p3ConnectMgr *cm)
:p3Config(CONFIG_TYPE_CACHE), mAuthMgr(am), mConnMgr(cm) :p3Config(CONFIG_TYPE_CACHE), mConnMgr(cm)
{ {
return; return;
} }
@ -832,7 +832,7 @@ bool CacheStrapper::loadList(std::list<RsItem *> load)
CacheData cd; CacheData cd;
cd.pid = rscc->pid; cd.pid = rscc->pid;
cd.pname = mAuthMgr->getName(cd.pid); cd.pname = getAuthSSL()->getName(cd.pid);
cd.cid.type = rscc->cachetypeid; cd.cid.type = rscc->cachetypeid;
cd.cid.subid = rscc->cachesubid; cd.cid.subid = rscc->cachesubid;
cd.path = rscc->path; cd.path = rscc->path;

View File

@ -277,7 +277,7 @@ class p3AuthMgr;
class CacheStrapper: public pqiMonitor, public p3Config class CacheStrapper: public pqiMonitor, public p3Config
{ {
public: public:
CacheStrapper(p3AuthMgr *am, p3ConnectMgr *cm); CacheStrapper(p3ConnectMgr *cm);
virtual ~CacheStrapper() { return; } virtual ~CacheStrapper() { return; }
/************* from pqiMonitor *******************/ /************* from pqiMonitor *******************/

View File

@ -262,8 +262,8 @@ void ftFiMonitor::setSharedDirectories(std::list<SharedDirInfo> dirList)
ftCacheStrapper::ftCacheStrapper(p3AuthMgr *am, p3ConnectMgr *cm) ftCacheStrapper::ftCacheStrapper(p3ConnectMgr *cm)
:CacheStrapper(am, cm) :CacheStrapper(cm)
{ {
return; return;
} }

View File

@ -78,7 +78,7 @@ virtual bool loadList(std::list<RsItem *> load);
class ftCacheStrapper: public CacheStrapper, public ftSearch class ftCacheStrapper: public CacheStrapper, public ftSearch
{ {
public: public:
ftCacheStrapper(p3AuthMgr *am, p3ConnectMgr *cm); ftCacheStrapper(p3ConnectMgr *cm);
/* overloaded search function */ /* overloaded search function */
virtual bool search(std::string hash, uint32_t hintflags, FileInfo &info) const; virtual bool search(std::string hash, uint32_t hintflags, FileInfo &info) const;

View File

@ -55,15 +55,15 @@ const int ftserverzone = 29539;
***/ ***/
/* Setup */ /* Setup */
ftServer::ftServer(p3AuthMgr *authMgr, p3ConnectMgr *connMgr) ftServer::ftServer(p3ConnectMgr *connMgr)
: mP3iface(NULL), : mP3iface(NULL),
mAuthMgr(authMgr), mConnMgr(connMgr), mConnMgr(connMgr),
mCacheStrapper(NULL), mCacheStrapper(NULL),
mFiStore(NULL), mFiMon(NULL), mFiStore(NULL), mFiMon(NULL),
mFtController(NULL), mFtExtra(NULL), mFtController(NULL), mFtExtra(NULL),
mFtDataplex(NULL), mFtSearch(NULL) mFtDataplex(NULL), mFtSearch(NULL)
{ {
mCacheStrapper = new ftCacheStrapper(authMgr, connMgr); mCacheStrapper = new ftCacheStrapper(connMgr);
} }
void ftServer::setConfigDirectory(std::string path) void ftServer::setConfigDirectory(std::string path)
@ -858,7 +858,7 @@ bool ftServer::handleCacheData()
data.name = ci->file.name; data.name = ci->file.name;
data.path = ci->file.path; data.path = ci->file.path;
data.pid = ci->PeerId(); data.pid = ci->PeerId();
data.pname = mAuthMgr->getName(ci->PeerId()); data.pname = getAuthSSL()->getName(ci->PeerId());
mCacheStrapper->recvCacheResponse(data, time(NULL)); mCacheStrapper->recvCacheResponse(data, time(NULL));
delete ci; delete ci;

View File

@ -79,7 +79,7 @@ class ftServer: public RsFiles, public ftDataSend, public RsThread
/******************** Setup ************************************/ /******************** Setup ************************************/
/***************************************************************/ /***************************************************************/
ftServer(p3AuthMgr *authMgr, p3ConnectMgr *connMgr); ftServer(p3ConnectMgr *connMgr);
/* Assign important variables */ /* Assign important variables */
void setConfigDirectory(std::string path); void setConfigDirectory(std::string path);

View File

@ -156,7 +156,7 @@ HEADERS += dbase/cachestrapper.h \
pqi/authssl.h \ pqi/authssl.h \
pqi/authgpg.h \ pqi/authgpg.h \
pqi/cleanupxpgp.h \ pqi/cleanupxpgp.h \
pqi/p3authmgr.h \ # pqi/p3authmgr.h \
pqi/p3cfgmgr.h \ pqi/p3cfgmgr.h \
pqi/p3connmgr.h \ pqi/p3connmgr.h \
pqi/p3dhtmgr.h \ pqi/p3dhtmgr.h \
@ -336,7 +336,7 @@ SOURCES += \
pqi/pqissl.cc \ pqi/pqissl.cc \
pqi/pqissltunnel.cc \ pqi/pqissltunnel.cc \
pqi/pqistore.cc \ pqi/pqistore.cc \
pqi/p3authmgr.cc \ # pqi/p3authmgr.cc \
pqi/p3cfgmgr.cc \ pqi/p3cfgmgr.cc \
pqi/p3connmgr.cc \ pqi/p3connmgr.cc \
pqi/p3dhtmgr.cc \ pqi/p3dhtmgr.cc \

View File

@ -318,10 +318,10 @@ int GPGAuthMgr::GPGInit(std::string ownId)
return 0; return 0;
} }
mOwnGpgCert.user.name = newKey->uids->name; mOwnGpgCert.name = newKey->uids->name;
mOwnGpgCert.user.email = newKey->uids->email; mOwnGpgCert.email = newKey->uids->email;
mOwnGpgCert.user.fpr = newKey->subkeys->fpr; mOwnGpgCert.fpr = newKey->subkeys->fpr;
mOwnGpgCert.user.id = ownId; mOwnGpgCert.id = ownId;
mOwnGpgCert.key = newKey; mOwnGpgCert.key = newKey;
mOwnId = ownId; mOwnId = ownId;
@ -362,16 +362,16 @@ int GPGAuthMgr::GPGInit(std::string name, std::string comment,
return 0; return 0;
} }
mOwnGpgCert.user.name = name; mOwnGpgCert.name = name;
mOwnGpgCert.user.email = email; mOwnGpgCert.email = email;
mOwnGpgCert.user.fpr = newKey->subkeys->fpr; mOwnGpgCert.fpr = newKey->subkeys->fpr;
mOwnGpgCert.user.id = newKey->subkeys->keyid; mOwnGpgCert.id = newKey->subkeys->keyid;
mOwnGpgCert.key = newKey; mOwnGpgCert.key = newKey;
this->passphrase = inPassphrase; this->passphrase = inPassphrase;
setPGPPassword_locked(inPassphrase); setPGPPassword_locked(inPassphrase);
mOwnId = mOwnGpgCert.user.id; mOwnId = mOwnGpgCert.id;
gpgmeKeySelected = true; gpgmeKeySelected = true;
return 1; return 1;
@ -454,11 +454,11 @@ bool GPGAuthMgr::storeAllKeys_locked()
* Don't really need to worry about other ids either. * Don't really need to worry about other ids either.
*/ */
gpgme_subkey_t mainsubkey = KEY->subkeys; gpgme_subkey_t mainsubkey = KEY->subkeys;
nu.user.id = mainsubkey->keyid; nu.id = mainsubkey->keyid;
nu.user.fpr = mainsubkey->fpr; nu.fpr = mainsubkey->fpr;
std::cerr << "MAIN KEYID: " << nu.user.id; std::cerr << "MAIN KEYID: " << nu.id;
std::cerr << " FPR: " << nu.user.fpr; std::cerr << " FPR: " << nu.fpr;
std::cerr << std::endl; std::cerr << std::endl;
@ -478,8 +478,8 @@ bool GPGAuthMgr::storeAllKeys_locked()
*/ */
gpgme_user_id_t mainuid = KEY->uids; gpgme_user_id_t mainuid = KEY->uids;
nu.user.name = mainuid->name; nu.name = mainuid->name;
nu.user.email = mainuid->email; nu.email = mainuid->email;
gpgme_key_sig_t mainsiglist = mainuid->signatures; gpgme_key_sig_t mainsiglist = mainuid->signatures;
while(mainsiglist != NULL) while(mainsiglist != NULL)
{ {
@ -491,11 +491,11 @@ bool GPGAuthMgr::storeAllKeys_locked()
*/ */
std::string keyid = mainsiglist->keyid; std::string keyid = mainsiglist->keyid;
if (nu.user.signers.end() == std::find( if (nu.signers.end() == std::find(
nu.user.signers.begin(), nu.signers.begin(),
nu.user.signers.end(),keyid)) nu.signers.end(),keyid))
{ {
nu.user.signers.push_back(keyid); nu.signers.push_back(keyid);
} }
} }
mainsiglist = mainsiglist->next; mainsiglist = mainsiglist->next;
@ -530,17 +530,17 @@ bool GPGAuthMgr::storeAllKeys_locked()
* signature notation supplied is GPGME_KEYLIST_MODE_SIG_NOTATION is on * signature notation supplied is GPGME_KEYLIST_MODE_SIG_NOTATION is on
*/ */
nu.user.trustLvl = KEY->owner_trust; nu.trustLvl = KEY->owner_trust;
nu.user.ownsign = KEY->can_sign; nu.ownsign = KEY->can_sign;
nu.user.validLvl = mainuid->validity; nu.validLvl = mainuid->validity;
nu.user.trusted = (mainuid->validity > GPGME_VALIDITY_MARGINAL); nu.trusted = (mainuid->validity > GPGME_VALIDITY_MARGINAL);
/* grab a reference, so the key remains */ /* grab a reference, so the key remains */
gpgme_key_ref(KEY); gpgme_key_ref(KEY);
nu.key = KEY; nu.key = KEY;
/* store in map */ /* store in map */
mKeyList[nu.user.id] = nu; mKeyList[nu.id] = nu;
} }
if (GPG_ERR_NO_ERROR != gpgme_op_keylist_end(CTX)) if (GPG_ERR_NO_ERROR != gpgme_op_keylist_end(CTX))
@ -575,7 +575,7 @@ bool GPGAuthMgr::updateTrustAllKeys_locked()
for(it = mKeyList.begin(); it != mKeyList.end(); it++) for(it = mKeyList.begin(); it != mKeyList.end(); it++)
{ {
/* check for trust items associated with key */ /* check for trust items associated with key */
std::string peerid = it->second.user.email; std::string peerid = it->second.email;
std::cerr << "Searching GPGme for TrustInfo on: " << peerid; std::cerr << "Searching GPGme for TrustInfo on: " << peerid;
std::cerr << std::endl; std::cerr << std::endl;
@ -634,26 +634,26 @@ bool GPGAuthMgr::printAllKeys_locked()
certmap::const_iterator it; certmap::const_iterator it;
for(it = mKeyList.begin(); it != mKeyList.end(); it++) for(it = mKeyList.begin(); it != mKeyList.end(); it++)
{ {
std::cerr << "PGP Key: " << it->second.user.id; std::cerr << "PGP Key: " << it->second.id;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "\tName: " << it->second.user.name; std::cerr << "\tName: " << it->second.name;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "\tEmail: " << it->second.user.email; std::cerr << "\tEmail: " << it->second.email;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "\ttrustLvl: " << it->second.user.trustLvl; std::cerr << "\ttrustLvl: " << it->second.trustLvl;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "\townsign?: " << it->second.user.ownsign; std::cerr << "\townsign?: " << it->second.ownsign;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "\ttrusted/valid: " << it->second.user.trusted; std::cerr << "\ttrusted/valid: " << it->second.trusted;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "\tEmail: " << it->second.user.email; std::cerr << "\tEmail: " << it->second.email;
std::cerr << std::endl; std::cerr << std::endl;
std::list<std::string>::const_iterator sit; std::list<std::string>::const_iterator sit;
for(sit = it->second.user.signers.begin(); for(sit = it->second.signers.begin();
sit != it->second.user.signers.end(); sit++) sit != it->second.signers.end(); sit++)
{ {
std::cerr << "\t\tSigner ID:" << *sit; std::cerr << "\t\tSigner ID:" << *sit;
@ -663,7 +663,7 @@ bool GPGAuthMgr::printAllKeys_locked()
certmap::const_iterator kit = mKeyList.find(*sit); certmap::const_iterator kit = mKeyList.find(*sit);
if (kit != mKeyList.end()) if (kit != mKeyList.end())
{ {
std::cerr << " Name:" << kit->second.user.name; std::cerr << " Name:" << kit->second.name;
std::cerr << std::endl; std::cerr << std::endl;
} }
} }
@ -677,14 +677,14 @@ bool GPGAuthMgr::printOwnKeys_locked()
certmap::iterator it; certmap::iterator it;
for(it = mKeyList.begin(); it != mKeyList.end(); it++) for(it = mKeyList.begin(); it != mKeyList.end(); it++)
{ {
if (it->second.user.ownsign) if (it->second.ownsign)
{ {
std::cerr << "Own PGP Key: " << it->second.user.id; std::cerr << "Own PGP Key: " << it->second.id;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "\tName: " << it->second.user.name; std::cerr << "\tName: " << it->second.name;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "\tEmail: " << it->second.user.email; std::cerr << "\tEmail: " << it->second.email;
std::cerr << std::endl; std::cerr << std::endl;
} }
} }
@ -943,30 +943,22 @@ std::string GPGAuthMgr::getPGPName(GPG_id id)
certmap::iterator it; certmap::iterator it;
if (mKeyList.end() != (it = mKeyList.find(id))) if (mKeyList.end() != (it = mKeyList.find(id)))
return it->second.user.name; return it->second.name;
return std::string(); return std::string();
} }
bool GPGAuthMgr::getDetails(GPG_id id, pqiAuthDetails &details) /**** These Two are common */
std::string GPGAuthMgr::getPGPEmail(GPG_id id)
{ {
//RsStackMutex stack(pgpMtx); /******* LOCKED ******/ RsStackMutex stack(pgpMtx); /******* LOCKED ******/
if(pgpMtx.trylock())
{
/* if we cannot find a ssl cert - might be a pgp cert */
certmap::iterator it;
if (mKeyList.end() != (it = mKeyList.find(id)))
{
/* what do we want from the gpg mgr */
details = it->second.user;
pgpMtx.unlock() ;
return true;
}
pgpMtx.unlock() ;
}
return false;
}
certmap::iterator it;
if (mKeyList.end() != (it = mKeyList.find(id)))
return it->second.email;
return std::string();
}
/**** GPG versions ***/ /**** GPG versions ***/
@ -1030,7 +1022,7 @@ bool GPGAuthMgr::getPGPAuthenticatedList(std::list<std::string> &ids)
certmap::iterator it; certmap::iterator it;
for(it = mKeyList.begin(); it != mKeyList.end(); it++) for(it = mKeyList.begin(); it != mKeyList.end(); it++)
{ {
if (it->second.user.trusted) if (it->second.trusted)
{ {
ids.push_back(it->first); ids.push_back(it->first);
} }
@ -1045,7 +1037,7 @@ bool GPGAuthMgr::getPGPUnknownList(std::list<std::string> &ids)
certmap::iterator it; certmap::iterator it;
for(it = mKeyList.begin(); it != mKeyList.end(); it++) for(it = mKeyList.begin(); it != mKeyList.end(); it++)
{ {
if (!(it->second.user.trusted)) if (!(it->second.trusted))
{ {
ids.push_back(it->first); ids.push_back(it->first);
} }
@ -1074,7 +1066,7 @@ bool GPGAuthMgr::isPGPAuthenticated(GPG_id id)
* which is the 'trusted' flag. * which is the 'trusted' flag.
*/ */
return (it->second.user.trusted); return (it->second.trusted);
} }
return false; return false;
} }

View File

@ -31,13 +31,17 @@
#define RS_GPG_AUTH_HEADER #define RS_GPG_AUTH_HEADER
#include <gpgme.h> #include <gpgme.h>
#include "pqi/p3authmgr.h"
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/evp.h> #include <openssl/evp.h>
#include "util/rsthreads.h" #include "util/rsthreads.h"
#include <string>
#include <list>
#include <map>
#define GPG_id std::string #define GPG_id std::string
class AuthGPG;
/* gpgcert is the identifier for a person. /* gpgcert is the identifier for a person.
* It is a wrapper class for a GPGme OpenPGP certificate. * It is a wrapper class for a GPGme OpenPGP certificate.
*/ */
@ -47,7 +51,23 @@ class gpgcert
gpgcert(); gpgcert();
~gpgcert(); ~gpgcert();
pqiAuthDetails user; std::string id;
std::string name;
std::string email;
// std::string location;
// std::string org;
//
// std::string issuer;
std::string fpr; /* fingerprint */
std::list<std::string> signers;
uint32_t trustLvl;
uint32_t validLvl;
bool ownsign;
bool trusted; // means valid in pgp world.
gpgme_key_t key; gpgme_key_t key;
}; };
@ -136,7 +156,7 @@ class GPGAuthMgr
/* get Details from the Certificates */ /* get Details from the Certificates */
bool isAuthenticated(std::string id); bool isAuthenticated(std::string id);
std::string getPGPName(GPG_id pgp_id); std::string getPGPName(GPG_id pgp_id);
bool getDetails(std::string id, pqiAuthDetails &details); std::string getPGPEmail(GPG_id pgp_id);
/* PGP versions of Certificate Fns */ /* PGP versions of Certificate Fns */
@ -146,7 +166,6 @@ class GPGAuthMgr
bool getPGPUnknownList(std::list<std::string> &ids); bool getPGPUnknownList(std::list<std::string> &ids);
bool isPGPValid(std::string id); bool isPGPValid(std::string id);
bool isPGPAuthenticated(std::string id); bool isPGPAuthenticated(std::string id);
bool getPGPDetails(std::string id, pqiAuthDetails &details);
/*********************************************************************************/ /*********************************************************************************/
/************************* STAGE 4 ***********************************************/ /************************* STAGE 4 ***********************************************/

View File

@ -790,43 +790,29 @@ GPG_id AuthSSL::getGPGId(SSL_id id) {
return getIssuerName(id); return getIssuerName(id);
} }
bool AuthSSL::getDetails(std::string id, pqiAuthDetails &details) bool AuthSSL::getCertDetails(SSL_id id, sslcert &cert)
{ {
#ifdef AUTHSSL_DEBUG #ifdef AUTHSSL_DEBUG
std::cerr << "AuthSSL::getDetails() \"" << id << "\""; std::cerr << "AuthSSL::getCertDetails() \"" << id << "\"";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
sslMtx.lock(); /***** LOCK *****/ sslMtx.lock(); /***** LOCK *****/
bool valid = false; bool valid = false;
sslcert *cert = NULL; sslcert *tcert = NULL;
if (id == mOwnId) if (id == mOwnId)
{ {
cert = mOwnCert; cert = *mOwnCert;
valid = true; valid = true;
} }
else if (locked_FindCert(id, &cert)) else if (locked_FindCert(id, &tcert))
{ {
valid = true; valid = true;
} }
if (valid) if (valid)
{ {
/* fill details */ cert = *tcert;
details.id = cert->id;
details.name = cert->name;
details.email = cert->email;
details.location= cert->location;
details.org = cert->org;
details.issuer = cert->issuer;
details.fpr = cert->fpr;
details.signers = cert->signers;
//details.trustLvl= cert->trustLvl;
//details.ownsign = cert->ownsign;
//details.trusted = cert->trusted;
details.trusted = cert->authed;
} }
sslMtx.unlock(); /**** UNLOCK ****/ sslMtx.unlock(); /**** UNLOCK ****/
@ -2145,8 +2131,7 @@ int pem_passwd_cb(char *buf, int size, int rwflag, void *password)
static int verify_x509_callback(int preverify_ok, X509_STORE_CTX *ctx) static int verify_x509_callback(int preverify_ok, X509_STORE_CTX *ctx)
{ {
AuthSSL *authssl = (AuthSSL *) getAuthMgr(); return getAuthSSL()->VerifyX509Callback(preverify_ok, ctx);
return authssl->VerifyX509Callback(preverify_ok, ctx);
} }
@ -2258,7 +2243,7 @@ int LoadCheckX509andGetName(const char *cert_file, std::string &userName, std::s
bool valid = false; bool valid = false;
if (x509) if (x509)
{ {
valid = ((AuthSSL *) getAuthMgr())->ValidateCertificate(x509, userId); valid = getAuthSSL()->ValidateCertificate(x509, userId);
} }
if (valid) if (valid)
@ -2311,7 +2296,7 @@ int LoadCheckX509andGetIssuerName(const char *cert_file, std::string &issuerName
bool valid = false; bool valid = false;
if (x509) if (x509)
{ {
valid = ((AuthSSL *) getAuthMgr())->ValidateCertificate(x509, userId); valid = getAuthSSL()->ValidateCertificate(x509, userId);
} }
if (valid) if (valid)

View File

@ -54,7 +54,6 @@
#include "pqi/pqi_base.h" #include "pqi/pqi_base.h"
#include "pqi/pqinetwork.h" #include "pqi/pqinetwork.h"
#include "pqi/p3authmgr.h"
typedef std::string SSL_id; typedef std::string SSL_id;
@ -64,6 +63,7 @@ class sslcert
{ {
public: public:
sslcert(X509 *x509, std::string id); sslcert(X509 *x509, std::string id);
sslcert();
/* certificate parameters */ /* certificate parameters */
std::string id; std::string id;
@ -85,7 +85,7 @@ class sslcert
}; };
class AuthSSL: public p3AuthMgr class AuthSSL
{ {
public: public:
@ -116,7 +116,7 @@ virtual bool isAuthenticated(std::string id);
virtual std::string getName(std::string id); virtual std::string getName(std::string id);
virtual std::string getIssuerName(std::string id); virtual std::string getIssuerName(std::string id);
virtual GPG_id getGPGId(SSL_id id); virtual GPG_id getGPGId(SSL_id id);
virtual bool getDetails(std::string id, pqiAuthDetails &details); virtual bool getCertDetails(std::string id, sslcert &cert);
/* first party trust info (dummy) */ /* first party trust info (dummy) */
virtual bool isTrustingMe(std::string id) ; virtual bool isTrustingMe(std::string id) ;

View File

@ -1,302 +0,0 @@
/*
* libretroshare/src/pqi: p3authmgr.cc
*
* 3P/PQI network interface for RetroShare.
*
* Copyright 2007-2008 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 <stdint.h>
#include <iostream>
#include "pqi/p3authmgr.h"
pqiAuthDetails::pqiAuthDetails()
:trustLvl(0), validLvl(0), ownsign(false), trusted(false)
{
return;
}
p3DummyAuthMgr::p3DummyAuthMgr()
{
/* for the truely dummy option */
mOwnId = "OWNID";
pqiAuthDetails ownDetails;
ownDetails.id = mOwnId;
ownDetails.name = "Youself";
ownDetails.email = "me@me.com";
ownDetails.location = "here";
ownDetails.org = "me.com";
ownDetails.trustLvl = 6;
ownDetails.ownsign = true;
ownDetails.trusted = true;
/* ignoring fpr and signers */
mPeerList[mOwnId] = ownDetails;
}
bool p3DummyAuthMgr::isTrustingMe(std::string id)
{
std::cerr << "isTrustingMe is not implemented in p3DummyAuthMgr. Look into authxpgp.cc." << std::endl ;
return false ;
}
void p3DummyAuthMgr::addTrustingPeer(std::string id)
{
std::cerr << "addTrustingPeer is not implemented in p3DummyAuthMgr. Look into authxpgp.cc." << std::endl ;
}
p3DummyAuthMgr::p3DummyAuthMgr(std::string ownId, std::list<pqiAuthDetails> peers)
{
mOwnId = ownId;
bool addedOwn = false;
std::list<pqiAuthDetails>::iterator it;
for(it = peers.begin(); it != peers.end(); it++)
{
mPeerList[it->id] = (*it);
if (it->id == ownId)
{
addedOwn = true;
}
}
if (!addedOwn)
{
pqiAuthDetails ownDetails;
ownDetails.id = mOwnId;
ownDetails.name = "Youself";
ownDetails.email = "me@me.com";
ownDetails.location = "here";
ownDetails.org = "me.com";
ownDetails.trustLvl = 6;
ownDetails.ownsign = true;
ownDetails.trusted = true;
/* ignoring fpr and signers */
mPeerList[mOwnId] = ownDetails;
}
}
bool p3DummyAuthMgr:: active()
{
return true;
}
int p3DummyAuthMgr::InitAuth(const char *srvr_cert, const char *priv_key,
const char *passwd)
{
return 1;
}
bool p3DummyAuthMgr::CloseAuth()
{
return true;
}
int p3DummyAuthMgr::setConfigDirectories(std::string confFile, std::string neighDir)
{
return 1;
}
std::string p3DummyAuthMgr::OwnId()
{
return mOwnId;
}
bool p3DummyAuthMgr::getAllList(std::list<std::string> &ids)
{
std::map<std::string, pqiAuthDetails>::iterator it;
for(it = mPeerList.begin(); it != mPeerList.end(); it++)
{
ids.push_back(it->first);
}
return true;
}
bool p3DummyAuthMgr::getAuthenticatedList(std::list<std::string> &ids)
{
std::map<std::string, pqiAuthDetails>::iterator it;
for(it = mPeerList.begin(); it != mPeerList.end(); it++)
{
if (it->second.trustLvl > 3)
{
ids.push_back(it->first);
}
}
return true;
}
bool p3DummyAuthMgr::getUnknownList(std::list<std::string> &ids)
{
std::map<std::string, pqiAuthDetails>::iterator it;
for(it = mPeerList.begin(); it != mPeerList.end(); it++)
{
if (it->second.trustLvl <= 3)
{
ids.push_back(it->first);
}
}
return true;
}
bool p3DummyAuthMgr::isValid(std::string id)
{
std::map<std::string, pqiAuthDetails>::iterator it;
return (mPeerList.end() != mPeerList.find(id));
}
bool p3DummyAuthMgr::isAuthenticated(std::string id)
{
std::map<std::string, pqiAuthDetails>::iterator it;
if (mPeerList.end() != (it = mPeerList.find(id)))
{
return (it->second.trustLvl > 3);
}
return false;
}
std::string p3DummyAuthMgr::getName(std::string id)
{
std::map<std::string, pqiAuthDetails>::iterator it;
if (mPeerList.end() != (it = mPeerList.find(id)))
{
return it->second.name;
}
std::string empty("");
return empty;
}
bool p3DummyAuthMgr::getDetails(std::string id, pqiAuthDetails &details)
{
std::map<std::string, pqiAuthDetails>::iterator it;
if (mPeerList.end() != (it = mPeerList.find(id)))
{
details = it->second;
return true;
}
return false;
}
bool p3DummyAuthMgr::FinalSaveCertificates()
{
return false;
}
bool p3DummyAuthMgr::CheckSaveCertificates()
{
return false;
}
bool p3DummyAuthMgr::saveCertificates()
{
return false;
}
bool p3DummyAuthMgr::loadCertificates()
{
return false;
}
bool p3DummyAuthMgr::LoadCertificateFromString(std::string pem, std::string &id)
{
return false;
}
std::string p3DummyAuthMgr::SaveCertificateToString(std::string id)
{
std::string dummy("CERT STRING");
return dummy;
}
bool p3DummyAuthMgr::LoadCertificateFromFile(std::string filename, std::string &id)
{
return false;
}
bool p3DummyAuthMgr::SaveCertificateToFile(std::string id, std::string filename)
{
return false;
}
bool p3DummyAuthMgr::LoadCertificateFromBinary(const uint8_t *ptr, uint32_t len, std::string &id)
{
return false;
}
bool p3DummyAuthMgr::SaveCertificateToBinary(std::string id, uint8_t **ptr, uint32_t *len)
{
return false;
}
/* Signatures */
bool p3DummyAuthMgr::AuthCertificate(std::string id)
{
return false;
}
bool p3DummyAuthMgr::SignCertificate(std::string id)
{
return false;
}
bool p3DummyAuthMgr::RevokeCertificate(std::string id)
{
return false;
}
bool p3DummyAuthMgr::TrustCertificate(std::string id, bool trust)
{
return false;
}
bool p3DummyAuthMgr::SignData(std::string input, std::string &sign)
{
return false;
}
bool p3DummyAuthMgr::SignData(const void *data, const uint32_t len, std::string &sign)
{
return false;
}
bool p3DummyAuthMgr::SignDataBin(std::string input,
unsigned char *sign, unsigned int *signlen)
{
return false;
}
bool p3DummyAuthMgr::SignDataBin(const void *data, const uint32_t len,
unsigned char *sign, unsigned int *signlen)
{
return false;
}
bool p3DummyAuthMgr::VerifySignBin(std::string pid,
const void *data, const uint32_t len,
unsigned char *sign, unsigned int signlen)
{
return false;
}

View File

@ -1,225 +0,0 @@
/*
* libretroshare/src/pqi: p3authmgr.h
*
* 3P/PQI network interface for RetroShare.
*
* Copyright 2007-2008 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 RS_GENERIC_AUTH_HEADER
#define RS_GENERIC_AUTH_HEADER
#include <list>
#include <map>
#include <string>
#include <gpgme.h>
#include <stdint.h>
/************** GENERIC AUTHENTICATION MANAGER ***********
* Provides a common interface for certificates.
*
* Initialisation must be done in derived classes
*
* Key features:
* everything indexed by std::string id;
* has auth perspective: authed / not authed - different to friends.
* load/save certificates as strings or files.
*
*/
class p3AuthMgr;
extern p3AuthMgr *authMgr;
p3AuthMgr *getAuthMgr();
class pqiAuthDetails
{
public:
pqiAuthDetails();
std::string id;
std::string name;
std::string email;
std::string location;
std::string org;
std::string issuer;
std::string fpr; /* fingerprint */
std::list<std::string> signers;
uint32_t trustLvl;
uint32_t validLvl;
bool ownsign;
bool trusted; // means valid in pgp world.
};
class p3AuthMgr
{
public:
virtual ~p3AuthMgr() { return; }
/* initialisation -> done by derived classes */
virtual bool active() = 0;
virtual int InitAuth(const char *srvr_cert, const char *priv_key,
const char *passwd) = 0;
virtual bool CloseAuth() = 0;
virtual int setConfigDirectories(std::string confFile, std::string neighDir) = 0;
/* get Certificate Ids */
virtual std::string OwnId() = 0;
virtual bool getAllList(std::list<std::string> &ids) = 0;
virtual bool getAuthenticatedList(std::list<std::string> &ids) = 0;
virtual bool getUnknownList(std::list<std::string> &ids) = 0;
/* get Details from the Certificates */
virtual bool isValid(std::string id) = 0;
virtual bool isAuthenticated(std::string id) = 0;
virtual std::string getName(std::string id) = 0;
virtual std::string getIssuerName(std::string id) { return getName(id); } // Default to same id.
virtual bool getDetails(std::string id, pqiAuthDetails &details) = 0;
/* High Level Load/Save Configuration */
virtual bool FinalSaveCertificates() = 0;
virtual bool CheckSaveCertificates() = 0;
virtual bool saveCertificates() = 0;
virtual bool loadCertificates() = 0;
/* first party trust info */
virtual bool isTrustingMe(std::string id) = 0;
virtual void addTrustingPeer(std::string id) = 0;
/* Extra Fns for PGP, call std versions if not overloaded */
virtual std::string PGPOwnId() { return OwnId(); }
virtual bool getPGPAllList(std::list<std::string> &ids) { return getAllList(ids); }
virtual bool encryptText(gpgme_data_t PLAIN, gpgme_data_t CIPHER) { return 0; }
virtual bool decryptText(gpgme_data_t CIPHER, gpgme_data_t PLAIN) { return 0; }
/* Load/Save certificates */
virtual bool LoadCertificateFromString(std::string pem, std::string &id) = 0;
virtual std::string SaveCertificateToString(std::string id) = 0;
virtual bool LoadCertificateFromFile(std::string filename, std::string &id) = 0;
virtual bool SaveCertificateToFile(std::string id, std::string filename) = 0;
/* specific OpenSSL ones -> careful with pointers....
* save will allocate space,
*/
virtual bool LoadCertificateFromBinary(const uint8_t *ptr, uint32_t len, std::string &id) = 0;
virtual bool SaveCertificateToBinary(std::string id, uint8_t **ptr, uint32_t *len) = 0;
/* Signatures */
virtual bool AuthCertificate(std::string uid) = 0;
virtual bool SignCertificate(std::string id) = 0;
virtual bool RevokeCertificate(std::string id) = 0;
virtual bool TrustCertificate(std::string id, bool trust) = 0;
/* Sign / Encrypt / Verify Data (TODO) */
virtual bool SignData(std::string input, std::string &sign) = 0;
virtual bool SignData(const void *data, const uint32_t len, std::string &sign) = 0;
virtual bool SignDataBin(std::string input, unsigned char *sign, unsigned int *signlen) = 0;
virtual bool SignDataBin(const void *data, const uint32_t len,
unsigned char *sign, unsigned int *signlen) = 0;
virtual bool VerifySignBin(std::string pid,
const void *data, const uint32_t len,
unsigned char *sign, unsigned int signlen) = 0;
//virtual bool encryptData(std::string recipientId, std::string plaindata, std::string &result);
};
class p3DummyAuthMgr: public p3AuthMgr
{
public:
p3DummyAuthMgr();
p3DummyAuthMgr(std::string ownId, std::list<pqiAuthDetails> peers);
/* initialisation -> done by derived classes */
virtual bool active();
virtual int InitAuth(const char *srvr_cert, const char *priv_key,
const char *passwd);
virtual bool CloseAuth();
virtual int setConfigDirectories(std::string confFile, std::string neighDir);
/* get Certificate Ids */
virtual std::string OwnId();
virtual bool getAllList(std::list<std::string> &ids);
virtual bool getAuthenticatedList(std::list<std::string> &ids);
virtual bool getUnknownList(std::list<std::string> &ids);
/* get Details from the Certificates */
virtual bool isValid(std::string id);
virtual bool isAuthenticated(std::string id);
virtual std::string getName(std::string id);
virtual bool getDetails(std::string id, pqiAuthDetails &details);
/* High Level Load/Save Configuration */
virtual bool FinalSaveCertificates();
virtual bool CheckSaveCertificates();
virtual bool saveCertificates();
virtual bool loadCertificates();
/* first party trust info */
virtual bool isTrustingMe(std::string id) ;
virtual void addTrustingPeer(std::string id) ;
/* Load/Save certificates */
virtual bool LoadCertificateFromString(std::string pem, std::string &id);
virtual std::string SaveCertificateToString(std::string id);
virtual bool LoadCertificateFromFile(std::string filename, std::string &id);
virtual bool SaveCertificateToFile(std::string id, std::string filename);
virtual bool LoadCertificateFromBinary(const uint8_t *ptr, uint32_t len, std::string &id);
virtual bool SaveCertificateToBinary(std::string id, uint8_t **ptr, uint32_t *len);
/* Signatures */
virtual bool AuthCertificate(std::string uid);
virtual bool SignCertificate(std::string id);
virtual bool RevokeCertificate(std::string id);
virtual bool TrustCertificate(std::string id, bool trust);
virtual bool SignData(std::string input, std::string &sign);
virtual bool SignData(const void *data, const uint32_t len, std::string &sign);
virtual bool SignDataBin(std::string input, unsigned char *sign, unsigned int *signlen);
virtual bool SignDataBin(const void *data, const uint32_t len,
unsigned char *sign, unsigned int *signlen);
virtual bool VerifySignBin(std::string pid,
const void *data, const uint32_t len,
unsigned char *sign, unsigned int signlen);
std::string mOwnId;
std::map<std::string, pqiAuthDetails> mPeerList;
};
#endif

View File

@ -26,7 +26,7 @@
#include "util/rsdir.h" #include "util/rsdir.h"
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
#include "pqi/p3cfgmgr.h" #include "pqi/p3cfgmgr.h"
#include "pqi/p3authmgr.h" #include "pqi/authssl.h"
#include "pqi/pqibin.h" #include "pqi/pqibin.h"
#include "pqi/pqistore.h" #include "pqi/pqistore.h"
#include "pqi/pqinotify.h" #include "pqi/pqinotify.h"
@ -40,8 +40,8 @@
#define CONFIG_DEBUG 1 #define CONFIG_DEBUG 1
p3ConfigMgr::p3ConfigMgr(p3AuthMgr *am, std::string dir, std::string fname, std::string signame) p3ConfigMgr::p3ConfigMgr(std::string dir, std::string fname, std::string signame)
:mAuthMgr(am), basedir(dir), metafname(fname), metasigfname(signame), :basedir(dir), metafname(fname), metasigfname(signame),
mConfigSaveActive(true) mConfigSaveActive(true)
{ {
@ -160,7 +160,7 @@ void p3ConfigMgr::saveConfiguration()
/* sign data */ /* sign data */
std::string signature; std::string signature;
mAuthMgr->SignData(membio->memptr(), membio->memsize(), signature); getAuthSSL()->SignData(membio->memptr(), membio->memsize(), signature);
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
std::cerr << "p3ConfigMgr::saveConfiguration() MetaFile Signature:"; std::cerr << "p3ConfigMgr::saveConfiguration() MetaFile Signature:";
@ -274,7 +274,7 @@ void p3ConfigMgr::loadConfiguration()
/* get signature */ /* get signature */
std::string signature; std::string signature;
mAuthMgr->SignData(membio->memptr(), membio->memsize(), signature); getAuthSSL()->SignData(membio->memptr(), membio->memsize(), signature);
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
std::cerr << "p3ConfigMgr::loadConfiguration() New MetaFile Signature:"; std::cerr << "p3ConfigMgr::loadConfiguration() New MetaFile Signature:";

View File

@ -90,7 +90,6 @@ const uint32_t CONFIG_TYPE_CHANNELS = 0x0103;
const uint32_t CONFIG_TYPE_CACHE = 0xff01; const uint32_t CONFIG_TYPE_CACHE = 0xff01;
class p3ConfigMgr; class p3ConfigMgr;
class p3AuthMgr;
class pqiConfig class pqiConfig
{ {
@ -138,7 +137,7 @@ bool HasConfigChanged(uint16_t idx);
class p3ConfigMgr class p3ConfigMgr
{ {
public: public:
p3ConfigMgr(p3AuthMgr *am, std::string bdir, std::string fname, std::string signame); p3ConfigMgr(std::string bdir, std::string fname, std::string signame);
void tick(); void tick();
void saveConfiguration(); void saveConfiguration();
@ -152,10 +151,6 @@ void completeConfiguration();
private: private:
/* these are constants - so shouldn't need mutex */
p3AuthMgr *mAuthMgr;
const std::string basedir; const std::string basedir;
const std::string metafname; const std::string metafname;
const std::string metasigfname; const std::string metasigfname;

View File

@ -128,19 +128,17 @@ std::string textPeerConnectState(peerConnectState &state)
p3ConnectMgr::p3ConnectMgr(p3AuthMgr *am) p3ConnectMgr::p3ConnectMgr()
:p3Config(CONFIG_TYPE_PEERS), :p3Config(CONFIG_TYPE_PEERS),
mAuthMgr(am), mNetStatus(RS_NET_UNKNOWN), mNetStatus(RS_NET_UNKNOWN),
mStunStatus(0), mStunFound(0), mStunMoreRequired(true), mStunStatus(0), mStunFound(0), mStunMoreRequired(true),
mStatusChanged(false) mStatusChanged(false)
{ {
/* setup basics of own state */ /* setup basics of own state */
if (am) ownState.id = getAuthSSL()->OwnId();
{ ownState.name = getAuthSSL()->getName(ownState.id);
ownState.id = mAuthMgr->OwnId(); ownState.netMode = RS_NET_MODE_UDP;
ownState.name = mAuthMgr->getName(ownState.id);
ownState.netMode = RS_NET_MODE_UDP;
}
//use_extr_addr_finder = true ; //use_extr_addr_finder = true ;
use_extr_addr_finder = false; use_extr_addr_finder = false;
allow_tunnel_connection = true; allow_tunnel_connection = true;
@ -1344,15 +1342,7 @@ void p3ConnectMgr::tickMonitors()
const std::string p3ConnectMgr::getOwnId() const std::string p3ConnectMgr::getOwnId()
{ {
if (mAuthMgr) return getAuthSSL()->OwnId();
{
return mAuthMgr->OwnId();
}
else
{
std::string nullStr;
return nullStr;
}
} }
@ -1384,7 +1374,7 @@ bool p3ConnectMgr::isOnline(std::string id)
else else
{ {
#ifdef CONN_DEBUG #ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::isOnline(" << id << ") is Not Friend" << std::endl << "p3ConnectMgr::isOnline() OwnId: " << mAuthMgr->OwnId() << std::endl; std::cerr << "p3ConnectMgr::isOnline(" << id << ") is Not Friend" << std::endl << "p3ConnectMgr::isOnline() OwnId: " << getAuthSSL()->OwnId() << std::endl;
#endif #endif
/* not a friend */ /* not a friend */
} }
@ -2024,7 +2014,7 @@ bool p3ConnectMgr::addFriend(std::string id, uint32_t netMode, uint32_t visState
} }
/* check with the AuthMgr if its authorised */ /* check with the AuthMgr if its authorised */
if (!mAuthMgr->isAuthenticated(id)) if (!getAuthSSL()->isAuthenticated(id))
{ {
#ifdef CONN_DEBUG #ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::addFriend() Failed Authentication" << std::endl; std::cerr << "p3ConnectMgr::addFriend() Failed Authentication" << std::endl;
@ -2074,8 +2064,8 @@ bool p3ConnectMgr::addFriend(std::string id, uint32_t netMode, uint32_t visState
} }
/* get details from AuthMgr */ /* get details from AuthMgr */
pqiAuthDetails detail; sslcert detail;
if (!mAuthMgr->getDetails(id, detail)) if (!getAuthSSL()->getCertDetails(id, detail))
{ {
#ifdef CONN_DEBUG #ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::addFriend() Failed to get Details" << std::endl; std::cerr << "p3ConnectMgr::addFriend() Failed to get Details" << std::endl;
@ -2184,15 +2174,15 @@ bool p3ConnectMgr::addNeighbour(std::string id)
} }
/* check with the AuthMgr if its valid */ /* check with the AuthMgr if its valid */
if (!mAuthMgr->isValid(id)) if (!getAuthSSL()->isValid(id))
{ {
/* no auth */ /* no auth */
return false; return false;
} }
/* get details from AuthMgr */ /* get details from AuthMgr */
pqiAuthDetails detail; sslcert detail;
if (!mAuthMgr->getDetails(id, detail)) if (!getAuthSSL()->getCertDetails(id, detail))
{ {
/* no details */ /* no details */
return false; return false;
@ -2469,7 +2459,7 @@ bool p3ConnectMgr::retryConnectNotify(std::string id)
bool p3ConnectMgr::setLocalAddress(std::string id, struct sockaddr_in addr) bool p3ConnectMgr::setLocalAddress(std::string id, struct sockaddr_in addr)
{ {
if (id == mAuthMgr->OwnId()) if (id == getAuthSSL()->OwnId())
{ {
{ {
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/ RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
@ -2519,7 +2509,7 @@ bool p3ConnectMgr::setLocalAddress(std::string id, struct sockaddr_in addr)
bool p3ConnectMgr::setExtAddress(std::string id, struct sockaddr_in addr) bool p3ConnectMgr::setExtAddress(std::string id, struct sockaddr_in addr)
{ {
if (id == mAuthMgr->OwnId()) if (id == getAuthSSL()->OwnId())
{ {
if (ownState.currentserveraddr.sin_addr.s_addr != addr.sin_addr.s_addr || if (ownState.currentserveraddr.sin_addr.s_addr != addr.sin_addr.s_addr ||
ownState.currentserveraddr.sin_port != addr.sin_port) { ownState.currentserveraddr.sin_port != addr.sin_port) {
@ -2619,7 +2609,7 @@ bool p3ConnectMgr::setAddressList(std::string id, std::list<IpAddressTimed> I
bool p3ConnectMgr::setNetworkMode(std::string id, uint32_t netMode) bool p3ConnectMgr::setNetworkMode(std::string id, uint32_t netMode)
{ {
if (id == mAuthMgr->OwnId()) if (id == getAuthSSL()->OwnId())
{ {
uint32_t visState = ownState.visState; uint32_t visState = ownState.visState;
setOwnNetConfig(netMode, visState); setOwnNetConfig(netMode, visState);
@ -2649,7 +2639,7 @@ bool p3ConnectMgr::setNetworkMode(std::string id, uint32_t netMode)
bool p3ConnectMgr::setVisState(std::string id, uint32_t visState) bool p3ConnectMgr::setVisState(std::string id, uint32_t visState)
{ {
if (id == mAuthMgr->OwnId()) if (id == getAuthSSL()->OwnId())
{ {
uint32_t netMode = ownState.netMode; uint32_t netMode = ownState.netMode;
setOwnNetConfig(netMode, visState); setOwnNetConfig(netMode, visState);

View File

@ -27,7 +27,6 @@
#define MRK_PQI_CONNECTION_MANAGER_HEADER #define MRK_PQI_CONNECTION_MANAGER_HEADER
#include "pqi/pqimonitor.h" #include "pqi/pqimonitor.h"
#include "pqi/p3authmgr.h"
#include "serialiser/rsconfigitems.h" #include "serialiser/rsconfigitems.h"
//#include "pqi/p3dhtmgr.h" //#include "pqi/p3dhtmgr.h"
@ -191,7 +190,7 @@ class p3ConnectMgr: public pqiConnectCb, public p3Config
{ {
public: public:
p3ConnectMgr(p3AuthMgr *authMgr); p3ConnectMgr();
void tick(); void tick();
@ -372,8 +371,6 @@ void addPeer(RsPeerConfigItem *item);
private: private:
p3AuthMgr *mAuthMgr;
p3tunnel *mP3tunnel; p3tunnel *mP3tunnel;
std::map<uint32_t, pqiNetAssistFirewall *> mFwAgents; std::map<uint32_t, pqiNetAssistFirewall *> mFwAgents;

View File

@ -87,7 +87,7 @@ static const int PQISSL_MAX_READ_ZERO_COUNT = 40;
* *
*/ */
pqissl::pqissl(pqissllistener *l, PQInterface *parent, p3AuthMgr *am, p3ConnectMgr *cm) pqissl::pqissl(pqissllistener *l, PQInterface *parent, p3ConnectMgr *cm)
:NetBinInterface(parent, parent->PeerId()), :NetBinInterface(parent, parent->PeerId()),
waiting(WAITING_NOT), active(false), certvalid(false), waiting(WAITING_NOT), active(false), certvalid(false),
sslmode(PQISSL_ACTIVE), ssl_connection(NULL), sockfd(-1), sslmode(PQISSL_ACTIVE), ssl_connection(NULL), sockfd(-1),
@ -97,15 +97,7 @@ pqissl::pqissl(pqissllistener *l, PQInterface *parent, p3AuthMgr *am, p3ConnectM
sameLAN(false), n_read_zero(0), sameLAN(false), n_read_zero(0),
mConnectDelay(0), mConnectTS(0), mConnectDelay(0), mConnectTS(0),
mConnectTimeout(0), mTimeoutTS(0), quietShutdown(false), mConnectTimeout(0), mTimeoutTS(0), quietShutdown(false),
mConnMgr(cm)
/**************** PQI_USE_XPGP ******************/
#if defined(PQI_USE_XPGP)
mAuthMgr((AuthXPGP *) am), mConnMgr(cm)
#else /* X509 Certificates */
/**************** PQI_USE_XPGP ******************/
mAuthMgr((AuthSSL *) am), mConnMgr(cm)
#endif /* X509 Certificates */
/**************** PQI_USE_XPGP ******************/
{ {
/* set address to zero */ /* set address to zero */

View File

@ -95,7 +95,7 @@ class pqissl: public NetBinInterface
{ {
public: public:
pqissl(pqissllistener *l, PQInterface *parent, pqissl(pqissllistener *l, PQInterface *parent,
p3AuthMgr *am, p3ConnectMgr *cm); p3ConnectMgr *cm);
virtual ~pqissl(); virtual ~pqissl();
// NetInterface // NetInterface

View File

@ -55,9 +55,8 @@ const int pqissllistenzone = 49787;
*/ */
pqissllistenbase::pqissllistenbase(struct sockaddr_in addr, p3AuthMgr *am, p3ConnectMgr *cm) pqissllistenbase::pqissllistenbase(struct sockaddr_in addr, p3ConnectMgr *cm)
:laddr(addr), active(false), :laddr(addr), active(false), mConnMgr(cm)
mAuthMgr((AuthSSL *) am), mConnMgr(cm)
{ {
if (!(mAuthMgr -> active())) if (!(mAuthMgr -> active()))
@ -521,8 +520,8 @@ int pqissllistenbase::continueaccepts()
* *
*/ */
pqissllistener::pqissllistener(struct sockaddr_in addr, p3AuthMgr *am, p3ConnectMgr *cm) pqissllistener::pqissllistener(struct sockaddr_in addr, p3ConnectMgr *cm)
:pqissllistenbase(addr, am, cm) :pqissllistenbase(addr, cm)
{ {
return; return;
} }

View File

@ -51,7 +51,7 @@ class pqissllistenbase: public pqilistener
public: public:
pqissllistenbase(struct sockaddr_in addr, p3AuthMgr *am, p3ConnectMgr *cm); pqissllistenbase(struct sockaddr_in addr, p3ConnectMgr *cm);
virtual ~pqissllistenbase(); virtual ~pqissllistenbase();
/*************************************/ /*************************************/
@ -99,7 +99,7 @@ class pqissllistener: public pqissllistenbase
{ {
public: public:
pqissllistener(struct sockaddr_in addr, p3AuthMgr *am, p3ConnectMgr *cm); pqissllistener(struct sockaddr_in addr, p3ConnectMgr *cm);
virtual ~pqissllistener(); virtual ~pqissllistener();
int addlistenaddr(std::string id, pqissl *acc); int addlistenaddr(std::string id, pqissl *acc);

View File

@ -28,7 +28,7 @@
#include "util/rsdebug.h" #include "util/rsdebug.h"
#include "pqi/pqisslpersongrp.h" #include "pqi/pqisslpersongrp.h"
#include "pqi/p3authmgr.h" #include "pqi/authssl.h"
const int pqipersongrpzone = 354; const int pqipersongrpzone = 354;
@ -50,8 +50,7 @@ const int pqipersongrpzone = 354;
pqilistener * pqisslpersongrp::createListener(struct sockaddr_in laddr) pqilistener * pqisslpersongrp::createListener(struct sockaddr_in laddr)
{ {
p3AuthMgr *authMgr = getAuthMgr(); pqilistener *listener = new pqissllistener(laddr, mConnMgr);
pqilistener *listener = new pqissllistener(laddr, authMgr, mConnMgr);
return listener; return listener;
} }
@ -63,9 +62,8 @@ pqiperson * pqisslpersongrp::createPerson(std::string id, pqilistener *listener)
pqioutput(PQL_DEBUG_BASIC, pqipersongrpzone, out.str()); pqioutput(PQL_DEBUG_BASIC, pqipersongrpzone, out.str());
} }
p3AuthMgr *authMgr = getAuthMgr();
pqiperson *pqip = new pqiperson(id, this); pqiperson *pqip = new pqiperson(id, this);
pqissl *pqis = new pqissl((pqissllistener *) listener, pqip, authMgr, mConnMgr); pqissl *pqis = new pqissl((pqissllistener *) listener, pqip, mConnMgr);
/* construct the serialiser .... /* construct the serialiser ....
* Needs: * Needs:
@ -83,7 +81,7 @@ pqiperson * pqisslpersongrp::createPerson(std::string id, pqilistener *listener)
pqip -> addChildInterface(PQI_CONNECT_TCP, pqisc); pqip -> addChildInterface(PQI_CONNECT_TCP, pqisc);
pqissltunnel *pqitun = new pqissltunnel(pqip, authMgr, mConnMgr); pqissltunnel *pqitun = new pqissltunnel(pqip, mConnMgr);
RsSerialiser *rss3 = new RsSerialiser(); RsSerialiser *rss3 = new RsSerialiser();
rss3->addSerialType(new RsFileItemSerialiser()); rss3->addSerialType(new RsFileItemSerialiser());
rss3->addSerialType(new RsCacheItemSerialiser()); rss3->addSerialType(new RsCacheItemSerialiser());
@ -92,7 +90,7 @@ pqiperson * pqisslpersongrp::createPerson(std::string id, pqilistener *listener)
pqip -> addChildInterface(PQI_CONNECT_TUNNEL, pqicontun); pqip -> addChildInterface(PQI_CONNECT_TUNNEL, pqicontun);
#ifndef PQI_DISABLE_UDP #ifndef PQI_DISABLE_UDP
pqissludp *pqius = new pqissludp(pqip, authMgr, mConnMgr); pqissludp *pqius = new pqissludp(pqip, mConnMgr);
RsSerialiser *rss2 = new RsSerialiser(); RsSerialiser *rss2 = new RsSerialiser();
rss2->addSerialType(new RsFileItemSerialiser()); rss2->addSerialType(new RsFileItemSerialiser());

View File

@ -90,9 +90,8 @@ const int pqisslzone = 37714;
* *
*/ */
pqissltunnel::pqissltunnel(PQInterface *parent, p3AuthMgr *am, p3ConnectMgr *cm) pqissltunnel::pqissltunnel(PQInterface *parent, p3ConnectMgr *cm)
:NetBinInterface(parent, parent->PeerId()), :NetBinInterface(parent, parent->PeerId()), mConnMgr(cm)
mAuthMgr((AuthSSL *) am), mConnMgr(cm)
{ {
active = false; active = false;
waiting = TUNNEL_WAITING_NOT; waiting = TUNNEL_WAITING_NOT;

View File

@ -74,7 +74,7 @@ struct data_with_length {
class pqissltunnel: public NetBinInterface class pqissltunnel: public NetBinInterface
{ {
public: public:
pqissltunnel(PQInterface *parent, p3AuthMgr *am, p3ConnectMgr *cm); pqissltunnel(PQInterface *parent, p3ConnectMgr *cm);
virtual ~pqissltunnel(); virtual ~pqissltunnel();
// NetInterface // NetInterface

View File

@ -52,8 +52,8 @@ static const uint32_t PQI_SSLUDP_DEF_CONN_PERIOD = 300; /* 5 minutes? */
/********** PQI SSL UDP STUFF **************************************/ /********** PQI SSL UDP STUFF **************************************/
pqissludp::pqissludp(PQInterface *parent, p3AuthMgr *am, p3ConnectMgr *cm) pqissludp::pqissludp(PQInterface *parent, p3ConnectMgr *cm)
:pqissl(NULL, parent, am, cm), tou_bio(NULL), :pqissl(NULL, parent, cm), tou_bio(NULL),
listen_checktime(0), mConnectPeriod(PQI_SSLUDP_DEF_CONN_PERIOD) listen_checktime(0), mConnectPeriod(PQI_SSLUDP_DEF_CONN_PERIOD)
{ {
sockaddr_clear(&remote_addr); sockaddr_clear(&remote_addr);

View File

@ -55,7 +55,7 @@ class cert;
class pqissludp: public pqissl class pqissludp: public pqissl
{ {
public: public:
pqissludp(PQInterface *parent, p3AuthMgr *am, p3ConnectMgr *cm); pqissludp(PQInterface *parent, p3ConnectMgr *cm);
virtual ~pqissludp(); virtual ~pqissludp();

View File

@ -29,6 +29,7 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include "pqi/authssl.h"
#include "util/rsdebug.h" #include "util/rsdebug.h"
const int p3facemsgzone = 11453; const int p3facemsgzone = 11453;
@ -102,8 +103,8 @@ int RsServer::UpdateAllConfig()
RsConfig &config = iface.mConfig; RsConfig &config = iface.mConfig;
config.ownId = mAuthMgr->OwnId(); config.ownId = getAuthSSL()->OwnId();
config.ownName = mAuthMgr->getName(config.ownId); config.ownName = getAuthSSL()->getName(config.ownId);
peerConnectState pstate; peerConnectState pstate;
mConnMgr->getOwnNetStatus(pstate); mConnMgr->getOwnNetStatus(pstate);
@ -156,7 +157,7 @@ void RsServer::ConfigFinalSave()
/* force saving of transfers TODO */ /* force saving of transfers TODO */
//ftserver->saveFileTransferStatus(); //ftserver->saveFileTransferStatus();
mAuthMgr->FinalSaveCertificates(); getAuthSSL()->FinalSaveCertificates();
mConfigMgr->completeConfiguration(); mConfigMgr->completeConfiguration();
} }

View File

@ -30,6 +30,7 @@
#include "tcponudp/tou.h" #include "tcponudp/tou.h"
#include <sstream> #include <sstream>
#include "pqi/authssl.h"
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>
@ -244,7 +245,7 @@ void RsServer::run()
//ftserver->saveFileTransferStatus(); //ftserver->saveFileTransferStatus();
/* see if we need to resave certs */ /* see if we need to resave certs */
mAuthMgr->CheckSaveCertificates(); getAuthSSL()->CheckSaveCertificates();
/* hour loop */ /* hour loop */
if (++min >= 60) if (++min >= 60)

View File

@ -42,6 +42,8 @@ const int p3facemsgzone = 11453;
#include "services/p3msgservice.h" #include "services/p3msgservice.h"
#include "services/p3chatservice.h" #include "services/p3chatservice.h"
#include "pqi/authssl.h"
/* external reference point */ /* external reference point */
RsMsgs *rsMsgs = NULL; RsMsgs *rsMsgs = NULL;
@ -154,7 +156,7 @@ bool p3Msgs::getNewChat(std::list<ChatInfo> &chats)
void p3Msgs::initRsChatInfo(RsChatMsgItem *c, ChatInfo &i) void p3Msgs::initRsChatInfo(RsChatMsgItem *c, ChatInfo &i)
{ {
i.rsid = c -> PeerId(); i.rsid = c -> PeerId();
i.name = mAuthMgr->getName(i.rsid); i.name = getAuthSSL()->getName(i.rsid);
i.chatflags = 0 ; i.chatflags = 0 ;
i.msg = c -> message; i.msg = c -> message;

View File

@ -26,7 +26,7 @@
#include "rsserver/p3peers.h" #include "rsserver/p3peers.h"
#include "rsserver/p3face.h" #include "rsserver/p3face.h"
#include "pqi/p3connmgr.h" #include "pqi/p3connmgr.h"
#include "pqi/p3authmgr.h" #include "pqi/authssl.h"
#include <rsiface/rsinit.h> #include <rsiface/rsinit.h>
#include <iostream> #include <iostream>
@ -165,8 +165,8 @@ std::string RsPeerLastConnectString(uint32_t lastConnect)
} }
p3Peers::p3Peers(p3ConnectMgr *cm, p3AuthMgr *am) p3Peers::p3Peers(p3ConnectMgr *cm)
:mConnMgr(cm), mAuthMgr(am) :mConnMgr(cm)
{ {
return; return;
} }
@ -202,7 +202,7 @@ std::string p3Peers::getOwnId()
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
return mAuthMgr->OwnId(); return getAuthSSL()->OwnId();
} }
bool p3Peers::getOnlineList(std::list<std::string> &ids) bool p3Peers::getOnlineList(std::list<std::string> &ids)
@ -237,7 +237,7 @@ bool p3Peers::getOthersList(std::list<std::string> &ids)
#endif #endif
/* get from mAuthMgr */ /* get from mAuthMgr */
mAuthMgr->getAllList(ids); getAuthSSL()->getAllList(ids);
return true; return true;
} }
@ -260,7 +260,7 @@ bool p3Peers::isOnline(std::string id)
bool p3Peers::isTrustingMe(std::string id) const bool p3Peers::isTrustingMe(std::string id) const
{ {
return mAuthMgr->isTrustingMe(id) ; return getAuthSSL()->isTrustingMe(id) ;
} }
bool p3Peers::isFriend(std::string id) bool p3Peers::isFriend(std::string id)
@ -301,8 +301,8 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
#endif #endif
/* get from mAuthMgr (first) */ /* get from mAuthMgr (first) */
pqiAuthDetails authDetail; sslcert authDetail;
if (!mAuthMgr->getDetails(id, authDetail)) if (!getAuthSSL()->getCertDetails(id, authDetail))
{ {
return false; return false;
} }
@ -317,16 +317,8 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
d.issuer = authDetail.issuer; d.issuer = authDetail.issuer;
d.ownsign = authDetail.ownsign; d.trusted = getAuthGPG()->isPGPAuthenticated(getAuthSSL()->getGPGId(id));
d.trusted = authDetail.trusted;
#ifdef RS_USE_PGPSSL
d.trustLvl = authDetail.trustLvl;
d.validLvl = authDetail.validLvl;
#else
d.trustLvl = RsPeerTranslateTrust(authDetail.trustLvl);
d.validLvl = RsPeerTranslateTrust(authDetail.trustLvl);
#endif
/* generate */ /* generate */
d.authcode = "AUTHCODE"; d.authcode = "AUTHCODE";
@ -334,7 +326,7 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
/* get from mConnectMgr */ /* get from mConnectMgr */
peerConnectState pcs; peerConnectState pcs;
if (id == mAuthMgr->OwnId()) if (id == getAuthSSL()->OwnId())
{ {
mConnMgr->getOwnNetStatus(pcs); mConnMgr->getOwnNetStatus(pcs);
} }
@ -478,7 +470,7 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
std::string p3Peers::getPeerPGPName(std::string id) std::string p3Peers::getPeerPGPName(std::string id)
{ {
/* get from mAuthMgr as it should have more peers? */ /* get from mAuthMgr as it should have more peers? */
return mAuthMgr->getIssuerName(id); return getAuthSSL()->getIssuerName(id);
} }
std::string p3Peers::getPeerName(std::string id) std::string p3Peers::getPeerName(std::string id)
@ -489,7 +481,7 @@ std::string p3Peers::getPeerName(std::string id)
#endif #endif
/* get from mAuthMgr as it should have more peers? */ /* get from mAuthMgr as it should have more peers? */
return mAuthMgr->getName(id); return getAuthSSL()->getName(id);
} }
@ -508,8 +500,8 @@ bool p3Peers::getPGPFriendList(std::list<std::string> &ids)
/* get from mAuthMgr (first) */ /* get from mAuthMgr (first) */
for(it = certids.begin(); it != certids.end(); it++) for(it = certids.begin(); it != certids.end(); it++)
{ {
pqiAuthDetails detail; sslcert detail;
if (!mAuthMgr->getDetails(*it, detail)) if (!getAuthSSL()->getCertDetails(*it, detail))
{ {
continue; continue;
} }
@ -552,7 +544,7 @@ bool p3Peers::getPGPAllList(std::list<std::string> &ids)
#endif #endif
/* get from mAuthMgr */ /* get from mAuthMgr */
mAuthMgr->getPGPAllList(ids); getAuthGPG()->getPGPAllList(ids);
return true; return true;
} }
@ -564,7 +556,7 @@ std::string p3Peers::getPGPOwnId()
#endif #endif
/* get from mAuthMgr */ /* get from mAuthMgr */
return mAuthMgr->PGPOwnId(); return getAuthGPG()->PGPOwnId();
} }
@ -742,12 +734,12 @@ p3Peers::GetRetroshareInvite()
std::cerr << "p3Peers::GetRetroshareInvite()"; std::cerr << "p3Peers::GetRetroshareInvite()";
std::cerr << std::endl; std::cerr << std::endl;
std::string ownId = mAuthMgr->OwnId(); std::string ownId = getAuthSSL()->OwnId();
std::string certstr = mAuthMgr->SaveCertificateToString(ownId); std::string certstr = getAuthSSL()->SaveCertificateToString(ownId);
std::string name = mAuthMgr->getName(ownId); std::string name = getAuthSSL()->getName(ownId);
std::string pgpownId = mAuthMgr->PGPOwnId(); std::string pgpownId = getAuthGPG()->PGPOwnId();
std::string pgpcertstr = mAuthMgr->SaveCertificateToString(pgpownId); std::string pgpcertstr = getAuthGPG()->SaveCertificateToString(pgpownId);
std::cerr << "p3Peers::GetRetroshareInvite() SSL Cert:"; std::cerr << "p3Peers::GetRetroshareInvite() SSL Cert:";
std::cerr << std::endl; std::cerr << std::endl;
@ -776,7 +768,7 @@ bool p3Peers::LoadCertificateFromFile(std::string fname, std::string &id)
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
return mAuthMgr->LoadCertificateFromFile(fname, id); return getAuthSSL()->LoadCertificateFromFile(fname, id);
} }
@ -841,14 +833,14 @@ bool p3Peers::LoadCertificateFromString(std::string cert, std::string &id)
std::cerr << "pgpcert .... " << std::endl; std::cerr << "pgpcert .... " << std::endl;
std::cerr << pgpcert << std::endl; std::cerr << pgpcert << std::endl;
ret = mAuthMgr->LoadCertificateFromString(pgpcert, id); ret = getAuthGPG()->LoadCertificateFromString(pgpcert);
} }
if (sslcert != "") if (sslcert != "")
{ {
std::cerr << "sslcert .... " << std::endl; std::cerr << "sslcert .... " << std::endl;
std::cerr << sslcert << std::endl; std::cerr << sslcert << std::endl;
ret = mAuthMgr->LoadCertificateFromString(sslcert, id); ret = getAuthSSL()->LoadCertificateFromString(sslcert, id);
} }
} }
@ -868,7 +860,7 @@ bool p3Peers::SaveCertificateToFile(std::string id, std::string fname)
ensureExtension(fname, "pqi"); ensureExtension(fname, "pqi");
return mAuthMgr->SaveCertificateToFile(id, fname); return getAuthSSL()->SaveCertificateToFile(id, fname);
} }
std::string p3Peers::SaveCertificateToString(std::string id) std::string p3Peers::SaveCertificateToString(std::string id)
@ -878,7 +870,7 @@ std::string p3Peers::SaveCertificateToString(std::string id)
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
return mAuthMgr->SaveCertificateToString(id); return getAuthSSL()->SaveCertificateToString(id);
} }
bool p3Peers::AuthCertificate(std::string id, std::string code) bool p3Peers::AuthCertificate(std::string id, std::string code)
@ -888,7 +880,7 @@ bool p3Peers::AuthCertificate(std::string id, std::string code)
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
if (mAuthMgr->AuthCertificate(id)) if (getAuthSSL()->AuthCertificate(id))
{ {
#ifdef P3PEERS_DEBUG #ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::AuthCertificate() OK ... Adding as Friend"; std::cerr << "p3Peers::AuthCertificate() OK ... Adding as Friend";
@ -908,7 +900,7 @@ bool p3Peers::SignCertificate(std::string id)
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
return mAuthMgr->SignCertificate(id); return getAuthSSL()->SignCertificate(id);
} }
bool p3Peers::TrustCertificate(std::string id, bool trust) bool p3Peers::TrustCertificate(std::string id, bool trust)
@ -918,7 +910,7 @@ bool p3Peers::TrustCertificate(std::string id, bool trust)
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
return mAuthMgr->TrustCertificate(id, trust); return getAuthSSL()->TrustCertificate(id, trust);
} }

View File

@ -28,13 +28,12 @@
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
#include "pqi/p3connmgr.h" #include "pqi/p3connmgr.h"
#include "pqi/p3authmgr.h"
class p3Peers: public RsPeers class p3Peers: public RsPeers
{ {
public: public:
p3Peers(p3ConnectMgr *cm, p3AuthMgr *am); p3Peers(p3ConnectMgr *cm);
virtual ~p3Peers() { return; } virtual ~p3Peers() { return; }
/* Updates ... */ /* Updates ... */
@ -95,7 +94,6 @@ virtual bool TrustCertificate(std::string id, bool trust);
private: private:
p3ConnectMgr *mConnMgr; p3ConnectMgr *mConnMgr;
p3AuthMgr *mAuthMgr;
}; };
#endif #endif

View File

@ -46,8 +46,8 @@
// for blocking signals // for blocking signals
#include <signal.h> #include <signal.h>
#include "pqi/authgpg.h"
#include "pqi/authssl.h" #include "pqi/authssl.h"
#include "pqi/authgpg.h"
class accountId class accountId
{ {
@ -469,7 +469,7 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored)
* 2) Get List of Available Accounts. * 2) Get List of Available Accounts.
* 4) Get List of GPG Accounts. * 4) Get List of GPG Accounts.
*/ */
getAuthMgr() -> InitAuth(NULL, NULL, NULL); getAuthSSL() -> InitAuth(NULL, NULL, NULL);
// first check config directories, and set bootstrap values. // first check config directories, and set bootstrap values.
setupBaseDir(); setupBaseDir();
@ -766,50 +766,27 @@ static bool checkAccount(std::string accountdir, accountId &id)
/* Generating GPGme Account */ /* Generating GPGme Account */
int RsInit::GetPGPLogins(std::list<std::string> &pgpIds) int RsInit::GetPGPLogins(std::list<std::string> &pgpIds) {
{ getAuthGPG()->availablePGPCertificates(pgpIds);
#ifdef PQI_USE_SSLONLY
return 0;
#else // PGP+SSL
GPGAuthMgr *mgr = (GPGAuthMgr *) getAuthMgr();
mgr->availablePGPCertificates(pgpIds);
return 1; return 1;
#endif
} }
bool RsInit::getPGPEngineFileName(std::string &fileName) bool RsInit::getPGPEngineFileName(std::string &fileName) {
{ return getAuthGPG()->getPGPEngineFileName(fileName);
#ifdef PQI_USE_SSLONLY
return false;
#else // PGP+SSL
GPGAuthMgr *mgr = (GPGAuthMgr *) getAuthMgr();
return mgr->getPGPEngineFileName(fileName);
#endif
} }
int RsInit::GetPGPLoginDetails(std::string id, std::string &name, std::string &email) int RsInit::GetPGPLoginDetails(std::string id, std::string &name, std::string &email)
{ {
std::cerr << "RsInit::GetPGPLoginDetails for \"" << id << "\""; std::cerr << "RsInit::GetPGPLoginDetails for \"" << id << "\"";
std::cerr << std::endl; std::cerr << std::endl;
#ifdef PQI_USE_SSLONLY name = getAuthGPG()->getPGPName(getAuthSSL()->getGPGId(id));
return 0; email = getAuthGPG()->getPGPEmail(getAuthSSL()->getGPGId(id));
#else // PGP+SSL if (name != "") {
return 1;
GPGAuthMgr *mgr = (GPGAuthMgr *) getAuthMgr(); } else {
pqiAuthDetails details; return 0;
if (!mgr->getDetails(id, details)) }
{
return 0;
}
name = details.name;
email = details.email;
return 1;
#endif
} }
/* Before any SSL stuff can be loaded, the correct PGP must be selected / generated: /* Before any SSL stuff can be loaded, the correct PGP must be selected / generated:
@ -821,7 +798,7 @@ bool RsInit::SelectGPGAccount(std::string id)
std::string gpgId = id; std::string gpgId = id;
std::string name = id; std::string name = id;
GPGAuthMgr *gpgAuthMgr = (GPGAuthMgr *) getAuthMgr(); GPGAuthMgr *gpgAuthMgr = getAuthGPG();
if (0 < gpgAuthMgr -> GPGInit(gpgId)) if (0 < gpgAuthMgr -> GPGInit(gpgId))
{ {
ok = true; ok = true;
@ -841,7 +818,7 @@ bool RsInit::SelectGPGAccount(std::string id)
bool RsInit::LoadGPGPassword(std::string inPGPpasswd) bool RsInit::LoadGPGPassword(std::string inPGPpasswd)
{ {
GPGAuthMgr *gpgAuthMgr = (GPGAuthMgr *) getAuthMgr(); GPGAuthMgr *gpgAuthMgr =getAuthGPG();
bool ok = false; bool ok = false;
if (0 < gpgAuthMgr -> LoadGPGPassword(inPGPpasswd)) if (0 < gpgAuthMgr -> LoadGPGPassword(inPGPpasswd))
@ -1221,25 +1198,8 @@ int RsInit::LoadCertificates(bool autoLoginNT)
return 0; return 0;
} }
//std::string ca_loc = RsInitConfig::basedir + RsInitConfig::dirSeperator;
//ca_loc += configCaFile;
p3AuthMgr *authMgr = getAuthMgr();
bool ok = false; bool ok = false;
#if defined(PQI_USE_SSLONLY)
std::cerr << "Calling initAuth debug 2." << std::endl;
if (0 < authMgr -> InitAuth(RsInitConfig::load_cert.c_str(), RsInitConfig::load_key.c_str(),RsInitConfig::passwd.c_str()))
{
ok = true;
}
else
{
std::cerr << "AuthSSL::InitAuth Failed" << std::endl;
}
#else /* X509 Certificates */
/* The SSL / SSL + PGP version requires, SSL init + PGP init. */ /* The SSL / SSL + PGP version requires, SSL init + PGP init. */
const char* sslPassword; const char* sslPassword;
sslPassword = RsInitConfig::passwd.c_str(); sslPassword = RsInitConfig::passwd.c_str();
@ -1256,7 +1216,7 @@ int RsInit::LoadCertificates(bool autoLoginNT)
gpgme_data_t plain; gpgme_data_t plain;
gpgme_data_new_from_mem(&plain, sslPassword, strlen(sslPassword), 1); gpgme_data_new_from_mem(&plain, sslPassword, strlen(sslPassword), 1);
gpgme_data_new_from_stream (&cipher, sslPassphraseFile); gpgme_data_new_from_stream (&cipher, sslPassphraseFile);
if (0 < authMgr->encryptText(plain, cipher)) { if (0 < getAuthGPG()->encryptText(plain, cipher)) {
std::cerr << "Encrypting went ok !" << std::endl; std::cerr << "Encrypting went ok !" << std::endl;
} }
gpgme_data_release (cipher); gpgme_data_release (cipher);
@ -1277,7 +1237,7 @@ int RsInit::LoadCertificates(bool autoLoginNT)
gpgme_data_t plain; gpgme_data_t plain;
gpgme_data_new (&plain); gpgme_data_new (&plain);
gpgme_error_t error_reading_file = gpgme_data_new_from_stream (&cipher, sslPassphraseFile); gpgme_error_t error_reading_file = gpgme_data_new_from_stream (&cipher, sslPassphraseFile);
if (0 < authMgr->decryptText(cipher, plain)) { if (0 < getAuthGPG()->decryptText(cipher, plain)) {
std::cerr << "Decrypting went ok !" << std::endl; std::cerr << "Decrypting went ok !" << std::endl;
gpgme_data_write (plain, "", 1); gpgme_data_write (plain, "", 1);
sslPassword = gpgme_data_release_and_get_mem(plain, NULL); sslPassword = gpgme_data_release_and_get_mem(plain, NULL);
@ -1293,7 +1253,7 @@ int RsInit::LoadCertificates(bool autoLoginNT)
std::cerr << "RsInitConfig::load_key.c_str() : " << RsInitConfig::load_key.c_str() << std::endl; std::cerr << "RsInitConfig::load_key.c_str() : " << RsInitConfig::load_key.c_str() << std::endl;
std::cerr << "sslPassword : " << sslPassword << std::endl;; std::cerr << "sslPassword : " << sslPassword << std::endl;;
if (0 < authMgr -> InitAuth(RsInitConfig::load_cert.c_str(), RsInitConfig::load_key.c_str(), sslPassword)) if (0 < getAuthSSL() -> InitAuth(RsInitConfig::load_cert.c_str(), RsInitConfig::load_key.c_str(), sslPassword))
{ {
ok = true; ok = true;
} }
@ -1302,7 +1262,6 @@ int RsInit::LoadCertificates(bool autoLoginNT)
std::cerr << "SSL Auth Failed!"; std::cerr << "SSL Auth Failed!";
std::cerr << std::endl; std::cerr << std::endl;
} }
#endif /* X509 Certificates */
if (ok) if (ok)
{ {
@ -1869,9 +1828,7 @@ int RsServer::StartupRetroShare()
/* (1) Load up own certificate (DONE ALREADY) - just CHECK */ /* (1) Load up own certificate (DONE ALREADY) - just CHECK */
/**************************************************************************/ /**************************************************************************/
mAuthMgr = getAuthMgr(); if (1 != getAuthSSL() -> InitAuth(NULL, NULL, NULL))
if (1 != mAuthMgr -> InitAuth(NULL, NULL, NULL))
{ {
std::cerr << "main() - Fatal Error....." << std::endl; std::cerr << "main() - Fatal Error....." << std::endl;
std::cerr << "Invalid Certificate configuration!" << std::endl; std::cerr << "Invalid Certificate configuration!" << std::endl;
@ -1879,7 +1836,7 @@ int RsServer::StartupRetroShare()
exit(1); exit(1);
} }
std::string ownId = mAuthMgr->OwnId(); std::string ownId = getAuthSSL()->OwnId();
/**************************************************************************/ /**************************************************************************/
/* Any Initial Configuration (Commandline Options) */ /* Any Initial Configuration (Commandline Options) */
@ -1924,9 +1881,9 @@ int RsServer::StartupRetroShare()
bool oldFormat = false; bool oldFormat = false;
std::map<std::string, std::string> oldConfigMap; std::map<std::string, std::string> oldConfigMap;
mAuthMgr -> setConfigDirectories(certConfigFile, certNeighDir); getAuthSSL() -> setConfigDirectories(certConfigFile, certNeighDir);
mAuthMgr -> loadCertificates(); getAuthSSL() -> loadCertificates();
/**************************************************************************/ /**************************************************************************/
/* setup classes / structures */ /* setup classes / structures */
@ -1936,7 +1893,7 @@ int RsServer::StartupRetroShare()
/* Setup Notify Early - So we can use it. */ /* Setup Notify Early - So we can use it. */
rsNotify = new p3Notify(); rsNotify = new p3Notify();
mConnMgr = new p3ConnectMgr(mAuthMgr); mConnMgr = new p3ConnectMgr();
pqiNetAssistFirewall *mUpnpMgr = new upnphandler(); pqiNetAssistFirewall *mUpnpMgr = new upnphandler();
//p3DhtMgr *mDhtMgr = new OpenDHTMgr(ownId, mConnMgr, RsInitConfig::configDir); //p3DhtMgr *mDhtMgr = new OpenDHTMgr(ownId, mConnMgr, RsInitConfig::configDir);
@ -1945,7 +1902,7 @@ int RsServer::StartupRetroShare()
//pqih = new pqipersongrpDummy(none, flags); //pqih = new pqipersongrpDummy(none, flags);
/****** New Ft Server **** !!! */ /****** New Ft Server **** !!! */
ftserver = new ftServer(mAuthMgr, mConnMgr); ftserver = new ftServer(mConnMgr);
ftserver->setP3Interface(pqih); ftserver->setP3Interface(pqih);
ftserver->setConfigDirectory(RsInitConfig::configDir); ftserver->setConfigDirectory(RsInitConfig::configDir);
@ -1962,15 +1919,15 @@ int RsServer::StartupRetroShare()
rsFiles = ftserver; rsFiles = ftserver;
mConfigMgr = new p3ConfigMgr(mAuthMgr, RsInitConfig::configDir, "rs-v0.5.cfg", "rs-v0.5.sgn"); mConfigMgr = new p3ConfigMgr(RsInitConfig::configDir, "rs-v0.5.cfg", "rs-v0.5.sgn");
mGeneralConfig = new p3GeneralConfig(); mGeneralConfig = new p3GeneralConfig();
/* create Services */ /* create Services */
ad = new p3disc(mAuthMgr, mConnMgr, pqih); ad = new p3disc(mConnMgr, pqih);
msgSrv = new p3MsgService(mConnMgr); msgSrv = new p3MsgService(mConnMgr);
chatSrv = new p3ChatService(mConnMgr); chatSrv = new p3ChatService(mConnMgr);
p3tunnel *tn = new p3tunnel(mAuthMgr,mConnMgr, pqih); p3tunnel *tn = new p3tunnel(mConnMgr, pqih);
pqih -> addService(tn); pqih -> addService(tn);
mConnMgr->setP3tunnel(tn); mConnMgr->setP3tunnel(tn);
@ -2000,7 +1957,7 @@ int RsServer::StartupRetroShare()
p3Forums *mForums = new p3Forums(RS_SERVICE_TYPE_FORUM, p3Forums *mForums = new p3Forums(RS_SERVICE_TYPE_FORUM,
mCacheStrapper, mCacheTransfer, mCacheStrapper, mCacheTransfer,
localcachedir, remotecachedir, mAuthMgr); localcachedir, remotecachedir);
CachePair cp4(mForums, mForums, CacheId(RS_SERVICE_TYPE_FORUM, 0)); CachePair cp4(mForums, mForums, CacheId(RS_SERVICE_TYPE_FORUM, 0));
mCacheStrapper -> addCachePair(cp4); mCacheStrapper -> addCachePair(cp4);
@ -2008,7 +1965,7 @@ int RsServer::StartupRetroShare()
p3Channels *mChannels = new p3Channels(RS_SERVICE_TYPE_CHANNEL, p3Channels *mChannels = new p3Channels(RS_SERVICE_TYPE_CHANNEL,
mCacheStrapper, mCacheTransfer, rsFiles, mCacheStrapper, mCacheTransfer, rsFiles,
localcachedir, remotecachedir, channelsdir, mAuthMgr); localcachedir, remotecachedir, channelsdir);
CachePair cp5(mChannels, mChannels, CacheId(RS_SERVICE_TYPE_CHANNEL, 0)); CachePair cp5(mChannels, mChannels, CacheId(RS_SERVICE_TYPE_CHANNEL, 0));
mCacheStrapper -> addCachePair(cp5); mCacheStrapper -> addCachePair(cp5);
@ -2177,7 +2134,7 @@ int RsServer::StartupRetroShare()
/* Setup GUI Interfaces. */ /* Setup GUI Interfaces. */
rsPeers = new p3Peers(mConnMgr, mAuthMgr); rsPeers = new p3Peers(mConnMgr);
rsMsgs = new p3Msgs(mAuthMgr, msgSrv, chatSrv); rsMsgs = new p3Msgs(mAuthMgr, msgSrv, chatSrv);
rsDisc = new p3Discovery(ad); rsDisc = new p3Discovery(ad);

View File

@ -30,7 +30,6 @@
#include <iomanip> #include <iomanip>
#include "pqi/pqistore.h" #include "pqi/pqistore.h"
#include "pqi/pqibin.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 BLOG_MAX_FWD_OFFSET = (60 * 60 * 24 * 2); /* 2 Days */
const uint32_t FRIEND_QBLOG_REPOST_PERIOD = 60; /* every minute for testing */ 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, p3Channels::p3Channels(uint16_t type, CacheStrapper *cs,
CacheTransfer *cft, RsFiles *files, CacheTransfer *cft, RsFiles *files,
std::string srcdir, std::string storedir, std::string chanDir, std::string srcdir, std::string storedir, std::string chanDir)
p3AuthMgr *mgr)
:p3GroupDistrib(type, cs, cft, srcdir, storedir, :p3GroupDistrib(type, cs, cft, srcdir, storedir,
CONFIG_TYPE_CHANNELS, CHANNEL_STOREPERIOD, CHANNEL_PUBPERIOD, mgr), CONFIG_TYPE_CHANNELS, CHANNEL_STOREPERIOD, CHANNEL_PUBPERIOD),
mRsFiles(files), mRsFiles(files),
mChannelsDir(chanDir) mChannelsDir(chanDir)
{ {

View File

@ -39,7 +39,7 @@ class p3Channels: public p3GroupDistrib, public RsChannels
public: public:
p3Channels(uint16_t type, CacheStrapper *cs, CacheTransfer *cft, RsFiles *files, 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(); virtual ~p3Channels();
/****************************************/ /****************************************/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
#include "rsiface/rsfiles.h" #include "rsiface/rsfiles.h"
#include "pqi/p3authmgr.h" #include "pqi/authssl.h"
#include "pqi/p3connmgr.h" #include "pqi/p3connmgr.h"
#include "pqi/pqinotify.h" #include "pqi/pqinotify.h"