summaryrefslogtreecommitdiff
path: root/src/relationship.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/relationship.c')
-rw-r--r--src/relationship.c351
1 files changed, 112 insertions, 239 deletions
diff --git a/src/relationship.c b/src/relationship.c
index e510d4b6..54cef688 100644
--- a/src/relationship.c
+++ b/src/relationship.c
@@ -1,37 +1,18 @@
-/**
+/*
* XML Security Library (http://www.aleksey.com/xmlsec).
*
- * Relationship transform
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
*
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
*/
-#include "globals.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <libxml/tree.h>
-#include <libxml/xpointer.h>
-#include <libxml/c14n.h>
-
-#include <xmlsec/xmlsec.h>
-#include <xmlsec/xmltree.h>
-#include <xmlsec/keys.h>
-#include <xmlsec/list.h>
-#include <xmlsec/transforms.h>
-#include <xmlsec/errors.h>
-
-
-/******************************************************************************
- *
- * Relationship transform
- *
- * http://standards.iso.org/ittf/PubliclyAvailableStandards/c061796_ISO_IEC_29500-2_2012.zip
+/**
+ * SECTION:relationship
+ * @Short_description: Relationship transform implementation
+ * @Stability: Private
*
- * 13.2.4.24 Relationships Transform Algorithm
+ * [Relationship transform](http://standards.iso.org/ittf/PubliclyAvailableStandards/c061796_ISO_IEC_29500-2_2012.zip)
*
* The relationships transform takes the XML document from the Relationships part and converts
* it to another XML document.
@@ -79,7 +60,7 @@
* IMPLEMENTATION NOTES (https://github.com/lsh123/xmlsec/pull/24):
*
* * We don't simply manipulate the XML tree, but do an XML tree -> output bytes transformation,
- * so e.g. because we never write characters inside XML elements, we implicitly remove all character
+ * because we never write characters inside XML elements, we implicitly remove all character
* contents, as required by step 3, point 1. It also simplifies the task of the situation that
* realistically the input of the transformation is always a document that conforms to the OOXML
* relationships XML schema, so in practice it'll never happen that the input document has e.g.
@@ -91,7 +72,24 @@
* when there will be such an input, then it'll be easy to add support for that. But I didn't want to clutter
* the current implementation with details that doesn't seem to be used in practice
*
- *****************************************************************************/
+ */
+#include "globals.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <libxml/tree.h>
+#include <libxml/xpointer.h>
+#include <libxml/c14n.h>
+
+#include <xmlsec/xmlsec.h>
+#include <xmlsec/xmltree.h>
+#include <xmlsec/keys.h>
+#include <xmlsec/list.h>
+#include <xmlsec/transforms.h>
+#include <xmlsec/errors.h>
+
+
typedef struct _xmlSecRelationshipCtx xmlSecRelationshipCtx,
*xmlSecRelationshipCtxPtr;
struct _xmlSecRelationshipCtx {
@@ -168,11 +166,8 @@ xmlSecRelationshipInitialize(xmlSecTransformPtr transform) {
ctx->sourceIdList = xmlSecPtrListCreate(xmlSecStringListId);
if(ctx->sourceIdList == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecPtrListCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecPtrListCreate",
+ xmlSecTransformGetName(transform));
return(-1);
}
return(0);
@@ -212,43 +207,21 @@ xmlSecRelationshipReadNode(xmlSecTransformPtr transform, xmlNodePtr node, xmlSec
while(cur != NULL) {
if(xmlSecCheckNodeName(cur, xmlSecNodeRelationshipReference, xmlSecRelationshipReferenceNs)) {
xmlChar* sourceId;
- xmlChar* tmp;
sourceId = xmlGetProp(cur, xmlSecRelationshipAttrSourceId);
if(sourceId == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "xmlGetProp",
- xmlSecErrorsSafeString(xmlSecRelationshipAttrSourceId),
- XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
- return(-1);
- }
-
- tmp = xmlStrdup(sourceId);
- if(tmp == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlStrdup",
- XMLSEC_ERRORS_R_STRDUP_FAILED,
- "len=%d", xmlStrlen(sourceId));
- xmlFree(sourceId);
+ xmlSecInvalidNodeAttributeError(cur, xmlSecRelationshipAttrSourceId,
+ NULL, "empty");
return(-1);
}
- ret = xmlSecPtrListAdd(ctx->sourceIdList, tmp);
+ ret = xmlSecPtrListAdd(ctx->sourceIdList, sourceId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecPtrListAdd",
+ xmlSecTransformGetName(transform));
xmlFree(sourceId);
- xmlFree(tmp);
return(-1);
}
- xmlFree(sourceId);
- xmlFree(tmp);
}
cur = cur->next;
@@ -260,8 +233,8 @@ xmlSecRelationshipReadNode(xmlSecTransformPtr transform, xmlNodePtr node, xmlSec
/* Sorts Relationship elements by Id value in lexicographical order. */
static int
xmlSecTransformRelationshipCompare(xmlNodePtr node1, xmlNodePtr node2) {
- xmlChar* id1;
- xmlChar* id2;
+ xmlChar* id1 = NULL;
+ xmlChar* id2 = NULL;
int ret;
if(node1 == node2) {
@@ -277,21 +250,28 @@ xmlSecTransformRelationshipCompare(xmlNodePtr node1, xmlNodePtr node2) {
id1 = xmlGetProp(node1, xmlSecRelationshipAttrId);
id2 = xmlGetProp(node2, xmlSecRelationshipAttrId);
if(id1 == NULL) {
- return(-1);
+ ret = -1;
+ goto done;
}
if(id2 == NULL) {
- xmlFree(id1);
- return(1);
+ ret = 1;
+ goto done;
}
ret = xmlStrcmp(id1, id2);
- xmlFree(id1);
- xmlFree(id2);
- return(ret);
+done:
+ if (id1 != NULL) {
+ xmlFree(id1);
+ }
+ if (id2 != NULL) {
+ xmlFree(id2);
+ }
+
+ return ret;
}
-/**
+/*
* This is step 2, point 4: if the input sourceId list doesn't contain the Id attribute of the current node,
* then exclude it from the output, instead of processing it.
*/
@@ -309,43 +289,38 @@ xmlSecTransformRelationshipProcessNode(xmlSecTransformPtr transform, xmlOutputBu
if(xmlSecCheckNodeName(cur, xmlSecNodeRelationship, xmlSecRelationshipsNs)) {
xmlChar* id = xmlGetProp(cur, xmlSecRelationshipAttrId);
if(id == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlGetProp(xmlSecRelationshipAttrId)",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=Id");
+ xmlSecXmlError2("xmlGetProp(xmlSecRelationshipAttrId)",
+ xmlSecTransformGetName(transform),
+ "name=%s", xmlSecRelationshipAttrId);
return(-1);
}
ctx = xmlSecRelationshipGetCtx(transform);
for(ii = 0; ii < xmlSecPtrListGetSize(ctx->sourceIdList); ++ii) {
- if(xmlStrcmp(xmlSecPtrListGetItem(ctx->sourceIdList, ii), id) == 0) {
+ if(xmlStrcmp((xmlChar *)xmlSecPtrListGetItem(ctx->sourceIdList, ii), id) == 0) {
found = 1;
break;
}
}
+ xmlFree(id);
+
if(found < 0) {
- xmlFree(id);
return(0);
}
- xmlFree(id);
}
ret = xmlSecTransformRelationshipProcessElementNode(transform, buf, cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformRelationshipProcessElementNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecTransformRelationshipProcessElementNode",
+ xmlSecTransformGetName(transform));
return(-1);
}
return(0);
}
-/**
+/*
* This is step 2, point 3: sort elements by Id: we process other elements as-is, but for elements we collect them in a list,
* then sort, and finally process them (process the head of the list, then pop the head, till the list becomes empty).
*/
@@ -360,32 +335,21 @@ xmlSecTransformRelationshipProcessNodeList(xmlSecTransformPtr transform, xmlOutp
list = xmlListCreate(NULL, (xmlListDataCompare)xmlSecTransformRelationshipCompare);
if(list == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlListCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlListCreate", xmlSecTransformGetName(transform));
return(-1);
}
for(; cur; cur = cur->next) {
if(xmlStrcmp(cur->name, xmlSecNodeRelationship) == 0) {
if(xmlListInsert(list, cur) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlListInsert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlListInsert", xmlSecTransformGetName(transform));
return(-1);
}
} else {
ret = xmlSecTransformRelationshipProcessNode(transform, buf, cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformRelationshipProcessNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecTransformRelationshipProcessNode",
+ xmlSecTransformGetName(transform));
xmlListDelete(list);
return(-1);
}
@@ -400,11 +364,8 @@ xmlSecTransformRelationshipProcessNodeList(xmlSecTransformPtr transform, xmlOutp
ret = xmlSecTransformRelationshipProcessNode(transform, buf, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformRelationshipProcessNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecTransformRelationshipProcessNode",
+ xmlSecTransformGetName(transform));
xmlListDelete(list);
return(-1);
}
@@ -426,50 +387,30 @@ xmlSecTransformRelationshipWriteProp(xmlOutputBufferPtr buf, const xmlChar * nam
ret = xmlOutputBufferWriteString(buf, " ");
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlOutputBufferWriteString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferWriteString", NULL);
return(-1);
}
ret = xmlOutputBufferWriteString(buf, (const char*) name);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlOutputBufferWriteString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferWriteString", NULL);
return(-1);
}
if(value != NULL) {
ret = xmlOutputBufferWriteString(buf, "=\"");
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlOutputBufferWriteString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferWriteString", NULL);
return(-1);
}
ret = xmlOutputBufferWriteString(buf, (const char*) value);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlOutputBufferWriteString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferWriteString", NULL);
return(-1);
}
ret = xmlOutputBufferWriteString(buf, "\"");
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlOutputBufferWriteString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferWriteString", NULL);
return(-1);
}
}
@@ -499,20 +440,14 @@ xmlSecTransformRelationshipProcessElementNode(xmlSecTransformPtr transform, xmlO
/* write open node */
ret = xmlOutputBufferWriteString(buf, "<");
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlOutputBufferWriteString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferWriteString",
+ xmlSecTransformGetName(transform));
return(-1);
}
ret = xmlOutputBufferWriteString(buf, (const char *)cur->name);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlOutputBufferWriteString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferWriteString",
+ xmlSecTransformGetName(transform));
return(-1);
}
@@ -520,22 +455,19 @@ xmlSecTransformRelationshipProcessElementNode(xmlSecTransformPtr transform, xmlO
if(cur->nsDef != NULL) {
ret = xmlSecTransformRelationshipWriteNs(buf, cur->nsDef->href);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformRelationshipWriteNs",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecTransformRelationshipWriteNs",
+ xmlSecTransformGetName(transform));
return(-1);
}
}
- /**
+ /*
* write attributes:
*
* This is step 3, point 6: add default value of TargetMode if there is no such attribute.
*/
for(attr = cur->properties; attr != NULL; attr = attr->next) {
- xmlChar* value = xmlGetProp(cur, attr->name);
+ xmlChar * value = xmlGetProp(cur, attr->name);
if(xmlStrcmp(attr->name, xmlSecRelationshipAttrTargetMode) == 0) {
foundTargetMode = 1;
@@ -543,14 +475,12 @@ xmlSecTransformRelationshipProcessElementNode(xmlSecTransformPtr transform, xmlO
ret = xmlSecTransformRelationshipWriteProp(buf, attr->name, value);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformRelationshipWriteProp",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecTransformRelationshipWriteProp",
+ xmlSecTransformGetName(transform));
xmlFree(value);
return(-1);
}
+
xmlFree(value);
}
@@ -558,11 +488,8 @@ xmlSecTransformRelationshipProcessElementNode(xmlSecTransformPtr transform, xmlO
if(xmlStrcmp(cur->name, xmlSecNodeRelationship) == 0 && !foundTargetMode) {
ret = xmlSecTransformRelationshipWriteProp(buf, xmlSecRelationshipAttrTargetMode, BAD_CAST "Internal");
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformRelationshipWriteProp(TargetMode=Internal)",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecTransformRelationshipWriteProp(TargetMode=Internal)",
+ xmlSecTransformGetName(transform));
return(-1);
}
}
@@ -570,11 +497,8 @@ xmlSecTransformRelationshipProcessElementNode(xmlSecTransformPtr transform, xmlO
/* finish writing open node */
ret = xmlOutputBufferWriteString(buf, ">");
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlOutputBufferWriteString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferWriteString",
+ xmlSecTransformGetName(transform));
return(-1);
}
@@ -582,11 +506,8 @@ xmlSecTransformRelationshipProcessElementNode(xmlSecTransformPtr transform, xmlO
if(cur->children != NULL) {
ret = xmlSecTransformRelationshipProcessNodeList(transform, buf, cur->children);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformRelationshipProcessNodeList",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecTransformRelationshipProcessNodeList",
+ xmlSecTransformGetName(transform));
return(-1);
}
}
@@ -594,28 +515,19 @@ xmlSecTransformRelationshipProcessElementNode(xmlSecTransformPtr transform, xmlO
/* write closing node */
ret = xmlOutputBufferWriteString(buf, "</");
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlOutputBufferWriteString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferWriteString",
+ xmlSecTransformGetName(transform));
return(-1);
}
ret = xmlOutputBufferWriteString(buf, (const char *)cur->name);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlOutputBufferWriteString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferWriteString",
+ xmlSecTransformGetName(transform));
return(-1);
}
if(xmlOutputBufferWriteString(buf, ">") < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlOutputBufferWriteString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferWriteString",
+ xmlSecTransformGetName(transform));
return(-1);
}
@@ -634,11 +546,8 @@ xmlSecTransformRelationshipExecute(xmlSecTransformPtr transform, xmlOutputBuffer
if(doc->children != NULL) {
ret = xmlSecTransformRelationshipProcessNodeList(transform, buf, doc->children);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformRelationshipProcessNodeList",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecTransformRelationshipProcessNodeList",
+ xmlSecTransformGetName(transform));
return(-1);
}
}
@@ -669,11 +578,7 @@ xmlSecTransformRelationshipPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPt
case xmlSecTransformStatusFinished:
return(0);
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
+ xmlSecInvalidTransfromStatusError(transform);
return(-1);
}
xmlSecAssert2(transform->status == xmlSecTransformStatusWorking, -1);
@@ -682,43 +587,30 @@ xmlSecTransformRelationshipPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPt
if(transform->next != NULL) {
buf = xmlSecTransformCreateOutputBuffer(transform->next, transformCtx);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformCreateOutputBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecTransformCreateOutputBuffer",
+ xmlSecTransformGetName(transform));
return(-1);
}
} else {
buf = xmlSecBufferCreateOutputBuffer(&(transform->outBuf));
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferCreateOutputBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecBufferCreateOutputBuffer",
+ xmlSecTransformGetName(transform));
return(-1);
}
}
ret = xmlSecTransformRelationshipExecute(transform, buf, nodes->doc);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlC14NExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecTransformRelationshipExecute",
+ xmlSecTransformGetName(transform));
xmlOutputBufferClose(buf);
return(-1);
}
ret = xmlOutputBufferClose(buf);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlOutputBufferClose",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferClose", xmlSecTransformGetName(transform));
return(-1);
}
transform->status = xmlSecTransformStatusFinished;
@@ -749,43 +641,30 @@ xmlSecTransformRelationshipPopBin(xmlSecTransformPtr transform, xmlSecByte* data
/* get xml data from previous transform */
ret = xmlSecTransformPopXml(transform->prev, &(transform->inNodes), transformCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformPopXml",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecTransformPopXml",
+ xmlSecTransformGetName(transform));
return(-1);
}
/* dump everything to internal buffer */
buf = xmlSecBufferCreateOutputBuffer(out);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferCreateOutputBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlSecBufferCreateOutputBuffer",
+ xmlSecTransformGetName(transform));
return(-1);
}
ret = xmlC14NExecute(transform->inNodes->doc, (xmlC14NIsVisibleCallback)xmlSecNodeSetContains, transform->inNodes, XML_C14N_1_0, NULL, 0, buf);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformC14NExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecInternalError("xmlC14NExecute",
+ xmlSecTransformGetName(transform));
xmlOutputBufferClose(buf);
return(-1);
}
ret = xmlOutputBufferClose(buf);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlOutputBufferClose",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXmlError("xmlOutputBufferClose", xmlSecTransformGetName(transform));
return(-1);
}
transform->status = xmlSecTransformStatusWorking;
@@ -808,11 +687,9 @@ xmlSecTransformRelationshipPopBin(xmlSecTransformPtr transform, xmlSecByte* data
memcpy(data, xmlSecBufferGetData(out), outSize);
ret = xmlSecBufferRemoveHead(out, outSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
+ xmlSecInternalError2("xmlSecBufferRemoveHead",
+ xmlSecTransformGetName(transform),
+ "size=%d", outSize);
return(-1);
}
} else if(xmlSecBufferGetSize(out) == 0) {
@@ -824,11 +701,7 @@ xmlSecTransformRelationshipPopBin(xmlSecTransformPtr transform, xmlSecByte* data
xmlSecAssert2(xmlSecBufferGetSize(out) == 0, -1);
(*dataSize) = 0;
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
+ xmlSecInvalidTransfromStatusError(transform);
return(-1);
}