You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by bl...@apache.org on 2003/05/10 09:23:37 UTC

cvs commit: xml-security/c/src/utils/winutils XSECURIResolverGenericWin32.cpp

blautenb    2003/05/10 00:23:37

  Modified:    c/src/dsig DSIGReference.cpp DSIGReference.hpp
               c/src/framework XSECURIResolver.hpp
                        XSECURIResolverXerces.cpp
               c/src/utils/unixutils XSECURIResolverGenericUnix.cpp
               c/src/utils/winutils XSECURIResolverGenericWin32.cpp
  Log:
  Updates to support anonymous references
  
  Revision  Changes    Path
  1.10      +18 -12    xml-security/c/src/dsig/DSIGReference.cpp
  
  Index: DSIGReference.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGReference.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DSIGReference.cpp	8 May 2003 12:10:58 -0000	1.9
  +++ DSIGReference.cpp	10 May 2003 07:23:36 -0000	1.10
  @@ -164,6 +164,7 @@
   	mp_transformList = NULL;
   	mp_URI = NULL;
   	m_isManifest = false;
  +	m_loaded = false;
   
   }
   
  @@ -182,6 +183,7 @@
   	me_hashMethod = HASH_NONE;
   	mp_URI = NULL;
   	m_isManifest = false;
  +	m_loaded = false;
   
   };
   
  @@ -365,8 +367,14 @@
   			MAKE_UNICODE_STRING(type));
   
   	// Set URI
  -	ret->setAttribute(s_unicodeStrURI, URI);
  -	mp_URI = ret->getAttribute(s_unicodeStrURI); // Used later on as a pointer
  +	if (URI != NULL) {
  +		ret->setAttribute(s_unicodeStrURI, URI);
  +		mp_URI = ret->getAttribute(s_unicodeStrURI); // Used later on as a pointer
  +	}
  +	else {
  +		// Anonymous reference
  +		mp_URI = NULL;
  +	}
   
   	// Create hash and hashValue nodes
   	makeQName(str, prefix, "DigestMethod");
  @@ -392,6 +400,7 @@
   	ret->appendChild(doc->createTextNode(DSIGConstants::s_unicodeStrNL));
   	mp_hashValueNode->appendChild(doc->createTextNode(MAKE_UNICODE_STRING("Not yet calculated")));
   	
  +	m_loaded = true;
   	return ret;
   
   }
  @@ -447,7 +456,8 @@
   
   	// Determine if this is a full URL or a pointer to a URL
   
  -	if (URI[0] != 0 && URI[0] != XERCES_CPP_NAMESPACE_QUALIFIER chPound) {
  +	if (URI == NULL || (URI[0] != 0 && 
  +		URI[0] != XERCES_CPP_NAMESPACE_QUALIFIER chPound)) {
   
   		TXFMURL * retTransform;
   
  @@ -605,12 +615,6 @@
   
   	}
   
  -	// Check to ensure the URI was set
  -
  -	if (mp_URI == NULL) {
  -		throw XSECException(XSECException::ExpectedReferenceURI);
  -	}
  -
   	// Now check for Transforms
   	tmpElt = mp_referenceNode->getFirstChild();
   
  @@ -763,6 +767,8 @@
   
   	} /* m_isManifest */
   
  +	m_loaded = true;
  +
   }
   
   // --------------------------------------------------------------------------------
  @@ -823,7 +829,7 @@
   	TXFMChain * txfmChain;
   	TXFMBase * currentTxfm;
   
  -	if (mp_URI == NULL) {
  +	if (m_loaded == false) {
   
   		throw XSECException(XSECException::NotLoaded, 
   			"calculateHash() called in DSIGReference before load()");
  @@ -1231,7 +1237,7 @@
   
   	unsigned int size;
   
  -	if (mp_URI == NULL) {
  +	if (m_loaded == false) {
   
   		throw XSECException(XSECException::NotLoaded, 
   			"calculateHash() called in DSIGReference before load()");
  
  
  
  1.7       +4 -1      xml-security/c/src/dsig/DSIGReference.hpp
  
  Index: DSIGReference.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGReference.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DSIGReference.hpp	8 May 2003 12:10:58 -0000	1.6
  +++ DSIGReference.hpp	10 May 2003 07:23:36 -0000	1.7
  @@ -190,7 +190,8 @@
   	 * attributes in <Reference> Elements.  However this may of use to calling
   	 * applications.
   	 *
  -	 * @param URI The URI (data source) for this reference.
  +	 * @param URI The URI (data source) for this reference.  Set to NULL for
  +	 * an anonymous reference.
   	 * @param hm The type of Digest to be used (generally SHA-1)
   	 * @param type A type string (as defined by XML Signature).
   	 * @returns The root Reference element of the newly created DOM structure.
  @@ -534,6 +535,8 @@
   	DOMNode						* mp_hashValueNode;		// Node where the Hash value is stored
   	DSIGSignature				* mp_parentSignature;	// Owner signature
   	DSIGTransformList			* mp_transformList;		// List of transforms
  +	
  +	bool                        m_loaded;
   
   	DSIGReference();
   
  
  
  
  1.4       +2 -1      xml-security/c/src/framework/XSECURIResolver.hpp
  
  Index: XSECURIResolver.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/framework/XSECURIResolver.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XSECURIResolver.hpp	22 Feb 2003 08:47:24 -0000	1.3
  +++ XSECURIResolver.hpp	10 May 2003 07:23:36 -0000	1.4
  @@ -128,7 +128,8 @@
   	 *
   	 * @note The returned stream is "owned" by the caller, which
   	 * will delete it when processing is complete.
  -	 * @param uri The string containing the URI to be de-referenced.
  +	 * @param uri The string containing the URI to be de-referenced.  NULL
  +	 * if this is an anonymous reference.
   	 * @returns The octet stream corresponding to the URI.
   	 */
   
  
  
  
  1.4       +4 -0      xml-security/c/src/framework/XSECURIResolverXerces.cpp
  
  Index: XSECURIResolverXerces.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/framework/XSECURIResolverXerces.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XSECURIResolverXerces.cpp	1 Mar 2003 06:27:29 -0000	1.3
  +++ XSECURIResolverXerces.cpp	10 May 2003 07:23:36 -0000	1.4
  @@ -122,6 +122,10 @@
   	URLInputSource			* URLS;		// Use Xerces URL Input source
   	BinInputStream			* is;		// To handle the actual input
   
  +	if (uri == NULL) {
  +		throw XSECException(XSECException::ErrorOpeningURI,
  +			"XSECURIResolverXerces - anonymous references not supported in default URI Resolvers");
  +	}
   
   	if (mp_baseURI == 0) {
   		XSECnew(URLS, URLInputSource(XMLURL(uri)));
  
  
  
  1.3       +9 -1      xml-security/c/src/utils/unixutils/XSECURIResolverGenericUnix.cpp
  
  Index: XSECURIResolverGenericUnix.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/utils/unixutils/XSECURIResolverGenericUnix.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XSECURIResolverGenericUnix.cpp	20 Feb 2003 10:35:10 -0000	1.2
  +++ XSECURIResolverGenericUnix.cpp	10 May 2003 07:23:36 -0000	1.3
  @@ -71,6 +71,9 @@
    * $Id$
    *
    * $Log$
  + * Revision 1.3  2003/05/10 07:23:36  blautenb
  + * Updates to support anonymous references
  + *
    * Revision 1.2  2003/02/20 10:35:10  blautenb
    * Fix for broken Xerces XMLUri
    *
  @@ -157,6 +160,11 @@
   	XSEC_USING_XERCES(BinFileInputStream);
   
   	XMLUri					* xmluri;
  +
  +	if (uri == NULL) {
  +		throw XSECException(XSECException::ErrorOpeningURI,
  +			"XSECURIResolverGenericUnix - anonymous references not supported in default URI Resolvers");
  +	}
   
   	// Create the appropriate XMLUri objects
   
  
  
  
  1.3       +10 -2     xml-security/c/src/utils/winutils/XSECURIResolverGenericWin32.cpp
  
  Index: XSECURIResolverGenericWin32.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/utils/winutils/XSECURIResolverGenericWin32.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XSECURIResolverGenericWin32.cpp	17 Feb 2003 11:21:45 -0000	1.2
  +++ XSECURIResolverGenericWin32.cpp	10 May 2003 07:23:36 -0000	1.3
  @@ -71,6 +71,9 @@
    * $Id$
    *
    * $Log$
  + * Revision 1.3  2003/05/10 07:23:36  blautenb
  + * Updates to support anonymous references
  + *
    * Revision 1.2  2003/02/17 11:21:45  blautenb
    * Work around for Xerces XMLUri bug
    *
  @@ -156,6 +159,11 @@
   
   	XMLUri					* xmluri;
   
  +	if (uri == NULL) {
  +		throw XSECException(XSECException::ErrorOpeningURI,
  +			"XSECURIResolverGenericWin32 - anonymous references not supported in default URI Resolvers");
  +	}
  +
   	// Create the appropriate XMLUri objects
   	if (mp_baseURI != NULL) {
   		XMLUri	* turi;
  @@ -278,4 +286,4 @@
   
   	mp_baseURI = XMLString::replicate(uri);
   
  -}
  \ No newline at end of file
  +}