mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
remove a maximum of debug outputs for the release
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2232 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7d82dfb115
commit
bf67301d71
@ -243,7 +243,9 @@ void ftController::tickTransfers()
|
||||
|
||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ticking transfers." << std::endl ;
|
||||
#endif
|
||||
mPriorityTab = std::vector<std::vector<ftTransferModule*> >(3,std::vector<ftTransferModule*>()) ;
|
||||
|
||||
for(std::map<std::string,ftFileControl>::iterator it(mDownloads.begin()); it != mDownloads.end(); it++)
|
||||
@ -258,11 +260,13 @@ void ftController::tickTransfers()
|
||||
// static const float LOW_PRIORITY_PROB = 0.15 ;
|
||||
// static const float SUSP_PRIORITY_PROB = 0.00 ;
|
||||
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "Priority tabs: " ;
|
||||
std::cerr << "Low (" << mPriorityTab[SPEED_LOW ].size() << ") " ;
|
||||
std::cerr << "Normal (" << mPriorityTab[SPEED_NORMAL].size() << ") " ;
|
||||
std::cerr << "High (" << mPriorityTab[SPEED_HIGH ].size() << ") " ;
|
||||
std::cerr << std::endl ;
|
||||
#endif
|
||||
|
||||
/* tick the transferModules */
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
|
||||
#define DB_DEBUG 1
|
||||
//#define DB_DEBUG 1
|
||||
|
||||
ftFiStore::ftFiStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,
|
||||
RsPeerId ownid, std::string cachedir)
|
||||
|
@ -175,10 +175,9 @@ void ftFileCreator::removeInactiveChunks()
|
||||
|
||||
int ftFileCreator::initializeFileAttrs()
|
||||
{
|
||||
std::cerr << "ftFileCreator::initializeFileAttrs() Filename: ";
|
||||
std::cerr << file_name;
|
||||
std::cerr << " this: " << this;
|
||||
std::cerr << std::endl;
|
||||
#ifdef FILE_DEBUG
|
||||
std::cerr << "ftFileCreator::initializeFileAttrs() Filename: " << file_name << " this: " << this << std::endl;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* check if the file exists
|
||||
@ -194,7 +193,9 @@ int ftFileCreator::initializeFileAttrs()
|
||||
*/
|
||||
|
||||
{
|
||||
std::cerr << "ftFileCreator::initializeFileAttrs() trying (r+b) ";
|
||||
#ifdef FILE_DEBUG
|
||||
std::cerr << "ftFileCreator::initializeFileAttrs() trying (r+b) " << file_name << " this: " << this << std::endl;
|
||||
#endif
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
@ -237,7 +238,9 @@ int ftFileCreator::initializeFileAttrs()
|
||||
|
||||
uint64_t recvdsize = ftello64(fd);
|
||||
|
||||
#ifdef FILE_DEBUG
|
||||
std::cerr << "ftFileCreator::initializeFileAttrs() File Expected Size: " << mSize << " RecvdSize: " << recvdsize << std::endl;
|
||||
#endif
|
||||
|
||||
/* start from there! */
|
||||
// mStart = recvdsize;
|
||||
|
@ -214,9 +214,9 @@ void ftFileProvider::getClientMap(const std::string& peer_id,CompressedChunkMap&
|
||||
|
||||
int ftFileProvider::initializeFileAttrs()
|
||||
{
|
||||
std::cerr << "ftFileProvider::initializeFileAttrs() Filename: ";
|
||||
std::cerr << file_name;
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_FT_FILE_PROVIDER
|
||||
std::cerr << "ftFileProvider::initializeFileAttrs() Filename: " << file_name << std::endl;
|
||||
#endif
|
||||
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
if (fd)
|
||||
@ -227,8 +227,9 @@ int ftFileProvider::initializeFileAttrs()
|
||||
*/
|
||||
|
||||
{
|
||||
std::cerr << "ftFileProvider::initializeFileAttrs() trying (r+b) ";
|
||||
std::cerr << std::endl;
|
||||
#ifdef DEBUG_FT_FILE_PROVIDER
|
||||
std::cerr << "ftFileProvider::initializeFileAttrs() trying (r+b) " << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -266,7 +267,9 @@ int ftFileProvider::initializeFileAttrs()
|
||||
|
||||
uint64_t recvdsize = ftello64(fd);
|
||||
|
||||
#ifdef DEBUG_FT_FILE_PROVIDER
|
||||
std::cerr << "ftFileProvider::initializeFileAttrs() File Expected Size: " << mSize << " RecvdSize: " << recvdsize << std::endl;
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
const uint32_t MAX_SEARCHS = 24; /* lower 24 bits of hint */
|
||||
|
||||
#define DEBUG_SEARCH 1
|
||||
//#define DEBUG_SEARCH 1
|
||||
|
||||
ftFileSearch::ftFileSearch()
|
||||
:mSearchs(MAX_SEARCHS)
|
||||
|
@ -3,7 +3,7 @@ CONFIG += static release
|
||||
TARGET = retroshare
|
||||
|
||||
DEFINES -= PQI_USE_XPGP
|
||||
DEFINES += RS_USE_PGPSSL P3DISC_DEBUG RSSERIAL_DEBUG DEBUG_PQISTREAMER SSL_DEBUG
|
||||
DEFINES += RS_USE_PGPSSL
|
||||
|
||||
profiling {
|
||||
QMAKE_CXXFLAGS -= -fomit-frame-pointer
|
||||
@ -15,7 +15,7 @@ debug {
|
||||
# DEFINES *= OPENDHT_DEBUG DHT_DEBUG CONN_DEBUG DEBUG_UDP_SORTER P3DISC_DEBUG DEBUG_UDP_LAYER FT_DEBUG EXTADDRSEARCH_DEBUG
|
||||
# DEFINES *= CHAT_DEBUG CONTROL_DEBUG FT_DEBUG
|
||||
# DEFINES *= P3TURTLE_DEBUG UPNP_DEBUG
|
||||
DEFINES *= CONN_DEBUG P3DISC_DEBUG RSSERIAL_DEBUG RSITEM_DEBUG DEBUG_PQISSL DEBUG_PQISTREAMER
|
||||
# DEFINES *= CONN_DEBUG P3DISC_DEBUG RSSERIAL_DEBUG RSITEM_DEBUG DEBUG_PQISSL DEBUG_PQISTREAMER
|
||||
# DEFINES *= NET_DEBUG
|
||||
# DEFINES *= DISTRIB_DEBUG
|
||||
QMAKE_CXXFLAGS *= -g
|
||||
|
@ -123,23 +123,20 @@ AuthGPG::AuthGPG()
|
||||
/* setup the engine (gpg2) */
|
||||
// if (GPG_ERR_NO_ERROR != gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP, "/usr/bin/gpg2", NULL))
|
||||
// {
|
||||
// std::cerr << "Error creating Setting engine";
|
||||
// std::cerr << std::endl;
|
||||
// std::cerr << "Error creating Setting engine" << std::endl;
|
||||
// return;
|
||||
// }
|
||||
#endif
|
||||
|
||||
if (GPG_ERR_NO_ERROR != gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP))
|
||||
{
|
||||
std::cerr << "Error check engine version";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error check engine version" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (GPG_ERR_NO_ERROR != gpgme_get_engine_info(&INFO))
|
||||
{
|
||||
std::cerr << "Error getting engine info";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error getting engine info" << std::endl;
|
||||
while (INFO && INFO->protocol != GPGME_PROTOCOL_OpenPGP) {
|
||||
INFO = INFO->next;
|
||||
}
|
||||
@ -163,16 +160,14 @@ AuthGPG::AuthGPG()
|
||||
/* Create New Contexts */
|
||||
if (GPG_ERR_NO_ERROR != gpgme_new(&CTX))
|
||||
{
|
||||
std::cerr << "Error creating GPGME Context";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error creating GPGME Context" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
/* setup the protocol */
|
||||
if (GPG_ERR_NO_ERROR != gpgme_set_protocol(CTX, GPGME_PROTOCOL_OpenPGP))
|
||||
{
|
||||
std::cerr << "Error creating Setting Protocol";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error creating Setting Protocol" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -182,7 +177,9 @@ AuthGPG::AuthGPG()
|
||||
gpgmeInit = true;
|
||||
|
||||
storeAllKeys_locked();
|
||||
#ifdef GPG_DEBUG
|
||||
printAllKeys_locked();
|
||||
#endif
|
||||
//updateTrustAllKeys_locked();
|
||||
}
|
||||
|
||||
@ -211,8 +208,7 @@ bool AuthGPG::availableGPGCertificatesWithPrivateKeys(std::list<std::string> &id
|
||||
/* Initiates a key listing */
|
||||
if (GPG_ERR_NO_ERROR != gpgme_op_keylist_start (CTX, "", 1))
|
||||
{
|
||||
std::cerr << "Error iterating through KeyList";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error iterating through KeyList" << std::endl;
|
||||
return false;
|
||||
|
||||
}
|
||||
@ -237,8 +233,7 @@ bool AuthGPG::availableGPGCertificatesWithPrivateKeys(std::list<std::string> &id
|
||||
|
||||
if (GPG_ERR_NO_ERROR != gpgme_op_keylist_end(CTX))
|
||||
{
|
||||
std::cerr << "Error ending KeyList";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error ending KeyList" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -316,14 +311,12 @@ bool AuthGPG::storeAllKeys_locked()
|
||||
gpg_error_t ERR;
|
||||
if (!gpgmeInit)
|
||||
{
|
||||
std::cerr << "Error since GPG is not initialised";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error since GPG is not initialised" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "AuthGPG::storeAllKeys_locked() clearing existing ones";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "AuthGPG::storeAllKeys_locked() clearing existing ones" << std::endl;
|
||||
#endif
|
||||
mKeyList.clear();
|
||||
|
||||
@ -339,8 +332,7 @@ bool AuthGPG::storeAllKeys_locked()
|
||||
/* Initiates a key listing 0 = All Keys */
|
||||
if (GPG_ERR_NO_ERROR != gpgme_op_keylist_start (CTX, "", 0))
|
||||
{
|
||||
std::cerr << "Error iterating through KeyList";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error iterating through KeyList" << std::endl;
|
||||
gpgme_set_keylist_mode(CTX, origmode);
|
||||
return false;
|
||||
}
|
||||
@ -357,8 +349,7 @@ bool AuthGPG::storeAllKeys_locked()
|
||||
|
||||
if ((!KEY->subkeys) || (!KEY->uids))
|
||||
{
|
||||
std::cerr << "Invalid Key in List... skipping";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Invalid Key in List... skipping" << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -472,8 +463,7 @@ bool AuthGPG::storeAllKeys_locked()
|
||||
|
||||
if (GPG_ERR_NO_ERROR != gpgme_op_keylist_end(CTX))
|
||||
{
|
||||
std::cerr << "Error ending KeyList";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error ending KeyList" << std::endl;
|
||||
gpgme_set_keylist_mode(CTX, origmode);
|
||||
return false;
|
||||
}
|
||||
@ -489,8 +479,7 @@ bool AuthGPG::updateTrustAllKeys_locked()
|
||||
gpg_error_t ERR;
|
||||
if (!gpgmeInit)
|
||||
{
|
||||
std::cerr << "Error since GPG is not initialised";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error since GPG is not initialised" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -504,15 +493,13 @@ bool AuthGPG::updateTrustAllKeys_locked()
|
||||
/* check for trust items associated with key */
|
||||
std::string peerid = it->second.email;
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "Searching GPGme for TrustInfo on: " << peerid;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Searching GPGme for TrustInfo on: " << peerid << std::endl;
|
||||
#endif
|
||||
|
||||
/* Initiates a key listing. NB: maxlevel is ignored!*/
|
||||
if (GPG_ERR_NO_ERROR != (ERR = gpgme_op_trustlist_start (CTX, peerid.c_str(), 0)))
|
||||
{
|
||||
std::cerr << "Error Starting Trust List";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error Starting Trust List" << std::endl;
|
||||
ProcessPGPmeError(ERR);
|
||||
continue;
|
||||
}
|
||||
@ -539,15 +526,13 @@ bool AuthGPG::updateTrustAllKeys_locked()
|
||||
std::cerr << " Name: " << ti->name;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
std::cerr << "End of TrustList Iteration.";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "End of TrustList Iteration." << std::endl;
|
||||
#endif
|
||||
ProcessPGPmeError(ERR);
|
||||
|
||||
if (GPG_ERR_NO_ERROR != gpgme_op_trustlist_end(CTX))
|
||||
{
|
||||
std::cerr << "Error ending TrustList";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error ending TrustList" << std::endl;
|
||||
|
||||
ProcessPGPmeError(ERR);
|
||||
}
|
||||
@ -562,22 +547,15 @@ bool AuthGPG::printAllKeys_locked()
|
||||
certmap::const_iterator it;
|
||||
for(it = mKeyList.begin(); it != mKeyList.end(); it++)
|
||||
{
|
||||
std::cerr << "PGP Key: " << it->second.id;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "PGP Key: " << it->second.id << std::endl;
|
||||
|
||||
std::cerr << "\tName: " << it->second.name;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tEmail: " << it->second.email;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tName: " << it->second.name << std::endl;
|
||||
std::cerr << "\tEmail: " << it->second.email << std::endl;
|
||||
|
||||
std::cerr << "\townsign: " << it->second.ownsign;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\ttrustLvl: " << it->second.trustLvl;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tvalidLvl: " << it->second.validLvl;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tEmail: " << it->second.email;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\townsign: " << it->second.ownsign << std::endl;
|
||||
std::cerr << "\ttrustLvl: " << it->second.trustLvl << std::endl;
|
||||
std::cerr << "\tvalidLvl: " << it->second.validLvl << std::endl;
|
||||
std::cerr << "\tEmail: " << it->second.email << std::endl;
|
||||
|
||||
std::list<std::string>::const_iterator sit;
|
||||
for(sit = it->second.signers.begin();
|
||||
@ -591,8 +569,7 @@ bool AuthGPG::printAllKeys_locked()
|
||||
certmap::const_iterator kit = mKeyList.find(*sit);
|
||||
if (kit != mKeyList.end())
|
||||
{
|
||||
std::cerr << " Name:" << kit->second.name;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << " Name:" << kit->second.name << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -606,13 +583,10 @@ bool AuthGPG::printOwnKeys_locked()
|
||||
{
|
||||
if (it->second.ownsign)
|
||||
{
|
||||
std::cerr << "Own PGP Key: " << it->second.id;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Own PGP Key: " << it->second.id << std::endl;
|
||||
|
||||
std::cerr << "\tName: " << it->second.name;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tEmail: " << it->second.email;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tName: " << it->second.name << std::endl;
|
||||
std::cerr << "\tEmail: " << it->second.email << std::endl;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -625,21 +599,6 @@ bool AuthGPG::printKeys()
|
||||
return printOwnKeys_locked();
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
|
||||
ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey,
|
||||
const EVP_MD *type)
|
||||
|
||||
#define X509_sign(x,pkey,md) \
|
||||
ASN1_sign((int (*)())i2d_X509_CINF, x->cert_info->signature, \
|
||||
x->sig_alg, x->signature, (char *)x->cert_info,pkey,md)
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ProcessPGPmeError(gpgme_error_t ERR)
|
||||
{
|
||||
gpgme_err_code_t code = gpgme_err_code(ERR);
|
||||
@ -713,12 +672,12 @@ bool AuthGPG::DoOwnSignature_locked(const void *data, unsigned int datalen, void
|
||||
if (GPG_ERR_NO_ERROR != (ERR = gpgme_op_sign(CTX,gpgmeData, gpgmeSig, mode)))
|
||||
{
|
||||
ProcessPGPmeError(ERR);
|
||||
std::cerr << "AuthGPG::Sign FAILED ERR: " << ERR;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "AuthGPG::Sign FAILED ERR: " << ERR << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
gpgme_sign_result_t res = gpgme_op_sign_result(CTX);
|
||||
|
||||
#ifdef GPG_DEBUG
|
||||
if (res)
|
||||
{
|
||||
@ -774,8 +733,7 @@ bool AuthGPG::VerifySignature_locked(const void *data, int datalen, const void *
|
||||
gpgme_data_t gpgmeData;
|
||||
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "VerifySignature: datalen: " << datalen << " siglen: " << siglen;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "VerifySignature: datalen: " << datalen << " siglen: " << siglen << std::endl;
|
||||
#endif
|
||||
|
||||
if(siglen==73)
|
||||
@ -786,14 +744,12 @@ bool AuthGPG::VerifySignature_locked(const void *data, int datalen, const void *
|
||||
|
||||
if (GPG_ERR_NO_ERROR != gpgme_data_new_from_mem(&gpgmeData, (const char *) data, datalen, 1))
|
||||
{
|
||||
std::cerr << "Error create Data";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error create Data" << std::endl;
|
||||
}
|
||||
|
||||
if (siglen != 0 && GPG_ERR_NO_ERROR != gpgme_data_new_from_mem(&gpgmeSig, (const char *) sig, siglen, 1))
|
||||
{
|
||||
std::cerr << "Error create Sig";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error create Sig" << std::endl;
|
||||
}
|
||||
|
||||
/* move string data to gpgmeData */
|
||||
@ -804,8 +760,7 @@ bool AuthGPG::VerifySignature_locked(const void *data, int datalen, const void *
|
||||
if (GPG_ERR_NO_ERROR != (ERR = gpgme_op_verify(CTX,gpgmeSig, gpgmeData, NULL)))
|
||||
{
|
||||
ProcessPGPmeError(ERR);
|
||||
std::cerr << "AuthGPG::Verify FAILED";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "AuthGPG::Verify FAILED" << std::endl;
|
||||
}
|
||||
|
||||
gpgme_verify_result_t res = gpgme_op_verify_result(CTX);
|
||||
@ -905,15 +860,6 @@ bool AuthGPG::CloseAuth()
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0 /**** no saving here! let AuthSSL store directories! ****/
|
||||
|
||||
int AuthGPG::setConfigDirectories(std::string confFile, std::string neighDir)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**** These Two are common */
|
||||
std::string AuthGPG::getGPGName(GPG_id id)
|
||||
{
|
||||
@ -1034,8 +980,7 @@ bool AuthGPG::encryptText(gpgme_data_t PLAIN, gpgme_data_t CIPHER) {
|
||||
if (GPG_ERR_NO_ERROR != (ERR = gpgme_op_encrypt(CTX, keys, *flags, PLAIN, CIPHER)))
|
||||
{
|
||||
ProcessPGPmeError(ERR);
|
||||
std::cerr << "AuthGPG::encryptText() Error encrypting text.";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "AuthGPG::encryptText() Error encrypting text." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1187,10 +1132,7 @@ std::string AuthGPG::SaveCertificateToString(std::string id)
|
||||
tmp = std::string(export_txt);
|
||||
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "Exported Certificate: ";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << tmp;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Exported Certificate: " << std::endl << tmp << std::endl;
|
||||
#endif
|
||||
|
||||
gpgme_free(export_txt);
|
||||
@ -1214,8 +1156,7 @@ bool AuthGPG::LoadCertificateFromString(std::string str, std::string &gpg_id)
|
||||
gpgme_data_t gpgmeData;
|
||||
if (GPG_ERR_NO_ERROR != gpgme_data_new_from_mem(&gpgmeData, cleancert.c_str(), cleancert.length(), 1))
|
||||
{
|
||||
std::cerr << "Error create Data";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error create Data" << std::endl;
|
||||
}
|
||||
|
||||
/* move string data to gpgmeData */
|
||||
@ -1224,8 +1165,7 @@ bool AuthGPG::LoadCertificateFromString(std::string str, std::string &gpg_id)
|
||||
|
||||
if (GPG_ERR_NO_ERROR != gpgme_op_import (CTX,gpgmeData))
|
||||
{
|
||||
std::cerr << "AuthGPG::LoadCertificateFromString() Error Importing Certificate";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "AuthGPG::LoadCertificateFromString() Error Importing Certificate" << std::endl;
|
||||
return false ;
|
||||
}
|
||||
|
||||
@ -1285,8 +1225,7 @@ bool AuthGPG::setAcceptToConnectGPGCertificate(std::string gpg_id, bool acceptan
|
||||
{
|
||||
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "AuthGPG::markGPGCertificateAsFriends(" << gpg_id << ")";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "AuthGPG::markGPGCertificateAsFriends(" << gpg_id << ")" << std::endl;
|
||||
#endif
|
||||
|
||||
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
|
||||
@ -1310,8 +1249,7 @@ bool AuthGPG::SignCertificateLevel0(GPG_id id)
|
||||
{
|
||||
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "AuthGPG::SignCertificat(" << id << ")";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "AuthGPG::SignCertificat(" << id << ")" << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
@ -1332,8 +1270,7 @@ bool AuthGPG::RevokeCertificate(std::string id)
|
||||
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
|
||||
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "AuthGPG::RevokeCertificate(" << id << ") not implemented yet";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "AuthGPG::RevokeCertificate(" << id << ") not implemented yet" << std::endl;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
@ -1467,8 +1404,7 @@ void AuthGPG::showData(gpgme_data_t dh)
|
||||
ret = gpgme_data_seek (dh, 0, SEEK_SET);
|
||||
if (ret)
|
||||
{
|
||||
std::cerr << "Fail data seek";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Fail data seek" << std::endl;
|
||||
// fail_if_err (gpgme_err_code_from_errno (errno));
|
||||
}
|
||||
|
||||
@ -1477,8 +1413,7 @@ void AuthGPG::showData(gpgme_data_t dh)
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cerr << "Fail data seek";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Fail data seek" << std::endl;
|
||||
//fail_if_err (gpgme_err_code_from_errno (errno));
|
||||
}
|
||||
}
|
||||
@ -1639,8 +1574,7 @@ static gpgme_key_t getKey(gpgme_ctx_t CTX, std::string name, std::string comment
|
||||
|
||||
if (GPG_ERR_NO_ERROR != gpgme_op_keylist_end(CTX))
|
||||
{
|
||||
std::cerr << "Error ending KeyList";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error ending KeyList" << std::endl;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -2087,7 +2021,9 @@ RsSerialiser *AuthGPG::setupSerialiser()
|
||||
|
||||
std::list<RsItem*> AuthGPG::saveList(bool& cleanup)
|
||||
{
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "AuthGPG::saveList() called" << std::endl ;
|
||||
#endif
|
||||
|
||||
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
|
||||
|
||||
@ -2104,7 +2040,9 @@ std::list<RsItem*> AuthGPG::saveList(bool& cleanup)
|
||||
}
|
||||
RsTlvKeyValue kv;
|
||||
kv.key = mapIt->first;
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "AuthGPG::saveList() called (mapIt->second) : " << (mapIt->second) << std::endl ;
|
||||
#endif
|
||||
kv.value = (mapIt->second)?"TRUE":"FALSE" ;
|
||||
vitem->tlvkvs.pairs.push_back(kv) ;
|
||||
}
|
||||
@ -2115,7 +2053,9 @@ std::list<RsItem*> AuthGPG::saveList(bool& cleanup)
|
||||
|
||||
bool AuthGPG::loadList(std::list<RsItem*> load)
|
||||
{
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "AuthGPG::loadList() Item Count: " << load.size() << std::endl;
|
||||
#endif
|
||||
|
||||
RsStackMutex stack(pgpMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
@ -2127,9 +2067,11 @@ bool AuthGPG::loadList(std::list<RsItem*> load)
|
||||
RsConfigKeyValueSet *vitem = dynamic_cast<RsConfigKeyValueSet *>(*it);
|
||||
|
||||
if(vitem) {
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "AuthGPG::loadList() General Variable Config Item:" << std::endl;
|
||||
vitem->print(std::cerr, 10);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::list<RsTlvKeyValue>::iterator kit;
|
||||
for(kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); kit++) {
|
||||
@ -2140,8 +2082,10 @@ bool AuthGPG::loadList(std::list<RsItem*> load)
|
||||
//set the gpg key
|
||||
certmap::iterator it;
|
||||
if (mKeyList.end() != (it = mKeyList.find(kit->key))) {
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "AuthGPG::loadList() setting accept to : " << (kit->value == "TRUE");
|
||||
std::cerr << " for gpg key id : " << kit->key << std::endl;
|
||||
#endif
|
||||
it->second.accept_connection = (kit->value == "TRUE");
|
||||
}
|
||||
}
|
||||
|
@ -431,9 +431,6 @@ int AuthSSL::InitAuth(const char *cert_file, const char *priv_key_file,
|
||||
std::cerr << "AuthSSL::InitAuth()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if ( passwd == NULL || strlen(passwd) == 0) {
|
||||
std::cerr << "Warning : AuthSSL::InitAuth passwd empty." << std::endl;
|
||||
}
|
||||
|
||||
static int initLib = 0;
|
||||
if (!initLib)
|
||||
@ -454,7 +451,7 @@ static int initLib = 0;
|
||||
(priv_key_file == NULL) ||
|
||||
(passwd == NULL))
|
||||
{
|
||||
fprintf(stderr, "sslroot::initssl() missing parameters!\n");
|
||||
//fprintf(stderr, "sslroot::initssl() missing parameters!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1946,35 +1943,23 @@ X509 *AuthSSL::SignX509Req(X509_REQ *req, long days)
|
||||
|
||||
bool AuthSSL::AuthX509(X509 *x509)
|
||||
{
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
fprintf(stderr, "AuthSSL::AuthX509() called\n");
|
||||
#endif
|
||||
|
||||
RsStackMutex stack(sslMtx); /******* LOCKED ******/
|
||||
|
||||
/* extract CN for peer Id */
|
||||
std::string issuer = getX509CNString(x509->cert_info->issuer);
|
||||
RsPeerDetails pd;
|
||||
std::cerr << "Checking GPG issuer : " << issuer << std::endl ;
|
||||
if (!AuthGPG::getAuthGPG()->getGPGDetails(issuer, pd))
|
||||
{
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "Checking GPG issuer : " << issuer << std::endl ;
|
||||
#endif
|
||||
if (!AuthGPG::getAuthGPG()->getGPGDetails(issuer, pd)) {
|
||||
std::cerr << "AuthSSL::AuthX509() X509 NOT authenticated : AuthGPG::getAuthGPG()->getGPGDetails() returned false." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// //check that the issuer is in the accepted GPG key list.
|
||||
// if (!pd.ownsign || !pd.is_connect_accepted_even_without_ownsign) {
|
||||
// //check that the gpg key is not one of our private key (usefull for initialisation)
|
||||
// std::list<std::string> privateIds;
|
||||
// AuthGPG::getAuthGPG()->availableGPGCertificatesWithPrivateKeys(privateIds);
|
||||
// bool isAccepted = false;
|
||||
// for(std::list<std::string>::iterator it = acceptedIds.begin(); it != privateIds.end(); it++){
|
||||
// std::cerr << "AuthSSL::AuthX509() : accepted id : " << *it << std::endl;
|
||||
// if (*it == issuer) {
|
||||
// isAccepted = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/* verify GPG signature */
|
||||
|
||||
/*** NOW The Manual signing bit (HACKED FROM asn1/a_sign.c) ***/
|
||||
@ -2002,10 +1987,12 @@ bool AuthSSL::AuthX509(X509 *x509)
|
||||
sigoutll=sigoutl=2048; //hashoutl; //EVP_PKEY_size(pkey);
|
||||
buf_sigout=(unsigned char *)OPENSSL_malloc((unsigned int)sigoutl);
|
||||
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "Buffer Sizes: in: " << inl;
|
||||
std::cerr << " HashOut: " << hashoutl;
|
||||
std::cerr << " SigOut: " << sigoutl;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if ((buf_in == NULL) || (buf_hashout == NULL) || (buf_sigout == NULL)) {
|
||||
hashoutl=0;
|
||||
@ -2015,7 +2002,9 @@ bool AuthSSL::AuthX509(X509 *x509)
|
||||
}
|
||||
p=buf_in;
|
||||
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "Buffers Allocated" << std::endl;
|
||||
#endif
|
||||
|
||||
i2d(data,&p);
|
||||
/* data in buf_in, ready to be hashed */
|
||||
@ -2029,7 +2018,9 @@ bool AuthSSL::AuthX509(X509 *x509)
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "Digest Applied: len: " << hashoutl << std::endl;
|
||||
#endif
|
||||
|
||||
/* copy data into signature */
|
||||
sigoutl = signature->length;
|
||||
@ -2037,17 +2028,21 @@ bool AuthSSL::AuthX509(X509 *x509)
|
||||
|
||||
/* NOW check sign via GPG Functions */
|
||||
//get the fingerprint of the key that is supposed to sign
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "AuthSSL::AuthX509() verifying the gpg sig with keyprint : " << pd.fpr << std::endl;
|
||||
std::cerr << "Sigoutl = " << sigoutl << std::endl ;
|
||||
std::cerr << "pd.fpr = " << pd.fpr << std::endl ;
|
||||
std::cerr << "hashoutl = " << hashoutl << std::endl ;
|
||||
#endif
|
||||
|
||||
if (!AuthGPG::getAuthGPG()->VerifySignBin(buf_hashout, hashoutl, buf_sigout, (unsigned int) sigoutl, pd.fpr)) {
|
||||
sigoutl = 0;
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "AuthSSL::AuthX509() X509 authenticated" << std::endl;
|
||||
#endif
|
||||
return true;
|
||||
|
||||
err:
|
||||
@ -2116,46 +2111,6 @@ bool AuthSSL::decrypt(void *&out, int &outlen, const void *in, int inlen)
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
/* check that they are exact match */
|
||||
//bool AuthSSL::CheckCertificate(std::string x509Id, X509 *x509)
|
||||
//{
|
||||
// sslMtx.lock(); /***** LOCK *****/
|
||||
//
|
||||
// sslcert *cert = NULL;
|
||||
// if (!locked_FindCert(x509Id, &cert))
|
||||
// {
|
||||
// /* not there -> error */
|
||||
// X509_free(x509);
|
||||
//
|
||||
// sslMtx.unlock(); /**** UNLOCK ****/
|
||||
// return false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// /* have a duplicate */
|
||||
// /* check that they are exact */
|
||||
// if (0 != X509_cmp(cert->certificate, x509))
|
||||
// {
|
||||
// /* MAJOR ERROR */
|
||||
// X509_free(x509);
|
||||
// sslMtx.unlock(); /**** UNLOCK ****/
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// /* transfer new signatures */
|
||||
// //X509_copy_known_signatures(pgp_keyring, cert->certificate, x509);
|
||||
// X509_free(x509);
|
||||
//
|
||||
// /* update signers */
|
||||
// //cert->signers = getX509signers(cert->certificate);
|
||||
//
|
||||
// sslMtx.unlock(); /**** UNLOCK ****/
|
||||
// return true;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
/********************************************************************************/
|
||||
/********************************************************************************/
|
||||
/********************************************************************************/
|
||||
@ -2179,9 +2134,10 @@ int AuthSSL::VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx)
|
||||
err = X509_STORE_CTX_get_error(ctx);
|
||||
depth = X509_STORE_CTX_get_error_depth(ctx);
|
||||
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "AuthSSL::VerifyX509Callback(preverify_ok: " << preverify_ok
|
||||
<< " Err: " << err << " Depth: " << depth;
|
||||
std::cerr << std::endl;
|
||||
<< " Err: " << err << " Depth: " << depth << std::endl;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Retrieve the pointer to the SSL of the connection currently treated
|
||||
@ -2190,13 +2146,16 @@ int AuthSSL::VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx)
|
||||
|
||||
X509_NAME_oneline(X509_get_subject_name(err_cert), buf, 256);
|
||||
|
||||
std::cerr << "AuthSSL::VerifyX509Callback: depth: " << depth << ":" << buf;
|
||||
std::cerr << std::endl;
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "AuthSSL::VerifyX509Callback: depth: " << depth << ":" << buf << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
if (!preverify_ok) {
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
fprintf(stderr, "Verify error:num=%d:%s:depth=%d:%s\n", err,
|
||||
X509_verify_cert_error_string(err), depth, buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2210,7 +2169,9 @@ int AuthSSL::VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx)
|
||||
X509_NAME_oneline(X509_get_issuer_name(X509_STORE_CTX_get_current_cert(ctx)), buf, 256);
|
||||
printf("issuer= %s\n", buf);
|
||||
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
fprintf(stderr, "Doing REAL PGP Certificates\n");
|
||||
#endif
|
||||
/* do the REAL Authentication */
|
||||
if (!AuthX509(X509_STORE_CTX_get_current_cert(ctx)))
|
||||
{
|
||||
@ -2230,48 +2191,6 @@ int AuthSSL::VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx)
|
||||
}
|
||||
preverify_ok = true;
|
||||
|
||||
// if ((err == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT) ||
|
||||
// (err == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY))
|
||||
// {
|
||||
// X509_NAME_oneline(X509_get_issuer_name(X509_STORE_CTX_get_current_cert(ctx)), buf, 256);
|
||||
// printf("issuer= %s\n", buf);
|
||||
//
|
||||
// fprintf(stderr, "Doing REAL PGP Certificates\n");
|
||||
// /* do the REAL Authentication */
|
||||
// if (!AuthX509(X509_STORE_CTX_get_current_cert(ctx)))
|
||||
// {
|
||||
// fprintf(stderr, "AuthSSL::VerifyX509Callback() X509 not authenticated.\n");
|
||||
// return false;
|
||||
// }
|
||||
// std::string pgpid = getX509CNString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->issuer);
|
||||
// if (!AuthGPG::getAuthGPG()->isGPGAccepted(pgpid) && pgpid != AuthGPG::getAuthGPG()->getGPGOwnId())
|
||||
// {
|
||||
// fprintf(stderr, "AuthSSL::VerifyX509Callback() pgp key not signed by ourself : \n");
|
||||
// fprintf(stderr, "issuer pgpid : ");
|
||||
// fprintf(stderr, "%s\n",pgpid.c_str());
|
||||
// fprintf(stderr, "\n AuthGPG::getAuthGPG()->getGPGOwnId() : ");
|
||||
// fprintf(stderr, "%s\n",AuthGPG::getAuthGPG()->getGPGOwnId().c_str());
|
||||
// fprintf(stderr, "\n");
|
||||
// return false;
|
||||
// }
|
||||
// preverify_ok = true;
|
||||
// }
|
||||
// else if ((err == X509_V_ERR_CERT_UNTRUSTED) ||
|
||||
// (err == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE))
|
||||
// {
|
||||
// std::string pgpid = getX509CNString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->issuer);
|
||||
// if (!AuthGPG::getAuthGPG()->isGPGAccepted(pgpid) && pgpid != AuthGPG::getAuthGPG()->getGPGOwnId())
|
||||
// {
|
||||
// fprintf(stderr, "AuthSSL::VerifyX509Callback() pgp key not signed by ourself : \n");
|
||||
// fprintf(stderr, "issuer pgpid : ");
|
||||
// fprintf(stderr, "%s\n",pgpid.c_str());
|
||||
// fprintf(stderr, "\n AuthGPG::getAuthGPG()->getGPGOwnId() : ");
|
||||
// fprintf(stderr, "%s\n",AuthGPG::getAuthGPG()->getGPGOwnId().c_str());
|
||||
// fprintf(stderr, "\n");
|
||||
// return false;
|
||||
// }
|
||||
// preverify_ok = true;
|
||||
// }
|
||||
} else {
|
||||
fprintf(stderr, "Failing Normal Certificate!!!\n");
|
||||
preverify_ok = false;
|
||||
@ -2374,8 +2293,10 @@ int LoadCheckX509andGetLocation(const char *cert_file, std::string &location, st
|
||||
return false ;
|
||||
}
|
||||
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "getX509LocString ok. Info:" << std::endl ;
|
||||
std::cout << getX509Info(x509) << std::endl ;
|
||||
#endif
|
||||
// clean up.
|
||||
X509_free(x509);
|
||||
|
||||
@ -2419,7 +2340,9 @@ int LoadCheckX509andGetIssuerName(const char *cert_file, std::string &issuerName
|
||||
issuerName = getX509CNString(x509->cert_info->issuer);
|
||||
}
|
||||
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cout << getX509Info(x509) << std::endl ;
|
||||
#endif
|
||||
// clean up.
|
||||
X509_free(x509);
|
||||
|
||||
|
@ -38,14 +38,10 @@
|
||||
* #define CONFIG_DEBUG 1
|
||||
***/
|
||||
|
||||
#define CONFIG_DEBUG 1
|
||||
|
||||
p3ConfigMgr::p3ConfigMgr(std::string dir, std::string fname, std::string signame)
|
||||
:basedir(dir), metafname(fname), metasigfname(signame),
|
||||
mConfigSaveActive(true)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void p3ConfigMgr::tick()
|
||||
@ -464,9 +460,9 @@ bool p3Config::saveConfiguration()
|
||||
std::string fname = Filename();
|
||||
std::string fnametmp = Filename()+".tmp";
|
||||
|
||||
std::cerr << "Writting p3config file " << fname.c_str() << std::endl ;
|
||||
#ifdef CONFIG_DEBUG
|
||||
std::cerr << "p3Config::saveConfiguration() toSave " << toSave.size();
|
||||
std::cerr << "Writting p3config file " << fname.c_str() << std::endl ;
|
||||
std::cerr << "p3Config::saveConfiguration() toSave " << toSave.size();
|
||||
std::cerr << " Elements to File: " << fname;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
@ -308,7 +308,9 @@ void p3ConnectMgr::netReset()
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "p3ConnectMgr::netReset() shutdown" << std::endl;
|
||||
#endif
|
||||
|
||||
shutdown(); /* blocking shutdown call */
|
||||
|
||||
@ -324,7 +326,9 @@ void p3ConnectMgr::netReset()
|
||||
/* check Network Address */
|
||||
checkNetAddress();
|
||||
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "p3ConnectMgr::netReset() done" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* to allow resets of network stuff */
|
||||
@ -343,11 +347,15 @@ void p3ConnectMgr::startListeners() {
|
||||
* as it calls back to p3ConnMgr.
|
||||
*/
|
||||
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "p3ConnectMgr::netReset() resetting listeners" << std::endl;
|
||||
#endif
|
||||
std::list<pqiNetListener *>::const_iterator it;
|
||||
for(it = mNetListeners.begin(); it != mNetListeners.end(); it++)
|
||||
{
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "p3ConnectMgr::netReset() reset listener" << std::endl;
|
||||
#endif
|
||||
(*it)->reset_listener();
|
||||
}
|
||||
mListenerActive = true;
|
||||
@ -2947,7 +2955,9 @@ std::list<RsItem *> p3ConnectMgr::saveList(bool &cleanup)
|
||||
kv.value = (use_extr_addr_finder)?"TRUE":"FALSE" ;
|
||||
vitem->tlvkvs.pairs.push_back(kv) ;
|
||||
|
||||
#ifdef CONN_DEBUG
|
||||
std::cout << "Pushing item for use_extr_addr_finder = " << use_extr_addr_finder << std::endl ;
|
||||
#endif
|
||||
saveData.push_back(vitem);
|
||||
|
||||
// Now save config for network digging strategies
|
||||
@ -2959,7 +2969,9 @@ std::list<RsItem *> p3ConnectMgr::saveList(bool &cleanup)
|
||||
kv2.value = (allow_tunnel_connection)?"TRUE":"FALSE" ;
|
||||
vitem2->tlvkvs.pairs.push_back(kv2) ;
|
||||
|
||||
#ifdef CONN_DEBUG
|
||||
std::cout << "Pushing item for allow_tunnel_connection = " << allow_tunnel_connection << std::endl ;
|
||||
#endif
|
||||
saveData.push_back(vitem2);
|
||||
|
||||
return saveData;
|
||||
|
@ -186,7 +186,9 @@ int pqipersongrp::init_listener()
|
||||
|
||||
int pqipersongrp::restart_listener()
|
||||
{
|
||||
#ifdef PGRP_DEBUG
|
||||
std::cerr << "pqipersongrp::restart_listener()" << std::endl;
|
||||
#endif
|
||||
|
||||
// stop it,
|
||||
// change the address.
|
||||
@ -199,7 +201,9 @@ int pqipersongrp::restart_listener()
|
||||
|
||||
if (haveListener)
|
||||
{
|
||||
#ifdef PGRP_DEBUG
|
||||
std::cerr << "pqipersongrp::restart_listener() haveListener" << std::endl;
|
||||
#endif
|
||||
|
||||
peerConnectState state;
|
||||
mConnMgr->getOwnNetStatus(state);
|
||||
@ -210,7 +214,9 @@ int pqipersongrp::restart_listener()
|
||||
pqil -> setListenAddr(state.currentlocaladdr);
|
||||
pqil -> setuplisten();
|
||||
|
||||
#ifdef PGRP_DEBUG
|
||||
std::cerr << "pqipersongrp::restart_listener() done!" << std::endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
return 1;
|
||||
|
@ -169,7 +169,7 @@ int pqissllistenbase::setuplisten()
|
||||
out << "\tSetup Port: " << ntohs(laddr.sin_port);
|
||||
|
||||
pqioutput(PQL_DEBUG_BASIC, pqissllistenzone, out.str());
|
||||
std::cerr << out.str() << std::endl;
|
||||
//std::cerr << out.str() << std::endl;
|
||||
}
|
||||
|
||||
/* added a call to REUSEADDR, so that we can re-open an existing socket
|
||||
|
@ -743,10 +743,10 @@ continue_packet:
|
||||
|
||||
// create packet, based on header.
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "Read Data Block -> Incoming Pkt(";
|
||||
out << blen + extralen << ")" << std::endl;
|
||||
// std::cerr << out.str() ;
|
||||
std::ostringstream out;
|
||||
out << "Read Data Block -> Incoming Pkt(";
|
||||
out << blen + extralen << ")" << std::endl;
|
||||
//std::cerr << out.str() ;
|
||||
pqioutput(PQL_DEBUG_BASIC, pqistreamerzone, out.str());
|
||||
}
|
||||
|
||||
|
@ -526,15 +526,19 @@ bool RsInit::getPreferedAccountId(std::string &id)
|
||||
bool RsInit::getAccountIds(std::list<std::string> &ids)
|
||||
{
|
||||
std::list<accountId>::iterator it;
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "getAccountIds:" << std::endl;
|
||||
#endif
|
||||
|
||||
for(it = RsInitConfig::accountIds.begin(); it != RsInitConfig::accountIds.end(); it++)
|
||||
{
|
||||
std::cerr << "SSL Id: " << it->sslId << " PGP Id " << it->pgpId <<
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "SSL Id: " << it->sslId << " PGP Id " << it->pgpId;
|
||||
std::cerr << " PGP Name: " << it->pgpName;
|
||||
std::cerr << " PGP Email: " << it->pgpEmail;
|
||||
std::cerr << " Location: " << it->location;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
ids.push_back(it->sslId);
|
||||
}
|
||||
@ -694,14 +698,16 @@ bool getAvailableAccounts(std::list<accountId> &ids)
|
||||
for(it = directories.begin(); it != directories.end(); it++)
|
||||
{
|
||||
std::string accountdir = RsInitConfig::basedir + RsInitConfig::dirSeperator + *it;
|
||||
std::cerr << "getAvailableAccounts() Checking: " << *it;
|
||||
std::cerr << std::endl;
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "getAvailableAccounts() Checking: " << *it << std::endl;
|
||||
#endif
|
||||
|
||||
accountId tmpId;
|
||||
if (checkAccount(accountdir, tmpId))
|
||||
{
|
||||
std::cerr << "getAvailableAccounts() Accepted: " << *it;
|
||||
std::cerr << std::endl;
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "getAvailableAccounts() Accepted: " << *it << std::endl;
|
||||
#endif
|
||||
ids.push_back(tmpId);
|
||||
}
|
||||
}
|
||||
@ -727,28 +733,36 @@ static bool checkAccount(std::string accountdir, accountId &id)
|
||||
std::string cert_name = basename + "_cert.pem";
|
||||
std::string userName, userId;
|
||||
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "checkAccount() dir: " << accountdir << std::endl;
|
||||
#endif
|
||||
|
||||
bool ret = false;
|
||||
|
||||
/* check against authmanagers private keys */
|
||||
LoadCheckX509andGetLocation(cert_name.c_str(), id.location, id.sslId);
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << "location: " << id.location << " id: " << id.sslId << std::endl;
|
||||
#endif
|
||||
|
||||
std::string tmpid;
|
||||
if (LoadCheckX509andGetIssuerName(cert_name.c_str(), id.pgpId, tmpid))
|
||||
{
|
||||
std::cerr << "issuerName: " << id.pgpId << " id: " << tmpid << std::endl;
|
||||
RsInit::GetPGPLoginDetails(id.pgpId, id.pgpName, id.pgpEmail);
|
||||
std::cerr << "PGPLoginDetails: " << id.pgpId << " name: " << id.pgpName;
|
||||
std::cerr << " email: " << id.pgpEmail << std::endl;
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "GetIssuerName FAILED!" << std::endl;
|
||||
ret = false;
|
||||
}
|
||||
std::string tmpid;
|
||||
if (LoadCheckX509andGetIssuerName(cert_name.c_str(), id.pgpId, tmpid))
|
||||
{
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "issuerName: " << id.pgpId << " id: " << tmpid << std::endl;
|
||||
#endif
|
||||
RsInit::GetPGPLoginDetails(id.pgpId, id.pgpName, id.pgpEmail);
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "PGPLoginDetails: " << id.pgpId << " name: " << id.pgpName;
|
||||
std::cerr << " email: " << id.pgpEmail << std::endl;
|
||||
#endif
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "GetIssuerName FAILED!" << std::endl;
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -771,8 +785,9 @@ int RsInit::GetPGPLogins(std::list<std::string> &pgpIds) {
|
||||
|
||||
int RsInit::GetPGPLoginDetails(std::string id, std::string &name, std::string &email)
|
||||
{
|
||||
std::cerr << "RsInit::GetPGPLoginDetails for \"" << id << "\"";
|
||||
std::cerr << std::endl;
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "RsInit::GetPGPLoginDetails for \"" << id << "\"" << std::endl;
|
||||
#endif
|
||||
|
||||
name = AuthGPG::getAuthGPG()->getGPGName(id);
|
||||
email = AuthGPG::getAuthGPG()->getGPGEmail(id);
|
||||
@ -795,7 +810,7 @@ bool RsInit::SelectGPGAccount(std::string id)
|
||||
if (0 < AuthGPG::getAuthGPG() -> GPGInit(gpgId))
|
||||
{
|
||||
ok = true;
|
||||
std::cerr << "PGP Auth Success!";
|
||||
std::cerr << "PGP Auth Success! ";
|
||||
std::cerr << "ID: " << id << " NAME: " << name;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
@ -1143,7 +1158,6 @@ int RsInit::LoadCertificates(bool autoLoginNT)
|
||||
}
|
||||
|
||||
std::cerr << "RsInitConfig::load_key.c_str() : " << RsInitConfig::load_key.c_str() << std::endl;
|
||||
std::cerr << "sslPassword : " << sslPassword << std::endl;;
|
||||
if (0 < AuthSSL::getAuthSSL() -> InitAuth(RsInitConfig::load_cert.c_str(), RsInitConfig::load_key.c_str(), sslPassword))
|
||||
{
|
||||
ok = true;
|
||||
@ -1620,7 +1634,7 @@ std::string RsInit::RsConfigDirectory()
|
||||
std::string RsInit::RsProfileConfigDirectory()
|
||||
{
|
||||
std::string dir = RsInitConfig::basedir + RsInitConfig::dirSeperator + RsInitConfig::preferedId;
|
||||
std::cerr << "RsInit::RsProfileConfigDirectory() returning : " << dir << std::endl;
|
||||
//std::cerr << "RsInit::RsProfileConfigDirectory() returning : " << dir << std::endl;
|
||||
return dir;
|
||||
}
|
||||
|
||||
@ -1918,8 +1932,6 @@ int RsServer::StartupRetroShare()
|
||||
|
||||
/**************************************************************************/
|
||||
/* need to Monitor too! */
|
||||
std::cerr << "need to Monitor too!" << std::endl;
|
||||
|
||||
mConnMgr->addMonitor(pqih);
|
||||
mConnMgr->addMonitor(mCacheStrapper);
|
||||
mConnMgr->addMonitor(ad);
|
||||
|
@ -799,7 +799,9 @@ RsSerialiser *p3disc::setupSerialiser()
|
||||
|
||||
std::list<RsItem*> p3disc::saveList(bool& cleanup)
|
||||
{
|
||||
std::cerr << "p3disc::saveList() called" << std::endl ;
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << "p3disc::saveList() called" << std::endl;
|
||||
#endif
|
||||
cleanup = true ;
|
||||
std::list<RsItem*> lst ;
|
||||
|
||||
@ -813,7 +815,9 @@ std::list<RsItem*> p3disc::saveList(bool& cleanup)
|
||||
time_string << mapIt->second;
|
||||
kv.value = time_string.str();
|
||||
vitem->tlvkvs.pairs.push_back(kv) ;
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << "p3disc::saveList() saving : " << mapIt->first << " ; " << mapIt->second << std::endl ;
|
||||
#endif
|
||||
}
|
||||
lst.push_back(vitem);
|
||||
|
||||
@ -822,7 +826,9 @@ std::list<RsItem*> p3disc::saveList(bool& cleanup)
|
||||
|
||||
bool p3disc::loadList(std::list<RsItem*> load)
|
||||
{
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << "p3disc::loadList() Item Count: " << load.size() << std::endl;
|
||||
#endif
|
||||
|
||||
RsStackMutex stack(mDiscMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
@ -832,9 +838,11 @@ bool p3disc::loadList(std::list<RsItem*> load)
|
||||
RsConfigKeyValueSet *vitem = dynamic_cast<RsConfigKeyValueSet *>(*it);
|
||||
|
||||
if(vitem) {
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << "p3disc::loadList() General Variable Config Item:" << std::endl;
|
||||
vitem->print(std::cerr, 10);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::list<RsTlvKeyValue>::iterator kit;
|
||||
for(kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); kit++) {
|
||||
|
@ -191,27 +191,39 @@ int UdpLayer::status(std::ostream &out)
|
||||
|
||||
int UdpLayer::reset(struct sockaddr_in &local)
|
||||
{
|
||||
#ifdef DEBUG_UDP_LAYER
|
||||
std::cerr << "UdpLayer::reset()" << std::endl;
|
||||
#endif
|
||||
|
||||
/* stop the old thread */
|
||||
{
|
||||
RsStackMutex stack(sockMtx); /********** LOCK MUTEX *********/
|
||||
#ifdef DEBUG_UDP_LAYER
|
||||
std::cerr << "UdpLayer::reset() setting stopThread flag" << std::endl;
|
||||
#endif
|
||||
stopThread = true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_UDP_LAYER
|
||||
std::cerr << "UdpLayer::reset() joining" << std::endl;
|
||||
#endif
|
||||
|
||||
join();
|
||||
|
||||
#ifdef DEBUG_UDP_LAYER
|
||||
std::cerr << "UdpLayer::reset() closing socket" << std::endl;
|
||||
#endif
|
||||
close();
|
||||
|
||||
#ifdef DEBUG_UDP_LAYER
|
||||
std::cerr << "UdpLayer::reset() resetting variables" << std::endl;
|
||||
#endif
|
||||
laddr = local;
|
||||
errorState = 0;
|
||||
ttl = UDP_DEF_TTL;
|
||||
|
||||
#ifdef DEBUG_UDP_LAYER
|
||||
std::cerr << "UdpLayer::reset() opening socket" << std::endl;
|
||||
#endif
|
||||
openSocket();
|
||||
|
||||
return 1 ;
|
||||
|
@ -547,7 +547,8 @@ void SharedFilesDialog::openfolder()
|
||||
|
||||
void SharedFilesDialog::preModDirectories(bool update_local)
|
||||
{
|
||||
std::cerr << "SharedFilesDialog::preModDirectories called with update_local = " << update_local << std::endl ;
|
||||
|
||||
//std::cerr << "SharedFilesDialog::preModDirectories called with update_local = " << update_local << std::endl ;
|
||||
if (update_local)
|
||||
localModel->preMods();
|
||||
else
|
||||
@ -557,7 +558,7 @@ void SharedFilesDialog::preModDirectories(bool update_local)
|
||||
|
||||
void SharedFilesDialog::postModDirectories(bool update_local)
|
||||
{
|
||||
std::cerr << "SharedFilesDialog::postModDirectories called with update_local = " << update_local << std::endl ;
|
||||
//std::cerr << "SharedFilesDialog::postModDirectories called with update_local = " << update_local << std::endl ;
|
||||
if (update_local)
|
||||
{
|
||||
localModel->postMods();
|
||||
|
Loading…
Reference in New Issue
Block a user