diff options
author | manu@netbsd.org <manu@netbsd.org@a716ebb1-153a-0410-b759-cfb97c6a1b53> | 2011-03-23 15:05:19 +0000 |
---|---|---|
committer | manu@netbsd.org <manu@netbsd.org@a716ebb1-153a-0410-b759-cfb97c6a1b53> | 2011-03-23 15:05:19 +0000 |
commit | f0467bab7c76db8b5989515da004931cfbca9837 (patch) | |
tree | 5081a9dab1e72c644ee7deaf2b7333b819d1305f /auth_mellon_config.c | |
parent | 30133d867b8513dbee8253c369d6d58d750eda54 (diff) | |
download | mod_auth_mellon-f0467bab7c76db8b5989515da004931cfbca9837.tar.gz mod_auth_mellon-f0467bab7c76db8b5989515da004931cfbca9837.tar.xz mod_auth_mellon-f0467bab7c76db8b5989515da004931cfbca9837.zip |
New MellonIdPMetadataGlob directive to load mulitple IdP metadata
using a glob(3) pattern.
git-svn-id: https://modmellon.googlecode.com/svn/trunk@117 a716ebb1-153a-0410-b759-cfb97c6a1b53
Diffstat (limited to 'auth_mellon_config.c')
-rw-r--r-- | auth_mellon_config.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/auth_mellon_config.c b/auth_mellon_config.c index 70e864e..2e740f6 100644 --- a/auth_mellon_config.c +++ b/auth_mellon_config.c @@ -222,6 +222,54 @@ static const char *am_get_provider_id(apr_pool_t *p, return NULL; } +/* This function handles configuration directives which use + * a glob pattern + * + * Parameters: + * cmd_parms *cmd The command structure for this configuration + * directive. + * void *struct_ptr Pointer to the current directory configuration. + * NULL if we are not in a directory configuration. + * const char *arg The string argument following this configuration + * directive in the configuraion file. + * + * Returns: + * NULL on success or an error string on failure. + */ +static const char *am_set_glob_fn(cmd_parms *cmd, + void *struct_ptr, + const char *arg) +{ + const char *(*take_argv)(cmd_parms *, void *, const char *); + apr_array_header_t *files; + const char *error; + const char *directory; + int i; + + take_argv = cmd->info; + directory = am_filepath_dirname(cmd->pool, arg); + + if (arg == NULL || *arg == '\0') + return apr_psprintf(cmd->pool, "%s takes one argument", cmd->cmd->name); + + if (apr_match_glob(arg, &files, cmd->pool) != 0) + return take_argv(cmd, struct_ptr, arg); + + for (i = 0; i < files->nelts; i++) { + const char *path; + + path = apr_pstrcat(cmd->pool, directory, "/", + ((const char **)(files->elts))[i], NULL); + + error = take_argv(cmd, struct_ptr, path); + + if (error != NULL) + return error; + } + + return NULL; +} + /* This function handles configuration directives which set an * idp related slot in the module configuration. * @@ -872,6 +920,13 @@ const command_rec auth_mellon_commands[] = { "Full path to xml metadata file for the IdP." ), AP_INIT_TAKE1( + "MellonIdPMetadataGlob", + am_set_glob_fn, + am_set_idp_string_slot, + OR_AUTHCFG, + "Full path to xml metadata files for the IdP, with glob(3) patterns." + ), + AP_INIT_TAKE1( "MellonIdPPublicKeyFile", ap_set_string_slot, (void *)APR_OFFSETOF(am_dir_cfg_rec, idp_public_key_file), |