mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
save and check token
This commit is contained in:
parent
55f6fe6d3a
commit
e0f80c9f91
2 changed files with 15 additions and 2 deletions
|
@ -169,7 +169,16 @@ namespace client
|
|||
LogPrint (eLogInfo, v.first);
|
||||
if (!v.first.empty())
|
||||
{
|
||||
if (v.first != I2P_CONTROL_PARAM_TOKEN) // exclude Token. TODO: verify it
|
||||
if (v.first == I2P_CONTROL_PARAM_TOKEN)
|
||||
{
|
||||
if (!m_Tokens.count (v.second.data ()))
|
||||
{
|
||||
LogPrint (eLogWarning, "Unknown token ", v.second.data ());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
params[v.first] = v.second.data ();
|
||||
}
|
||||
}
|
||||
|
@ -252,7 +261,9 @@ namespace client
|
|||
if (password != m_Password)
|
||||
LogPrint (eLogError, "I2PControl Authenticate Invalid password ", password, " expected ", m_Password);
|
||||
results[I2P_CONTROL_PARAM_API] = api;
|
||||
results[I2P_CONTROL_PARAM_TOKEN] = boost::lexical_cast<std::string>(i2p::util::GetSecondsSinceEpoch ());
|
||||
std::string token = boost::lexical_cast<std::string>(i2p::util::GetSecondsSinceEpoch ());
|
||||
m_Tokens.insert (token);
|
||||
results[I2P_CONTROL_PARAM_TOKEN] = token;
|
||||
}
|
||||
|
||||
void I2PControlService::EchoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue