fixed max user ask count

This commit is contained in:
Václav Šmejkal 2024-01-28 13:46:00 +01:00
parent cce133e56c
commit b9e85da4dc
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -390,16 +390,16 @@ void *why2_communicate_thread(void *arg)
if (config_username == NULL || strcmp(config_username, "true") == 0) if (config_username == NULL || strcmp(config_username, "true") == 0)
{ {
if (usernames_n++ == WHY2_MAX_USERNAME_TRIES) //ASKED CLIENT WAY TOO FUCKING MANY TIMES FOR USERNAME, KICK HIM
{
exiting = 1;
goto deallocation;
}
if (config_username == NULL) fprintf(stderr, "Your config doesn't contain 'user_pick_username'. Please update your configuration.\n"); if (config_username == NULL) fprintf(stderr, "Your config doesn't contain 'user_pick_username'. Please update your configuration.\n");
while (invalid_username) while (invalid_username)
{ {
if (usernames_n++ == WHY2_MAX_USERNAME_TRIES) //ASKED CLIENT WAY TOO FUCKING MANY TIMES FOR USERNAME, KICK HIM
{
exiting = 1;
goto deallocation;
}
why2_send_socket(WHY2_CHAT_CODE_PICK_USERNAME, WHY2_CHAT_SERVER_USERNAME, connection); //ASK USER FOR USERNAME why2_send_socket(WHY2_CHAT_CODE_PICK_USERNAME, WHY2_CHAT_SERVER_USERNAME, connection); //ASK USER FOR USERNAME
if ((raw = read_user(connection, &raw_ptr)) == NULL) //READ if ((raw = read_user(connection, &raw_ptr)) == NULL) //READ
@ -422,6 +422,7 @@ void *why2_communicate_thread(void *arg)
if (invalid_username) if (invalid_username)
{ {
why2_send_socket(WHY2_CHAT_CODE_INVALID_USERNAME, WHY2_CHAT_SERVER_USERNAME, connection); //TELL THE USER HE IS DUMB AS FUCK why2_send_socket(WHY2_CHAT_CODE_INVALID_USERNAME, WHY2_CHAT_SERVER_USERNAME, connection); //TELL THE USER HE IS DUMB AS FUCK
continue;
} }
printf("User set username.\t%d\t%s\n", connection, decoded_buffer); printf("User set username.\t%d\t%s\n", connection, decoded_buffer);