signing userpost without rt/sig_rt to do rt again...

This commit is contained in:
erqan 2015-08-12 18:50:25 +03:00
parent f857194215
commit 8d5bd0c956
2 changed files with 15 additions and 0 deletions

View File

@ -1618,10 +1618,24 @@ bool createSignedUserpost(entry &v, std::string const &username, int k,
switch(flag)
{
case USERPOST_FLAG_RT:
{
if (msg.size())
{
std::vector<char> buf;
bencode(std::back_inserter(buf), userpost);
std::string sig = createSignature(std::string(buf.data(),buf.size()), username);
if(sig.size())
{
v["sig_wort"] = sig;
} else {
return false;
}
}
//userpost["t"] = "rt";
userpost["rt"] = *ent;
userpost["sig_rt"] = *sig;
break;
}
case USERPOST_FLAG_FAV:
userpost["fav"] = *ent;
userpost["sig_fav"] = *sig;

View File

@ -373,6 +373,7 @@ void hexcapePost(libtorrent::entry &e)
{
if( e.type() == libtorrent::entry::dictionary_t ) {
findAndHexcape(e,"sig_userpost");
findAndHexcape(e,"sig_wort");
if( e.find_key("userpost") ) {
entry &userpost = e["userpost"];
if( userpost.type() == libtorrent::entry::dictionary_t ) {