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

Function authaliassection

modules/aaa/mod_authn_core.c:201–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199};
200
201static const char *authaliassection(cmd_parms *cmd, void *mconfig, const char *arg)
202{
203 const char *endp = ap_strrchr_c(arg, '>');
204 const char *args;
205 char *provider_alias;
206 char *provider_name;
207 int old_overrides = cmd->override;
208 const char *errmsg;
209 const authn_provider *provider = NULL;
210 ap_conf_vector_t *new_auth_config = ap_create_per_dir_config(cmd->pool);
211 authn_alias_srv_conf *authcfg =
212 (authn_alias_srv_conf *)ap_get_module_config(cmd->server->module_config,
213 &authn_core_module);
214
215 const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
216 if (err != NULL) {
217 return err;
218 }
219
220 if (endp == NULL) {
221 return apr_pstrcat(cmd->pool, cmd->cmd->name,
222 "> directive missing closing '>'", NULL);
223 }
224
225 args = apr_pstrndup(cmd->temp_pool, arg, endp - arg);
226
227 if (!args[0]) {
228 return apr_pstrcat(cmd->pool, cmd->cmd->name,
229 "> directive requires additional arguments", NULL);
230 }
231
232 /* Pull the real provider name and the alias name from the block header */
233 provider_name = ap_getword_conf(cmd->pool, &args);
234 provider_alias = ap_getword_conf(cmd->pool, &args);
235
236 if (!provider_name[0] || !provider_alias[0]) {
237 return apr_pstrcat(cmd->pool, cmd->cmd->name,
238 "> directive requires additional arguments", NULL);
239 }
240
241 if (strcasecmp(provider_name, provider_alias) == 0) {
242 return apr_pstrcat(cmd->pool,
243 "The alias provider name must be different from the base provider name.", NULL);
244 }
245
246 /* Look up the alias provider to make sure that it hasn't already been registered. */
247 provider = ap_lookup_provider(AUTHN_PROVIDER_GROUP, provider_alias,
248 AUTHN_PROVIDER_VERSION);
249 if (provider) {
250 return apr_pstrcat(cmd->pool, "The alias provider ", provider_alias,
251 " has already be registered previously as either a base provider or an alias provider.",
252 NULL);
253 }
254
255 /* walk the subsection configuration to get the per_dir config that we will
256 merge just before the real provider is called. */
257 cmd->override = OR_AUTHCFG | ACCESS_CONF;
258 errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_auth_config);

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected