mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-09 22:37:55 +00:00
ignore far-future message in getposts
This commit is contained in:
parent
a7e9b67e37
commit
4d43c08a5b
@ -123,7 +123,7 @@ void dht_get_observer::reply(msg const& m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64 p_time = p->dict_find_int_value("time");
|
int64 p_time = p->dict_find_int_value("time");
|
||||||
if(!p_time || p_time > GetAdjustedTime() + 2*60*60 ) {
|
if(!p_time || p_time > GetAdjustedTime() + MAX_TIME_IN_FUTURE ) {
|
||||||
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
||||||
TORRENT_LOG(traversal) << "dht_get_observer::reply invalid time";
|
TORRENT_LOG(traversal) << "dht_get_observer::reply invalid time";
|
||||||
#endif
|
#endif
|
||||||
|
@ -1430,7 +1430,7 @@ void node_impl::incoming_request(msg const& m, entry& e)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg_keys[mk_time]->int_value() > GetAdjustedTime() + 2*60*60) {
|
if (msg_keys[mk_time]->int_value() > GetAdjustedTime() + MAX_TIME_IN_FUTURE) {
|
||||||
incoming_error(e, "time > GetAdjustedTime");
|
incoming_error(e, "time > GetAdjustedTime");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1927,6 +1927,10 @@ Value getposts(const Array& params, bool fHelp)
|
|||||||
lazy_entry const* post = v.dict_find_dict("userpost");
|
lazy_entry const* post = v.dict_find_dict("userpost");
|
||||||
int64 time = post->dict_find_int_value("time",-1);
|
int64 time = post->dict_find_int_value("time",-1);
|
||||||
|
|
||||||
|
if(time == -1 || time > GetAdjustedTime() + MAX_TIME_IN_FUTURE ) {
|
||||||
|
printf("getposts: ignoring far-future message by '%s'\n", strUsername.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
entry vEntry;
|
entry vEntry;
|
||||||
vEntry = v;
|
vEntry = v;
|
||||||
hexcapePost(vEntry);
|
hexcapePost(vEntry);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#define BLOCK_AGE_TO_EXPIRE_DHT_ENTRY (2016) // about 2 weeks
|
#define BLOCK_AGE_TO_EXPIRE_DHT_ENTRY (2016) // about 2 weeks
|
||||||
#define BLOCK_AGE_TO_EXPIRE_DHT_POSTS (4320*2) // about 2 months
|
#define BLOCK_AGE_TO_EXPIRE_DHT_POSTS (4320*2) // about 2 months
|
||||||
|
#define MAX_TIME_IN_FUTURE (2*60*60) // same constant as in Bitcoin's main.cpp:CheckBlock()
|
||||||
|
|
||||||
namespace libtorrent {
|
namespace libtorrent {
|
||||||
class entry;
|
class entry;
|
||||||
|
Loading…
Reference in New Issue
Block a user