1281
1414
SnippetType type;
1282
1415
struct XmlSnippet *snippet_any = NULL;
1283
1416
struct XmlSnippet *snippet_any_attribute = NULL;
1417
GType g_type_collect_namespaces, g_type_any, g_type_any_attribute;
1284
1418
struct XmlSnippet *snippet_collect_namespaces = NULL;
1285
1419
struct XmlSnippet *snippet_signature = NULL;
1286
GSList *unknown_nodes = NULL;
1287
GSList *known_attributes = NULL;
1288
1420
gboolean keep_xmlnode = FALSE;
1290
class = LASSO_NODE_GET_CLASS(node);
1292
/* What do you want me to initialize ? */
1421
GSList *class_list = NULL;
1422
GSList *class_iter = NULL;
1423
xmlAttr *attr = NULL;
1425
LassoNodeClass *node_class;
1433
node_class = class = LASSO_NODE_GET_CLASS(node);
1296
1434
/* No node_data no initialization possible */
1297
1435
if (! class->node_data) {
1298
message(G_LOG_LEVEL_WARNING, "Class %s has no node_data so no initialization is possible", G_OBJECT_CLASS_NAME(class));
1302
if (lasso_flag_memory_debug == TRUE) {
1303
fprintf(stderr, "Initializing %s (at %p)\n", G_OBJECT_TYPE_NAME(node), node);
1306
while (class && LASSO_IS_NODE_CLASS(class) && class->node_data) {
1307
lasso_trace(" initializing %s\n", G_OBJECT_CLASS_NAME(class));
1309
/* reduce keep_xmlnode flags */
1310
keep_xmlnode |= class->node_data->keep_xmlnode;
1312
for (t = xmlnode->children; t; t = t->next) {
1313
if (t->type == XML_TEXT_NODE) {
1314
for (snippet = class->node_data->snippets;
1315
snippet && snippet->name; snippet++) {
1316
GList **location = NULL;
1318
type = snippet->type & 0xff;
1319
value = G_STRUCT_MEMBER_P(node, snippet->offset);
1321
if (type == SNIPPET_LIST_XMLNODES) {
1323
*location = g_list_append(
1324
*location, xmlCopyNode(t, 1));
1325
trace_snippet(" adding xmlNode %p", g_list_last(*location)->data);
1326
} else if (type == SNIPPET_LIST_NODES &&
1327
snippet->type & SNIPPET_ALLOW_TEXT) {
1328
LassoNode *text_node;
1329
text_node = lasso_node_new_from_xmlNode_with_type(t,
1330
"LassoMiscTextNode");
1332
*location = g_list_append(*location, text_node);
1333
trace_snippet(" adding LassoMiscTextNode %p", text_node);
1340
if (t->type != XML_ELEMENT_NODE)
1343
for (snippet = class->node_data->snippets;
1344
snippet && snippet->name; snippet++) {
1436
message(G_LOG_LEVEL_WARNING, "Class %s has no node_data so no initialization "
1437
"is possible", G_OBJECT_CLASS_NAME(class));
1442
/* Collect special snippets like SNIPPET_COLLECT_NAMESPACES, SNIPPET_ANY, SNIPPET_ATTRIBUTE
1443
* or SNIPPET_SIGNATURE, and initialize class_list in reverse. */
1444
while (class && LASSO_IS_NODE_CLASS(class)) {
1445
if (class->node_data) {
1446
GType g_type = G_TYPE_FROM_CLASS(class);
1447
keep_xmlnode |= class->node_data->keep_xmlnode;
1448
if (class->node_data->snippets)
1449
class_list = g_slist_prepend(class_list, class);
1450
for (snippet = class->node_data->snippets; snippet && snippet->name; snippet++) {
1346
1451
type = snippet->type & 0xff;
1347
value = G_STRUCT_MEMBER_P(node, snippet->offset);
1349
if ((snippet->type & SNIPPET_ANY) && type != SNIPPET_ATTRIBUTE) {
1350
snippet_any = snippet;
1353
if (strcmp((char*)t->name, snippet->name) != 0 && snippet->name[0])
1356
if (type == SNIPPET_NODE) {
1357
tmp = lasso_node_new_from_xmlNode_with_type(t,
1358
snippet->class_name);
1359
} else if (type == SNIPPET_NODE_IN_CHILD) {
1360
xmlNode *t2 = t->children;
1361
while (t2 && t2->type != XML_ELEMENT_NODE)
1364
tmp = lasso_node_new_from_xmlNode_with_type(t2,
1365
snippet->class_name);
1367
} else if (type == SNIPPET_CONTENT) {
1368
tmp = xmlNodeGetContent(t);
1369
} else if (type == SNIPPET_NAME_IDENTIFIER) {
1370
tmp = lasso_saml_name_identifier_new_from_xmlNode(t);
1371
} else if (type == SNIPPET_LIST_NODES) {
1372
GList **location = value;
1374
n = lasso_node_new_from_xmlNode_with_type(t,
1375
snippet->class_name);
1376
if (n == NULL && snippet_any == snippet &&
1377
t->properties == NULL && t->children &&
1378
t->children->type == XML_TEXT_NODE &&
1379
t->children->next == NULL) {
1380
/* unknown, but no attributes, and content
1381
* is text ? -> use generic object */
1382
n = lasso_node_new_from_xmlNode_with_type(t,
1383
"LassoMiscTextNode");
1385
if (n && snippet->type & SNIPPET_KEEP_XMLNODE &&
1386
! LASSO_NODE_GET_CLASS(n)->node_data->keep_xmlnode) {
1387
lasso_node_set_original_xmlnode(n, t);
1391
*location = g_list_append(*location, n);
1392
trace_snippet(" adding %p of type %s(%s) to ",
1393
n, G_OBJECT_TYPE_NAME(n),
1394
snippet->class_name);
1396
/* failed to do sth with */
1397
message(G_LOG_LEVEL_WARNING,
1398
"Failed to do sth with %s",
1401
} else if (type == SNIPPET_LIST_CONTENT) {
1402
GList **location = value;
1403
xmlChar *s = xmlNodeGetContent(t);
1404
lasso_list_add_string(*location, (char*)s);
1405
trace_snippet(" adding text %s as content to ", s);
1406
lasso_release_xml_string(s);
1407
} else if (type == SNIPPET_EXTENSION ||
1408
type == SNIPPET_LIST_XMLNODES) {
1409
GList **location = value;
1410
*location = g_list_append(*location, xmlCopyNode(t, 1));
1411
trace_snippet(" adding xmlNode %p to ", g_list_last(*location)->data);
1412
} else if (type == SNIPPET_XMLNODE) {
1413
tmp = xmlCopyNode(t, 1);
1414
} else if (type == SNIPPET_COLLECT_NAMESPACES) {
1415
/* Collect namespaces on the children t */
1416
_lasso_node_collect_namespaces(value, t);
1422
if (type == SNIPPET_XMLNODE || type == SNIPPET_NODE || type == SNIPPET_NODE_IN_CHILD || type ==
1423
SNIPPET_NAME_IDENTIFIER) {
1424
if (snippet->type & SNIPPET_KEEP_XMLNODE && !
1425
LASSO_NODE_GET_CLASS(tmp)->node_data->keep_xmlnode)
1427
lasso_trace(" setting original xmlNode of %p (%s) to %p", tmp, G_OBJECT_TYPE_NAME(tmp), t)
1428
lasso_node_set_original_xmlnode(tmp, t);
1430
if (type == SNIPPET_XMLNODE) {
1431
trace_snippet(" setting xmlNode %p as ", tmp);
1433
trace_snippet(" setting %p of type %s (wanted %s) as ", tmp,
1434
G_OBJECT_TYPE_NAME(tmp),
1435
snippet->class_name);
1437
*(void**)value = tmp;
1439
} else if (snippet->type & SNIPPET_INTEGER) {
1440
int val = strtol(tmp, NULL, 10);
1441
if (((val == LONG_MIN || val == LONG_MAX) && errno == ERANGE)
1442
|| errno == EINVAL || val < 0) {
1443
if (snippet->type & SNIPPET_OPTIONAL_NEG) {
1449
(*(int*)value) = val;
1450
trace_snippet(" setting integer %i for ", val);
1453
} else if (snippet->type & SNIPPET_BOOLEAN) {
1455
if (strcmp((char*)tmp, "true") == 0) {
1457
} else if (strcmp((char*)tmp, "1") == 0) {
1460
trace_snippet(" setting bool %s for ", val ? "TRUE" : "FALSE");
1461
(*(int*)value) = val;
1465
lasso_release_string(*(char**)value);
1466
*(char**)value = g_strdup(tmp);
1467
trace_snippet(" setting text %s as value for ", (char*)tmp);
1468
if (lasso_flag_memory_debug == TRUE) {
1469
fprintf(stderr, " setting field %s/%s to value %p: %s\n", G_OBJECT_TYPE_NAME(node), snippet->name, *(void**)value, (char*)tmp);
1471
lasso_release_xml_string((*(xmlChar**)&tmp));
1477
if ((snippet == NULL || snippet->name == NULL) && snippet_any) {
1478
if (g_slist_find(unknown_nodes, t) == NULL)
1479
unknown_nodes = g_slist_append(unknown_nodes, t);
1481
unknown_nodes = g_slist_remove(unknown_nodes, t);
1485
for (snippet = class->node_data->snippets; snippet && snippet->name; snippet++) {
1487
type = snippet->type & 0xff;
1489
value = G_STRUCT_MEMBER_P(node, snippet->offset);
1490
if (snippet->name && snippet->name[0] == '\0' && type ==
1491
SNIPPET_COLLECT_NAMESPACES) {
1492
snippet_collect_namespaces = snippet;
1495
if (type == SNIPPET_SIGNATURE) {
1496
snippet_signature = snippet;
1499
if (type == SNIPPET_ATTRIBUTE) {
1500
if (snippet->type & SNIPPET_ANY) {
1453
if (snippet->name && snippet->name[0] == '\0' && type ==
1454
SNIPPET_COLLECT_NAMESPACES) {
1455
snippet_collect_namespaces = snippet;
1456
g_type_collect_namespaces = g_type;
1457
} else if (type == SNIPPET_SIGNATURE) {
1458
snippet_signature = snippet;
1459
} else if (type == SNIPPET_ATTRIBUTE && snippet->type & SNIPPET_ANY) {
1460
g_type_any_attribute = g_type;
1501
1461
snippet_any_attribute = snippet;
1504
tmp = xmlGetProp(xmlnode, (xmlChar*)snippet->name);
1505
known_attributes = g_slist_append(known_attributes, snippet->name);
1507
if (type == SNIPPET_TEXT_CHILD)
1508
tmp = xmlNodeGetContent(xmlnode);
1512
if (snippet->type & SNIPPET_INTEGER) {
1513
int val = strtol(tmp, NULL, 10);
1514
if (((val == LONG_MIN || val == LONG_MAX) && errno == ERANGE)
1515
|| errno == EINVAL || val < 0) {
1516
if (snippet->type & SNIPPET_OPTIONAL_NEG) {
1462
} else if (type == SNIPPET_TEXT_CHILD) {
1463
xmlChar *tmp = xmlNodeGetContent(xmlnode);
1464
snippet_set_value(node, class, snippet, tmp);
1465
lasso_release_xml_string(tmp);
1466
} else if (type != SNIPPET_ATTRIBUTE && type != SNIPPET_NODE && snippet->type & SNIPPET_ANY) {
1467
if (! snippet_any) {
1468
g_type_any = g_type;
1469
snippet_any = snippet;
1471
critical("Two any node snippet for class %s",
1472
g_type_name(G_TYPE_FROM_INSTANCE(node)));
1522
(*(int*)value) = val;
1523
} else if (snippet->type & SNIPPET_BOOLEAN) {
1525
if (strcmp((char*)tmp, "true") == 0) {
1527
} else if (strcmp((char*)tmp, "1") == 0) {
1530
(*(int*)value) = val;
1532
lasso_assign_string((*(char**)value), tmp);
1533
if (lasso_flag_memory_debug == TRUE) {
1534
fprintf(stderr, " setting prop %s/%s to value %p: %s\n",
1535
G_OBJECT_TYPE_NAME(node), snippet->name, *(void**)value, (char*)tmp);
1541
1477
class = g_type_class_peek_parent(class);
1544
/* If any parent asked for keeping the current xmlnode, keep it around */
1480
/* If any class asked for keeping the xmlNode, keep it around */
1545
1481
if (keep_xmlnode) {
1546
1482
lasso_node_set_original_xmlnode(node, xmlnode);
1485
/** Collect attributes */
1486
for (attr = xmlnode->properties; attr; attr = attr->next) {
1488
content = xmlNodeGetContent((xmlNode*)attr);
1491
/* Skip xsi:type if it was used to find the node class */
1492
if (attr->ns && lasso_strisequal((char*)attr->name, "type") &&
1493
lasso_strisequal((char*)attr->ns->href, LASSO_XSI_HREF)) {
1494
char *colon = strchr((char*)content, ':');
1498
ns = xmlSearchNs(NULL, xmlnode, content);
1500
if (ns && lasso_strisequal((char*)ns->href, (char*)node_class->node_data->ns->href)
1501
&& lasso_strisequal(&colon[1], node_class->node_data->node_name)) {
1502
lasso_release_xml_string(content);
1508
for (class_iter = class_list; class_iter; class_iter = class_iter->next) {
1509
class = class_iter->data;
1510
for (snippet = class->node_data->snippets;
1511
snippet && snippet->name; snippet++) {
1512
type = snippet->type & 0xff;
1513
/* assign attribute content if attribute has the same name as the
1515
* - the snippet and the attribute have no namespace
1516
* - the snippet has no namespace but the attribute has the same
1517
* namespace as the node
1518
* - the snippet and the node have a namespace, which are equal.
1520
if (type != SNIPPET_ATTRIBUTE)
1522
if (! lasso_strisequal((char*)attr->name, (char*)snippet->name))
1525
gboolean same_namespace, given_namespace;
1527
same_namespace = lasso_equal_namespace(attr->ns,
1528
xmlnode->ns) && ! snippet->ns_uri;
1529
given_namespace = snippet->ns_uri &&
1530
lasso_strisequal((char*)attr->ns->href,
1532
if (! same_namespace && ! given_namespace)
1535
snippet_set_value(node, class, snippet, content);
1540
if (! ok && attr->ns && snippet_any_attribute) {
1541
GHashTable **any_attribute;
1544
any_attribute = SNIPPET_STRUCT_MEMBER_P(node, g_type_any_attribute,
1545
snippet_any_attribute);
1546
if (*any_attribute == NULL) {
1547
*any_attribute = g_hash_table_new_full(g_str_hash, g_str_equal,
1550
if (lasso_equal_namespace(attr->ns, xmlnode->ns)) {
1551
key = g_strdup((char*)attr->name);
1553
key = g_strdup_printf("{%s}%s", attr->ns->href, attr->name);
1555
g_hash_table_insert(*any_attribute, key, g_strdup((char*)content));
1556
lasso_release_xml_string(content);
1558
warning("lasso_node_impl_init_from_xml: Unexpected attribute: {%s}%s = %s",
1559
attr->ns ? attr->ns->href : NULL, attr->name, content);
1561
lasso_release_xml_string(content);
1564
/* Collect children nodes in reverse order of class parents (older parent first), skip non
1565
* node and ANY snippets) */
1566
class_iter = class_list;
1567
snippet = ((LassoNodeClass*)class_iter->data)->node_data->snippets;
1568
next_node_snippet(&class_iter, &snippet);
1569
for (t = xmlnode->children; t && class_iter && snippet; t = t->next) {
1570
/* Only collect text node if:
1571
* - there is a LIST_XMLNODES any snippet
1572
* - there is a LIST_NODES any snippet with the ALLOW_TEXT modifier
1574
if (t->type == XML_TEXT_NODE && snippet_any &&
1575
(is_snippet_type(snippet_any, SNIPPET_LIST_XMLNODES)
1576
|| (is_snippet_type(snippet_any, SNIPPET_LIST_NODES) &&
1577
(snippet_any->type & SNIPPET_ALLOW_TEXT)))) {
1578
GList **location = SNIPPET_STRUCT_MEMBER_P(node, g_type_any, snippet_any);
1579
if (is_snippet_type(snippet_any, SNIPPET_LIST_XMLNODES)) {
1580
lasso_list_add_xml_node(*location, t);
1582
lasso_list_add_new_gobject(*location,
1583
lasso_node_new_from_xmlNode_with_type(t,
1584
"LassoMiscTextNode"));
1586
} else if (t->type == XML_COMMENT_NODE || t->type == XML_PI_NODE || t->type == XML_TEXT_NODE) {
1587
/* ignore comments */
1589
} else if (t->type == XML_ELEMENT_NODE) {
1590
LassoNode *subnode = NULL;
1591
xmlNode *first_child = NULL;
1592
GList **list = NULL;
1593
xmlChar *content = NULL;
1594
gboolean match = FALSE;
1595
struct XmlSnippet *matched_snippet = NULL;
1599
next_node_snippet(&class_iter, &snippet);
1601
error("Element %s:%s cannot be parsed", \
1602
t->ns != NULL ? (char*)t->ns->prefix : "<noprefix>", \
1606
/* Find a matching snippet */
1607
while (class_iter && snippet) {
1608
gboolean mandatory = is_snippet_mandatory(snippet);
1609
gboolean multiple = is_snippet_multiple(snippet);
1611
if ((match = node_match_snippet(xmlnode, t, snippet))) {
1612
matched_snippet = snippet;
1613
class = class_iter->data;
1614
g_type = G_TYPE_FROM_CLASS(class);
1615
value = SNIPPET_STRUCT_MEMBER_P(node, g_type, snippet);
1635
if (matched_snippet->offset || (matched_snippet->type & SNIPPET_PRIVATE)) {
1636
switch (matched_snippet->type & 0xff) {
1637
case SNIPPET_LIST_NODES:
1639
subnode = lasso_node_new_from_xmlNode_with_type(t,
1640
matched_snippet->class_name);
1641
if (is_snippet_type(matched_snippet, SNIPPET_NODE)) {
1642
lasso_assign_new_gobject(*(LassoNode**)value, subnode);
1644
lasso_list_add_new_gobject(*list, subnode);
1647
case SNIPPET_NODE_IN_CHILD:
1648
first_child = xmlSecGetNextElementNode(t->children);
1650
subnode = lasso_node_new_from_xmlNode_with_type(first_child,
1651
matched_snippet->class_name);
1652
lasso_assign_new_gobject(*(LassoNode**)value, subnode);
1655
case SNIPPET_XMLNODE:
1656
lasso_assign_xml_node(*(xmlNode**)value, t);
1658
case SNIPPET_LIST_XMLNODES:
1659
case SNIPPET_EXTENSION:
1660
lasso_list_add_xml_node(*list, t);
1662
case SNIPPET_CONTENT:
1663
case SNIPPET_LIST_CONTENT:
1664
content = xmlNodeGetContent(t);
1665
if (is_snippet_type(matched_snippet, SNIPPET_CONTENT)) {
1666
snippet_set_value(node, class, matched_snippet, content);
1667
} else { /* only list of string-like xsd:type supported */
1668
lasso_list_add_string(*list, (char*)content);
1670
lasso_release_xml_string(content);
1672
case SNIPPET_SIGNATURE:
1676
g_assert_not_reached();
1680
/* When creating a new LassoNode and option KEEP_XMLNODE is present,
1681
* we attached the xmlNode to the LassoNode */
1682
if (subnode && (matched_snippet->type & SNIPPET_KEEP_XMLNODE)) {
1683
lasso_node_set_original_xmlnode(subnode, t);
1686
g_assert_not_reached();
1689
if (t) { /* t is an ELEMENT that dont match any snippet, when taken in order */
1690
if (snippet_any && is_snippet_type(snippet_any, SNIPPET_LIST_XMLNODES)) {
1691
value = SNIPPET_STRUCT_MEMBER_P(node, g_type_any, snippet_any);
1692
GList **list = value;
1693
for (; t; t = t->next) {
1694
lasso_list_add_xml_node(*list, t);
1696
} else if (snippet_any && is_snippet_type(snippet_any, SNIPPET_LIST_NODES)) {
1697
value = SNIPPET_STRUCT_MEMBER_P(node, g_type_any, snippet_any);
1698
GList **list = value;
1699
for (; t; t = t->next) {
1700
LassoNode *subnode = NULL;
1702
if (t->type == XML_TEXT_NODE && (snippet_any->type &
1703
SNIPPET_ALLOW_TEXT)) {
1704
lasso_list_add_new_gobject(*list,
1705
lasso_node_new_from_xmlNode_with_type(t,
1706
"LassoMiscTextNode"));
1707
} else if (t->type == XML_ELEMENT_NODE) {
1708
subnode = lasso_node_new_from_xmlNode_with_type(t,
1709
snippet_any->class_name);
1710
if (subnode && (snippet_any->type & SNIPPET_KEEP_XMLNODE)) {
1711
lasso_node_set_original_xmlnode(subnode, t);
1714
subnode = (LassoNode*)
1715
lasso_misc_text_node_new_with_xml_node(t);
1717
lasso_list_add_new_gobject(*list, subnode);
1720
} else if (snippet_any) {
1721
g_assert_not_reached();
1723
for (; t; t = t->next) {
1724
if (t->type == XML_ELEMENT_NODE) {
1725
critical("lasso_node_impl_init_from_xml: Cannot match "
1726
"element {%s}%s with a snippet of "
1728
t->ns ? t->ns->href : NULL, t->name,
1729
g_type_name(G_TYPE_FROM_INSTANCE(node)));
1549
1737
/* Collect namespaces on the current node */
1550
1738
if (snippet_collect_namespaces) {
1551
void *value = G_STRUCT_MEMBER_P(node, snippet_collect_namespaces->offset);
1739
void *value = SNIPPET_STRUCT_MEMBER_P(node, g_type_collect_namespaces,
1740
snippet_collect_namespaces);
1552
1741
_lasso_node_collect_namespaces(value, xmlnode);
1555
1744
/* Collect signature parameters */
1557
LassoSignatureMethod method;
1558
LassoSignatureType type;
1746
LassoSignatureMethod method = 0;
1559
1747
xmlChar *private_key = NULL;
1560
1748
xmlChar *private_key_password = NULL;
1561
1749
xmlChar *certificate = NULL;
1750
LassoSignatureContext signature_context = LASSO_SIGNATURE_CONTEXT_NONE;
1563
1752
while (snippet_signature) {
2714
2847
if (snippet_any_attribute) {
2715
GHashTable *value = G_STRUCT_MEMBER(GHashTable*, node,
2716
snippet_any_attribute->offset);
2848
GHashTable *value = SNIPPET_STRUCT_MEMBER(GHashTable *, node, g_type,
2849
snippet_any_attribute);
2718
2851
g_hash_table_foreach(value, (GHFunc)snippet_dump_any, xmlnode);
2724
void lasso_node_add_signature_template(LassoNode *node, xmlNode *xmlnode,
2857
lasso_node_add_signature_template(LassoNode *node, xmlNode *xmlnode,
2725
2858
struct XmlSnippet *snippet_signature)
2727
LassoNodeClass *klass = LASSO_NODE_GET_CLASS(node);
2728
LassoSignatureType sign_type;
2729
LassoSignatureMethod sign_method;
2730
xmlNode *signature = NULL, *reference, *key_info, *t;
2734
while (klass && LASSO_IS_NODE_CLASS(klass) && klass->node_data) {
2735
if (klass->node_data->sign_type_offset)
2737
klass = g_type_class_peek_parent(klass);
2740
if (klass->node_data->sign_type_offset == 0)
2743
sign_type = G_STRUCT_MEMBER(
2744
LassoSignatureType, node,
2745
klass->node_data->sign_type_offset);
2746
sign_method = G_STRUCT_MEMBER(
2747
LassoSignatureMethod, node,
2748
klass->node_data->sign_method_offset);
2750
if (sign_type == LASSO_SIGNATURE_TYPE_NONE)
2753
if (sign_method == LASSO_SIGNATURE_METHOD_RSA_SHA1) {
2754
signature = xmlSecTmplSignatureCreate(NULL,
2755
xmlSecTransformExclC14NId,
2756
xmlSecTransformRsaSha1Id, NULL);
2758
signature = xmlSecTmplSignatureCreate(NULL,
2759
xmlSecTransformExclC14NId,
2760
xmlSecTransformDsaSha1Id, NULL);
2762
/* XXX: get out if signature == NULL ? */
2763
xmlAddChild(xmlnode, signature);
2765
id = G_STRUCT_MEMBER(char*, node, snippet_signature->offset);
2766
uri = g_strdup_printf("#%s", id);
2767
reference = xmlSecTmplSignatureAddReference(signature,
2768
xmlSecTransformSha1Id, NULL, (xmlChar*)uri, NULL);
2771
/* add enveloped transform */
2772
xmlSecTmplReferenceAddTransform(reference, xmlSecTransformEnvelopedId);
2773
/* add exclusive C14N transform */
2774
xmlSecTmplReferenceAddTransform(reference, xmlSecTransformExclC14NId);
2776
if (sign_type == LASSO_SIGNATURE_TYPE_WITHX509) {
2777
/* add <dsig:KeyInfo/> */
2778
key_info = xmlSecTmplSignatureEnsureKeyInfo(signature, NULL);
2779
t = xmlSecTmplKeyInfoAddX509Data(key_info);
2860
LassoNodeClass *klass = NULL;
2861
LassoNodeClassData *node_data = NULL;
2862
LassoSignatureContext context;
2865
node_data = lasso_legacy_get_signature_node_data(node, &klass);
2869
if (node_data->sign_type_offset == 0)
2872
context = lasso_node_get_signature(node);
2873
if (! lasso_validate_signature_context(context))
2874
if (lasso_legacy_extract_and_copy_signature_parameters(node, node_data))
2875
context = lasso_node_get_signature(node);
2877
if (snippet_signature->offset) {
2878
id = SNIPPET_STRUCT_MEMBER(char *, node, G_TYPE_FROM_CLASS(klass), snippet_signature);
2881
lasso_xmlnode_add_saml2_signature_template(xmlnode, context, id);
2783
2884
static struct XmlSnippet*
2784
find_xml_snippet_by_name(LassoNode *node, char *name)
2885
find_xml_snippet_by_name(LassoNode *node, char *name, LassoNodeClass **class_p)
2786
2887
LassoNodeClass *class;
2787
2888
struct XmlSnippet *snippet;