Merge lp:~racb/ubuntu/precise/apache2/988819 into lp:ubuntu/precise/apache2

Proposed by Robie Basak
Status: Merged
Merge reported by: Martin Pitt
Merged at revision: not available
Proposed branch: lp:~racb/ubuntu/precise/apache2/988819
Merge into: lp:ubuntu/precise/apache2
Diff against target: 773 lines (+641/-35)
6 files modified
.pc/083_dlopen_search_path/modules/mappers/mod_so.c (+434/-0)
.pc/applied-patches (+1/-0)
debian/changelog (+9/-0)
debian/patches/083_dlopen_search_path (+152/-0)
debian/patches/series (+1/-0)
modules/mappers/mod_so.c (+44/-35)
To merge this branch: bzr merge lp:~racb/ubuntu/precise/apache2/988819
Reviewer Review Type Date Requested Status
James Page Approve
Ubuntu branches Pending
Review via email: mp+109379@code.launchpad.net
To post a comment you must log in.
Revision history for this message
James Page (james-page) wrote :

Uploaded to -proposed

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory '.pc/083_dlopen_search_path'
=== added directory '.pc/083_dlopen_search_path/modules'
=== added directory '.pc/083_dlopen_search_path/modules/mappers'
=== added file '.pc/083_dlopen_search_path/modules/mappers/mod_so.c'
--- .pc/083_dlopen_search_path/modules/mappers/mod_so.c 1970-01-01 00:00:00 +0000
+++ .pc/083_dlopen_search_path/modules/mappers/mod_so.c 2012-06-08 15:02:19 +0000
@@ -0,0 +1,434 @@
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * This module is used to load Apache modules at runtime. This means that the
19 * server functionality can be extended without recompiling and even without
20 * taking the server down at all. Only a HUP or AP_SIG_GRACEFUL signal
21 * needs to be sent to the server to reload the dynamically loaded modules.
22 *
23 * To use, you'll first need to build your module as a shared library, then
24 * update your configuration (httpd.conf) to get the Apache core to load the
25 * module at start-up.
26 *
27 * The easiest way to build a module as a shared library is to use the
28 * `SharedModule' command in the Configuration file, instead of `AddModule'.
29 * You should also change the file extension from `.o' to `.so'. So, for
30 * example, to build the status module as a shared library edit Configuration
31 * and change
32 * AddModule modules/standard/mod_status.o
33 * to
34 * SharedModule modules/standard/mod_status.so
35 *
36 * Run Configure and make. Now Apache's httpd binary will _not_ include
37 * mod_status. Instead a shared object called mod_status.so will be build, in
38 * the modules/standard directory. You can build most of the modules as shared
39 * libraries like this.
40 *
41 * To use the shared module, move the .so file(s) into an appropriate
42 * directory. You might like to create a directory called "modules" under you
43 * server root for this (e.g. /usr/local/httpd/modules).
44 *
45 * Then edit your conf/httpd.conf file, and add LoadModule lines. For
46 * example
47 * LoadModule status_module modules/mod_status.so
48 *
49 * The first argument is the module's structure name (look at the end of the
50 * module source to find this). The second option is the path to the module
51 * file, relative to the server root. Put these directives right at the top
52 * of your httpd.conf file.
53 *
54 * Now you can start Apache. A message will be logged at "debug" level to your
55 * error_log to confirm that the module(s) are loaded (use "LogLevel debug"
56 * directive to get these log messages).
57 *
58 * If you edit the LoadModule directives while the server is live you can get
59 * Apache to re-load the modules by sending it a HUP or AP_SIG_GRACEFUL
60 * signal as normal. You can use this to dynamically change the capability
61 * of your server without bringing it down.
62 *
63 * Because currently there is only limited builtin support in the Configure
64 * script for creating the shared library files (`.so'), please consult your
65 * vendors cc(1), ld(1) and dlopen(3) manpages to find out the appropriate
66 * compiler and linker flags and insert them manually into the Configuration
67 * file under CFLAGS_SHLIB, LDFLAGS_SHLIB and LDFLAGS_SHLIB_EXPORT.
68 *
69 * If you still have problems figuring out the flags both try the paper
70 * http://developer.netscape.com/library/documentation/enterprise
71 * /unix/svrplug.htm#1013807
72 * or install a Perl 5 interpreter on your platform and then run the command
73 *
74 * $ perl -V:usedl -V:ccdlflags -V:cccdlflags -V:lddlflags
75 *
76 * This gives you what type of dynamic loading Perl 5 uses on your platform
77 * and which compiler and linker flags Perl 5 uses to create the shared object
78 * files.
79 *
80 * Another location where you can find useful hints is the `ltconfig' script
81 * of the GNU libtool 1.2 package. Search for your platform name inside the
82 * various "case" constructs.
83 *
84 */
85
86#include "apr.h"
87#include "apr_dso.h"
88#include "apr_strings.h"
89#include "apr_errno.h"
90
91#define CORE_PRIVATE
92#include "ap_config.h"
93#include "httpd.h"
94#include "http_config.h"
95#include "http_log.h"
96#include "http_core.h"
97
98#include "mod_so.h"
99
100module AP_MODULE_DECLARE_DATA so_module;
101
102
103/*
104 * Server configuration to keep track of actually
105 * loaded modules and the corresponding module name.
106 */
107
108typedef struct so_server_conf {
109 apr_array_header_t *loaded_modules;
110} so_server_conf;
111
112static void *so_sconf_create(apr_pool_t *p, server_rec *s)
113{
114 so_server_conf *soc;
115
116 soc = (so_server_conf *)apr_pcalloc(p, sizeof(so_server_conf));
117 soc->loaded_modules = apr_array_make(p, DYNAMIC_MODULE_LIMIT,
118 sizeof(ap_module_symbol_t));
119
120 return (void *)soc;
121}
122
123#ifndef NO_DLOPEN
124
125/*
126 * This is the cleanup for a loaded shared object. It unloads the module.
127 * This is called as a cleanup function from the core.
128 */
129
130static apr_status_t unload_module(void *data)
131{
132 ap_module_symbol_t *modi = (ap_module_symbol_t*)data;
133
134 /* only unload if module information is still existing */
135 if (modi->modp == NULL)
136 return APR_SUCCESS;
137
138 /* remove the module pointer from the core structure */
139 ap_remove_loaded_module(modi->modp);
140
141 /* destroy the module information */
142 modi->modp = NULL;
143 modi->name = NULL;
144 return APR_SUCCESS;
145}
146
147/*
148 * This is called for the directive LoadModule and actually loads
149 * a shared object file into the address space of the server process.
150 */
151
152static const char *load_module(cmd_parms *cmd, void *dummy,
153 const char *modname, const char *filename)
154{
155 apr_dso_handle_t *modhandle;
156 apr_dso_handle_sym_t modsym;
157 module *modp;
158 const char *szModuleFile = ap_server_root_relative(cmd->pool, filename);
159 so_server_conf *sconf;
160 ap_module_symbol_t *modi;
161 ap_module_symbol_t *modie;
162 int i;
163 const char *error;
164
165 /* we need to setup this value for dummy to make sure that we don't try
166 * to add a non-existant tree into the build when we return to
167 * execute_now.
168 */
169 *(ap_directive_t **)dummy = NULL;
170
171 if (!szModuleFile) {
172 return apr_pstrcat(cmd->pool, "Invalid LoadModule path ",
173 filename, NULL);
174 }
175
176 /*
177 * check for already existing module
178 * If it already exists, we have nothing to do
179 * Check both dynamically-loaded modules and statically-linked modules.
180 */
181 sconf = (so_server_conf *)ap_get_module_config(cmd->server->module_config,
182 &so_module);
183 modie = (ap_module_symbol_t *)sconf->loaded_modules->elts;
184 for (i = 0; i < sconf->loaded_modules->nelts; i++) {
185 modi = &modie[i];
186 if (modi->name != NULL && strcmp(modi->name, modname) == 0) {
187 ap_log_perror(APLOG_MARK, APLOG_WARNING, 0,
188 cmd->pool, "module %s is already loaded, skipping",
189 modname);
190 return NULL;
191 }
192 }
193
194 for (i = 0; ap_preloaded_modules[i]; i++) {
195 const char *preload_name;
196 apr_size_t preload_len;
197 apr_size_t thismod_len;
198
199 modp = ap_preloaded_modules[i];
200
201 /* make sure we're comparing apples with apples
202 * make sure name of preloaded module is mod_FOO.c
203 * make sure name of structure being loaded is FOO_module
204 */
205
206 if (memcmp(modp->name, "mod_", 4)) {
207 continue;
208 }
209
210 preload_name = modp->name + strlen("mod_");
211 preload_len = strlen(preload_name) - 2;
212
213 if (strlen(modname) <= strlen("_module")) {
214 continue;
215 }
216 thismod_len = strlen(modname) - strlen("_module");
217 if (strcmp(modname + thismod_len, "_module")) {
218 continue;
219 }
220
221 if (thismod_len != preload_len) {
222 continue;
223 }
224
225 if (!memcmp(modname, preload_name, preload_len)) {
226 return apr_pstrcat(cmd->pool, "module ", modname,
227 " is built-in and can't be loaded",
228 NULL);
229 }
230 }
231
232 modi = apr_array_push(sconf->loaded_modules);
233 modi->name = modname;
234
235 /*
236 * Load the file into the Apache address space
237 */
238 if (apr_dso_load(&modhandle, szModuleFile, cmd->pool) != APR_SUCCESS) {
239 char my_error[256];
240
241 return apr_pstrcat(cmd->pool, "Cannot load ", szModuleFile,
242 " into server: ",
243 apr_dso_error(modhandle, my_error, sizeof(my_error)),
244 NULL);
245 }
246 ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, cmd->pool,
247 "loaded module %s", modname);
248
249 /*
250 * Retrieve the pointer to the module structure through the module name:
251 * First with the hidden variant (prefix `AP_') and then with the plain
252 * symbol name.
253 */
254 if (apr_dso_sym(&modsym, modhandle, modname) != APR_SUCCESS) {
255 char my_error[256];
256
257 return apr_pstrcat(cmd->pool, "Can't locate API module structure `",
258 modname, "' in file ", szModuleFile, ": ",
259 apr_dso_error(modhandle, my_error, sizeof(my_error)),
260 NULL);
261 }
262 modp = (module*) modsym;
263 modp->dynamic_load_handle = (apr_dso_handle_t *)modhandle;
264 modi->modp = modp;
265
266 /*
267 * Make sure the found module structure is really a module structure
268 *
269 */
270 if (modp->magic != MODULE_MAGIC_COOKIE) {
271 return apr_psprintf(cmd->pool, "API module structure '%s' in file %s "
272 "is garbled - expected signature %08lx but saw "
273 "%08lx - perhaps this is not an Apache module DSO, "
274 "or was compiled for a different Apache version?",
275 modname, szModuleFile,
276 MODULE_MAGIC_COOKIE, modp->magic);
277 }
278
279 /*
280 * Add this module to the Apache core structures
281 */
282 error = ap_add_loaded_module(modp, cmd->pool);
283 if (error) {
284 return error;
285 }
286
287 /*
288 * Register a cleanup in the config apr_pool_t (normally pconf). When
289 * we do a restart (or shutdown) this cleanup will cause the
290 * shared object to be unloaded.
291 */
292 apr_pool_cleanup_register(cmd->pool, modi, unload_module, apr_pool_cleanup_null);
293
294 /*
295 * Finally we need to run the configuration process for the module
296 */
297 ap_single_module_configure(cmd->pool, cmd->server, modp);
298
299 return NULL;
300}
301
302/*
303 * This implements the LoadFile directive and loads an arbitrary
304 * shared object file into the adress space of the server process.
305 */
306
307static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
308{
309 apr_dso_handle_t *handle;
310 const char *file;
311
312 file = ap_server_root_relative(cmd->pool, filename);
313
314 if (!file) {
315 return apr_pstrcat(cmd->pool, "Invalid LoadFile path ",
316 filename, NULL);
317 }
318
319 if (apr_dso_load(&handle, file, cmd->pool) != APR_SUCCESS) {
320 char my_error[256];
321
322 return apr_pstrcat(cmd->pool, "Cannot load ", filename,
323 " into server: ",
324 apr_dso_error(handle, my_error, sizeof(my_error)),
325 NULL);
326 }
327
328 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
329 "loaded file %s", filename);
330
331 return NULL;
332}
333
334static module *ap_find_loaded_module_symbol(server_rec *s, const char *modname)
335{
336 so_server_conf *sconf;
337 ap_module_symbol_t *modi;
338 ap_module_symbol_t *modie;
339 int i;
340
341 sconf = (so_server_conf *)ap_get_module_config(s->module_config,
342 &so_module);
343 modie = (ap_module_symbol_t *)sconf->loaded_modules->elts;
344
345 for (i = 0; i < sconf->loaded_modules->nelts; i++) {
346 modi = &modie[i];
347 if (modi->name != NULL && strcmp(modi->name, modname) == 0) {
348 return modi->modp;
349 }
350 }
351 return NULL;
352}
353
354static void dump_loaded_modules(apr_pool_t *p, server_rec *s)
355{
356 ap_module_symbol_t *modie;
357 ap_module_symbol_t *modi;
358 so_server_conf *sconf;
359 int i;
360 apr_file_t *out = NULL;
361
362 if (!ap_exists_config_define("DUMP_MODULES")) {
363 return;
364 }
365
366 apr_file_open_stdout(&out, p);
367
368 apr_file_printf(out, "Loaded Modules:\n");
369
370 sconf = (so_server_conf *)ap_get_module_config(s->module_config,
371 &so_module);
372 for (i = 0; ; i++) {
373 modi = &ap_prelinked_module_symbols[i];
374 if (modi->name != NULL) {
375 apr_file_printf(out, " %s (static)\n", modi->name);
376 }
377 else {
378 break;
379 }
380 }
381
382 modie = (ap_module_symbol_t *)sconf->loaded_modules->elts;
383 for (i = 0; i < sconf->loaded_modules->nelts; i++) {
384 modi = &modie[i];
385 if (modi->name != NULL) {
386 apr_file_printf(out, " %s (shared)\n", modi->name);
387 }
388 }
389}
390
391#else /* not NO_DLOPEN */
392
393static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
394{
395 ap_log_perror(APLOG_MARK, APLOG_STARTUP, 0, cmd->pool,
396 "WARNING: LoadFile not supported on this platform");
397 return NULL;
398}
399
400static const char *load_module(cmd_parms *cmd, void *dummy,
401 const char *modname, const char *filename)
402{
403 ap_log_perror(APLOG_MARK, APLOG_STARTUP, 0, cmd->pool,
404 "WARNING: LoadModule not supported on this platform");
405 return NULL;
406}
407
408#endif /* NO_DLOPEN */
409
410static void register_hooks(apr_pool_t *p)
411{
412#ifndef NO_DLOPEN
413 APR_REGISTER_OPTIONAL_FN(ap_find_loaded_module_symbol);
414 ap_hook_test_config(dump_loaded_modules, NULL, NULL, APR_HOOK_MIDDLE);
415#endif
416}
417
418static const command_rec so_cmds[] = {
419 AP_INIT_TAKE2("LoadModule", load_module, NULL, RSRC_CONF | EXEC_ON_READ,
420 "a module name and the name of a shared object file to load it from"),
421 AP_INIT_ITERATE("LoadFile", load_file, NULL, RSRC_CONF | EXEC_ON_READ,
422 "shared object file or library to load into the server at runtime"),
423 { NULL }
424};
425
426module AP_MODULE_DECLARE_DATA so_module = {
427 STANDARD20_MODULE_STUFF,
428 NULL, /* create per-dir config */
429 NULL, /* merge per-dir config */
430 so_sconf_create, /* server config */
431 NULL, /* merge server config */
432 so_cmds, /* command apr_table_t */
433 register_hooks /* register hooks */
434};
0435
=== modified file '.pc/applied-patches'
--- .pc/applied-patches 2012-02-01 21:49:04 +0000
+++ .pc/applied-patches 2012-06-08 15:02:19 +0000
@@ -21,5 +21,6 @@
21077_CacheIgnoreURLSessionIdentifiers21077_CacheIgnoreURLSessionIdentifiers
22079_polish_translation22079_polish_translation
23082_ab_num_requests23082_ab_num_requests
24083_dlopen_search_path
24099_config_guess_sub_update25099_config_guess_sub_update
25201_build_suexec-custom26201_build_suexec-custom
2627
=== modified file 'debian/changelog'
--- debian/changelog 2012-02-12 20:06:35 +0000
+++ debian/changelog 2012-06-08 15:02:19 +0000
@@ -1,3 +1,12 @@
1apache2 (2.2.22-1ubuntu1.1) precise-proposed; urgency=low
2
3 * debian/patches/083_dlopen_search_path: use dlopen() search path to
4 enable modules that use multiarch, such as libapache2-modsecurity.
5 These modules can now use no path and apache2 will be able to find
6 them (LP: #988819).
7
8 -- Robie Basak <robie.basak@ubuntu.com> Fri, 08 Jun 2012 15:45:02 +0100
9
1apache2 (2.2.22-1ubuntu1) precise; urgency=low10apache2 (2.2.22-1ubuntu1) precise; urgency=low
211
3 * Merge from Debian testing. Remaining changes:12 * Merge from Debian testing. Remaining changes:
413
=== added file 'debian/patches/083_dlopen_search_path'
--- debian/patches/083_dlopen_search_path 1970-01-01 00:00:00 +0000
+++ debian/patches/083_dlopen_search_path 2012-06-08 15:02:19 +0000
@@ -0,0 +1,152 @@
1Backport r1332378 from upstream trunk:
2
3If a filename without slashes is specified for LoadFile or
4LoadModule and the file cannot be found in the server root directory,
5try to use the standard dlopen() search path.
6
7git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1332378 13f79535-47bb-0310-9956-ffa450edef68
8
9Author: Stefan Fritsch
10Origin: upstream, http://svn.apache.org/viewvc?view=revision&revision=1332378
11Bug-Debian: http://bugs.debian.org/670247
12Bug-Ubuntu: https://launchpad.net/bugs/988819
13Last-Update: 2012-06-08
14
15---
16 modules/mappers/mod_so.c | 77 ++++++++++++++++++++++++++--------------------
17 1 file changed, 43 insertions(+), 34 deletions(-)
18
19diff --git a/modules/mappers/mod_so.c b/modules/mappers/mod_so.c
20index 2d4a54c..6a9fdae 100644
21--- a/modules/mappers/mod_so.c
22+++ b/modules/mappers/mod_so.c
23@@ -144,6 +144,37 @@ static apr_status_t unload_module(void *data)
24 return APR_SUCCESS;
25 }
26
27+static const char *dso_load(cmd_parms *cmd, apr_dso_handle_t **modhandlep,
28+ const char *filename, const char **used_filename)
29+{
30+ int retry = 0;
31+ const char *fullname = ap_server_root_relative(cmd->temp_pool, filename);
32+ char my_error[256];
33+ if (filename != NULL && ap_strchr_c(filename, '/') == NULL) {
34+ /* retry on error without path to use dlopen()'s search path */
35+ retry = 1;
36+ }
37+
38+ if (fullname == NULL && !retry) {
39+ return apr_psprintf(cmd->temp_pool, "Invalid %s path %s",
40+ cmd->cmd->name, filename);
41+ }
42+ *used_filename = fullname;
43+ if (apr_dso_load(modhandlep, fullname, cmd->pool) == APR_SUCCESS) {
44+ return NULL;
45+ }
46+ if (retry) {
47+ *used_filename = filename;
48+ if (apr_dso_load(modhandlep, filename, cmd->pool) == APR_SUCCESS)
49+ return NULL;
50+ }
51+
52+ return apr_pstrcat(cmd->temp_pool, "Cannot load ", filename,
53+ " into server: ",
54+ apr_dso_error(*modhandlep, my_error, sizeof(my_error)),
55+ NULL);
56+}
57+
58 /*
59 * This is called for the directive LoadModule and actually loads
60 * a shared object file into the address space of the server process.
61@@ -155,7 +186,7 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
62 apr_dso_handle_t *modhandle;
63 apr_dso_handle_sym_t modsym;
64 module *modp;
65- const char *szModuleFile = ap_server_root_relative(cmd->pool, filename);
66+ const char *module_file;
67 so_server_conf *sconf;
68 ap_module_symbol_t *modi;
69 ap_module_symbol_t *modie;
70@@ -168,11 +199,6 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
71 */
72 *(ap_directive_t **)dummy = NULL;
73
74- if (!szModuleFile) {
75- return apr_pstrcat(cmd->pool, "Invalid LoadModule path ",
76- filename, NULL);
77- }
78-
79 /*
80 * check for already existing module
81 * If it already exists, we have nothing to do
82@@ -235,16 +261,11 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
83 /*
84 * Load the file into the Apache address space
85 */
86- if (apr_dso_load(&modhandle, szModuleFile, cmd->pool) != APR_SUCCESS) {
87- char my_error[256];
88-
89- return apr_pstrcat(cmd->pool, "Cannot load ", szModuleFile,
90- " into server: ",
91- apr_dso_error(modhandle, my_error, sizeof(my_error)),
92- NULL);
93- }
94+ error = dso_load(cmd, &modhandle, filename, &module_file);
95+ if (error)
96+ return error;
97 ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, cmd->pool,
98- "loaded module %s", modname);
99+ "loaded module %s from %s", modname, module_file);
100
101 /*
102 * Retrieve the pointer to the module structure through the module name:
103@@ -255,7 +276,7 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
104 char my_error[256];
105
106 return apr_pstrcat(cmd->pool, "Can't locate API module structure `",
107- modname, "' in file ", szModuleFile, ": ",
108+ modname, "' in file ", module_file, ": ",
109 apr_dso_error(modhandle, my_error, sizeof(my_error)),
110 NULL);
111 }
112@@ -272,7 +293,7 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
113 "is garbled - expected signature %08lx but saw "
114 "%08lx - perhaps this is not an Apache module DSO, "
115 "or was compiled for a different Apache version?",
116- modname, szModuleFile,
117+ modname, module_file,
118 MODULE_MAGIC_COOKIE, modp->magic);
119 }
120
121@@ -307,26 +328,14 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
122 static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
123 {
124 apr_dso_handle_t *handle;
125- const char *file;
126-
127- file = ap_server_root_relative(cmd->pool, filename);
128+ const char *used_file, *error;
129
130- if (!file) {
131- return apr_pstrcat(cmd->pool, "Invalid LoadFile path ",
132- filename, NULL);
133- }
134-
135- if (apr_dso_load(&handle, file, cmd->pool) != APR_SUCCESS) {
136- char my_error[256];
137-
138- return apr_pstrcat(cmd->pool, "Cannot load ", filename,
139- " into server: ",
140- apr_dso_error(handle, my_error, sizeof(my_error)),
141- NULL);
142- }
143+ error = dso_load(cmd, &handle, filename, &used_file);
144+ if (error)
145+ return error;
146
147 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
148- "loaded file %s", filename);
149+ "loaded file %s", used_file);
150
151 return NULL;
152 }
0153
=== modified file 'debian/patches/series'
--- debian/patches/series 2012-02-01 21:49:04 +0000
+++ debian/patches/series 2012-06-08 15:02:19 +0000
@@ -21,6 +21,7 @@
21077_CacheIgnoreURLSessionIdentifiers21077_CacheIgnoreURLSessionIdentifiers
22079_polish_translation22079_polish_translation
23082_ab_num_requests23082_ab_num_requests
24083_dlopen_search_path
24099_config_guess_sub_update25099_config_guess_sub_update
25201_build_suexec-custom26201_build_suexec-custom
26# The patch below must not be applied by quilt at extraction time. It depends27# The patch below must not be applied by quilt at extraction time. It depends
2728
=== modified file 'modules/mappers/mod_so.c'
--- modules/mappers/mod_so.c 2009-08-04 11:02:34 +0000
+++ modules/mappers/mod_so.c 2012-06-08 15:02:19 +0000
@@ -144,6 +144,37 @@
144 return APR_SUCCESS;144 return APR_SUCCESS;
145}145}
146146
147static const char *dso_load(cmd_parms *cmd, apr_dso_handle_t **modhandlep,
148 const char *filename, const char **used_filename)
149{
150 int retry = 0;
151 const char *fullname = ap_server_root_relative(cmd->temp_pool, filename);
152 char my_error[256];
153 if (filename != NULL && ap_strchr_c(filename, '/') == NULL) {
154 /* retry on error without path to use dlopen()'s search path */
155 retry = 1;
156 }
157
158 if (fullname == NULL && !retry) {
159 return apr_psprintf(cmd->temp_pool, "Invalid %s path %s",
160 cmd->cmd->name, filename);
161 }
162 *used_filename = fullname;
163 if (apr_dso_load(modhandlep, fullname, cmd->pool) == APR_SUCCESS) {
164 return NULL;
165 }
166 if (retry) {
167 *used_filename = filename;
168 if (apr_dso_load(modhandlep, filename, cmd->pool) == APR_SUCCESS)
169 return NULL;
170 }
171
172 return apr_pstrcat(cmd->temp_pool, "Cannot load ", filename,
173 " into server: ",
174 apr_dso_error(*modhandlep, my_error, sizeof(my_error)),
175 NULL);
176}
177
147/*178/*
148 * This is called for the directive LoadModule and actually loads179 * This is called for the directive LoadModule and actually loads
149 * a shared object file into the address space of the server process.180 * a shared object file into the address space of the server process.
@@ -155,7 +186,7 @@
155 apr_dso_handle_t *modhandle;186 apr_dso_handle_t *modhandle;
156 apr_dso_handle_sym_t modsym;187 apr_dso_handle_sym_t modsym;
157 module *modp;188 module *modp;
158 const char *szModuleFile = ap_server_root_relative(cmd->pool, filename);189 const char *module_file;
159 so_server_conf *sconf;190 so_server_conf *sconf;
160 ap_module_symbol_t *modi;191 ap_module_symbol_t *modi;
161 ap_module_symbol_t *modie;192 ap_module_symbol_t *modie;
@@ -168,11 +199,6 @@
168 */199 */
169 *(ap_directive_t **)dummy = NULL;200 *(ap_directive_t **)dummy = NULL;
170201
171 if (!szModuleFile) {
172 return apr_pstrcat(cmd->pool, "Invalid LoadModule path ",
173 filename, NULL);
174 }
175
176 /*202 /*
177 * check for already existing module203 * check for already existing module
178 * If it already exists, we have nothing to do204 * If it already exists, we have nothing to do
@@ -235,16 +261,11 @@
235 /*261 /*
236 * Load the file into the Apache address space262 * Load the file into the Apache address space
237 */263 */
238 if (apr_dso_load(&modhandle, szModuleFile, cmd->pool) != APR_SUCCESS) {264 error = dso_load(cmd, &modhandle, filename, &module_file);
239 char my_error[256];265 if (error)
240266 return error;
241 return apr_pstrcat(cmd->pool, "Cannot load ", szModuleFile,
242 " into server: ",
243 apr_dso_error(modhandle, my_error, sizeof(my_error)),
244 NULL);
245 }
246 ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, cmd->pool,267 ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, cmd->pool,
247 "loaded module %s", modname);268 "loaded module %s from %s", modname, module_file);
248269
249 /*270 /*
250 * Retrieve the pointer to the module structure through the module name:271 * Retrieve the pointer to the module structure through the module name:
@@ -255,7 +276,7 @@
255 char my_error[256];276 char my_error[256];
256277
257 return apr_pstrcat(cmd->pool, "Can't locate API module structure `",278 return apr_pstrcat(cmd->pool, "Can't locate API module structure `",
258 modname, "' in file ", szModuleFile, ": ",279 modname, "' in file ", module_file, ": ",
259 apr_dso_error(modhandle, my_error, sizeof(my_error)),280 apr_dso_error(modhandle, my_error, sizeof(my_error)),
260 NULL);281 NULL);
261 }282 }
@@ -272,7 +293,7 @@
272 "is garbled - expected signature %08lx but saw "293 "is garbled - expected signature %08lx but saw "
273 "%08lx - perhaps this is not an Apache module DSO, "294 "%08lx - perhaps this is not an Apache module DSO, "
274 "or was compiled for a different Apache version?",295 "or was compiled for a different Apache version?",
275 modname, szModuleFile, 296 modname, module_file,
276 MODULE_MAGIC_COOKIE, modp->magic);297 MODULE_MAGIC_COOKIE, modp->magic);
277 }298 }
278299
@@ -307,26 +328,14 @@
307static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)328static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
308{329{
309 apr_dso_handle_t *handle;330 apr_dso_handle_t *handle;
310 const char *file;331 const char *used_file, *error;
311332
312 file = ap_server_root_relative(cmd->pool, filename);333 error = dso_load(cmd, &handle, filename, &used_file);
313334 if (error)
314 if (!file) {335 return error;
315 return apr_pstrcat(cmd->pool, "Invalid LoadFile path ",
316 filename, NULL);
317 }
318
319 if (apr_dso_load(&handle, file, cmd->pool) != APR_SUCCESS) {
320 char my_error[256];
321
322 return apr_pstrcat(cmd->pool, "Cannot load ", filename,
323 " into server: ",
324 apr_dso_error(handle, my_error, sizeof(my_error)),
325 NULL);
326 }
327336
328 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,337 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
329 "loaded file %s", filename);338 "loaded file %s", used_file);
330339
331 return NULL;340 return NULL;
332}341}

Subscribers

People subscribed via source and target branches

to all changes: