proccessing password hash in client send loop

This commit is contained in:
Václav Šmejkal 2024-09-02 15:02:58 +02:00
parent d6e540d9e7
commit 42562013b5
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -260,7 +260,23 @@ int main(void)
}
} else
{
why2_send_socket(line, NULL, listen_socket); //NULL IS SENT BECAUSE IT IS USELESS TO SEND USER FROM CLIENT - SERVER WON'T USE IT
if (__why2_get_asking_password())
{
//REMOVE \n AT THE END OF line
line[strlen(line) - 1] = '\0';
char *hash = why2_sha256(line); //HASHISH
why2_send_socket(hash, NULL, listen_socket); //SEND BUT HASHED
//DEALLOCATION
why2_deallocate(hash);
__why2_set_asking_password(0);
} else
{
why2_send_socket(line, NULL, listen_socket); //NULL IS SENT BECAUSE IT IS USELESS TO SEND USER FROM CLIENT - SERVER WON'T USE IT
}
free(line);
}
}