removed/improved debug info

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8409 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-06-10 19:56:27 +00:00
parent 91bf1d6cb2
commit 4a6b5dce8f
3 changed files with 44 additions and 17 deletions

View File

@ -106,8 +106,9 @@ void DistantChatService::flush()
pendingDistantChatItems.push_back(cs) ; pendingDistantChatItems.push_back(cs) ;
it->second.last_keep_alive_sent = now ; it->second.last_keep_alive_sent = now ;
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "(II) DistantChatService:: Sending keep alive packet to gxs id " << it->first << std::endl; std::cerr << "(II) DistantChatService:: Sending keep alive packet to gxs id " << it->first << std::endl;
#endif
} }
} }
} }
@ -372,7 +373,9 @@ void DistantChatService::receiveTurtleData(RsTurtleGenericTunnelItem *gitem,cons
} }
if(*((uint64_t*)item->data_bytes) != 0) if(*((uint64_t*)item->data_bytes) != 0)
{ {
#ifdef DEBUG_DISTANT_CHAT
std::cerr << " Item is encrypted." << std::endl; std::cerr << " Item is encrypted." << std::endl;
#endif
// if cannot decrypt, it means the key is wrong. We need to re-negociate a new key. // if cannot decrypt, it means the key is wrong. We need to re-negociate a new key.
@ -380,7 +383,9 @@ void DistantChatService::receiveTurtleData(RsTurtleGenericTunnelItem *gitem,cons
} }
else else
{ {
#ifdef DEBUG_DISTANT_CHAT
std::cerr << " Item is not encrypted." << std::endl; std::cerr << " Item is not encrypted." << std::endl;
#endif
// Now try deserialise the decrypted data to make an RsItem out of it. // Now try deserialise the decrypted data to make an RsItem out of it.
// //

View File

@ -714,14 +714,16 @@ bool p3IdService::validateData(const uint8_t *data,uint32_t data_size,const RsTl
if(signature_key.keyData.bin_data == NULL) if(signature_key.keyData.bin_data == NULL)
{ {
#ifdef DEBUG_IDS
std::cerr << "(EE) Cannot validate signature for unknown key " << signature.keyId << std::endl; std::cerr << "(EE) Cannot validate signature for unknown key " << signature.keyId << std::endl;
#endif
signing_error = RS_GIXS_ERROR_KEY_NOT_AVAILABLE ; signing_error = RS_GIXS_ERROR_KEY_NOT_AVAILABLE ;
return false; return false;
} }
if(!GxsSecurity::validateSignature((char*)data,data_size,signature_key,signature)) if(!GxsSecurity::validateSignature((char*)data,data_size,signature_key,signature))
{ {
std::cerr << "(EE) Signature was verified and it doesn't check! This is a security issue!" << std::endl; std::cerr << "(SS) Signature was verified and it doesn't check! This is a security issue!" << std::endl;
signing_error = RS_GIXS_ERROR_SIGNATURE_MISMATCH ; signing_error = RS_GIXS_ERROR_SIGNATURE_MISMATCH ;
return false; return false;
} }

View File

@ -172,8 +172,10 @@ bool sockaddr_storage_copyip(struct sockaddr_storage &dst, const struct sockaddr
return sockaddr_storage_ipv6_copyip(dst, src); return sockaddr_storage_ipv6_copyip(dst, src);
break; break;
default: default:
std::cerr << "sockaddr_storage_copyip() invalid addr.ss_family"; #ifdef SS_DEBUG
std::cerr << std::endl; std::cerr << "sockaddr_storage_copyip() invalid addr.ss_family";
std::cerr << std::endl;
#endif
break; break;
} }
return false; return false;
@ -220,8 +222,10 @@ bool sockaddr_storage_setport(struct sockaddr_storage &addr, uint16_t port)
return sockaddr_storage_ipv6_setport(addr, port); return sockaddr_storage_ipv6_setport(addr, port);
break; break;
default: default:
std::cerr << "sockaddr_storage_setport() invalid addr.ss_family"; #ifdef SS_DEBUG
std::cerr << std::endl; std::cerr << "sockaddr_storage_setport() invalid addr.ss_family";
std::cerr << std::endl;
#endif
break; break;
} }
return false; return false;
@ -292,8 +296,10 @@ bool operator<(const struct sockaddr_storage &a, const struct sockaddr_storage &
return sockaddr_storage_ipv6_lessthan(a, b); return sockaddr_storage_ipv6_lessthan(a, b);
break; break;
default: default:
std::cerr << "sockaddr_storage_operator<() INVALID Family - error"; #ifdef SS_DEBUG
std::cerr << std::endl; std::cerr << "sockaddr_storage_operator<() INVALID Family - error";
std::cerr << std::endl;
#endif
break; break;
} }
return false; return false;
@ -319,8 +325,10 @@ bool sockaddr_storage_same(const struct sockaddr_storage &addr, const struct soc
return sockaddr_storage_ipv6_same(addr, addr2); return sockaddr_storage_ipv6_same(addr, addr2);
break; break;
default: default:
std::cerr << "sockaddr_storage_same() INVALID Family - error"; #ifdef SS_DEBUG
std::cerr << std::endl; std::cerr << "sockaddr_storage_same() INVALID Family - error";
std::cerr << std::endl;
#endif
break; break;
} }
return false; return false;
@ -356,8 +364,10 @@ bool sockaddr_storage_sameip(const struct sockaddr_storage &addr, const struct s
return sockaddr_storage_ipv6_sameip(addr, addr2); return sockaddr_storage_ipv6_sameip(addr, addr2);
break; break;
default: default:
std::cerr << "sockaddr_storage_sameip() INVALID Family - error"; #ifdef SS_DEBUG
std::cerr << std::endl; std::cerr << "sockaddr_storage_sameip() INVALID Family - error";
std::cerr << std::endl;
#endif
break; break;
} }
return false; return false;
@ -409,8 +419,10 @@ bool sockaddr_storage_samesubnet(const struct sockaddr_storage &addr, const stru
return sockaddr_storage_ipv6_samesubnet(addr, addr2); return sockaddr_storage_ipv6_samesubnet(addr, addr2);
break; break;
default: default:
std::cerr << "sockaddr_storage_samesubnet() INVALID Family - error"; #ifdef SS_DEBUG
std::cerr << std::endl; std::cerr << "sockaddr_storage_samesubnet() INVALID Family - error";
std::cerr << std::endl;
#endif
break; break;
} }
return false; return false;
@ -529,8 +541,10 @@ bool sockaddr_storage_isValidNet(const struct sockaddr_storage &addr)
return sockaddr_storage_ipv6_isValidNet(addr); return sockaddr_storage_ipv6_isValidNet(addr);
break; break;
default: default:
#ifdef SS_DEBUG
std::cerr << "sockaddr_storage_isValidNet() INVALID Family - error: " << sockaddr_storage_iptostring(addr); std::cerr << "sockaddr_storage_isValidNet() INVALID Family - error: " << sockaddr_storage_iptostring(addr);
std::cerr << std::endl; std::cerr << std::endl;
#endif
break; break;
} }
return false; return false;
@ -552,8 +566,10 @@ bool sockaddr_storage_isLoopbackNet(const struct sockaddr_storage &addr)
return sockaddr_storage_ipv6_isLoopbackNet(addr); return sockaddr_storage_ipv6_isLoopbackNet(addr);
break; break;
default: default:
#ifdef SS_DEBUG
std::cerr << "sockaddr_storage_isLoopbackNet() INVALID Family - error: " << sockaddr_storage_iptostring(addr); std::cerr << "sockaddr_storage_isLoopbackNet() INVALID Family - error: " << sockaddr_storage_iptostring(addr);
std::cerr << std::endl; std::cerr << std::endl;
#endif
break; break;
} }
return false; return false;
@ -576,8 +592,10 @@ bool sockaddr_storage_isPrivateNet(const struct sockaddr_storage &addr)
return sockaddr_storage_ipv6_isPrivateNet(addr); return sockaddr_storage_ipv6_isPrivateNet(addr);
break; break;
default: default:
#ifdef SS_DEBUG
std::cerr << "sockaddr_storage_isPrivateNet() INVALID Family - error: " << sockaddr_storage_iptostring(addr); std::cerr << "sockaddr_storage_isPrivateNet() INVALID Family - error: " << sockaddr_storage_iptostring(addr);
std::cerr << std::endl; std::cerr << std::endl;
#endif
break; break;
} }
return false; return false;
@ -600,8 +618,10 @@ bool sockaddr_storage_isExternalNet(const struct sockaddr_storage &addr)
return sockaddr_storage_ipv6_isExternalNet(addr); return sockaddr_storage_ipv6_isExternalNet(addr);
break; break;
default: default:
std::cerr << "sockaddr_storage_isExternalNet() INVALID Family - error"; #ifdef SS_DEBUG
std::cerr << std::endl; std::cerr << "sockaddr_storage_isExternalNet() INVALID Family - error";
std::cerr << std::endl;
#endif
break; break;
} }
return false; return false;