mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-05 14:01:32 +00:00
stratum: prevent spaces in the username
that was possible since decred 35 chars workaround...
This commit is contained in:
parent
266f78431a
commit
5116ea9f65
1 changed files with 8 additions and 7 deletions
|
@ -181,16 +181,17 @@ bool client_authorize(YAAMP_CLIENT *client, json_value *json_params)
|
|||
{
|
||||
strncpy(client->username, json_params->u.array.values[0]->u.string.ptr, 1023);
|
||||
|
||||
if (client->username[0] == ' ')
|
||||
return false;
|
||||
|
||||
char sep = client->username[34];
|
||||
if (sep == '.' || sep == ',' || sep == ':') {
|
||||
client->username[34] = 0;
|
||||
if (sep == '.' || sep == ',' || sep == ':' || sep == ' ') {
|
||||
client->username[34] = '\0';
|
||||
strncpy(client->worker, client->username+35, 1023-35);
|
||||
// debuglog("%s\n", client->username);
|
||||
// debuglog("%s\n", client->worker);
|
||||
} else if (strlen(client->username) > 35) {
|
||||
client->username[35] = 0;
|
||||
} else if (strlen(client->username) > 35 && client->username[0] >= 'D') {
|
||||
// 35 chars allowed for decred...
|
||||
client->username[35] = '\0';
|
||||
strncpy(client->worker, client->username+36, 1023-36);
|
||||
debuglog("address %s was too long, truncated to 35 chars\n", client->username);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue