fixed casing of PGP into Pgp

This commit is contained in:
csoler 2021-10-29 19:05:54 +02:00
parent fdac22f49c
commit 7672ffa0ec
13 changed files with 57 additions and 57 deletions

View File

@ -107,7 +107,7 @@ p3discovery2::p3discovery2(
addSerialType(new RsDiscSerialiser());
// Add self into PGP FriendList.
mFriendList[AuthPGP::getPGPOwnId()] = 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::getPGPOwnId();
AuthPGP::getPGPAcceptedList(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::getPGPOwnId();
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::getPGPOwnId();
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::getPGPAllList(ids);
return AuthPGP::getPgpAllList(ids);
}
bool PgpAuxUtilsImpl::parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const

View File

@ -373,7 +373,7 @@ bool AuthPGP::GeneratePGPCertificate(const std::string& name, const std::stri
}
/**** These Two are common */
std::string AuthPGP::getGPGName(const RsPgpId& id,bool *success)
std::string AuthPGP::getPgpName(const RsPgpId& id,bool *success)
{
RsStackMutex stack(instance()->gpgMtxData); /******* LOCKED ******/
@ -406,7 +406,7 @@ bool AuthPGP::isPGPId(const RsPgpId& id)
return instance()->mPgpHandler->isGPGId(id);
}
/**** These Two are common */
std::string AuthPGP::getGPGEmail(const RsPgpId& id,bool *success)
std::string AuthPGP::getPgpEmail(const RsPgpId& id,bool *success)
{
RsStackMutex stack(instance()->gpgMtxData); /******* LOCKED ******/
const PGPCertificateInfo *info = instance()->mPgpHandler->getCertificateInfo(id) ;
@ -425,18 +425,18 @@ std::string AuthPGP::getGPGEmail(const RsPgpId& id,bool *success)
/**** GPG versions ***/
const RsPgpId& AuthPGP::getPGPOwnId()
const RsPgpId& AuthPGP::getPgpOwnId()
{
RsStackMutex stack(instance()->gpgMtxData); /******* LOCKED ******/
return instance()->mOwnGpgId ;
}
std::string AuthPGP::getPGPOwnName()
std::string AuthPGP::getPgpOwnName()
{
return getGPGName(instance()->mOwnGpgId) ;
return getPgpName(instance()->mOwnGpgId) ;
}
bool AuthPGP::getPGPAllList(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::getPGPDetails(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::getPGPValidList(std::list<RsPgpId> &ids)
bool AuthPGP::getPgpValidList(std::list<RsPgpId> &ids)
{
return getGPGFilteredList(ids,&filter_Validity);
}
bool AuthPGP::getPGPAcceptedList(std::list<RsPgpId> &ids)
bool AuthPGP::getPgpAcceptedList(std::list<RsPgpId> &ids)
{
return getGPGFilteredList(ids,&filter_Accepted);
}
bool AuthPGP::getPGPSignedList(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 ;
getPGPAcceptedList(ids) ; // needs to be done before the lock
getPgpAcceptedList(ids) ; // needs to be done before the lock
RsStackMutex stack(gpgMtxData); /******* LOCKED ******/

View File

@ -146,25 +146,25 @@ public:
* provide access to details in cache list.
*
****/
static std::string getGPGName(const RsPgpId &pgp_id,bool *success = NULL);
static std::string getGPGEmail(const RsPgpId &pgp_id,bool *success = NULL);
static std::string getPgpName(const RsPgpId &pgp_id,bool *success = NULL);
static std::string getPgpEmail(const RsPgpId &pgp_id,bool *success = NULL);
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& getPGPOwnId();
static std::string getPGPOwnName();
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 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 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::getPGPOwnId().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::getPGPOwnId().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::getPGPDetails(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::getPGPOwnId() && !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::getPGPAcceptedList(gpgIds);
AuthPGP::getPgpAcceptedList(gpgIds);
// add own gpg id, if we have more than one location
std::list<RsPeerId> ownSslIds;
getAssociatedPeers(AuthPGP::getPGPOwnId(), 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::getPGPOwnId())
if (!AuthPGP::isPGPAccepted(gpg_id) && gpg_id != AuthPGP::getPgpOwnId())
{
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::addFriend() gpg is not accepted" << std::endl;
@ -1024,7 +1024,7 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg
pstate.id = id;
pstate.gpg_id = gpg_id;
pstate.name = AuthPGP::getGPGName(gpg_id);
pstate.name = AuthPGP::getPgpName(gpg_id);
pstate.vs_disc = vs_disc;
pstate.vs_dht = vs_dht;
@ -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::getPGPOwnId();
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::getPGPOwnId())
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::getPGPOwnId())
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::getPGPOwnId() && !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::getPGPOwnId() && !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::getPGPOwnId();
ps.gpg_id = AuthPGP::getPgpOwnId();
}
else if (!mPeerMgr->getFriendNetStatus(id, ps))
{
@ -565,7 +565,7 @@ bool p3Peers::isKeySupported(const RsPgpId& id)
std::string p3Peers::getGPGName(const RsPgpId &gpg_id)
{
/* get from mAuthMgr as it should have more peers? */
return AuthPGP::getGPGName(gpg_id);
return AuthPGP::getPgpName(gpg_id);
}
bool p3Peers::isPgpFriend(const RsPgpId& pgpId)
@ -597,7 +597,7 @@ std::string p3Peers::getPeerName(const RsPeerId& ssl)
#endif
std::string name;
if (ssl == AuthSSL::getAuthSSL()->OwnId())
return AuthPGP::getPGPOwnName();
return AuthPGP::getPgpOwnName();
if (mPeerMgr->getPeerName(ssl, name))
{
@ -617,7 +617,7 @@ bool p3Peers::getGPGAllList(std::list<RsPgpId> &ids)
#endif
/* get from mAuthMgr */
AuthPGP::getPGPAllList(ids);
AuthPGP::getPgpAllList(ids);
return true;
}
@ -628,7 +628,7 @@ bool p3Peers::getGPGValidList(std::list<RsPgpId> &ids)
#endif
/* get from mAuthMgr */
AuthPGP::getPGPValidList(ids);
AuthPGP::getPgpValidList(ids);
return true;
}
@ -639,14 +639,14 @@ bool p3Peers::getGPGSignedList(std::list<RsPgpId> &ids)
#endif
/* get from mAuthMgr */
AuthPGP::getPGPSignedList(ids);
AuthPGP::getPgpSignedList(ids);
return true;
}
bool p3Peers::getPgpFriendList(std::vector<RsPgpId>& pgpIds)
{
std::list<RsPgpId> ids;
if(AuthPGP::getPGPAcceptedList(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::getPGPAcceptedList(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::getPGPDetails(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::getPGPOwnId();
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::getPGPOwnId();
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::getPGPOwnId()) {
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::getPGPOwnName();
status.ownName = AuthPGP::getPgpOwnName();
// Details from PeerMgr.
peerState pstate;

View File

@ -864,10 +864,10 @@ int RsAccountsDetail::GetPGPLoginDetails(const RsPgpId& id, std::string &na
#endif
bool ok = true ;
name = AuthPGP::getGPGName(id,&ok);
name = AuthPGP::getPgpName(id,&ok);
if(!ok)
return 0 ;
email = AuthPGP::getGPGEmail(id,&ok);
email = AuthPGP::getPgpEmail(id,&ok);
if(!ok)
return 0 ;

View File

@ -910,8 +910,8 @@ int RsServer::StartupRetroShare()
/* History Manager */
mHistoryMgr = new p3HistoryMgr();
mPeerMgr = new p3PeerMgrIMPL( AuthSSL::getAuthSSL()->OwnId(),
AuthPGP::getPGPOwnId(),
AuthPGP::getPGPOwnName(),
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::getPGPOwnId();
ssdata.pgp.pgpId = AuthPGP::getPgpOwnId();
ssdata.pgp.lastCheckTs = time(nullptr);
}