[Pkg-apache-commits] [SCM] Debian packaging for apache2 (Apache HTTPD 2.x) branch, master, updated. debian/2.2.22-3-4-g201f359

Stefan Fritsch sf at sfritsch.de
Mon Apr 30 21:50:50 UTC 2012


The following commit has been merged in the master branch:
commit 201f359b7de1ab2726b47d8c749b47e4df4661f0
Author: Stefan Fritsch <sf at sfritsch.de>
Date:   Mon Apr 30 23:34:42 2012 +0200

    Make LoadFile/LoadModule use standard dlopen() search paths

diff --git a/debian/changelog b/debian/changelog
index 94a7de3..f8c763a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+apache2 (2.2.22-5) unstable; urgency=low
+
+  * Make LoadFile and LoadModule look in the standard search paths if the
+    dso file name is given as a pure filename. This helps with the multi-arch
+    transition.
+
+ -- Stefan Fritsch <sf at debian.org>  Mon, 30 Apr 2012 23:38:33 +0200
+
 apache2 (2.2.22-4) unstable; urgency=high
 
   * CVE-2012-0216: Remove "Alias /doc /usr/share/doc" from the default virtual
diff --git a/debian/patches/083_dlopen_search_path b/debian/patches/083_dlopen_search_path
new file mode 100644
index 0000000..54671c3
--- /dev/null
+++ b/debian/patches/083_dlopen_search_path
@@ -0,0 +1,145 @@
+Backport r1332378 from upstream trunk:
+
+If a filename without slashes is specified for LoadFile or
+LoadModule and the file cannot be found in the server root directory,
+try to use the standard dlopen() search path.
+
+git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1332378 13f79535-47bb-0310-9956-ffa450edef68
+---
+ modules/mappers/mod_so.c |   77 ++++++++++++++++++++++++++--------------------
+ 1 file changed, 43 insertions(+), 34 deletions(-)
+
+diff --git a/modules/mappers/mod_so.c b/modules/mappers/mod_so.c
+index 2d4a54c..6a9fdae 100644
+--- a/modules/mappers/mod_so.c
++++ b/modules/mappers/mod_so.c
+@@ -144,6 +144,37 @@ static apr_status_t unload_module(void *data)
+     return APR_SUCCESS;
+ }
+ 
++static const char *dso_load(cmd_parms *cmd, apr_dso_handle_t **modhandlep,
++                            const char *filename, const char **used_filename)
++{
++    int retry = 0;
++    const char *fullname = ap_server_root_relative(cmd->temp_pool, filename);
++    char my_error[256];
++    if (filename != NULL && ap_strchr_c(filename, '/') == NULL) {
++        /* retry on error without path to use dlopen()'s search path */
++        retry = 1;
++    }
++
++    if (fullname == NULL && !retry) {
++        return apr_psprintf(cmd->temp_pool, "Invalid %s path %s",
++                            cmd->cmd->name, filename);
++    }
++    *used_filename = fullname;
++    if (apr_dso_load(modhandlep, fullname, cmd->pool) == APR_SUCCESS) {
++        return NULL;
++    }
++    if (retry) {
++        *used_filename = filename;
++        if (apr_dso_load(modhandlep, filename, cmd->pool) == APR_SUCCESS)
++            return NULL;
++    }
++
++    return apr_pstrcat(cmd->temp_pool, "Cannot load ", filename,
++                        " into server: ",
++                        apr_dso_error(*modhandlep, my_error, sizeof(my_error)),
++                        NULL);
++}
++
+ /*
+  * This is called for the directive LoadModule and actually loads
+  * a shared object file into the address space of the server process.
+@@ -155,7 +186,7 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
+     apr_dso_handle_t *modhandle;
+     apr_dso_handle_sym_t modsym;
+     module *modp;
+-    const char *szModuleFile = ap_server_root_relative(cmd->pool, filename);
++    const char *module_file;
+     so_server_conf *sconf;
+     ap_module_symbol_t *modi;
+     ap_module_symbol_t *modie;
+@@ -168,11 +199,6 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
+      */
+     *(ap_directive_t **)dummy = NULL;
+ 
+-    if (!szModuleFile) {
+-        return apr_pstrcat(cmd->pool, "Invalid LoadModule path ",
+-                           filename, NULL);
+-    }
+-
+     /*
+      * check for already existing module
+      * If it already exists, we have nothing to do
+@@ -235,16 +261,11 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
+     /*
+      * Load the file into the Apache address space
+      */
+-    if (apr_dso_load(&modhandle, szModuleFile, cmd->pool) != APR_SUCCESS) {
+-        char my_error[256];
+-
+-        return apr_pstrcat(cmd->pool, "Cannot load ", szModuleFile,
+-                          " into server: ",
+-                          apr_dso_error(modhandle, my_error, sizeof(my_error)),
+-                          NULL);
+-    }
++    error = dso_load(cmd, &modhandle, filename, &module_file);
++    if (error)
++        return error;
+     ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, cmd->pool,
+-                 "loaded module %s", modname);
++                  "loaded module %s from %s", modname, module_file);
+ 
+     /*
+      * Retrieve the pointer to the module structure through the module name:
+@@ -255,7 +276,7 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
+         char my_error[256];
+ 
+         return apr_pstrcat(cmd->pool, "Can't locate API module structure `",
+-                          modname, "' in file ", szModuleFile, ": ",
++                          modname, "' in file ", module_file, ": ",
+                           apr_dso_error(modhandle, my_error, sizeof(my_error)),
+                           NULL);
+     }
+@@ -272,7 +293,7 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
+                             "is garbled - expected signature %08lx but saw "
+                             "%08lx - perhaps this is not an Apache module DSO, "
+                             "or was compiled for a different Apache version?",
+-                            modname, szModuleFile, 
++                            modname, module_file,
+                             MODULE_MAGIC_COOKIE, modp->magic);
+     }
+ 
+@@ -307,26 +328,14 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
+ static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
+ {
+     apr_dso_handle_t *handle;
+-    const char *file;
+-
+-    file = ap_server_root_relative(cmd->pool, filename);
++    const char *used_file, *error;
+ 
+-    if (!file) {
+-        return apr_pstrcat(cmd->pool, "Invalid LoadFile path ",
+-                           filename, NULL);
+-    }
+-
+-    if (apr_dso_load(&handle, file, cmd->pool) != APR_SUCCESS) {
+-        char my_error[256];
+-
+-        return apr_pstrcat(cmd->pool, "Cannot load ", filename,
+-                          " into server: ",
+-                          apr_dso_error(handle, my_error, sizeof(my_error)),
+-                          NULL);
+-    }
++    error = dso_load(cmd, &handle, filename, &used_file);
++    if (error)
++        return error;
+ 
+     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
+-                 "loaded file %s", filename);
++                 "loaded file %s", used_file);
+ 
+     return NULL;
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 6404142..baf225d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -21,6 +21,7 @@
 077_CacheIgnoreURLSessionIdentifiers
 079_polish_translation
 082_ab_num_requests
+083_dlopen_search_path
 099_config_guess_sub_update
 201_build_suexec-custom
 # The patch below must not be applied by quilt at extraction time.  It depends

-- 
Debian packaging for apache2 (Apache HTTPD 2.x)



More information about the Pkg-apache-commits mailing list