Browse Source

Userpass needs to be copied to user and pass earlier to allow stratum authorisation to work with it.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
df91df3507
  1. 16
      cgminer.c

16
cgminer.c

@ -644,6 +644,7 @@ static char *set_pass(const char *arg)
static char *set_userpass(const char *arg) static char *set_userpass(const char *arg)
{ {
struct pool *pool; struct pool *pool;
char *updup;
if (total_users || total_passes) if (total_users || total_passes)
return "Use only user + pass or userpass, but not both"; return "Use only user + pass or userpass, but not both";
@ -652,7 +653,14 @@ static char *set_userpass(const char *arg)
add_pool(); add_pool();
pool = pools[total_userpasses - 1]; pool = pools[total_userpasses - 1];
updup = strdup(arg);
opt_set_charp(arg, &pool->rpc_userpass); 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; return NULL;
} }
@ -6085,14 +6093,6 @@ int main(int argc, char *argv[])
if (!pool->rpc_userpass) if (!pool->rpc_userpass)
quit(1, "Failed to malloc userpass"); quit(1, "Failed to malloc userpass");
sprintf(pool->rpc_userpass, "%s:%s", pool->rpc_user, pool->rpc_pass); 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 */ /* Set the currentpool to pool 0 */

Loading…
Cancel
Save