]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: streams: Move the conn_stream allocation outside #IF USE_OPENSSL.
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 24 Jan 2020 13:10:55 +0000 (14:10 +0100)
committerOlivier Houchard <cognet@ci0.org>
Fri, 24 Jan 2020 13:14:35 +0000 (14:14 +0100)
When commit 477902bd2e8c1e978ad43d22dba1f28525bb797a made the conn_stream
allocation unconditional, it unfortunately moved the code doing the allocation
inside #if USE_OPENSSL, which means anybody compiling haproxy without
openssl wouldn't allocate any conn_stream, and would get a segfault later.
Fix that by moving the code that does the allocation outside #if USE_OPENSSL.

src/backend.c

index 2cf8c751ac0e7f48ea868d8a56a23203a4cae6d7..1c0cf660b7f5f45b25ece9088ffef22c0d408367 100644 (file)
@@ -1386,13 +1386,13 @@ int connect_server(struct stream *s)
                else
                        return SF_ERR_INTERNAL;  /* how did we get there ? */
 
-#if defined(USE_OPENSSL) && defined(TLSEXT_TYPE_application_layer_protocol_negotiation)
                srv_cs = si_alloc_cs(&s->si[1], srv_conn);
                if (!srv_cs) {
                        conn_free(srv_conn);
                        return SF_ERR_RESOURCE;
                }
                srv_conn->ctx = srv_cs;
+#if defined(USE_OPENSSL) && defined(TLSEXT_TYPE_application_layer_protocol_negotiation)
                if (!srv ||
                    ((!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) ||
                    srv->mux_proto || s->be->mode != PR_MODE_HTTP))