From e3cc8a66f06cf2b89bcc84ca929abefc2f3e62e8 Mon Sep 17 00:00:00 2001 From: Ruediger Pluem Date: Fri, 10 Oct 2014 17:54:33 +0000 Subject: [PATCH] * Check if we are having an SSL connection before looking up SSL related variables during expression evaluation to avoid a crash. If not return an empty string. PR: 57070 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1630947 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ modules/ssl/ssl_engine_vars.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index c1db503d40..52e6ad4128 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) mod_ssl: Do not crash when looking up SSL related variables during + expression evaluation on non SSL connections. PR 57070 [Ruediger Pluem] + *) core: Ensure that httpd exits with an error status when the MPM fails to run. [Yann Ylavic] diff --git a/modules/ssl/ssl_engine_vars.c b/modules/ssl/ssl_engine_vars.c index fa0b0e1fe1..be55ba31d9 100644 --- a/modules/ssl/ssl_engine_vars.c +++ b/modules/ssl/ssl_engine_vars.c @@ -142,7 +142,9 @@ static apr_array_header_t *expr_peer_ext_list_fn(ap_expr_eval_ctx_t *ctx, static const char *expr_var_fn(ap_expr_eval_ctx_t *ctx, const void *data) { char *var = (char *)data; - return ssl_var_lookup_ssl(ctx->p, ctx->c, ctx->r, var); + SSLConnRec *sslconn = myConnConfig(ctx->c); + + return sslconn ? ssl_var_lookup_ssl(ctx->p, ctx->c, ctx->r, var) : ""; } static int ssl_expr_lookup(ap_expr_lookup_parms *parms) -- 2.40.0