mirror of
				https://github.com/RetroShare/RetroShare.git
				synced 2025-11-03 15:29:02 -05:00 
			
		
		
		
	removed old includes of gpgme. Updated values for trust
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5279 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
		
							parent
							
								
									93f08ae730
								
							
						
					
					
						commit
						fa6674fd01
					
				
					 9 changed files with 68 additions and 188 deletions
				
			
		| 
						 | 
				
			
			@ -747,6 +747,11 @@ bool PGPHandler::privateSignCertificate(const PGPIdType& ownId,const PGPIdType&
 | 
			
		|||
 | 
			
		||||
	_pubring_changed = true ;
 | 
			
		||||
 | 
			
		||||
	// 4 - update signatures.
 | 
			
		||||
	//
 | 
			
		||||
	PGPCertificateInfo& cert(_public_keyring_map[ id_of_key_to_sign.toStdString() ]) ;
 | 
			
		||||
	validateAndUpdateSignatures(cert,key_to_sign) ;
 | 
			
		||||
 | 
			
		||||
	return true ;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -916,10 +921,10 @@ bool PGPHandler::privateTrustCertificate(const PGPIdType& id,int trustlvl)
 | 
			
		|||
		return false ;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if( (int)it->second._validLvl != trustlvl )
 | 
			
		||||
	if( (int)it->second._trustLvl != trustlvl )
 | 
			
		||||
		_trustdb_changed = true ;
 | 
			
		||||
 | 
			
		||||
	it->second._validLvl = trustlvl ;
 | 
			
		||||
	it->second._trustLvl = trustlvl ;
 | 
			
		||||
 | 
			
		||||
	return true ;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -945,6 +950,7 @@ void PGPHandler::locked_readPrivateTrustDatabase()
 | 
			
		|||
	}
 | 
			
		||||
	std::map<std::string,PGPCertificateInfo>::iterator it ;
 | 
			
		||||
	PrivateTrustPacket trustpacket;
 | 
			
		||||
	int n_packets = 0 ;
 | 
			
		||||
 | 
			
		||||
	while(fread((void*)&trustpacket,sizeof(PrivateTrustPacket),1,fdb) == 1)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -961,10 +967,13 @@ void PGPHandler::locked_readPrivateTrustDatabase()
 | 
			
		|||
			continue ;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		it->second._validLvl = trustpacket.trust_level ;
 | 
			
		||||
		++n_packets ;
 | 
			
		||||
		it->second._trustLvl = trustpacket.trust_level ;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fclose(fdb) ;
 | 
			
		||||
 | 
			
		||||
	std::cerr << "PGPHandler: Successfully read " << n_packets << " trust packets." << std::endl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool PGPHandler::locked_writePrivateTrustDatabase()
 | 
			
		||||
| 
						 | 
				
			
			@ -984,7 +993,7 @@ bool PGPHandler::locked_writePrivateTrustDatabase()
 | 
			
		|||
	for(std::map<std::string,PGPCertificateInfo>::iterator it = _public_keyring_map.begin();it!=_public_keyring_map.end() ;++it)
 | 
			
		||||
	{
 | 
			
		||||
		memcpy(&trustpacket.user_id,PGPIdType(it->first).toByteArray(),KEY_ID_SIZE) ;
 | 
			
		||||
		trustpacket.trust_level = it->second._validLvl ;
 | 
			
		||||
		trustpacket.trust_level = it->second._trustLvl ;
 | 
			
		||||
 | 
			
		||||
		if(fwrite((void*)&trustpacket,sizeof(PrivateTrustPacket),1,fdb) != 1)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -107,6 +107,7 @@ AuthGPG::AuthGPG(const std::string& path_to_public_keyring,const std::string& pa
 | 
			
		|||
			gpgMtxData("AuthGPG-data"),
 | 
			
		||||
			gpgKeySelected(false) 
 | 
			
		||||
{
 | 
			
		||||
	_force_sync_database = false ;
 | 
			
		||||
	start();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -171,7 +172,7 @@ void AuthGPG::run()
 | 
			
		|||
        processServices();
 | 
			
		||||
 | 
			
		||||
        /* every ten seconds */
 | 
			
		||||
        if (++count >= 100) 
 | 
			
		||||
        if (++count >= 100 || _force_sync_database) 
 | 
			
		||||
		  {
 | 
			
		||||
			  RsStackMutex stack(gpgMtxService); /******* LOCKED ******/
 | 
			
		||||
			  
 | 
			
		||||
| 
						 | 
				
			
			@ -182,6 +183,7 @@ void AuthGPG::run()
 | 
			
		|||
			  //
 | 
			
		||||
			  PGPHandler::syncDatabase() ;
 | 
			
		||||
			  count = 0;
 | 
			
		||||
			  _force_sync_database = false ;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -420,7 +422,7 @@ bool AuthGPG::getGPGDetails(const std::string& id, RsPeerDetails &d)
 | 
			
		|||
	d.name = cert._name;
 | 
			
		||||
	d.email = cert._email;
 | 
			
		||||
	d.trustLvl = cert._trustLvl;
 | 
			
		||||
	d.validLvl = cert._validLvl;
 | 
			
		||||
	d.validLvl = cert._trustLvl;
 | 
			
		||||
	d.ownsign = cert._flags & PGPCertificateInfo::PGP_CERTIFICATE_FLAG_HAS_OWN_SIGNATURE;
 | 
			
		||||
	d.gpgSigners.clear() ;
 | 
			
		||||
	for(std::set<std::string>::const_iterator it(cert.signers.begin());it!=cert.signers.end();++it)
 | 
			
		||||
| 
						 | 
				
			
			@ -561,28 +563,15 @@ bool AuthGPG::AllowConnection(const std::string &gpg_id, bool accept)
 | 
			
		|||
/* These take PGP Ids */
 | 
			
		||||
bool AuthGPG::SignCertificateLevel0(const std::string &id)
 | 
			
		||||
{
 | 
			
		||||
	/* remove unused parameter warnings */
 | 
			
		||||
	(void) id;
 | 
			
		||||
 | 
			
		||||
#ifdef GPG_DEBUG
 | 
			
		||||
	std::cerr << "AuthGPG::SignCertificat(" << id << ")" << std::endl;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (1 != privateSignCertificate(id))
 | 
			
		||||
	{
 | 
			
		||||
//		storeAllKeys();
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* reload stuff now ... */
 | 
			
		||||
//	storeAllKeys();
 | 
			
		||||
	return true;
 | 
			
		||||
	return privateSignCertificate(id) ;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool AuthGPG::RevokeCertificate(const std::string &id)
 | 
			
		||||
{
 | 
			
		||||
	//RsStackMutex stack(gpgMtx); /******* LOCKED ******/
 | 
			
		||||
 | 
			
		||||
	/* remove unused parameter warnings */
 | 
			
		||||
	(void) id;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -596,106 +585,30 @@ bool AuthGPG::RevokeCertificate(const std::string &id)
 | 
			
		|||
bool AuthGPG::TrustCertificate(const std::string &id, int trustlvl)
 | 
			
		||||
{
 | 
			
		||||
#ifdef GPG_DEBUG
 | 
			
		||||
        std::cerr << "AuthGPG::TrustCertificate(" << id << ", " << trustlvl << ")" << std::endl;
 | 
			
		||||
	std::cerr << "AuthGPG::TrustCertificate(" << id << ", " << trustlvl << ")" << std::endl;
 | 
			
		||||
#endif
 | 
			
		||||
        if (1 != privateTrustCertificate(id, trustlvl))
 | 
			
		||||
        {
 | 
			
		||||
//                storeAllKeys();
 | 
			
		||||
                return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
	/* Keys are reloaded by privateTrustCertificate */
 | 
			
		||||
        return true;
 | 
			
		||||
	return privateTrustCertificate(id, trustlvl) ;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if 0 
 | 
			
		||||
/* remove otherwise will cause bugs */
 | 
			
		||||
bool AuthGPG::SignData(std::string input, std::string &sign)
 | 
			
		||||
bool AuthGPG::SignDataBin(const void *data, unsigned int datalen, unsigned char *sign, unsigned int *signlen) 
 | 
			
		||||
{
 | 
			
		||||
	return false;
 | 
			
		||||
	return DoOwnSignature(data, datalen, sign, signlen);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool AuthGPG::SignData(const void *data, const uint32_t len, std::string &sign)
 | 
			
		||||
bool AuthGPG::VerifySignBin(const void *data, uint32_t datalen, unsigned char *sign, unsigned int signlen, const std::string &withfingerprint) 
 | 
			
		||||
{
 | 
			
		||||
	return false;
 | 
			
		||||
	return VerifySignature(data, datalen, sign, signlen, withfingerprint);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
bool AuthGPG::SignDataBin(std::string input, unsigned char *sign, unsigned int *signlen)
 | 
			
		||||
{
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
bool AuthGPG::SignDataBin(const void *data, unsigned int datalen, unsigned char *sign, unsigned int *signlen) {
 | 
			
		||||
        return DoOwnSignature(data, datalen,
 | 
			
		||||
                        sign, signlen);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool AuthGPG::VerifySignBin(const void *data, uint32_t datalen, unsigned char *sign, unsigned int signlen, const std::string &withfingerprint) {
 | 
			
		||||
        return VerifySignature(data, datalen,
 | 
			
		||||
                        sign, signlen, withfingerprint);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/* Sign/Trust stuff */
 | 
			
		||||
/* Sign/Trust stuff */
 | 
			
		||||
 | 
			
		||||
int	AuthGPG::privateSignCertificate(const std::string &id)
 | 
			
		||||
{
 | 
			
		||||
	return PGPHandler::privateSignCertificate(mOwnGpgId,PGPIdType(id)) ;
 | 
			
		||||
	RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
 | 
			
		||||
 | 
			
		||||
//	/* The key should be in Others list and not in Peers list ?? 
 | 
			
		||||
//	 * Once the key is signed, it moves from Others to Peers list ??? 
 | 
			
		||||
//	 */
 | 
			
		||||
//
 | 
			
		||||
//	gpgcert signKey;
 | 
			
		||||
//	gpgcert ownKey;
 | 
			
		||||
//
 | 
			
		||||
//	{
 | 
			
		||||
//		RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
 | 
			
		||||
//		certmap::iterator it;
 | 
			
		||||
//
 | 
			
		||||
//		if (mKeyList.end() == (it = mKeyList.find(id)))
 | 
			
		||||
//		{
 | 
			
		||||
//			return false;
 | 
			
		||||
//		}
 | 
			
		||||
//
 | 
			
		||||
//		/* grab a reference, so the key remains */
 | 
			
		||||
//		gpgme_key_ref(it->second.key);
 | 
			
		||||
//
 | 
			
		||||
//		signKey = it->second;
 | 
			
		||||
//
 | 
			
		||||
//		/* grab a reference, so the key remains */
 | 
			
		||||
//		gpgme_key_ref(mOwnGpgCert.key);
 | 
			
		||||
//
 | 
			
		||||
//		ownKey  = mOwnGpgCert;
 | 
			
		||||
//	} /******* UNLOCKED ******/
 | 
			
		||||
//
 | 
			
		||||
//	RsStackMutex stack(gpgMtxEngine); /******* LOCKED ******/
 | 
			
		||||
//
 | 
			
		||||
//	class SignParams sparams("0");
 | 
			
		||||
//	class EditParams params(SIGN_START, &sparams);
 | 
			
		||||
//	gpgme_data_t out;
 | 
			
		||||
//	gpg_error_t ERR;
 | 
			
		||||
//
 | 
			
		||||
//	if(GPG_ERR_NO_ERROR != (ERR = gpgme_data_new(&out))) {
 | 
			
		||||
//		return 0;
 | 
			
		||||
//	}
 | 
			
		||||
//
 | 
			
		||||
//	gpgme_signers_clear(CTX);
 | 
			
		||||
//	if(GPG_ERR_NO_ERROR != (ERR = gpgme_signers_add(CTX, ownKey.key))) {
 | 
			
		||||
//		gpgme_data_release(out);
 | 
			
		||||
//		return 0;
 | 
			
		||||
//	}
 | 
			
		||||
//	
 | 
			
		||||
//	if(GPG_ERR_NO_ERROR != (ERR = gpgme_op_edit(CTX, signKey.key, keySignCallback, ¶ms, out))) {
 | 
			
		||||
//		gpgme_data_release(out);
 | 
			
		||||
//		gpgme_signers_clear(CTX);
 | 
			
		||||
//		return 0;	
 | 
			
		||||
//	}
 | 
			
		||||
//
 | 
			
		||||
//	gpgme_data_release(out);
 | 
			
		||||
//	gpgme_signers_clear(CTX);
 | 
			
		||||
	int ret = PGPHandler::privateSignCertificate(mOwnGpgId,PGPIdType(id)) ;
 | 
			
		||||
	_force_sync_database = true ;
 | 
			
		||||
	return ret ;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* revoke the signature on Certificate */
 | 
			
		||||
| 
						 | 
				
			
			@ -708,6 +621,8 @@ int	AuthGPG::privateRevokeCertificate(const std::string &/*id*/)
 | 
			
		|||
 | 
			
		||||
int	AuthGPG::privateTrustCertificate(const std::string &id, int trustlvl)
 | 
			
		||||
{
 | 
			
		||||
	RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
 | 
			
		||||
 | 
			
		||||
	/* The certificate should be in Peers list ??? */	
 | 
			
		||||
	if(!isGPGAccepted(id)) 
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -715,7 +630,9 @@ int	AuthGPG::privateTrustCertificate(const std::string &id, int trustlvl)
 | 
			
		|||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return PGPHandler::privateTrustCertificate(PGPIdType(id),trustlvl) ;
 | 
			
		||||
	int res = PGPHandler::privateTrustCertificate(PGPIdType(id),trustlvl) ;
 | 
			
		||||
	_force_sync_database = true ;
 | 
			
		||||
	return res ;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// -----------------------------------------------------------------------------------//
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -286,6 +286,7 @@ class AuthGPG: public p3Config, public RsThread, public PGPHandler
 | 
			
		|||
 | 
			
		||||
		PGPIdType mOwnGpgId;
 | 
			
		||||
		bool gpgKeySelected;
 | 
			
		||||
		bool _force_sync_database ;
 | 
			
		||||
 | 
			
		||||
		std::list<AuthGPGService*> services ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,12 +38,14 @@
 | 
			
		|||
class RsPeers;
 | 
			
		||||
extern RsPeers   *rsPeers;
 | 
			
		||||
 | 
			
		||||
/* Trust Levels */
 | 
			
		||||
const uint32_t RS_TRUST_LVL_NONE	= 2;
 | 
			
		||||
const uint32_t RS_TRUST_LVL_MARGINAL	= 3;
 | 
			
		||||
const uint32_t RS_TRUST_LVL_FULL	= 4;
 | 
			
		||||
const uint32_t RS_TRUST_LVL_ULTIMATE	= 5;
 | 
			
		||||
/* Trust Levels. Should be the same values than what is declared in PGPHandler.h */
 | 
			
		||||
 | 
			
		||||
const uint32_t RS_TRUST_LVL_UNDEFINED  = 0;
 | 
			
		||||
const uint32_t RS_TRUST_LVL_UNKNOWN    = 1;
 | 
			
		||||
const uint32_t RS_TRUST_LVL_NEVER      = 2;
 | 
			
		||||
const uint32_t RS_TRUST_LVL_MARGINAL   = 3;
 | 
			
		||||
const uint32_t RS_TRUST_LVL_FULL	      = 4;
 | 
			
		||||
const uint32_t RS_TRUST_LVL_ULTIMATE   = 5;
 | 
			
		||||
 | 
			
		||||
/* Net Mode */
 | 
			
		||||
const uint32_t RS_NETMODE_UDP		= 0x0001;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,6 @@
 | 
			
		|||
/****************************/
 | 
			
		||||
/*  #define DEBUG_PGPUTIL 1 */
 | 
			
		||||
/****************************/
 | 
			
		||||
#define DEBUG_PGPUTIL 1 
 | 
			
		||||
 | 
			
		||||
#define PGP_CRC24_INIT 0xB704CEL
 | 
			
		||||
#define PGP_CRC24_POLY 0x1864CFBL
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,6 @@
 | 
			
		|||
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, 
 | 
			
		||||
 *  Boston, MA  02110-1301, USA.
 | 
			
		||||
 ****************************************************************/
 | 
			
		||||
#include <gpgme.h>
 | 
			
		||||
 | 
			
		||||
#include <QTreeWidget>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
| 
						 | 
				
			
			@ -311,50 +310,6 @@ void NetworkDialog::copyLink()
 | 
			
		|||
	RSLinkClipboard::copyLinks(urls);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Open a QFileDialog to browse for a pem/pqi file. */
 | 
			
		||||
//void NetworkDialog::loadcert()
 | 
			
		||||
//{
 | 
			
		||||
// use misc::getOpenFileName
 | 
			
		||||
//  /* Create a new input dialog, which allows users to create files, too */
 | 
			
		||||
//  QFileDialog dialog (this, tr("Select a pem/pqi File"));
 | 
			
		||||
//  //dialog.setDirectory(QFileInfo(ui.lineTorConfig->text()).absoluteDir());
 | 
			
		||||
//  //dialog.selectFile(QFileInfo(ui.lineTorConfig->text()).fileName());
 | 
			
		||||
//  dialog.setFileMode(QFileDialog::AnyFile);
 | 
			
		||||
//  dialog.setReadOnly(false);
 | 
			
		||||
//
 | 
			
		||||
//  /* Prompt the user to select a file or create a new one */
 | 
			
		||||
//  if (!dialog.exec() || dialog.selectedFiles().isEmpty()) {
 | 
			
		||||
//    return;
 | 
			
		||||
//  }
 | 
			
		||||
//  QString filename = QDir::convertSeparators(dialog.selectedFiles().at(0));
 | 
			
		||||
//
 | 
			
		||||
//  /* Check if the file exists */
 | 
			
		||||
//  QFile torrcFile(filename);
 | 
			
		||||
//  if (!QFileInfo(filename).exists()) {
 | 
			
		||||
//    /* The given file does not exist. Should we create it? */
 | 
			
		||||
//    int response = VMessageBox::question(this,
 | 
			
		||||
//                     tr("File Not Found"),
 | 
			
		||||
//                     tr("%1 does not exist. Would you like to create it?")
 | 
			
		||||
//                                                            .arg(filename),
 | 
			
		||||
//                     VMessageBox::Yes, VMessageBox::No);
 | 
			
		||||
//
 | 
			
		||||
//    if (response == VMessageBox::No) {
 | 
			
		||||
//      /* Don't create it. Just bail. */
 | 
			
		||||
//      return;
 | 
			
		||||
//    }
 | 
			
		||||
//    /* Attempt to create the specified file */
 | 
			
		||||
//    if (!torrcFile.open(QIODevice::WriteOnly)) {
 | 
			
		||||
//      VMessageBox::warning(this,
 | 
			
		||||
//        tr("Failed to Create File"),
 | 
			
		||||
//        tr("Unable to create %1 [%2]").arg(filename)
 | 
			
		||||
//                                      .arg(torrcFile.errorString()),
 | 
			
		||||
//        VMessageBox::Ok);
 | 
			
		||||
//      return;
 | 
			
		||||
//    }
 | 
			
		||||
//  }
 | 
			
		||||
//  //ui.lineTorConfig->setText(filename);
 | 
			
		||||
//}
 | 
			
		||||
 | 
			
		||||
void NetworkDialog::updateDisplay()
 | 
			
		||||
{
 | 
			
		||||
	insertConnect() ;
 | 
			
		||||
| 
						 | 
				
			
			@ -393,7 +348,7 @@ void NetworkDialog::insertConnect()
 | 
			
		|||
	while (index < connectWidget->topLevelItemCount()) {
 | 
			
		||||
		std::string gpg_widget_id = (connectWidget->topLevelItem(index))->text(COLUMN_PEERID).toStdString();
 | 
			
		||||
		RsPeerDetails detail;
 | 
			
		||||
		if (!rsPeers->getGPGDetails(gpg_widget_id, detail) || (detail.validLvl < GPGME_VALIDITY_MARGINAL && !detail.accept_connection)) {
 | 
			
		||||
		if (!rsPeers->getGPGDetails(gpg_widget_id, detail) || (detail.validLvl < RS_TRUST_LVL_MARGINAL && !detail.accept_connection)) {
 | 
			
		||||
			delete (connectWidget->takeTopLevelItem(index));
 | 
			
		||||
		} else {
 | 
			
		||||
			index++;
 | 
			
		||||
| 
						 | 
				
			
			@ -403,7 +358,7 @@ void NetworkDialog::insertConnect()
 | 
			
		|||
	while (index < ui.unvalidGPGkeyWidget->topLevelItemCount()) {
 | 
			
		||||
		std::string gpg_widget_id = (ui.unvalidGPGkeyWidget->topLevelItem(index))->text(COLUMN_PEERID).toStdString();
 | 
			
		||||
		RsPeerDetails detail;
 | 
			
		||||
		if (!rsPeers->getGPGDetails(gpg_widget_id, detail) || detail.validLvl >= GPGME_VALIDITY_MARGINAL || detail.accept_connection) {
 | 
			
		||||
		if (!rsPeers->getGPGDetails(gpg_widget_id, detail) || detail.validLvl >= RS_TRUST_LVL_MARGINAL || detail.accept_connection) {
 | 
			
		||||
			delete (ui.unvalidGPGkeyWidget->takeTopLevelItem(index));
 | 
			
		||||
		} else {
 | 
			
		||||
			index++;
 | 
			
		||||
| 
						 | 
				
			
			@ -464,12 +419,12 @@ void NetworkDialog::insertConnect()
 | 
			
		|||
		else 
 | 
			
		||||
			switch(detail.trustLvl)
 | 
			
		||||
			{
 | 
			
		||||
				case GPGME_VALIDITY_MARGINAL: item->setText(2,tr("Marginally trusted peer")) ; break;
 | 
			
		||||
				case GPGME_VALIDITY_FULL:
 | 
			
		||||
				case GPGME_VALIDITY_ULTIMATE: item->setText(2,tr("Fully trusted peer")) ; break ;
 | 
			
		||||
				case GPGME_VALIDITY_UNKNOWN:
 | 
			
		||||
				case GPGME_VALIDITY_UNDEFINED: 
 | 
			
		||||
				case GPGME_VALIDITY_NEVER:
 | 
			
		||||
				case RS_TRUST_LVL_MARGINAL: item->setText(2,tr("Marginally trusted peer")) ; break;
 | 
			
		||||
				case RS_TRUST_LVL_FULL:
 | 
			
		||||
				case RS_TRUST_LVL_ULTIMATE: item->setText(2,tr("Fully trusted peer")) ; break ;
 | 
			
		||||
				case RS_TRUST_LVL_UNKNOWN:
 | 
			
		||||
				case RS_TRUST_LVL_UNDEFINED: 
 | 
			
		||||
				case RS_TRUST_LVL_NEVER:
 | 
			
		||||
				default: 							item->setText(2,tr("Untrusted peer")) ; break ;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -524,7 +479,7 @@ void NetworkDialog::insertConnect()
 | 
			
		|||
			item -> setBackground(i,QBrush(backgrndcolor));
 | 
			
		||||
 | 
			
		||||
		/* add to the list */
 | 
			
		||||
		if (detail.accept_connection || detail.validLvl >= GPGME_VALIDITY_MARGINAL) 
 | 
			
		||||
		if (detail.accept_connection || detail.validLvl >= RS_TRUST_LVL_MARGINAL) 
 | 
			
		||||
		{
 | 
			
		||||
			/* add gpg item to the list. If item is already in the list, it won't be duplicated thanks to Qt */
 | 
			
		||||
			connectWidget->addTopLevelItem(item);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,8 +23,6 @@
 | 
			
		|||
#include <retroshare/rspeers.h>
 | 
			
		||||
#include <retroshare/rsdisc.h>
 | 
			
		||||
 | 
			
		||||
#include <gpgme.h>
 | 
			
		||||
 | 
			
		||||
#include <deque>
 | 
			
		||||
#include <set>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
| 
						 | 
				
			
			@ -160,12 +158,12 @@ void  NetworkView::updateDisplay()
 | 
			
		|||
 | 
			
		||||
		switch(detail.trustLvl)
 | 
			
		||||
		{
 | 
			
		||||
			case GPGME_VALIDITY_MARGINAL: auth = GraphWidget::ELASTIC_NODE_AUTH_MARGINAL ; break;
 | 
			
		||||
			case GPGME_VALIDITY_FULL:
 | 
			
		||||
			case GPGME_VALIDITY_ULTIMATE: auth = GraphWidget::ELASTIC_NODE_AUTH_FULL ; break;
 | 
			
		||||
			case GPGME_VALIDITY_UNKNOWN:
 | 
			
		||||
			case GPGME_VALIDITY_UNDEFINED: 
 | 
			
		||||
			case GPGME_VALIDITY_NEVER:
 | 
			
		||||
			case RS_TRUST_LVL_MARGINAL: auth = GraphWidget::ELASTIC_NODE_AUTH_MARGINAL ; break;
 | 
			
		||||
			case RS_TRUST_LVL_FULL:
 | 
			
		||||
			case RS_TRUST_LVL_ULTIMATE: auth = GraphWidget::ELASTIC_NODE_AUTH_FULL ; break;
 | 
			
		||||
			case RS_TRUST_LVL_UNKNOWN:
 | 
			
		||||
			case RS_TRUST_LVL_UNDEFINED: 
 | 
			
		||||
			case RS_TRUST_LVL_NEVER:
 | 
			
		||||
			default: 							auth = GraphWidget::ELASTIC_NODE_AUTH_UNKNOWN ; break ;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,6 @@
 | 
			
		|||
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
 | 
			
		||||
 *  Boston, MA  02110-1301, USA.
 | 
			
		||||
 ****************************************************************/
 | 
			
		||||
#include <gpgme.h>
 | 
			
		||||
 | 
			
		||||
#include "ConfCertDialog.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -268,7 +267,7 @@ void ConfCertDialog::load()
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        //web of trust
 | 
			
		||||
        if (detail.trustLvl == GPGME_VALIDITY_ULTIMATE) {
 | 
			
		||||
        if (detail.trustLvl == RS_TRUST_LVL_ULTIMATE) {
 | 
			
		||||
            //trust is ultimate, it means it's one of our own keys
 | 
			
		||||
            ui.web_of_trust_label->setText(tr("Your trust in this peer is ultimate, it's probably a key you own."));
 | 
			
		||||
            ui.radioButton_trust_fully->hide();
 | 
			
		||||
| 
						 | 
				
			
			@ -278,19 +277,19 @@ void ConfCertDialog::load()
 | 
			
		|||
            ui.radioButton_trust_fully->show();
 | 
			
		||||
            ui.radioButton_trust_marginnaly->show();
 | 
			
		||||
            ui.radioButton_trust_never->show();
 | 
			
		||||
            if (detail.trustLvl == GPGME_VALIDITY_FULL) {
 | 
			
		||||
            if (detail.trustLvl == RS_TRUST_LVL_FULL) {
 | 
			
		||||
                ui.web_of_trust_label->setText(tr("Your trust in this peer is full."));
 | 
			
		||||
                ui.radioButton_trust_fully->setChecked(true);
 | 
			
		||||
                ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-48.png"));
 | 
			
		||||
                ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png"));
 | 
			
		||||
                ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-off-48.png"));
 | 
			
		||||
            } else if (detail.trustLvl == GPGME_VALIDITY_MARGINAL) {
 | 
			
		||||
            } else if (detail.trustLvl == RS_TRUST_LVL_MARGINAL) {
 | 
			
		||||
                ui.web_of_trust_label->setText(tr("Your trust in this peer is marginal."));
 | 
			
		||||
                ui.radioButton_trust_marginnaly->setChecked(true);
 | 
			
		||||
                ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-48.png"));
 | 
			
		||||
                ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-off-48.png"));
 | 
			
		||||
                ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-off-48.png"));
 | 
			
		||||
            } else if (detail.trustLvl == GPGME_VALIDITY_NEVER) {
 | 
			
		||||
            } else if (detail.trustLvl == RS_TRUST_LVL_NEVER) {
 | 
			
		||||
                ui.web_of_trust_label->setText(tr("Your trust in this peer is none."));
 | 
			
		||||
                ui.radioButton_trust_never->setChecked(true);
 | 
			
		||||
                ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-48.png"));
 | 
			
		||||
| 
						 | 
				
			
			@ -379,13 +378,13 @@ void ConfCertDialog::applyDialog()
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    //check the GPG trustlvl
 | 
			
		||||
    if (ui.radioButton_trust_fully->isChecked() && detail.trustLvl != GPGME_VALIDITY_FULL) {
 | 
			
		||||
    if (ui.radioButton_trust_fully->isChecked() && detail.trustLvl != RS_TRUST_LVL_FULL) {
 | 
			
		||||
        //trust has changed to fully
 | 
			
		||||
        rsPeers->trustGPGCertificate(detail.id, GPGME_VALIDITY_FULL);
 | 
			
		||||
    } else if (ui.radioButton_trust_marginnaly->isChecked() && detail.trustLvl != GPGME_VALIDITY_MARGINAL) {
 | 
			
		||||
        rsPeers->trustGPGCertificate(detail.id, GPGME_VALIDITY_MARGINAL);
 | 
			
		||||
    } else if (ui.radioButton_trust_never->isChecked() && detail.trustLvl != GPGME_VALIDITY_NEVER) {
 | 
			
		||||
        rsPeers->trustGPGCertificate(detail.id, GPGME_VALIDITY_NEVER);
 | 
			
		||||
        rsPeers->trustGPGCertificate(detail.id, RS_TRUST_LVL_FULL);
 | 
			
		||||
    } else if (ui.radioButton_trust_marginnaly->isChecked() && detail.trustLvl != RS_TRUST_LVL_MARGINAL) {
 | 
			
		||||
        rsPeers->trustGPGCertificate(detail.id, RS_TRUST_LVL_MARGINAL);
 | 
			
		||||
    } else if (ui.radioButton_trust_never->isChecked() && detail.trustLvl != RS_TRUST_LVL_NEVER) {
 | 
			
		||||
        rsPeers->trustGPGCertificate(detail.id, RS_TRUST_LVL_NEVER);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!detail.isOnlyGPGdetail) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1144,7 +1144,7 @@ void ConclusionPage::initializePage() {
 | 
			
		|||
            case RS_TRUST_LVL_MARGINAL:
 | 
			
		||||
                    trustString = "Marginal";
 | 
			
		||||
            break;
 | 
			
		||||
            case RS_TRUST_LVL_NONE:
 | 
			
		||||
            case RS_TRUST_LVL_NEVER:
 | 
			
		||||
                    trustString = "None";
 | 
			
		||||
            break;
 | 
			
		||||
            default:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue