* 20100714.0 (2.3.7-dev) add access_checker_ex hook, add AUTHZ_DENIED_NO_USER
* to authz_status, call authz providers twice to allow
* authz without authenticated user
+ * 20100719.0 (2.3.7-dev) Add symbol name parameter to ap_add_module and
+ * ap_add_loaded_module. Add ap_find_module_short_name
*/
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
#ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20100714
+#define MODULE_MAGIC_NUMBER_MAJOR 20100719
#endif
#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */
* Add a module to the server
* @param m The module structure of the module to add
* @param p The pool of the same lifetime as the module
+ * @param s The module's symbol name (used for logging)
*/
-AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p);
+AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p,
+ const char *s);
/**
* Remove a module from the server. There are some caveats:
* Add a module to the chained modules list and the list of loaded modules
* @param mod The module structure of the module to add
* @param p The pool with the same lifetime as the module
+ * @param s The module's symbol name (used for logging)
*/
-AP_DECLARE(const char *) ap_add_loaded_module(module *mod, apr_pool_t *p);
+AP_DECLARE(const char *) ap_add_loaded_module(module *mod, apr_pool_t *p,
+ const char *s);
/**
* Remove a module fromthe chained modules list and the list of loaded modules
* @param mod the module structure of the module to remove
* @return the name of the module
*/
AP_DECLARE(const char *) ap_find_module_name(module *m);
+/**
+ * Find the short name of the module identified by the specified module index
+ * @param module_index The module index to get the name for
+ * @return the name of the module
+ */
+AP_DECLARE(const char *) ap_find_module_short_name(int module_index);
/**
* Find a module based on the name of the module
* @param name the name of the module
static apr_hash_t *ap_config_hash = NULL;
+/* a list of the module symbol names with the trailing "_module"removed */
+static char **ap_module_short_names = NULL;
+
typedef int (*handler_func)(request_rec *);
typedef void *(*dir_maker_func)(apr_pool_t *, char *);
typedef void *(*merger_func)(apr_pool_t *, void *, void *);
/* One-time setup for precompiled modules --- NOT to be done on restart */
-AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p)
+AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p,
+ const char *sym_name)
{
+ ap_module_symbol_t *sym = ap_prelinked_module_symbols;
+
/* This could be called from a LoadModule httpd.conf command,
* after the file has been linked and the module structure within it
* teased out...
"reached. Please increase "
"DYNAMIC_MODULE_LIMIT and recompile.", m->name);
}
+
+ }
+ else if (!sym_name) {
+ while (sym->modp != NULL) {
+ if (sym->modp == m) {
+ sym_name = sym->name;
+ break;
+ }
+ sym++;
+ }
}
+ if (sym_name) {
+ int len = strlen(sym_name);
+ int slen = strlen("_module");
+ if (len > slen && !strcmp(sym_name + len - slen, "_module")) {
+ len -= slen;
+ }
+
+ ap_module_short_names[m->module_index] = strdup(sym_name);
+ ap_module_short_names[m->module_index][len] = '\0';
+ }
+
+
/* Some C compilers put a complete path into __FILE__, but we want
* only the filename (e.g. mod_includes.c). So check for path
* components (Unix and DOS), and remove them.
modp->next = modp->next->next;
}
+ free(ap_module_short_names[m->module_index]);
+ ap_module_short_names[m->module_index] = NULL;
+
m->module_index = -1; /* simulate being unloaded, should
* be unnecessary */
dynamic_modules--;
total_modules--;
}
-AP_DECLARE(const char *) ap_add_loaded_module(module *mod, apr_pool_t *p)
+AP_DECLARE(const char *) ap_add_loaded_module(module *mod, apr_pool_t *p,
+ const char *short_name)
{
module **m;
const char *error;
/*
* Add module pointer to top of chained module list
*/
- error = ap_add_module(mod, p);
+ error = ap_add_module(mod, p, short_name);
if (error) {
return error;
}
conf_vector_length = max_modules;
/*
- * Initialise list of loaded modules
+ * Initialise list of loaded modules and short names
*/
ap_loaded_modules = (module **)apr_palloc(process->pool,
sizeof(module *) * conf_vector_length);
+ if (!ap_module_short_names)
+ ap_module_short_names = malloc(sizeof(char *) * conf_vector_length);
- if (ap_loaded_modules == NULL) {
+ if (ap_loaded_modules == NULL || ap_module_short_names == NULL) {
return "Ouch! Out of memory in ap_setup_prelinked_modules()!";
}
* Initialize chain of linked (=activate) modules
*/
for (m = ap_prelinked_modules; *m != NULL; m++) {
- error = ap_add_module(*m, process->pconf);
+ error = ap_add_module(*m, process->pconf, NULL);
if (error) {
return error;
}
return m->name;
}
+AP_DECLARE(const char *) ap_find_module_short_name(int module_index)
+{
+ if (module_index < 0)
+ return "-";
+ return ap_module_short_names[module_index];
+}
+
AP_DECLARE(module *) ap_find_linked_module(const char *name)
{
module *modp;