renamed remaining *GPG* names into *PGP*

This commit is contained in:
csoler 2021-10-29 19:02:09 +02:00
parent 5e37bd42e4
commit fdac22f49c
12 changed files with 48 additions and 48 deletions

View File

@ -107,7 +107,7 @@ p3discovery2::p3discovery2(
addSerialType(new RsDiscSerialiser());
// Add self into PGP FriendList.
mFriendList[AuthPGP::getGPGOwnId()] = DiscPgpInfo();
mFriendList[AuthPGP::getPGPOwnId()] = DiscPgpInfo();
}
@ -604,8 +604,8 @@ void p3discovery2::updatePgpFriendList()
std::list<RsPgpId>::iterator lit;
std::map<RsPgpId, DiscPgpInfo>::iterator it;
RsPgpId ownPgpId = AuthPGP::getGPGOwnId();
AuthPGP::getGPGAcceptedList(pgpList);
RsPgpId ownPgpId = AuthPGP::getPGPOwnId();
AuthPGP::getPGPAcceptedList(pgpList);
pgpList.push_back(ownPgpId);
// convert to set for ordering.
@ -1058,7 +1058,7 @@ void p3discovery2::recvPGPCertificateRequest( const RsPeerId& fromId, const RsDi
return;
}
RsPgpId ownPgpId = AuthPGP::getGPGOwnId();
RsPgpId ownPgpId = AuthPGP::getPGPOwnId();
for(const RsPgpId& pgpId : item->pgpIdSet.ids)
if (pgpId == ownPgpId)
sendPGPCertificate(pgpId, fromId);

View File

@ -34,7 +34,7 @@ PgpAuxUtilsImpl::PgpAuxUtilsImpl()
const RsPgpId& PgpAuxUtilsImpl::getPGPOwnId()
{
return AuthPGP::getGPGOwnId();
return AuthPGP::getPGPOwnId();
}
RsPgpId PgpAuxUtilsImpl::getPGPId(const RsPeerId& sslid)
@ -59,7 +59,7 @@ bool PgpAuxUtilsImpl::VerifySignBin(const void *data,
bool PgpAuxUtilsImpl::getGPGAllList(std::list<RsPgpId> &ids)
{
return AuthPGP::getGPGAllList(ids);
return AuthPGP::getPGPAllList(ids);
}
bool PgpAuxUtilsImpl::parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const

View File

@ -425,18 +425,18 @@ std::string AuthPGP::getGPGEmail(const RsPgpId& id,bool *success)
/**** GPG versions ***/
const RsPgpId& AuthPGP::getGPGOwnId()
const RsPgpId& AuthPGP::getPGPOwnId()
{
RsStackMutex stack(instance()->gpgMtxData); /******* LOCKED ******/
return instance()->mOwnGpgId ;
}
std::string AuthPGP::getGPGOwnName()
std::string AuthPGP::getPGPOwnName()
{
return getGPGName(instance()->mOwnGpgId) ;
}
bool AuthPGP::getGPGAllList(std::list<RsPgpId> &ids)
bool AuthPGP::getPGPAllList(std::list<RsPgpId> &ids)
{
RsStackMutex stack(instance()->gpgMtxData); /******* LOCKED ******/
@ -470,7 +470,7 @@ bool AuthPGP::isKeySupported(const RsPgpId& id)
return !(pc->_flags & PGPCertificateInfo::PGP_CERTIFICATE_FLAG_UNSUPPORTED_ALGORITHM) ;
}
bool AuthPGP::getGPGDetails(const RsPgpId& pgp_id, RsPeerDetails &d)
bool AuthPGP::getPGPDetails(const RsPgpId& pgp_id, RsPeerDetails &d)
{
RsStackMutex stack(instance()->gpgMtxData); /******* LOCKED ******/
@ -510,17 +510,17 @@ static bool filter_Validity(const PGPCertificateInfo& /*info*/) { return true ;
static bool filter_Accepted(const PGPCertificateInfo& info) { return info._flags & PGPCertificateInfo::PGP_CERTIFICATE_FLAG_ACCEPT_CONNEXION ; }
static bool filter_OwnSigned(const PGPCertificateInfo& info) { return info._flags & PGPCertificateInfo::PGP_CERTIFICATE_FLAG_HAS_OWN_SIGNATURE ; }
bool AuthPGP::getGPGValidList(std::list<RsPgpId> &ids)
bool AuthPGP::getPGPValidList(std::list<RsPgpId> &ids)
{
return getGPGFilteredList(ids,&filter_Validity);
}
bool AuthPGP::getGPGAcceptedList(std::list<RsPgpId> &ids)
bool AuthPGP::getPGPAcceptedList(std::list<RsPgpId> &ids)
{
return getGPGFilteredList(ids,&filter_Accepted);
}
bool AuthPGP::getGPGSignedList(std::list<RsPgpId> &ids)
bool AuthPGP::getPGPSignedList(std::list<RsPgpId> &ids)
{
return getGPGFilteredList(ids,&filter_OwnSigned);
}
@ -739,7 +739,7 @@ bool AuthPGP::saveList(bool& cleanup, std::list<RsItem*>& lst)
std::cerr << "AuthGPG::saveList() called" << std::endl ;
#endif
std::list<RsPgpId> ids ;
getGPGAcceptedList(ids) ; // needs to be done before the lock
getPGPAcceptedList(ids) ; // needs to be done before the lock
RsStackMutex stack(gpgMtxData); /******* LOCKED ******/

View File

@ -152,19 +152,19 @@ public:
static bool exportPublicKey( const RsPgpId& id, unsigned char*& mem_block, size_t& mem_size, bool armoured, bool include_signatures );
/* PGP web of trust management */
static const RsPgpId& getGPGOwnId();
static std::string getGPGOwnName();
static const RsPgpId& getPGPOwnId();
static std::string getPGPOwnName();
//virtual std::string getGPGOwnEmail();
static bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) ;
static bool isKeySupported(const RsPgpId &id) ;
static bool isPgpPubKeyAvailable(const RsPgpId& pgp_id);
static bool haveSecretKey(const RsPgpId &id) ;
static bool getGPGDetails(const RsPgpId& id, RsPeerDetails &d);
static bool getGPGAllList(std::list<RsPgpId> &ids);
static bool getGPGValidList(std::list<RsPgpId> &ids);
static bool getGPGAcceptedList(std::list<RsPgpId> &ids);
static bool getGPGSignedList(std::list<RsPgpId> &ids);
static bool getPGPDetails(const RsPgpId& id, RsPeerDetails &d);
static bool getPGPAllList(std::list<RsPgpId> &ids);
static bool getPGPValidList(std::list<RsPgpId> &ids);
static bool getPGPAcceptedList(std::list<RsPgpId> &ids);
static bool getPGPSignedList(std::list<RsPgpId> &ids);
static bool importProfile(const std::string& filename,RsPgpId& gpg_id,std::string& import_error) ;
static bool importProfileFromString(const std::string& data,RsPgpId& gpg_id,std::string& import_error) ;
static bool exportProfile(const std::string& filename,const RsPgpId& gpg_id) ;

View File

@ -759,7 +759,7 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long /*days*/)
//long version = 0x00;
unsigned long chtype = MBSTRING_UTF8;
X509_NAME *issuer_name = X509_NAME_new();
X509_NAME_add_entry_by_txt(issuer_name, "CN", chtype, (unsigned char *) AuthPGP::getGPGOwnId().toStdString().c_str(), -1, -1, 0);
X509_NAME_add_entry_by_txt(issuer_name, "CN", chtype, (unsigned char *) AuthPGP::getPGPOwnId().toStdString().c_str(), -1, -1, 0);
/****
X509_NAME_add_entry_by_NID(issuer_name, 48, 0,
(unsigned char *) "email@email.com", -1, -1, 0);
@ -769,7 +769,7 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long /*days*/)
(unsigned char *) "loc", -1, -1, 0);
****/
std::cerr << "AuthSSLimpl::SignX509Req() Issuer name: " << AuthPGP::getGPGOwnId().toStdString() << std::endl;
std::cerr << "AuthSSLimpl::SignX509Req() Issuer name: " << AuthPGP::getPGPOwnId().toStdString() << std::endl;
#ifdef V07_NON_BACKWARD_COMPATIBLE_CHANGE_002
static const uint64_t CERTIFICATE_SERIAL_NUMBER = RS_CERTIFICATE_VERSION_NUMBER_07_0001 ;
@ -1039,7 +1039,7 @@ bool AuthSSLimpl::AuthX509WithGPG(X509 *x509,bool verbose, uint32_t& diagnostic)
{
RsPgpId issuer = RsX509Cert::getCertIssuer(*x509);
RsPeerDetails pd;
if (!AuthPGP::getGPGDetails(issuer, pd))
if (!AuthPGP::getPGPDetails(issuer, pd))
{
RsInfo() << __PRETTY_FUNCTION__ << " X509 NOT authenticated : "
<< "AuthGPG::getAuthGPG()->getGPGDetails(" << issuer
@ -1380,7 +1380,7 @@ int AuthSSLimpl::VerifyX509Callback(int /*preverify_ok*/, X509_STORE_CTX* ctx)
std::cerr << "******* VerifyX509Callback cert: " << std::hex << ctx->cert <<std::dec << std::endl;
#endif
if ( !isSslOnlyFriend && pgpId != AuthPGP::getGPGOwnId() && !AuthPGP::isPGPAccepted(pgpId) )
if ( !isSslOnlyFriend && pgpId != AuthPGP::getPGPOwnId() && !AuthPGP::isPGPAccepted(pgpId) )
{
std::string errMsg = "Connection attempt signed by PGP key id: " +
pgpId.toStdString() + " not accepted because it is not"

View File

@ -812,11 +812,11 @@ int p3PeerMgrIMPL::getFriendCount(bool ssl, bool online)
// count all gpg id's
std::list<RsPgpId> gpgIds;
AuthPGP::getGPGAcceptedList(gpgIds);
AuthPGP::getPGPAcceptedList(gpgIds);
// add own gpg id, if we have more than one location
std::list<RsPeerId> ownSslIds;
getAssociatedPeers(AuthPGP::getGPGOwnId(), ownSslIds);
getAssociatedPeers(AuthPGP::getPGPOwnId(), ownSslIds);
return gpgIds.size() + ((ownSslIds.size() > 0) ? 1 : 0);
}
@ -970,7 +970,7 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg
//Authentication is now tested at connection time, we don't store the ssl cert anymore
//
if (!AuthPGP::isPGPAccepted(gpg_id) && gpg_id != AuthPGP::getGPGOwnId())
if (!AuthPGP::isPGPAccepted(gpg_id) && gpg_id != AuthPGP::getPGPOwnId())
{
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::addFriend() gpg is not accepted" << std::endl;
@ -2470,7 +2470,7 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
setOwnNetworkMode(pitem->netMode);
setOwnVisState(pitem->vs_disc, pitem->vs_dht);
mOwnState.gpg_id = AuthPGP::getGPGOwnId();
mOwnState.gpg_id = AuthPGP::getPGPOwnId();
mOwnState.location = AuthSSL::getAuthSSL()->getOwnLocation();
}
else
@ -2642,7 +2642,7 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
#endif
for(uint32_t i=0;i<sitem->pgp_ids.size();++i)
if(AuthPGP::isPGPAccepted(sitem->pgp_ids[i]) || sitem->pgp_ids[i] == AuthPGP::getGPGOwnId())
if(AuthPGP::isPGPAccepted(sitem->pgp_ids[i]) || sitem->pgp_ids[i] == AuthPGP::getPGPOwnId())
{
mFriendsPermissionFlags[sitem->pgp_ids[i]] = sitem->service_flags[i] ;
#ifdef PEER_DEBUG
@ -2684,7 +2684,7 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
for(auto group_pair:groupList)
{
for(auto profileIdIt(group_pair.second.peerIds.begin());profileIdIt!=group_pair.second.peerIds.end();)
if(AuthPGP::isPGPAccepted(*profileIdIt) || *profileIdIt == AuthPGP::getGPGOwnId())
if(AuthPGP::isPGPAccepted(*profileIdIt) || *profileIdIt == AuthPGP::getPGPOwnId())
++profileIdIt;
else
{

View File

@ -1213,7 +1213,7 @@ int pqissl::Authorise_SSL_Connection()
}
RsPgpId pgpId = RsX509Cert::getCertIssuer(*peercert);
if( !isSslOnlyFriend && pgpId != AuthPGP::getGPGOwnId() && !AuthPGP::isPGPAccepted(pgpId) )
if( !isSslOnlyFriend && pgpId != AuthPGP::getPGPOwnId() && !AuthPGP::isPGPAccepted(pgpId) )
{
RsFatal() << __PRETTY_FUNCTION__ << " pgpId: " << pgpId
<< " is not friend. It is very unlikely to happen at this "

View File

@ -797,7 +797,7 @@ int pqissllistener::completeConnection(int fd, IncomingSSLInfo& info)
exit(failure);
}
if( !isSslOnlyFriend && pgpId != AuthPGP::getGPGOwnId() && !AuthPGP::isPGPAccepted(pgpId) )
if( !isSslOnlyFriend && pgpId != AuthPGP::getPGPOwnId() && !AuthPGP::isPGPAccepted(pgpId) )
{
RsFatal() << __PRETTY_FUNCTION__ << " pgpId: " << pgpId
<< " is not friend. It is very unlikely to happen at this "

View File

@ -273,7 +273,7 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
if (id == sOwnId)
{
mPeerMgr->getOwnNetStatus(ps);
ps.gpg_id = AuthPGP::getGPGOwnId();
ps.gpg_id = AuthPGP::getPGPOwnId();
}
else if (!mPeerMgr->getFriendNetStatus(id, ps))
{
@ -597,7 +597,7 @@ std::string p3Peers::getPeerName(const RsPeerId& ssl)
#endif
std::string name;
if (ssl == AuthSSL::getAuthSSL()->OwnId())
return AuthPGP::getGPGOwnName();
return AuthPGP::getPGPOwnName();
if (mPeerMgr->getPeerName(ssl, name))
{
@ -617,7 +617,7 @@ bool p3Peers::getGPGAllList(std::list<RsPgpId> &ids)
#endif
/* get from mAuthMgr */
AuthPGP::getGPGAllList(ids);
AuthPGP::getPGPAllList(ids);
return true;
}
@ -628,7 +628,7 @@ bool p3Peers::getGPGValidList(std::list<RsPgpId> &ids)
#endif
/* get from mAuthMgr */
AuthPGP::getGPGValidList(ids);
AuthPGP::getPGPValidList(ids);
return true;
}
@ -639,14 +639,14 @@ bool p3Peers::getGPGSignedList(std::list<RsPgpId> &ids)
#endif
/* get from mAuthMgr */
AuthPGP::getGPGSignedList(ids);
AuthPGP::getPGPSignedList(ids);
return true;
}
bool p3Peers::getPgpFriendList(std::vector<RsPgpId>& pgpIds)
{
std::list<RsPgpId> ids;
if(AuthPGP::getGPGAcceptedList(ids))
if(AuthPGP::getPGPAcceptedList(ids))
{
pgpIds.clear();
std::copy(ids.begin(), ids.end(), std::back_inserter(pgpIds));
@ -660,7 +660,7 @@ bool p3Peers::getGPGAcceptedList(std::list<RsPgpId> &ids)
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::getGPGAcceptedList()" << std::endl;
#endif
AuthPGP::getGPGAcceptedList(ids);
AuthPGP::getPGPAcceptedList(ids);
return true;
}
@ -691,7 +691,7 @@ bool p3Peers::getGPGDetails(const RsPgpId &pgp_id, RsPeerDetails &d)
#endif
/* get from mAuthMgr */
bool res = AuthPGP::getGPGDetails(pgp_id, d);
bool res = AuthPGP::getPGPDetails(pgp_id, d);
d.isOnlyGPGdetail = true ;
d.service_perm_flags = mPeerMgr->servicePermissionFlags(pgp_id) ;
@ -706,7 +706,7 @@ const RsPgpId& p3Peers::getGPGOwnId()
#endif
/* get from mAuthMgr */
return AuthPGP::getGPGOwnId();
return AuthPGP::getPGPOwnId();
}
RsPgpId p3Peers::getGPGId(const RsPeerId& sslid)
@ -718,7 +718,7 @@ RsPgpId p3Peers::getGPGId(const RsPeerId& sslid)
/* get from mAuthMgr */
if (sslid == AuthSSL::getAuthSSL()->OwnId())
{
return AuthPGP::getGPGOwnId();
return AuthPGP::getPGPOwnId();
}
peerState pcs;
if (mPeerMgr->getFriendNetStatus(sslid, pcs))
@ -817,7 +817,7 @@ bool p3Peers::removeFriend(const RsPgpId& gpgId)
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::removeFriend() " << gpgId << std::endl;
#endif
if (gpgId == AuthPGP::getGPGOwnId()) {
if (gpgId == AuthPGP::getPGPOwnId()) {
std::cerr << "p3Peers::removeFriend() ERROR we're not going to remove our own GPG id." << std::endl;
return false;
}

View File

@ -140,7 +140,7 @@ bool p3ServerConfig::setConfigurationOption(uint32_t key, const std::string &opt
int p3ServerConfig::getConfigNetStatus(RsConfigNetStatus &status)
{
status.ownId = AuthSSL::getAuthSSL()->OwnId();
status.ownName = AuthPGP::getGPGOwnName();
status.ownName = AuthPGP::getPGPOwnName();
// Details from PeerMgr.
peerState pstate;

View File

@ -910,8 +910,8 @@ int RsServer::StartupRetroShare()
/* History Manager */
mHistoryMgr = new p3HistoryMgr();
mPeerMgr = new p3PeerMgrIMPL( AuthSSL::getAuthSSL()->OwnId(),
AuthPGP::getGPGOwnId(),
AuthPGP::getGPGOwnName(),
AuthPGP::getPGPOwnId(),
AuthPGP::getPGPOwnName(),
AuthSSL::getAuthSSL()->getOwnLocation());
mNetMgr = new p3NetMgrIMPL();
mLinkMgr = new p3LinkMgrIMPL(mPeerMgr, mNetMgr);

View File

@ -1067,7 +1067,7 @@ bool p3IdService::createIdentity(uint32_t& token, RsIdentityParameters &params)
if(params.isPgpLinked)
{
ssdata.pgp.pgpId = AuthPGP::getGPGOwnId();
ssdata.pgp.pgpId = AuthPGP::getPGPOwnId();
ssdata.pgp.lastCheckTs = time(nullptr);
}