Change cfg->idp_metadata_files to an array instead of an hash.
git-svn-id: https://modmellon.googlecode.com/svn/trunk/mod_mellon2@126 a716ebb1-153a-0410-b759-cfb97c6a1b53
This commit is contained in:
parent
e48e01904c
commit
5e43170724
|
@ -183,7 +183,7 @@ typedef struct am_dir_cfg_rec {
|
|||
const char *sp_metadata_file;
|
||||
const char *sp_private_key_file;
|
||||
const char *sp_cert_file;
|
||||
apr_hash_t *idp_metadata_files;
|
||||
apr_array_header_t *idp_metadata_files;
|
||||
const char *idp_public_key_file;
|
||||
const char *idp_ca_file;
|
||||
|
||||
|
|
|
@ -291,17 +291,10 @@ static const char *am_set_idp_string_slot(cmd_parms *cmd,
|
|||
server_rec *s = cmd->server;
|
||||
apr_pool_t *pconf = s->process->pconf;
|
||||
am_dir_cfg_rec *cfg = (am_dir_cfg_rec *)struct_ptr;
|
||||
const char *error;
|
||||
const char *provider_id;
|
||||
const char **filename_slot;
|
||||
|
||||
if ((error = am_get_provider_id(cmd->pool, s,
|
||||
arg, &provider_id)) != NULL)
|
||||
return apr_psprintf(cmd->pool, "%s - %s", cmd->cmd->name, error);
|
||||
|
||||
apr_hash_set(cfg->idp_metadata_files,
|
||||
apr_pstrdup(pconf, provider_id),
|
||||
APR_HASH_KEY_STRING,
|
||||
apr_pstrdup(pconf, arg));
|
||||
filename_slot = apr_array_push(cfg->idp_metadata_files);
|
||||
*filename_slot = apr_pstrdup(pconf, arg);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1084,7 +1077,7 @@ void *auth_mellon_dir_config(apr_pool_t *p, char *d)
|
|||
dir->sp_metadata_file = NULL;
|
||||
dir->sp_private_key_file = NULL;
|
||||
dir->sp_cert_file = NULL;
|
||||
dir->idp_metadata_files = apr_hash_make(p);
|
||||
dir->idp_metadata_files = apr_array_make(p, 0, sizeof(const char *));
|
||||
dir->idp_public_key_file = NULL;
|
||||
dir->idp_ca_file = NULL;
|
||||
dir->login_path = default_login_path;
|
||||
|
@ -1208,10 +1201,9 @@ void *auth_mellon_dir_merge(apr_pool_t *p, void *base, void *add)
|
|||
add_cfg->sp_cert_file :
|
||||
base_cfg->sp_cert_file);
|
||||
|
||||
new_cfg->idp_metadata_files = apr_hash_copy(p,
|
||||
(apr_hash_count(add_cfg->idp_metadata_files) > 0) ?
|
||||
add_cfg->idp_metadata_files :
|
||||
base_cfg->idp_metadata_files);
|
||||
new_cfg->idp_metadata_files = (add_cfg->idp_metadata_files->nelts > 0 ?
|
||||
add_cfg->idp_metadata_files :
|
||||
base_cfg->idp_metadata_files);
|
||||
|
||||
new_cfg->idp_public_key_file = (add_cfg->idp_public_key_file ?
|
||||
add_cfg->idp_public_key_file :
|
||||
|
|
|
@ -216,33 +216,27 @@ static int am_server_add_providers(request_rec *r)
|
|||
am_dir_cfg_rec *cfg = am_get_dir_cfg(r);
|
||||
const char *idp_metadata_file;
|
||||
const char *idp_public_key_file;
|
||||
apr_hash_index_t *index;
|
||||
apr_size_t index;
|
||||
int count = 0;
|
||||
|
||||
if (apr_hash_count(cfg->idp_metadata_files) == 1)
|
||||
if (cfg->idp_metadata_files->nelts == 1)
|
||||
idp_public_key_file = cfg->idp_public_key_file;
|
||||
else
|
||||
idp_public_key_file = NULL;
|
||||
|
||||
for (index = apr_hash_first(r->pool, cfg->idp_metadata_files);
|
||||
index;
|
||||
index = apr_hash_next(index)) {
|
||||
const char *idp_provider_id;
|
||||
apr_ssize_t len;
|
||||
for (index = 0; index < cfg->idp_metadata_files->nelts; index++) {
|
||||
int ret;
|
||||
|
||||
apr_hash_this(index, (const void **)&idp_provider_id,
|
||||
&len, (void *)&idp_metadata_file);
|
||||
idp_metadata_file = APR_ARRAY_IDX(cfg->idp_metadata_files, index,
|
||||
const char *);
|
||||
|
||||
|
||||
ret = lasso_server_add_provider(cfg->server, LASSO_PROVIDER_ROLE_IDP,
|
||||
idp_metadata_file,
|
||||
idp_public_key_file,
|
||||
cfg->idp_ca_file);
|
||||
if (ret != 0) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||
"Error adding IdP \"%s\" to lasso server object.",
|
||||
idp_provider_id);
|
||||
"Error adding IdP from \"%s\" to lasso server object.",
|
||||
idp_metadata_file);
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue