From 8d5bd0c956bce50de3327b20c0b9e5c0c89d5df4 Mon Sep 17 00:00:00 2001 From: erqan Date: Wed, 12 Aug 2015 18:50:25 +0300 Subject: [PATCH] signing userpost without rt/sig_rt to do rt again... --- src/twister.cpp | 14 ++++++++++++++ src/twister_utils.cpp | 1 + 2 files changed, 15 insertions(+) diff --git a/src/twister.cpp b/src/twister.cpp index ec3d7d27..f9cde0f5 100644 --- a/src/twister.cpp +++ b/src/twister.cpp @@ -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 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; diff --git a/src/twister_utils.cpp b/src/twister_utils.cpp index beac6a00..d1ad08fd 100644 --- a/src/twister_utils.cpp +++ b/src/twister_utils.cpp @@ -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 ) {