From b54d5eb102c0c955e7309241d65dcd8a501426fb Mon Sep 17 00:00:00 2001 From: TapTap Date: Fri, 17 Jul 2026 10:07:03 +0200 Subject: [PATCH] fix: io_set_ssl NULL in client_disconnect, SSL* type safety in protocol.h --- src/shared/protocol.c | 4 ++-- src/shared/protocol.h | 4 +++- src/shared/transport_tcp.c | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/shared/protocol.c b/src/shared/protocol.c index c878f32..889305c 100644 --- a/src/shared/protocol.c +++ b/src/shared/protocol.c @@ -15,8 +15,8 @@ void io_set_fds(int read_fd, int write_fd) { io_write_fd = write_fd; } -void io_set_ssl(void *ssl) { - io_ssl = (SSL *)ssl; +void io_set_ssl(SSL *ssl) { + io_ssl = ssl; } static int io_fd(int dir_fd, int file_descriptor) { diff --git a/src/shared/protocol.h b/src/shared/protocol.h index 62dbed5..f9fde30 100644 --- a/src/shared/protocol.h +++ b/src/shared/protocol.h @@ -5,11 +5,13 @@ #include #include +typedef struct ssl_st SSL; + typedef int Status; enum NET_STATUS { STATUS_OK, STATUS_ERROR, STATUS_FINISHED, STATUS_NEXT, STATUS_CHUNK, STATUS_MANIFEST }; void io_set_fds(int read_fd, int write_fd); -void io_set_ssl(void *ssl); +void io_set_ssl(SSL *ssl); bool send_n_data(int file_descriptor, void *data, size_t data_size); bool receive_n_data(int file_descriptor, void *data, size_t data_size); diff --git a/src/shared/transport_tcp.c b/src/shared/transport_tcp.c index 82e33ba..2050ea2 100644 --- a/src/shared/transport_tcp.c +++ b/src/shared/transport_tcp.c @@ -1,5 +1,6 @@ #include "transport_tcp.h" #include "log.h" +#include "protocol.h" #include #include #include @@ -152,6 +153,7 @@ void client_disconnect(Client *client) { SSL_shutdown(client->ssl); SSL_free(client->ssl); client->ssl = NULL; + io_set_ssl(NULL); } close(client->file_descriptor); if (client->ssh_child_pid > 0) {