mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 18:11:05 +00:00
Fix --userpass option.
This commit is contained in:
parent
d6da0652ce
commit
35d868fb48
4 changed files with 17 additions and 22 deletions
|
@ -98,7 +98,20 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch
|
||||||
return set(doc, "algo", arg);
|
return set(doc, "algo", arg);
|
||||||
|
|
||||||
case IConfig::UserpassKey: /* --userpass */
|
case IConfig::UserpassKey: /* --userpass */
|
||||||
return add(doc, kPools, "userpass", arg);
|
{
|
||||||
|
const char *p = strrchr(arg, ':');
|
||||||
|
if (!p) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *user = new char[p - arg + 1]();
|
||||||
|
strncpy(user, arg, static_cast<size_t>(p - arg));
|
||||||
|
|
||||||
|
add<const char *>(doc, kPools, "user", user);
|
||||||
|
add(doc, kPools, "pass", p + 1);
|
||||||
|
delete [] user;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case IConfig::UrlKey: /* --url */
|
case IConfig::UrlKey: /* --url */
|
||||||
return add(doc, kPools, "url", arg, true);
|
return add(doc, kPools, "url", arg, true);
|
||||||
|
|
|
@ -541,7 +541,7 @@ int64_t xmrig::Client::send(const rapidjson::Document &doc)
|
||||||
|
|
||||||
int64_t xmrig::Client::send(size_t size)
|
int64_t xmrig::Client::send(size_t size)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("[%s] send (%d bytes): \"%s\"", url(), size, m_sendBuf);
|
LOG_DEBUG("[%s] send (%d bytes): \"%.*s\"", url(), size, static_cast<int>(size) - 1, m_sendBuf);
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
if (isTLS()) {
|
if (isTLS()) {
|
||||||
|
@ -676,7 +676,7 @@ void xmrig::Client::parse(char *line, size_t len)
|
||||||
{
|
{
|
||||||
startTimeout();
|
startTimeout();
|
||||||
|
|
||||||
LOG_DEBUG("[%s] received (%d bytes): \"%s\"", url(), len, line);
|
LOG_DEBUG("[%s] received (%d bytes): \"%.*s\"", url(), len, static_cast<int>(len), line);
|
||||||
|
|
||||||
if (len < 32 || line[0] != '{') {
|
if (len < 32 || line[0] != '{') {
|
||||||
if (!isQuiet()) {
|
if (!isQuiet()) {
|
||||||
|
|
|
@ -246,23 +246,6 @@ bool xmrig::Pool::parse(const char *url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool xmrig::Pool::setUserpass(const char *userpass)
|
|
||||||
{
|
|
||||||
const char *p = strchr(userpass, ':');
|
|
||||||
if (!p) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *user = new char[p - userpass + 1]();
|
|
||||||
strncpy(user, userpass, static_cast<size_t>(p - userpass));
|
|
||||||
|
|
||||||
m_user = user;
|
|
||||||
m_password = p + 1;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
rapidjson::Value xmrig::Pool::toJSON(rapidjson::Document &doc) const
|
rapidjson::Value xmrig::Pool::toJSON(rapidjson::Document &doc) const
|
||||||
{
|
{
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
|
@ -344,7 +327,7 @@ void xmrig::Pool::print() const
|
||||||
LOG_DEBUG ("pass: %s", m_password.data());
|
LOG_DEBUG ("pass: %s", m_password.data());
|
||||||
LOG_DEBUG ("rig-id %s", m_rigId.data());
|
LOG_DEBUG ("rig-id %s", m_rigId.data());
|
||||||
LOG_DEBUG ("algo: %s", m_algorithm.name());
|
LOG_DEBUG ("algo: %s", m_algorithm.name());
|
||||||
LOG_DEBUG ("nicehash: %d", static_cast<int>(m_nicehash));
|
LOG_DEBUG ("nicehash: %d", static_cast<int>(m_flags.test(FLAG_NICEHASH)));
|
||||||
LOG_DEBUG ("keepAlive: %d", m_keepAlive);
|
LOG_DEBUG ("keepAlive: %d", m_keepAlive);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -88,7 +88,6 @@ public:
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
bool isEqual(const Pool &other) const;
|
bool isEqual(const Pool &other) const;
|
||||||
bool parse(const char *url);
|
bool parse(const char *url);
|
||||||
bool setUserpass(const char *userpass);
|
|
||||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||||
void adjust(const Algorithm &algorithm);
|
void adjust(const Algorithm &algorithm);
|
||||||
void setAlgo(const Algorithm &algorithm);
|
void setAlgo(const Algorithm &algorithm);
|
||||||
|
|
Loading…
Reference in a new issue