diff --git a/src/controller/ha.c b/src/controller/ha.c index 12641c03..de99c2c4 100644 --- a/src/controller/ha.c +++ b/src/controller/ha.c @@ -1080,9 +1080,15 @@ static void *vote_request_thread(void *arg) fcntl(sock, F_SETFL, flags & ~O_NONBLOCK); } - /* ── 2. SSL handshake ────────────────────────────────── */ + /* ── 2. SSL handshake (client side) ─────────────────── */ if (ha->ssl_ctx) { - ssl = SSL_new((SSL_CTX *)ha->ssl_ctx); + /* ha->ssl_ctx was created with TLS_server_method (for incoming connections). + * SSL_connect requires a client-method context, so create one on-demand. */ + SSL_CTX *client_ctx = SSL_CTX_new(TLS_client_method()); + if (!client_ctx) goto deny; + SSL_CTX_set_verify(client_ctx, SSL_VERIFY_NONE, NULL); + ssl = SSL_new(client_ctx); + SSL_CTX_free(client_ctx); /* ssl holds a reference; safe to free ctx */ if (!ssl) goto deny; SSL_set_fd(ssl, sock); int sr;