~ubuntu-branches/ubuntu/saucy/apache2/saucy

« back to all changes in this revision

Viewing changes to modules/mappers/mod_so.c

  • Committer: Package Import Robot
  • Author(s): Robie Basak
  • Date: 2012-06-08 11:37:31 UTC
  • mfrom: (14.3.39 sid)
  • Revision ID: package-import@ubuntu.com-20120608113731-lapfog4y8do2sdfv
Tags: 2.2.22-6ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - debian/{control, rules}: Enable PIE hardening.
  - debian/{control, rules, apache2.2-common.ufw.profile}: Add ufw profiles.
  - debian/apache2.py, debian/apache2.2-common.install: Add apport hook.
  - debian/control, debian/ask-for-passphrase, debian/config-dir/mods-available/ssl.conf:
    Plymouth aware passphrase dialog program ask-for-passphrase.
* Dropped changes:
  - debian/control: Add bzr tag and point it to our tree; this is not 
    really required and just increases the delta.

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
    return APR_SUCCESS;
145
145
}
146
146
 
 
147
static 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
179
 * This is called for the directive LoadModule and actually loads
149
180
 * a shared object file into the address space of the server process.
155
186
    apr_dso_handle_t *modhandle;
156
187
    apr_dso_handle_sym_t modsym;
157
188
    module *modp;
158
 
    const char *szModuleFile = ap_server_root_relative(cmd->pool, filename);
 
189
    const char *module_file;
159
190
    so_server_conf *sconf;
160
191
    ap_module_symbol_t *modi;
161
192
    ap_module_symbol_t *modie;
168
199
     */
169
200
    *(ap_directive_t **)dummy = NULL;
170
201
 
171
 
    if (!szModuleFile) {
172
 
        return apr_pstrcat(cmd->pool, "Invalid LoadModule path ",
173
 
                           filename, NULL);
174
 
    }
175
 
 
176
202
    /*
177
203
     * check for already existing module
178
204
     * If it already exists, we have nothing to do
235
261
    /*
236
262
     * Load the file into the Apache address space
237
263
     */
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
 
    }
 
264
    error = dso_load(cmd, &modhandle, filename, &module_file);
 
265
    if (error)
 
266
        return error;
246
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);
248
269
 
249
270
    /*
250
271
     * Retrieve the pointer to the module structure through the module name:
255
276
        char my_error[256];
256
277
 
257
278
        return apr_pstrcat(cmd->pool, "Can't locate API module structure `",
258
 
                          modname, "' in file ", szModuleFile, ": ",
 
279
                          modname, "' in file ", module_file, ": ",
259
280
                          apr_dso_error(modhandle, my_error, sizeof(my_error)),
260
281
                          NULL);
261
282
    }
272
293
                            "is garbled - expected signature %08lx but saw "
273
294
                            "%08lx - perhaps this is not an Apache module DSO, "
274
295
                            "or was compiled for a different Apache version?",
275
 
                            modname, szModuleFile, 
 
296
                            modname, module_file,
276
297
                            MODULE_MAGIC_COOKIE, modp->magic);
277
298
    }
278
299
 
307
328
static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
308
329
{
309
330
    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
 
    }
 
331
    const char *used_file, *error;
 
332
 
 
333
    error = dso_load(cmd, &handle, filename, &used_file);
 
334
    if (error)
 
335
        return error;
327
336
 
328
337
    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
329
 
                 "loaded file %s", filename);
 
338
                 "loaded file %s", used_file);
330
339
 
331
340
    return NULL;
332
341
}