Userpass needs to be copied to user and pass earlier to allow stratum authorisation to work with it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/cgminer.c b/cgminer.c
index db132b1..7c3d2d1 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -644,6 +644,7 @@ static char *set_pass(const char *arg)
static char *set_userpass(const char *arg)
{
struct pool *pool;
+ char *updup;
if (total_users || total_passes)
return "Use only user + pass or userpass, but not both";
@@ -652,7 +653,14 @@ static char *set_userpass(const char *arg)
add_pool();
pool = pools[total_userpasses - 1];
+ updup = strdup(arg);
opt_set_charp(arg, &pool->rpc_userpass);
+ pool->rpc_user = strtok(updup, ":");
+ if (!pool->rpc_user)
+ return "Failed to find : delimited user info";
+ pool->rpc_pass = strtok(NULL, ":");
+ if (!pool->rpc_pass)
+ return "Failed to find : delimited pass info";
return NULL;
}
@@ -6085,14 +6093,6 @@ int main(int argc, char *argv[])
if (!pool->rpc_userpass)
quit(1, "Failed to malloc userpass");
sprintf(pool->rpc_userpass, "%s:%s", pool->rpc_user, pool->rpc_pass);
- } else {
- pool->rpc_user = malloc(strlen(pool->rpc_userpass) + 1);
- if (!pool->rpc_user)
- quit(1, "Failed to malloc user");
- strcpy(pool->rpc_user, pool->rpc_userpass);
- pool->rpc_user = strtok(pool->rpc_user, ":");
- if (!pool->rpc_user)
- quit(1, "Failed to find colon delimiter in userpass");
}
}
/* Set the currentpool to pool 0 */