1*cdf0e10cSrcweir /** -- C++ Source File -- **/ 2*cdf0e10cSrcweir 3*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 4*cdf0e10cSrcweir #include "precompiled_xmlsecurity.hxx" 5*cdf0e10cSrcweir #include <stdio.h> 6*cdf0e10cSrcweir #include "helper.hxx" 7*cdf0e10cSrcweir 8*cdf0e10cSrcweir #include "libxml/tree.h" 9*cdf0e10cSrcweir #include "libxml/parser.h" 10*cdf0e10cSrcweir #ifndef XMLSEC_NO_XSLT 11*cdf0e10cSrcweir #include "libxslt/xslt.h" 12*cdf0e10cSrcweir #endif 13*cdf0e10cSrcweir 14*cdf0e10cSrcweir #include "securityenvironment_mscryptimpl.hxx" 15*cdf0e10cSrcweir #include "xmlelementwrapper_xmlsecimpl.hxx" 16*cdf0e10cSrcweir 17*cdf0e10cSrcweir #include "xmlsec/strings.h" 18*cdf0e10cSrcweir #include "xmlsec/mscrypto/app.h" 19*cdf0e10cSrcweir #include "xmlsec/xmltree.h" 20*cdf0e10cSrcweir 21*cdf0e10cSrcweir #include <rtl/ustring.hxx> 22*cdf0e10cSrcweir #include <cppuhelper/servicefactory.hxx> 23*cdf0e10cSrcweir 24*cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 25*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 26*cdf0e10cSrcweir #include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp> 27*cdf0e10cSrcweir #include <com/sun/star/xml/wrapper/XXMLDocumentWrapper.hpp> 28*cdf0e10cSrcweir #include <com/sun/star/xml/crypto/XXMLSignature.hpp> 29*cdf0e10cSrcweir #include <com/sun/star/xml/crypto/XXMLSignatureTemplate.hpp> 30*cdf0e10cSrcweir #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> 31*cdf0e10cSrcweir #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir using namespace ::rtl ; 34*cdf0e10cSrcweir using namespace ::cppu ; 35*cdf0e10cSrcweir using namespace ::com::sun::star::uno ; 36*cdf0e10cSrcweir using namespace ::com::sun::star::io ; 37*cdf0e10cSrcweir using namespace ::com::sun::star::ucb ; 38*cdf0e10cSrcweir using namespace ::com::sun::star::beans ; 39*cdf0e10cSrcweir using namespace ::com::sun::star::document ; 40*cdf0e10cSrcweir using namespace ::com::sun::star::lang ; 41*cdf0e10cSrcweir using namespace ::com::sun::star::registry ; 42*cdf0e10cSrcweir using namespace ::com::sun::star::xml::wrapper ; 43*cdf0e10cSrcweir using namespace ::com::sun::star::xml::crypto ; 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir int SAL_CALL main( int argc, char **argv ) 47*cdf0e10cSrcweir { 48*cdf0e10cSrcweir const char* n_pCertStore ; 49*cdf0e10cSrcweir HCERTSTORE n_hStoreHandle ; 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir xmlDocPtr doc = NULL ; 52*cdf0e10cSrcweir xmlNodePtr tplNode ; 53*cdf0e10cSrcweir xmlNodePtr tarNode ; 54*cdf0e10cSrcweir xmlAttrPtr idAttr ; 55*cdf0e10cSrcweir xmlChar* idValue ; 56*cdf0e10cSrcweir xmlAttrPtr uriAttr ; 57*cdf0e10cSrcweir xmlChar* uriValue ; 58*cdf0e10cSrcweir OUString* uri = NULL ; 59*cdf0e10cSrcweir Reference< XUriBinding > xUriBinding ; 60*cdf0e10cSrcweir FILE* dstFile = NULL ; 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir if( argc !=3 && argc != 4 ) { 63*cdf0e10cSrcweir fprintf( stderr, "Usage: %s <file_url> <rdb file>\n" , argv[0] ) ; 64*cdf0e10cSrcweir fprintf( stderr, "Or: \t%s <file_url> <rdb file> < Cert Store Name >\n\n" , argv[0] ) ; 65*cdf0e10cSrcweir return 1 ; 66*cdf0e10cSrcweir } 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir for( int hhh = 0 ; hhh < 1 ; hhh ++ ) { 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir //Init libxml and libxslt libraries 71*cdf0e10cSrcweir xmlInitParser(); 72*cdf0e10cSrcweir LIBXML_TEST_VERSION 73*cdf0e10cSrcweir xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; 74*cdf0e10cSrcweir xmlSubstituteEntitiesDefault(1); 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir #ifndef XMLSEC_NO_XSLT 77*cdf0e10cSrcweir xmlIndentTreeOutput = 1; 78*cdf0e10cSrcweir #endif // XMLSEC_NO_XSLT 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir //Initialize the crypto engine 81*cdf0e10cSrcweir if( argc == 4 ) { 82*cdf0e10cSrcweir n_pCertStore = argv[3] ; 83*cdf0e10cSrcweir n_hStoreHandle = CertOpenSystemStore( NULL, n_pCertStore ) ; 84*cdf0e10cSrcweir if( n_hStoreHandle == NULL ) { 85*cdf0e10cSrcweir fprintf( stderr, "Can not open the system cert store %s\n", n_pCertStore ) ; 86*cdf0e10cSrcweir return 1 ; 87*cdf0e10cSrcweir } 88*cdf0e10cSrcweir } else { 89*cdf0e10cSrcweir n_pCertStore = NULL ; 90*cdf0e10cSrcweir n_hStoreHandle = NULL ; 91*cdf0e10cSrcweir } 92*cdf0e10cSrcweir xmlSecMSCryptoAppInit( n_pCertStore ) ; 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir //Load XML document 95*cdf0e10cSrcweir doc = xmlParseFile( argv[1] ) ; 96*cdf0e10cSrcweir if( doc == NULL || xmlDocGetRootElement( doc ) == NULL ) { 97*cdf0e10cSrcweir fprintf( stderr , "### Cannot load template xml document!\n" ) ; 98*cdf0e10cSrcweir goto done ; 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir //Find the signature template 102*cdf0e10cSrcweir tplNode = xmlSecFindNode( xmlDocGetRootElement( doc ), xmlSecNodeSignature, xmlSecDSigNs ) ; 103*cdf0e10cSrcweir if( tplNode == NULL ) { 104*cdf0e10cSrcweir fprintf( stderr , "### Cannot find the signature template!\n" ) ; 105*cdf0e10cSrcweir goto done ; 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir //Find the element with ID attribute 109*cdf0e10cSrcweir tarNode = xmlSecFindNode( xmlDocGetRootElement( doc ), ( xmlChar* )"document", ( xmlChar* )"http://openoffice.org/2000/office" ) ; 110*cdf0e10cSrcweir if( tarNode == NULL ) { 111*cdf0e10cSrcweir tarNode = xmlSecFindNode( xmlDocGetRootElement( doc ), ( xmlChar* )"document", NULL ) ; 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir //Find the "id" attrbute in the element 115*cdf0e10cSrcweir if( tarNode != NULL ) { 116*cdf0e10cSrcweir if( ( idAttr = xmlHasProp( tarNode, ( xmlChar* )"id" ) ) != NULL ) { 117*cdf0e10cSrcweir //NULL 118*cdf0e10cSrcweir } else if( ( idAttr = xmlHasProp( tarNode, ( xmlChar* )"Id" ) ) != NULL ) { 119*cdf0e10cSrcweir //NULL 120*cdf0e10cSrcweir } else { 121*cdf0e10cSrcweir idAttr = NULL ; 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir //Add ID to DOM 126*cdf0e10cSrcweir if( idAttr != NULL ) { 127*cdf0e10cSrcweir idValue = xmlNodeListGetString( tarNode->doc, idAttr->children, 1 ) ; 128*cdf0e10cSrcweir if( idValue == NULL ) { 129*cdf0e10cSrcweir fprintf( stderr , "### the ID value is NULL!\n" ) ; 130*cdf0e10cSrcweir goto done ; 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir if( xmlAddID( NULL, doc, idValue, idAttr ) == NULL ) { 134*cdf0e10cSrcweir fprintf( stderr , "### Can not add the ID value!\n" ) ; 135*cdf0e10cSrcweir goto done ; 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir //Reference handler 140*cdf0e10cSrcweir //Find the signature reference 141*cdf0e10cSrcweir tarNode = xmlSecFindNode( tplNode, xmlSecNodeReference, xmlSecDSigNs ) ; 142*cdf0e10cSrcweir if( tarNode == NULL ) { 143*cdf0e10cSrcweir fprintf( stderr , "### Cannot find the signature reference!\n" ) ; 144*cdf0e10cSrcweir goto done ; 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir //Find the "URI" attrbute in the reference 148*cdf0e10cSrcweir uriAttr = xmlHasProp( tarNode, ( xmlChar* )"URI" ) ; 149*cdf0e10cSrcweir if( tarNode == NULL ) { 150*cdf0e10cSrcweir fprintf( stderr , "### Cannot find URI of the reference!\n" ) ; 151*cdf0e10cSrcweir goto done ; 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir //Get the "URI" attrbute value 155*cdf0e10cSrcweir uriValue = xmlNodeListGetString( tarNode->doc, uriAttr->children, 1 ) ; 156*cdf0e10cSrcweir if( uriValue == NULL ) { 157*cdf0e10cSrcweir fprintf( stderr , "### the URI value is NULL!\n" ) ; 158*cdf0e10cSrcweir goto done ; 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir if( strchr( ( const char* )uriValue, '/' ) != NULL && strchr( ( const char* )uriValue, '#' ) == NULL ) { 162*cdf0e10cSrcweir fprintf( stdout , "### Find a stream URI [%s]\n", uriValue ) ; 163*cdf0e10cSrcweir // uri = new ::rtl::OUString( ( const sal_Unicode* )uriValue ) ; 164*cdf0e10cSrcweir uri = new ::rtl::OUString( ( const sal_Char* )uriValue, xmlStrlen( uriValue ), RTL_TEXTENCODING_ASCII_US ) ; 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir if( uri != NULL ) { 168*cdf0e10cSrcweir fprintf( stdout , "### Find the URI [%s]\n", OUStringToOString( *uri , RTL_TEXTENCODING_ASCII_US ).getStr() ) ; 169*cdf0e10cSrcweir Reference< XInputStream > xStream = createStreamFromFile( *uri ) ; 170*cdf0e10cSrcweir if( !xStream.is() ) { 171*cdf0e10cSrcweir fprintf( stderr , "### Can not get the URI stream!\n" ) ; 172*cdf0e10cSrcweir goto done ; 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir xUriBinding = new OUriBinding( *uri, xStream ) ; 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir try { 180*cdf0e10cSrcweir Reference< XMultiComponentFactory > xManager = NULL ; 181*cdf0e10cSrcweir Reference< XComponentContext > xContext = NULL ; 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir xManager = serviceManager( xContext , OUString::createFromAscii( "local" ), OUString::createFromAscii( argv[2] ) ) ; 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir //Create signature template 186*cdf0e10cSrcweir Reference< XInterface > element = 187*cdf0e10cSrcweir xManager->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.xml.security.bridge.xmlsec.XMLElementWrapper_XmlSecImpl" ) , xContext ) ; 188*cdf0e10cSrcweir OSL_ENSURE( element.is() , 189*cdf0e10cSrcweir "Verifier - " 190*cdf0e10cSrcweir "Cannot get service instance of \"xsec.XMLElementWrapper\"" ) ; 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir Reference< XXMLElementWrapper > xElement( element , UNO_QUERY ) ; 193*cdf0e10cSrcweir OSL_ENSURE( xElement.is() , 194*cdf0e10cSrcweir "Verifier - " 195*cdf0e10cSrcweir "Cannot get interface of \"XXMLElementWrapper\" from service \"xsec.XMLElementWrapper\"" ) ; 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir Reference< XUnoTunnel > xEleTunnel( xElement , UNO_QUERY ) ; 198*cdf0e10cSrcweir OSL_ENSURE( xEleTunnel.is() , 199*cdf0e10cSrcweir "Verifier - " 200*cdf0e10cSrcweir "Cannot get interface of \"XUnoTunnel\" from service \"xsec.XMLElement\"" ) ; 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir XMLElementWrapper_XmlSecImpl* pElement = ( XMLElementWrapper_XmlSecImpl* )xEleTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ) ; 203*cdf0e10cSrcweir OSL_ENSURE( pElement != NULL , 204*cdf0e10cSrcweir "Verifier - " 205*cdf0e10cSrcweir "Cannot get implementation of \"xsec.XMLElementWrapper\"" ) ; 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir //Set signature template 208*cdf0e10cSrcweir pElement->setNativeElement( tplNode ) ; 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir //Build XML Signature template 211*cdf0e10cSrcweir Reference< XInterface > signtpl = 212*cdf0e10cSrcweir xManager->createInstanceWithContext( OUString::createFromAscii("com.sun.star.xml.crypto.XMLSignatureTemplate"), xContext ) ; 213*cdf0e10cSrcweir OSL_ENSURE( signtpl.is() , 214*cdf0e10cSrcweir "Verifier - " 215*cdf0e10cSrcweir "Cannot get service instance of \"xsec.XMLSignatureTemplate\"" ) ; 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir Reference< XXMLSignatureTemplate > xTemplate( signtpl , UNO_QUERY ) ; 218*cdf0e10cSrcweir OSL_ENSURE( xTemplate.is() , 219*cdf0e10cSrcweir "Verifier - " 220*cdf0e10cSrcweir "Cannot get interface of \"XXMLSignatureTemplate\" from service \"xsec.XMLSignatureTemplate\"" ) ; 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir //Import the signature template 223*cdf0e10cSrcweir xTemplate->setTemplate( xElement ) ; 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir //Import the URI/Stream binding 226*cdf0e10cSrcweir if( xUriBinding.is() ) 227*cdf0e10cSrcweir xTemplate->setBinding( xUriBinding ) ; 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir //Create security environment 230*cdf0e10cSrcweir //Build Security Environment 231*cdf0e10cSrcweir Reference< XInterface > xsecenv = 232*cdf0e10cSrcweir xManager->createInstanceWithContext( OUString::createFromAscii("com.sun.star.xml.security.bridge.xmlsec.SecurityEnvironment_MSCryptImpl"), xContext ) ; 233*cdf0e10cSrcweir OSL_ENSURE( xsecenv.is() , 234*cdf0e10cSrcweir "Verifier - " 235*cdf0e10cSrcweir "Cannot get service instance of \"xsec.SecurityEnvironment\"" ) ; 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir Reference< XSecurityEnvironment > xSecEnv( xsecenv , UNO_QUERY ) ; 238*cdf0e10cSrcweir OSL_ENSURE( xSecEnv.is() , 239*cdf0e10cSrcweir "Verifier - " 240*cdf0e10cSrcweir "Cannot get interface of \"XSecurityEnvironment\" from service \"xsec.SecurityEnvironment\"" ) ; 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir //Setup key slot and certDb 243*cdf0e10cSrcweir Reference< XUnoTunnel > xEnvTunnel( xsecenv , UNO_QUERY ) ; 244*cdf0e10cSrcweir OSL_ENSURE( xElement.is() , 245*cdf0e10cSrcweir "Verifier - " 246*cdf0e10cSrcweir "Cannot get interface of \"XUnoTunnel\" from service \"xsec.SecurityEnvironment\"" ) ; 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xEnvTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ; 249*cdf0e10cSrcweir OSL_ENSURE( pSecEnv != NULL , 250*cdf0e10cSrcweir "Verifier - " 251*cdf0e10cSrcweir "Cannot get implementation of \"xsec.SecurityEnvironment\"" ) ; 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir //Setup key slot and certDb 254*cdf0e10cSrcweir if( n_hStoreHandle != NULL ) { 255*cdf0e10cSrcweir pSecEnv->setCryptoSlot( n_hStoreHandle ) ; 256*cdf0e10cSrcweir pSecEnv->setCertDb( n_hStoreHandle ) ; 257*cdf0e10cSrcweir } else { 258*cdf0e10cSrcweir pSecEnv->enableDefaultCrypt( sal_True ) ; 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir //Build XML Security Context 262*cdf0e10cSrcweir Reference< XInterface > xmlsecctx = 263*cdf0e10cSrcweir xManager->createInstanceWithContext( OUString::createFromAscii("com.sun.star.xml.security.bridge.xmlsec.XMLSecurityContext_MSCryptImpl"), xContext ) ; 264*cdf0e10cSrcweir OSL_ENSURE( xsecenv.is() , 265*cdf0e10cSrcweir "Verifier - " 266*cdf0e10cSrcweir "Cannot get service instance of \"xsec.XMLSecurityContext\"" ) ; 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir Reference< XXMLSecurityContext > xSecCtx( xmlsecctx , UNO_QUERY ) ; 269*cdf0e10cSrcweir OSL_ENSURE( xSecCtx.is() , 270*cdf0e10cSrcweir "Verifier - " 271*cdf0e10cSrcweir "Cannot get interface of \"XXMLSecurityContext\" from service \"xsec.XMLSecurityContext\"" ) ; 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir xSecCtx->addSecurityEnvironment( xSecEnv ) ; 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir //Generate XML signature 276*cdf0e10cSrcweir Reference< XInterface > xmlsigner = 277*cdf0e10cSrcweir xManager->createInstanceWithContext( OUString::createFromAscii("com.sun.star.xml.security.bridge.xmlsec.XMLSignature_MSCryptImpl"), xContext ) ; 278*cdf0e10cSrcweir OSL_ENSURE( xmlsigner.is() , 279*cdf0e10cSrcweir "Verifier - " 280*cdf0e10cSrcweir "Cannot get service instance of \"xsec.XMLSignature\"" ) ; 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir Reference< XXMLSignature > xSigner( xmlsigner , UNO_QUERY ) ; 283*cdf0e10cSrcweir OSL_ENSURE( xSigner.is() , 284*cdf0e10cSrcweir "Verifier - " 285*cdf0e10cSrcweir "Cannot get interface of \"XXMLSignature\" from service \"xsec.XMLSignature\"" ) ; 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir //perform validation 289*cdf0e10cSrcweir xTemplate = xSigner->validate( xTemplate , xSecCtx ) ; 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir com::sun::star::xml::crypto::SecurityOperationStatus m_nStatus = xTemplate->getStatus(); 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir if (m_nStatus == SecurityOperationStatus_OPERATION_SUCCEEDED) 294*cdf0e10cSrcweir { 295*cdf0e10cSrcweir fprintf( stdout, "Operation succeeds.\n") ; 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir else 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir fprintf( stdout, "Operation fails.\n") ; 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir } catch( Exception& e ) { 302*cdf0e10cSrcweir fprintf( stderr , "Error Message: %s\n" , OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).getStr() ) ; 303*cdf0e10cSrcweir goto done ; 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir done : 307*cdf0e10cSrcweir if( uri != NULL ) 308*cdf0e10cSrcweir delete uri ; 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir if( doc != NULL ) 311*cdf0e10cSrcweir xmlFreeDoc( doc ) ; 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir if( n_hStoreHandle != NULL ) 314*cdf0e10cSrcweir CertCloseStore( n_hStoreHandle, CERT_CLOSE_STORE_FORCE_FLAG ) ; 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir xmlSecMSCryptoAppShutdown() ; 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir /* Shutdown libxslt/libxml */ 319*cdf0e10cSrcweir #ifndef XMLSEC_NO_XSLT 320*cdf0e10cSrcweir xsltCleanupGlobals(); 321*cdf0e10cSrcweir #endif /* XMLSEC_NO_XSLT */ 322*cdf0e10cSrcweir xmlCleanupParser(); 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir return 0 ; 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir 329