summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2013-10-11 16:35:03 +0200
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2013-10-11 16:35:03 +0200
commite50981372fb788f4a8b1d4a2e72e7a51fec3ddd1 (patch)
tree343cf241e0ec42e808ab4d86c21164dc3a03b4f6
parent0bb846a3558beb80ba5e7d4c6696f6cfb724b5f1 (diff)
saml-2.0/provider: when looking for endpoints take a null role as meanning « take the first one »
-rw-r--r--lasso/saml-2.0/provider.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/lasso/saml-2.0/provider.c b/lasso/saml-2.0/provider.c
index 8f408b12..9371d286 100644
--- a/lasso/saml-2.0/provider.c
+++ b/lasso/saml-2.0/provider.c
@@ -808,7 +808,9 @@ lasso_saml20_provider_get_endpoint_url(LassoProvider *provider,
continue;
if (! endpoint_type->binding)
continue;
- if (endpoint_type->role != role)
+ if (endpoint_type->role != role \
+ && role != LASSO_PROVIDER_ROLE_ANY \
+ && role != LASSO_PROVIDER_ROLE_NONE)
continue;
if (! lasso_strisequal(endpoint_type->kind, kind))
continue;
@@ -851,11 +853,14 @@ lasso_saml20_provider_get_artifact_resolution_service_index(LassoProvider *provi
continue;
/* endpoints are already properly ordered to provide the default endpoint first, so
* we just need to return the first matching one */
- if (endpoint_type->role == provider->role &&
- lasso_strisequal(endpoint_type->kind,kind))
- {
- *index = endpoint_type->index;
- return 0;
+ if (endpoint_type->role == provider->role || provider->role ==
+ LASSO_PROVIDER_ROLE_NONE || provider->role ==
+ LASSO_PROVIDER_ROLE_ANY) {
+ if (lasso_strisequal(endpoint_type->kind,kind))
+ {
+ *index = endpoint_type->index;
+ return 0;
+ }
}
}
return -1;