Good point. Fixed in r1645670. Regards
Rüdiger On 12/15/2014 06:41 AM, Christophe JAILLET wrote: > Hi, > > returning NULL (instead of the proposed "") could be "cleaner" and more in > the spirit of ssl_var_lookup_ssl which > already returns NULL if the lookup can't match. > I've tested with NULL and it also fix the crash for me. > > CJ > > > Le 10/10/2014 19:54, [email protected] a écrit : >> Author: rpluem >> Date: Fri Oct 10 17:54:33 2014 >> New Revision: 1630947 >> >> URL: http://svn.apache.org/r1630947 >> Log: >> * 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 >> >> Modified: >> httpd/httpd/trunk/CHANGES >> httpd/httpd/trunk/modules/ssl/ssl_engine_vars.c >> >> Modified: httpd/httpd/trunk/CHANGES >> URL: >> http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1630947&r1=1630946&r2=1630947&view=diff >> ============================================================================== >> --- httpd/httpd/trunk/CHANGES [utf-8] (original) >> +++ httpd/httpd/trunk/CHANGES [utf-8] Fri Oct 10 17:54:33 2014 >> @@ -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] >> >> Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_vars.c >> URL: >> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_vars.c?rev=1630947&r1=1630946&r2=1630947&view=diff >> ============================================================================== >> --- httpd/httpd/trunk/modules/ssl/ssl_engine_vars.c (original) >> +++ httpd/httpd/trunk/modules/ssl/ssl_engine_vars.c Fri Oct 10 17:54:33 2014 >> @@ -142,7 +142,9 @@ static apr_array_header_t *expr_peer_ext >> 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) > >
