/usr/include/xsec/canon/XSECC14n20010315.hpp is in libxml-security-c-dev 1.7.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* XSEC
*
* XSECC14n20010315 := Canonicaliser object to process XML document in line with
* RFC 3076
*
* Author(s): Berin Lautenbach
*
* $Id: XSECC14n20010315.hpp 1125514 2011-05-20 19:08:33Z scantor $
*
*/
#ifndef XSECC14n20010315_INCLUDE
#define XSECC14n20010315_INCLUDE
//XSEC includes
#include <xsec/framework/XSECDefs.hpp>
#include <xsec/utils/XSECSafeBuffer.hpp>
#include <xsec/utils/XSECXPathNodeList.hpp>
#include <xsec/canon/XSECCanon.hpp>
#include <xsec/canon/XSECXMLNSStack.hpp>
#include <xercesc/framework/XMLFormatter.hpp>
// General includes
#include <memory.h>
#include <vector>
XSEC_USING_XERCES(XMLFormatter);
XSEC_USING_XERCES(XMLFormatTarget);
class XSECSafeBufferFormatter;
// --------------------------------------------------------------------------------
// Simple structure for holding a list of nodes
// --------------------------------------------------------------------------------
// NOTE: We don't use NamedNodeMap or DOMNodeList as we are unsure what might happen
// to them in the future. Also, to add items we would have to delve into the inards
// of Xerces (and use the "...impl" classes). Such an approach might not be supported
// in the future.
struct XSECNodeListElt {
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *element; // Element referred to
safeBuffer sortString; // The string that is used to sort the nodes
XSECNodeListElt *next,
*last; // For the list
};
// Used for the sorting function
#define XMLNS_PREFIX "a"
#define ATTRIBUTE_PREFIX "b"
#define NOURI_PREFIX "a"
#define HAVEURI_PREFIX "b"
// --------------------------------------------------------------------------------
// XSECC14n20010315 Object definition
// --------------------------------------------------------------------------------
class CANON_EXPORT XSECC14n20010315 : public XSECCanon {
#if defined(XALAN_NO_NAMESPACES)
typedef vector<char *> CharListVectorType;
#else
typedef std::vector<char *> CharListVectorType;
#endif
#if defined(XALAN_SIZE_T_IN_NAMESPACE_STD)
typedef std::size_t size_type;
#else
typedef size_t size_type;
#endif
public:
// Constructors
XSECC14n20010315();
XSECC14n20010315(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *newDoc);
XSECC14n20010315(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *newDoc,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *newStartNode);
virtual ~XSECC14n20010315();
// XPath processor
int XPathSelectNodes(const char * XPathExpr);
void setXPathMap(const XSECXPathNodeList & map);
// Comments processing
void setCommentsProcessing(bool onoff);
bool getCommentsProcessing(void);
// Exclusive processing
void setExclusive(void);
void setExclusive(char * xmlnsList);
// Inclusive 1.1 processing
void setInclusive11(void);
// Namespace processing
void setUseNamespaceStack(bool flag) {m_useNamespaceStack = flag;}
protected:
// Implementation of virtual function
xsecsize_t processNextNode();
// Test whether a name space is in the non-exclusive list
bool inNonExclNSList(safeBuffer &ns);
private:
void init();
bool checkRenderNameSpaceNode(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *e,
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *a);
void stackInit(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * n);
// For formatting the buffers
XSECSafeBufferFormatter * mp_formatter;
safeBuffer m_formatBuffer;
// For holding state whilst walking the DOM tree
XSECNodeListElt * mp_attributes, // Start of list
* mp_currentAttribute, // Where we currently are in list
* mp_firstNonNsAttribute; // First NON XMLNS element in list
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * mp_attributeParent; // To return up the tree
bool m_returnedFromChild; // Did we get to this node from below?
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * mp_firstElementNode; // The root element of the document
bool m_firstElementProcessed; // Has the first node been handled?
unsigned char * mp_charBuffer;
// For XPath evaluation
bool m_XPathSelection; // Are we doing an XPath?
XSECXPathNodeList m_XPathMap; // The elements in the XPath
// For comment processing
bool m_processComments; // Whether comments are in or out (in by default)
// For exclusive canonicalisation
CharListVectorType m_exclNSList;
bool m_exclusive;
bool m_exclusiveDefault;
// For Inclusive 1.1 support
bool m_incl11;
// How do we handle namespaces?
// Use the namespace stack if name space expansion has not been run on the document.
// NOTE : Using the name space stack *will* cause problems if a full XPath expression
// has been run to select the input nodeset. Otherwise we should be fine.
bool m_useNamespaceStack;
XSECXMLNSStack m_nsStack;
};
#endif /* XSECC14n20010315_INCLUDE */
|