fix ssl settings not stored in the listener

Mon, 22 May 2023 10:22:15 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 22 May 2023 10:22:15 +0200
changeset 492
07452a54a22b
parent 491
5454ae7bf86b
child 493
56cf890dd9ed

fix ssl settings not stored in the listener

src/server/daemon/httplistener.c file | annotate | diff | comparison | revisions
src/server/daemon/httplistener.h file | annotate | diff | comparison | revisions
--- a/src/server/daemon/httplistener.c	Sun May 07 11:53:27 2023 +0200
+++ b/src/server/daemon/httplistener.c	Mon May 22 10:22:15 2023 +0200
@@ -364,7 +364,7 @@
     listener->nacceptors = conf->nacceptors;
     listener->port = conf->port;
     listener->next = NULL;
-    listener->ssl = NULL;
+    //listener->ssl = NULL;
     
     // create sockets
     listener->server_socket = get_socket(conf, LISTENER_PROTO_IPV4);
@@ -595,16 +595,19 @@
     struct sockaddr *ca_ptr;
     socklen_t ca_length;
     ConnectionAddrType addr_type;
+    HttpSSL *socket_ssl = NULL;
     if(acceptor->ipv6) {
         server_socket = listener->server_socket6->socket;
         ca_ptr = (struct sockaddr*)&ca.address_v6;
         ca_length = sizeof(ca.address_v6);
         addr_type = CONN_ADDR_IPV6;
+        socket_ssl = listener->server_socket6->ssl;
     } else {
         server_socket = listener->server_socket->socket;
         ca_ptr = (struct sockaddr*)&ca.address_v4;
         ca_length = sizeof(ca.address_v4);
         addr_type = CONN_ADDR_IPV4;
+        socket_ssl = listener->server_socket->ssl;
     }
     
     log_ereport(LOG_DEBUG, "acceptor: %p listener: %p start", acceptor, acceptor->listener);
@@ -646,7 +649,7 @@
         conn->fd = clientfd;
         conn->listener = ls;
         conn->ssl_accepted = 0;
-        if(ls->ssl) {
+        if(socket_ssl) {
             // SSL connections are always non-blocking 
             // set socket non blocking
             int flags;
@@ -659,7 +662,7 @@
                 free(conn);
                 conn = NULL;
             } else {
-                SSL *ssl = SSL_new(ls->ssl->sslctx);
+                SSL *ssl = SSL_new(socket_ssl->sslctx);
                 if(ssl) {
                     SSL_set_fd(ssl, clientfd);
 
--- a/src/server/daemon/httplistener.h	Sun May 07 11:53:27 2023 +0200
+++ b/src/server/daemon/httplistener.h	Mon May 22 10:22:15 2023 +0200
@@ -100,7 +100,6 @@
     int                  nacceptors;
     uint32_t             nacceptors_running;
     int                  running;
-    HttpSSL              *ssl;
     
     pthread_mutex_t      shutdown_mutex;
     pthread_cond_t       shutdown_cond;

mercurial