| 2804 | } |
| 2805 | |
| 2806 | static module *find_module(server_rec *s, const char *name) |
| 2807 | { |
| 2808 | module *found = ap_find_linked_module(name); |
| 2809 | |
| 2810 | /* search prelinked stuff */ |
| 2811 | if (!found) { |
| 2812 | ap_module_symbol_t *current = ap_prelinked_module_symbols; |
| 2813 | |
| 2814 | for (; current->name; ++current) { |
| 2815 | if (!strcmp(current->name, name)) { |
| 2816 | found = current->modp; |
| 2817 | break; |
| 2818 | } |
| 2819 | } |
| 2820 | } |
| 2821 | |
| 2822 | /* search dynamic stuff */ |
| 2823 | if (!found) { |
| 2824 | APR_OPTIONAL_FN_TYPE(ap_find_loaded_module_symbol) *check_symbol = |
| 2825 | APR_RETRIEVE_OPTIONAL_FN(ap_find_loaded_module_symbol); |
| 2826 | |
| 2827 | if (check_symbol) { |
| 2828 | /* |
| 2829 | * There are two phases where calling ap_find_loaded_module_symbol |
| 2830 | * is problematic: |
| 2831 | * |
| 2832 | * During reading of the config, ap_server_conf is invalid but s |
| 2833 | * points to the main server config, if passed from cmd->server |
| 2834 | * of an EXEC_ON_READ directive. |
| 2835 | * |
| 2836 | * During config parsing, s may be a virtual host that would cause |
| 2837 | * a segfault in mod_so if passed to ap_find_loaded_module_symbol, |
| 2838 | * because mod_so's server config for vhosts is initialized later. |
| 2839 | * But ap_server_conf is already set at this time. |
| 2840 | * |
| 2841 | * Therefore we use s if it is not virtual and ap_server_conf if |
| 2842 | * s is virtual. |
| 2843 | */ |
| 2844 | found = check_symbol(s->is_virtual ? ap_server_conf : s, name); |
| 2845 | } |
| 2846 | } |
| 2847 | |
| 2848 | return found; |
| 2849 | } |
| 2850 | |
| 2851 | /* Callback function type used by start_cond_section. */ |
| 2852 | typedef int (*test_cond_section_fn)(cmd_parms *cmd, const char *arg); |