Browse Source

Bugfix: Parse userpass option with strchr rather than strtok to avoid usernameless passwords getting into the username field and being displayed

Luke Dashjr 11 years ago
parent
commit
e61da77243
1 changed files with 6 additions and 6 deletions
  1. 6 6
      miner.c

+ 6 - 6
miner.c

@@ -1240,12 +1240,12 @@ static char *set_userpass(const char *arg)
 	pool = pools[total_users - 1];
 	pool = pools[total_users - 1];
 	updup = strdup(arg);
 	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)
-		pool->rpc_pass = "";
+	pool->rpc_user = updup;
+	pool->rpc_pass = strchr(updup, ':');
+	if (pool->rpc_pass)
+		pool->rpc_pass++[0] = '\0';
+	else
+		pool->rpc_pass = &updup[strlen(updup)];
 
 
 	return NULL;
 	return NULL;
 }
 }