httpd/httpd-2.2.6-ssllibver.patch
2007-09-18 07:48:57 +00:00

105 lines
3.3 KiB
Diff

--- httpd-2.2.6/modules/ssl/mod_ssl.c.ssllibver
+++ httpd-2.2.6/modules/ssl/mod_ssl.c
@@ -500,7 +500,7 @@ static void ssl_register_hooks(apr_pool_
ap_hook_insert_filter (ssl_hook_Insert_Filter, NULL,NULL, APR_HOOK_MIDDLE);
/* ap_hook_handler (ssl_hook_Upgrade, NULL,NULL, APR_HOOK_MIDDLE); */
- ssl_var_register();
+ ssl_var_register(p);
APR_REGISTER_OPTIONAL_FN(ssl_proxy_enable);
APR_REGISTER_OPTIONAL_FN(ssl_engine_disable);
--- httpd-2.2.6/modules/ssl/ssl_engine_vars.c.ssllibver
+++ httpd-2.2.6/modules/ssl/ssl_engine_vars.c
@@ -58,12 +58,32 @@ static int ssl_is_https(conn_rec *c)
return sslconn && sslconn->ssl;
}
-void ssl_var_register(void)
+static const char var_interface[] = "mod_ssl/" MOD_SSL_VERSION;
+static char var_library_interface[] = SSL_LIBRARY_TEXT;
+static char *var_library = NULL;
+
+void ssl_var_register(apr_pool_t *p)
{
+ char *cp, *cp2;
+
APR_REGISTER_OPTIONAL_FN(ssl_is_https);
APR_REGISTER_OPTIONAL_FN(ssl_var_lookup);
APR_REGISTER_OPTIONAL_FN(ssl_ext_lookup);
- return;
+
+ /* Perform once-per-process library version determination: */
+ var_library = apr_pstrdup(p, SSL_LIBRARY_DYNTEXT);
+
+ if ((cp = strchr(var_library, ' ')) != NULL) {
+ *cp = '/';
+ if ((cp2 = strchr(cp, ' ')) != NULL)
+ *cp2 = NUL;
+ }
+
+ if ((cp = strchr(var_library_interface, ' ')) != NULL) {
+ *cp = '/';
+ if ((cp2 = strchr(cp, ' ')) != NULL)
+ *cp2 = NUL;
+ }
}
/* This function must remain safe to use for a non-SSL connection. */
@@ -635,39 +655,17 @@ static void ssl_var_lookup_ssl_cipher_bi
static char *ssl_var_lookup_ssl_version(apr_pool_t *p, char *var)
{
- static char interface[] = "mod_ssl/" MOD_SSL_VERSION;
- static char library_interface[] = SSL_LIBRARY_TEXT;
- static char *library = NULL;
- char *result;
-
- if (!library) {
- char *cp, *cp2;
- library = apr_pstrdup(p, SSL_LIBRARY_DYNTEXT);
- if ((cp = strchr(library, ' ')) != NULL) {
- *cp = '/';
- if ((cp2 = strchr(cp, ' ')) != NULL)
- *cp2 = NUL;
- }
- if ((cp = strchr(library_interface, ' ')) != NULL) {
- *cp = '/';
- if ((cp2 = strchr(cp, ' ')) != NULL)
- *cp2 = NUL;
- }
- }
-
if (strEQ(var, "INTERFACE")) {
- result = apr_pstrdup(p, interface);
+ return apr_pstrdup(p, var_interface);
}
else if (strEQ(var, "LIBRARY_INTERFACE")) {
- result = apr_pstrdup(p, library_interface);
+ return apr_pstrdup(p, var_library_interface);
}
else if (strEQ(var, "LIBRARY")) {
- result = apr_pstrdup(p, library);
- }
- else {
- result = NULL;
+ return apr_pstrdup(p, var_library);
}
- return result;
+
+ return NULL;
}
--- httpd-2.2.6/modules/ssl/ssl_private.h.ssllibver
+++ httpd-2.2.6/modules/ssl/ssl_private.h
@@ -648,7 +648,7 @@ void ssl_die(void);
void ssl_log_ssl_error(const char *, int, int, server_rec *);
/** Variables */
-void ssl_var_register(void);
+void ssl_var_register(apr_pool_t *p);
char *ssl_var_lookup(apr_pool_t *, server_rec *, conn_rec *, request_rec *, char *);
const char *ssl_ext_lookup(apr_pool_t *p, conn_rec *c, int peer, const char *oid);