From a0bb314010b913c37d1cda934b2e4cb60588c6cc Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sat, 1 Feb 2025 18:07:33 +0100 Subject: [PATCH] implemented CA code in client --- src/chat/main/client.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/chat/main/client.c b/src/chat/main/client.c index f22ab73..e5ce425 100644 --- a/src/chat/main/client.c +++ b/src/chat/main/client.c @@ -20,6 +20,7 @@ along with this program. If not, see . #include #include #include +#include #include #include #include @@ -108,6 +109,7 @@ int main(void) pthread_t thread_getline; why2_bool ssqc = 0; char *cmd_arg = NULL; + why2_bool *ca_success; //DEFINE CONNECTION PROPERTIES struct sockaddr_in server_addr; @@ -124,7 +126,11 @@ int main(void) pthread_create(&thread_buffer, NULL, why2_listen_authority, &listen_socket); //LISTEN TO AUTHORITY (only in why2, fuck authorities irl [hi fbi, this is just a joke haha]) why2_deallocate(line); //DEALLOCATE ADDRESS - pthread_join(thread_buffer, NULL); //WAIT UNTIL CA AUTH IS COMPLETED + pthread_join(thread_buffer, (void**) &ca_success); //WAIT UNTIL CA AUTH IS COMPLETED + close(listen_socket); //CLOSE CONNECTION + + if (!*ca_success) why2_die("CA Authentication failed!"); + why2_deallocate(ca_success); //SERVER CONNECT server_addr.sin_port = htons(WHY2_CHAT_SERVER_PORT);