summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2006-12-06 16:32:02 +0000
committerFrederic Peters <fpeters@entrouvert.com>2006-12-06 16:32:02 +0000
commit3ff0082fdf8d632a3a35d26761cd7d9f2e526abd (patch)
tree287ec1967cdf4a985caa486afcbf43af6381a811
parent99f0d3df4f648309c34a857694712c216a5cc61d (diff)
downloadlasso-3ff0082fdf8d632a3a35d26761cd7d9f2e526abd.tar.gz
lasso-3ff0082fdf8d632a3a35d26761cd7d9f2e526abd.tar.xz
lasso-3ff0082fdf8d632a3a35d26761cd7d9f2e526abd.zip
if signature element is not found, look for it in an assertion element
(this is not perfect since it should be possibly to check *both* signatures and we don't care for the moment)
-rw-r--r--lasso/id-ff/provider.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/lasso/id-ff/provider.c b/lasso/id-ff/provider.c
index 33545745..479695e6 100644
--- a/lasso/id-ff/provider.c
+++ b/lasso/id-ff/provider.c
@@ -963,14 +963,6 @@ int lasso_provider_verify_signature(LassoProvider *provider,
xmlnode = xmlDocGetRootElement(doc);
}
- if (id_attr_name) {
- xmlChar *id_value = xmlGetProp(xmlnode, (xmlChar*)id_attr_name);
- xmlAttr *id_attr = xmlHasProp(xmlnode, (xmlChar*)id_attr_name);
- if (id_value) {
- xmlAddID(NULL, doc, id_value, id_attr);
- xmlFree(id_value);
- }
- }
sign = NULL;
for (sign = xmlnode->children; sign; sign = sign->next) {
@@ -978,11 +970,36 @@ int lasso_provider_verify_signature(LassoProvider *provider,
break;
}
+ /* If no signature was found, look for one in assertion */
+ if (sign == NULL) {
+ for (sign = xmlnode->children; sign; sign = sign->next) {
+ if (strcmp((char*)sign->name, "Assertion") == 0)
+ break;
+ }
+ if (sign != NULL) {
+ xmlnode = sign;
+ for (sign = xmlnode->children; sign; sign = sign->next) {
+ if (strcmp((char*)sign->name, "Signature") == 0)
+ break;
+ }
+ }
+ }
+
+
if (sign == NULL) {
xmlFreeDoc(doc);
return LASSO_DS_ERROR_SIGNATURE_NOT_FOUND;
}
+ if (id_attr_name) {
+ xmlChar *id_value = xmlGetProp(xmlnode, (xmlChar*)id_attr_name);
+ xmlAttr *id_attr = xmlHasProp(xmlnode, (xmlChar*)id_attr_name);
+ if (id_value) {
+ xmlAddID(NULL, doc, id_value, id_attr);
+ xmlFree(id_value);
+ }
+ }
+
x509data = xmlSecFindNode(xmlnode, xmlSecNodeX509Data, xmlSecDSigNs);
if (x509data != NULL && provider->ca_cert_chain != NULL) {
keys_mngr = lasso_load_certs_from_pem_certs_chain_file(
@@ -1024,7 +1041,7 @@ int lasso_provider_verify_signature(LassoProvider *provider,
}
/**
- * lasso_provider_set_encryption:
+ * lasso_provider_set_encryption_mode:
* @provider: provider to set encryption for
* @encryption_activation: TRUE to activate, FALSE, to desactivate
*