mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-14 09:29:30 -04:00
allow non signature checking for GR message recepts at intermediate peers when key is missing. Should fix return receipt being lost in the way keeping messages in outbox
This commit is contained in:
parent
ecebaced23
commit
232dba28ea
2 changed files with 14 additions and 10 deletions
|
@ -1543,11 +1543,18 @@ void p3GRouter::handleIncomingReceiptItem(RsGRouterSignedReceiptItem *receipt_it
|
||||||
else
|
else
|
||||||
std::cerr << " checking receipt hash : OK" << std::endl;
|
std::cerr << " checking receipt hash : OK" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
// check signature.
|
// check signature. The policy if the following:
|
||||||
|
// if we're the destination:
|
||||||
|
// signature should check and signing key should be available // always ensures the receipt is valid
|
||||||
|
// else
|
||||||
|
// if key is available, signature should check // early protects against frodulent receipts that we can check
|
||||||
|
|
||||||
|
uint32_t error_status ;
|
||||||
|
|
||||||
if(! verifySignedDataItem(receipt_item))
|
if(! verifySignedDataItem(receipt_item))
|
||||||
|
if( (it->second.routing_flags & GRouterRoutingInfo::ROUTING_FLAGS_IS_ORIGIN) || (error_status != RsGixs::RS_GIXS_ERROR_KEY_NOT_AVAILABLE))
|
||||||
{
|
{
|
||||||
std::cerr << " checking receipt signature : FAILED. Receipt is dropped." << std::endl;
|
std::cerr << " checking receipt signature : FAILED. Receipt is dropped. Error status=" << error_status << std::endl;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
#ifdef GROUTER_DEBUG
|
#ifdef GROUTER_DEBUG
|
||||||
|
@ -1978,7 +1985,7 @@ bool p3GRouter::signDataItem(RsGRouterAbstractMsgItem *item,const RsGxsId& signi
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool p3GRouter::verifySignedDataItem(RsGRouterAbstractMsgItem *item)
|
bool p3GRouter::verifySignedDataItem(RsGRouterAbstractMsgItem *item,uint32_t& error_status)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1997,9 +2004,6 @@ bool p3GRouter::verifySignedDataItem(RsGRouterAbstractMsgItem *item)
|
||||||
if(!item->serialise_signed_data(data,data_size))
|
if(!item->serialise_signed_data(data,data_size))
|
||||||
throw std::runtime_error("Cannot serialise signed data.") ;
|
throw std::runtime_error("Cannot serialise signed data.") ;
|
||||||
|
|
||||||
|
|
||||||
uint32_t error_status ;
|
|
||||||
|
|
||||||
if(!mGixs->validateData(data,data_size,item->signature,true,error_status))
|
if(!mGixs->validateData(data,data_size,item->signature,true,error_status))
|
||||||
{
|
{
|
||||||
switch(error_status)
|
switch(error_status)
|
||||||
|
|
|
@ -263,7 +263,7 @@ private:
|
||||||
|
|
||||||
// signs an item with the given key.
|
// signs an item with the given key.
|
||||||
bool signDataItem(RsGRouterAbstractMsgItem *item,const RsGxsId& id) ;
|
bool signDataItem(RsGRouterAbstractMsgItem *item,const RsGxsId& id) ;
|
||||||
bool verifySignedDataItem(RsGRouterAbstractMsgItem *item) ;
|
bool verifySignedDataItem(RsGRouterAbstractMsgItem *item, uint32_t &error_status) ;
|
||||||
bool encryptDataItem(RsGRouterGenericDataItem *item,const RsGxsId& destination_key) ;
|
bool encryptDataItem(RsGRouterGenericDataItem *item,const RsGxsId& destination_key) ;
|
||||||
bool decryptDataItem(RsGRouterGenericDataItem *item) ;
|
bool decryptDataItem(RsGRouterGenericDataItem *item) ;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue