Make i2pcontrol password configurable.

pull/242/head
EinMByte 9 years ago
parent 8434863beb
commit 843abb60dd

@ -116,7 +116,8 @@ namespace client
if(i2pcontrolPort) {
m_I2PControlService = new I2PControlService(
i2p::util::config::GetArg("-i2pcontroladdress", "127.0.0.1"),
i2pcontrolPort
i2pcontrolPort,
i2p::util::config::GetArg("-i2pcontrolpassword", I2P_CONTROL_DEFAULT_PASSWORD)
);
m_I2PControlService->Start();
LogPrint("I2PControl started");

@ -100,8 +100,8 @@ void I2PControlSession::Response::setId(const std::string& identifier)
id = identifier;
}
I2PControlSession::I2PControlSession(boost::asio::io_service& ios)
: password(I2P_CONTROL_DEFAULT_PASSWORD), tokens(), tokensMutex(),
I2PControlSession::I2PControlSession(boost::asio::io_service& ios, const std::string& pass)
: password(pass), tokens(), tokensMutex(),
service(ios), shutdownTimer(ios), expireTokensTimer(ios)
{
// Method handlers

@ -108,10 +108,12 @@ public:
/**
* Sets up the appropriate handlers.
* @param pass the password required to authenticate (i.e. obtains a token)
* @param ios the parent io_service object, must remain valid throughout
* the lifetime of this I2PControlSession.
*/
I2PControlSession(boost::asio::io_service& ios);
I2PControlSession(boost::asio::io_service& ios,
const std::string& pass = I2P_CONTROL_DEFAULT_PASSWORD);
/**
* Starts the I2PControlSession.

@ -6,12 +6,10 @@
#include "util/Timestamp.h"
#include "version.h"
namespace i2p
{
namespace client
{
I2PControlService::I2PControlService(const std::string& address, int port)
: m_Session(std::make_shared<I2PControlSession>(m_Service)),
namespace i2p {
namespace client {
I2PControlService::I2PControlService(const std::string& address, int port, const std::string& pass)
: m_Session(std::make_shared<I2PControlSession>(m_Service, pass)),
m_IsRunning(false), m_Thread(nullptr),
m_Acceptor(m_Service, boost::asio::ip::tcp::endpoint(
boost::asio::ip::address::from_string(address), port)

@ -21,7 +21,7 @@ typedef std::array<char, I2P_CONTROL_MAX_REQUEST_SIZE> I2PControlBuffer;
class I2PControlService {
public:
I2PControlService(const std::string& address, int port);
I2PControlService(const std::string& address, int port, const std::string& pass);
~I2PControlService ();
void Start ();

Loading…
Cancel
Save