mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-19 14:30:43 -04:00
Completed Basic configuration storage:
* Added read/writetofile() fns to BinMemInterface * Added SignData() fns to AuthXPGP. * Added Certificate saving to AuthXPGP. * added Signatures to Configuration. * now discards messages if Hash is wrong (p3msgservice) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@341 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
08d3634d28
commit
3e1b155f1a
12 changed files with 353 additions and 39 deletions
|
@ -328,20 +328,41 @@ bool p3MsgService::loadConfiguration(std::string &loadHash)
|
|||
|
||||
std::string hashin = in->gethash();
|
||||
|
||||
delete pa_in;
|
||||
|
||||
if (hashin != loadHash)
|
||||
{
|
||||
/* big error message! */
|
||||
std::cerr << "p3MsgService::loadConfiguration() FAILED!" << std::endl;
|
||||
std::cerr << "p3MsgService::loadConfiguration() FAILED!" << std::endl;
|
||||
std::cerr << "p3MsgService::loadConfiguration() FAILED!" << std::endl;
|
||||
std::cerr << "p3MsgService::loadConfiguration() FAILED!" << std::endl;
|
||||
std::cerr << "p3MsgService::loadConfiguration() FAILED!" << std::endl;
|
||||
std::cerr << "p3MsgService::loadConfiguration() FAILED! Msgs Tampered" << std::endl;
|
||||
std::string msgfileold = msgfile + ".failed";
|
||||
|
||||
rename(msgfile.c_str(), msgfileold.c_str());
|
||||
|
||||
std::cerr << "Moving Old file to: " << msgfileold << std::endl;
|
||||
std::cerr << "removing dodgey msgs" << std::endl;
|
||||
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
|
||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||
for(mit = imsg.begin(); mit != imsg.end(); mit++)
|
||||
{
|
||||
delete (mit->second);
|
||||
}
|
||||
imsg.clear();
|
||||
|
||||
for(mit = msgOutgoing.begin(); mit != msgOutgoing.end(); mit++)
|
||||
{
|
||||
delete (mit->second);
|
||||
}
|
||||
msgOutgoing.clear();
|
||||
setHash("");
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
setHash(hashin);
|
||||
|
||||
delete pa_in;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue