Lines 169-177
void *merge_fcgid_server_config(apr_pool
Link Here
|
169 |
return merged; |
169 |
return merged; |
170 |
} |
170 |
} |
171 |
|
171 |
|
172 |
void *create_fcgid_dir_config(apr_pool_t * p, char *dummy) |
172 |
void *create_fcgid_dir_config(apr_pool_t * p, char *context) |
173 |
{ |
173 |
{ |
|
|
174 |
static int dir_id = 0; |
175 |
|
174 |
fcgid_dir_conf *config = apr_pcalloc(p, sizeof(fcgid_dir_conf)); |
176 |
fcgid_dir_conf *config = apr_pcalloc(p, sizeof(fcgid_dir_conf)); |
|
|
177 |
++dir_id; |
178 |
|
179 |
config->dir_id = dir_id; |
180 |
config->context = context; |
175 |
|
181 |
|
176 |
config->wrapper_info_hash = apr_hash_make(p); |
182 |
config->wrapper_info_hash = apr_hash_make(p); |
177 |
/* config->authenticator_info = NULL; */ |
183 |
/* config->authenticator_info = NULL; */ |
Lines 180-185
void *create_fcgid_dir_config(apr_pool_t
Link Here
|
180 |
config->authorizer_authoritative = 1; |
186 |
config->authorizer_authoritative = 1; |
181 |
/* config->access_info = NULL; */ |
187 |
/* config->access_info = NULL; */ |
182 |
config->access_authoritative = 1; |
188 |
config->access_authoritative = 1; |
|
|
189 |
/* config->default_init_env = NULL;*/ |
183 |
return (void *) config; |
190 |
return (void *) config; |
184 |
} |
191 |
} |
185 |
|
192 |
|
Lines 190-195
void *merge_fcgid_dir_config(apr_pool_t
Link Here
|
190 |
fcgid_dir_conf *merged = |
197 |
fcgid_dir_conf *merged = |
191 |
(fcgid_dir_conf *) apr_pmemdup(p, local, sizeof(fcgid_dir_conf)); |
198 |
(fcgid_dir_conf *) apr_pmemdup(p, local, sizeof(fcgid_dir_conf)); |
192 |
|
199 |
|
|
|
200 |
/* Merge environment variables */ |
201 |
if (base->default_init_env == NULL) { |
202 |
/* merged already set to local */ |
203 |
} |
204 |
else if (local->default_init_env == NULL) { |
205 |
merged->default_init_env = base->default_init_env; |
206 |
} |
207 |
else { |
208 |
merged->default_init_env = |
209 |
apr_table_copy(p, base->default_init_env); |
210 |
apr_table_overlap(merged->default_init_env, |
211 |
local->default_init_env, |
212 |
APR_OVERLAP_TABLES_SET); |
213 |
} |
214 |
|
193 |
merged->wrapper_info_hash = |
215 |
merged->wrapper_info_hash = |
194 |
apr_hash_overlay(p, local->wrapper_info_hash, |
216 |
apr_hash_overlay(p, local->wrapper_info_hash, |
195 |
base->wrapper_info_hash); |
217 |
base->wrapper_info_hash); |
Lines 570-584
static void add_envvar_to_table(apr_tabl
Link Here
|
570 |
apr_table_set(t, name, value ? value : ""); |
592 |
apr_table_set(t, name, value ? value : ""); |
571 |
} |
593 |
} |
572 |
|
594 |
|
573 |
const char *add_default_env_vars(cmd_parms * cmd, void *dummy, |
595 |
const char *add_default_env_vars(cmd_parms * cmd, void *dir_config, |
574 |
const char *name, const char *value) |
596 |
const char *name, const char *value) |
575 |
{ |
597 |
{ |
|
|
598 |
if (cmd->path != NULL) { /* dir context (Directory / Files / Location) */ |
599 |
fcgid_dir_conf *dconfig = ap_get_module_config(cmd->context, &fcgid_module); |
600 |
|
601 |
if (dconfig->default_init_env == NULL) |
602 |
dconfig->default_init_env = apr_table_make(cmd->pool, 20); |
603 |
|
604 |
add_envvar_to_table(dconfig->default_init_env, cmd->pool, name, value); |
605 |
|
606 |
return NULL; |
607 |
} |
608 |
|
576 |
fcgid_server_conf *config = |
609 |
fcgid_server_conf *config = |
577 |
ap_get_module_config(cmd->server->module_config, &fcgid_module); |
610 |
ap_get_module_config(cmd->server->module_config, &fcgid_module); |
578 |
if (config->default_init_env == NULL) |
611 |
if (config->default_init_env == NULL) |
579 |
config->default_init_env = apr_table_make(cmd->pool, 20); |
612 |
config->default_init_env = apr_table_make(cmd->pool, 20); |
580 |
|
613 |
|
581 |
add_envvar_to_table(config->default_init_env, cmd->pool, name, value); |
614 |
add_envvar_to_table(config->default_init_env, cmd->pool, name, value); |
|
|
615 |
|
582 |
return NULL; |
616 |
return NULL; |
583 |
} |
617 |
} |
584 |
|
618 |
|
Lines 935-947
fcgid_cmd_conf *get_wrapper_info(const c
Link Here
|
935 |
return NULL; |
969 |
return NULL; |
936 |
} |
970 |
} |
937 |
|
971 |
|
938 |
static int set_cmd_envvars(fcgid_cmd_env *cmdenv, apr_table_t *envvars) |
972 |
static int set_cmd_envvars(fcgid_cmd_env *cmdenv, apr_table_t *envvars, apr_table_t *denvvars) |
939 |
{ |
973 |
{ |
940 |
const apr_array_header_t *envvars_arr; |
974 |
const apr_array_header_t *envvars_arr; |
941 |
const apr_table_entry_t *envvars_entry; |
975 |
const apr_table_entry_t *envvars_entry; |
942 |
int i; |
976 |
int i; |
943 |
int overflow = 0; |
977 |
int overflow = 0; |
944 |
|
978 |
|
|
|
979 |
if (denvvars) { /* directory environment overwrites vhost environment */ |
980 |
envvars = denvvars; |
981 |
} |
982 |
|
945 |
if (envvars) { |
983 |
if (envvars) { |
946 |
envvars_arr = apr_table_elts(envvars); |
984 |
envvars_arr = apr_table_elts(envvars); |
947 |
envvars_entry = (apr_table_entry_t *) envvars_arr->elts; |
985 |
envvars_entry = (apr_table_entry_t *) envvars_arr->elts; |
Lines 1106-1112
const char *set_cmd_options(cmd_parms *c
Link Here
|
1106 |
option); |
1144 |
option); |
1107 |
} |
1145 |
} |
1108 |
|
1146 |
|
1109 |
if ((overflow = set_cmd_envvars(cmdopts->cmdenv, envvars)) != 0) { |
1147 |
if ((overflow = set_cmd_envvars(cmdopts->cmdenv, envvars, NULL)) != 0) { |
1110 |
return apr_psprintf(cmd->pool, "mod_fcgid: environment variable table " |
1148 |
return apr_psprintf(cmd->pool, "mod_fcgid: environment variable table " |
1111 |
"overflow; increase INITENV_CNT in fcgid_pm.h from" |
1149 |
"overflow; increase INITENV_CNT in fcgid_pm.h from" |
1112 |
" %d to at least %d", |
1150 |
" %d to at least %d", |
Lines 1122-1127
void get_cmd_options(request_rec *r, con
Link Here
|
1122 |
fcgid_cmd_options *cmdopts, |
1160 |
fcgid_cmd_options *cmdopts, |
1123 |
fcgid_cmd_env *cmdenv) |
1161 |
fcgid_cmd_env *cmdenv) |
1124 |
{ |
1162 |
{ |
|
|
1163 |
fcgid_dir_conf *dconf = ap_get_module_config(r->per_dir_config, &fcgid_module); |
1164 |
|
1125 |
fcgid_server_conf *sconf = |
1165 |
fcgid_server_conf *sconf = |
1126 |
ap_get_module_config(r->server->module_config, &fcgid_module); |
1166 |
ap_get_module_config(r->server->module_config, &fcgid_module); |
1127 |
fcgid_cmd_options *cmd_specific = apr_hash_get(sconf->cmdopts_hash, |
1167 |
fcgid_cmd_options *cmd_specific = apr_hash_get(sconf->cmdopts_hash, |
Lines 1149-1155
void get_cmd_options(request_rec *r, con
Link Here
|
1149 |
cmdopts->min_class_process_count = sconf->min_class_process_count; |
1189 |
cmdopts->min_class_process_count = sconf->min_class_process_count; |
1150 |
cmdopts->proc_lifetime = sconf->proc_lifetime; |
1190 |
cmdopts->proc_lifetime = sconf->proc_lifetime; |
1151 |
|
1191 |
|
1152 |
if ((overflow = set_cmd_envvars(cmdenv, sconf->default_init_env)) != 0) { |
1192 |
if ((overflow = set_cmd_envvars(cmdenv, sconf->default_init_env, dconf->default_init_env)) != 0) { |
1153 |
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, |
1193 |
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, |
1154 |
"mod_fcgid: %d environment variables dropped; increase " |
1194 |
"mod_fcgid: %d environment variables dropped; increase " |
1155 |
"INITENV_CNT in fcgid_pm.h from %d to at least %d", |
1195 |
"INITENV_CNT in fcgid_pm.h from %d to at least %d", |