MCPcopy Create free account
hub / github.com/apache/httpd / authz_require_alias_section

Function authz_require_alias_section

modules/aaa/mod_authz_core.c:248–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246};
247
248static const char *authz_require_alias_section(cmd_parms *cmd, void *mconfig,
249 const char *args)
250{
251 const char *endp = ap_strrchr_c(args, '>');
252 char *provider_name;
253 char *provider_alias;
254 char *provider_args, *extra_args;
255 ap_conf_vector_t *new_authz_config;
256 int old_overrides = cmd->override;
257 const char *errmsg;
258
259 const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
260 if (err != NULL) {
261 return err;
262 }
263
264 if (endp == NULL) {
265 return apr_pstrcat(cmd->pool, cmd->cmd->name,
266 "> directive missing closing '>'", NULL);
267 }
268
269 args = apr_pstrndup(cmd->temp_pool, args, endp - args);
270
271 if (!args[0]) {
272 return apr_pstrcat(cmd->pool, cmd->cmd->name,
273 "> directive requires additional arguments", NULL);
274 }
275
276 /* Pull the real provider name and the alias name from the block header */
277 provider_name = ap_getword_conf(cmd->pool, &args);
278 provider_alias = ap_getword_conf(cmd->pool, &args);
279 provider_args = ap_getword_conf(cmd->pool, &args);
280 extra_args = ap_getword_conf(cmd->pool, &args);
281
282 if (!provider_name[0] || !provider_alias[0]) {
283 return apr_pstrcat(cmd->pool, cmd->cmd->name,
284 "> directive requires additional arguments", NULL);
285 }
286
287 /* We only handle one "Require-Parameters" parameter. If several parameters
288 are needed, they must be enclosed between quotes */
289 if (extra_args && *extra_args) {
290 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(10142)
291 "When several arguments (%s %s...) are passed to a %s directive, "
292 "they must be enclosed in quotation marks. Otherwise, only the "
293 "first one is taken into account",
294 provider_args, extra_args, cmd->cmd->name);
295 }
296
297 new_authz_config = ap_create_per_dir_config(cmd->pool);
298
299 /* Walk the subsection configuration to get the per_dir config that we will
300 * merge just before the real provider is called.
301 */
302 cmd->override = OR_AUTHCFG | ACCESS_CONF;
303 errmsg = ap_walk_config(cmd->directive->first_child, cmd,
304 new_authz_config);
305 cmd->override = old_overrides;

Callers

nothing calls this directly

Calls 9

ap_strrchr_cFunction · 0.85
ap_check_cmd_contextFunction · 0.85
ap_getword_confFunction · 0.85
ap_create_per_dir_configFunction · 0.85
ap_walk_configFunction · 0.85
ap_lookup_providerFunction · 0.85
ap_get_module_configFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected