diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-06-07 09:41:19 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-06-18 12:30:29 +0200 |
commit | b655b3012fa3613fedfb2bd2932901fd9699ec0b (patch) | |
tree | b73aeac3f8e9636dff36bfaabe50a320a1fee20e | |
parent | 14d7816072104eac67fa9c09915c7803067b7877 (diff) |
Fix CppunitTest_xmlsecurity_signing with system-xmlsec 1.2.26
Swap the order of the default and custom callback registration, since
the order of lookup is now reversed since
<https://github.com/lsh123/xmlsec/commit/968646fb9b8428174a112fce2f08b1ec89d0ed97>.
Thanks Tomas Chvatal for reporting this.
(cherry picked from commit 576f899811a22e83b6fb6a120c8da303b1f4cac1)
xmlsecurity: check for the libxmlsec version runtime, not build-time
For the general benefit of --with-system-xmlsec usage scenarios (where
LO may be built against an old version of xmlsec and run against a new
one).
(cherry picked from commit bc4e43dd926bbe6f5315b5c372770ac8c7222177)
Change-Id: I60a347454701a679db4ccd8924a723a236d5edff
Reviewed-on: https://gerrit.libreoffice.org/55462
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit 3d532502c9a17049bdd383a3d5c56005222331b7)
Reviewed-on: https://gerrit.libreoffice.org/55948
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Tested-by: Michael Stahl <Michael.Stahl@cib.de>
-rw-r--r-- | xmlsecurity/source/xmlsec/xmlstreamio.cxx | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/xmlsecurity/source/xmlsec/xmlstreamio.cxx b/xmlsecurity/source/xmlsec/xmlstreamio.cxx index de32f8286c1b..910944e11611 100644 --- a/xmlsecurity/source/xmlsec/xmlstreamio.cxx +++ b/xmlsecurity/source/xmlsec/xmlstreamio.cxx @@ -157,21 +157,44 @@ XSECXMLSEC_DLLPUBLIC int xmlEnableStreamInputCallbacks() //Notes: all none default callbacks will lose. xmlSecIOCleanupCallbacks() ; - //Register my classbacks. - int cbs = xmlSecIORegisterCallbacks( - xmlStreamMatch, - xmlStreamOpen, - xmlStreamRead, - xmlStreamClose ) ; - if( cbs < 0 ) { - return -1 ; + // Newer xmlsec wants the callback order in the opposite direction. + if (xmlSecCheckVersionExt(1, 2, 26, xmlSecCheckVersionABICompatible)) + { + //Register the default callbacks. + //Notes: the error will cause xmlsec working problems. + int cbs = xmlSecIORegisterDefaultCallbacks() ; + if( cbs < 0 ) { + return -1 ; + } + + //Register my classbacks. + cbs = xmlSecIORegisterCallbacks( + xmlStreamMatch, + xmlStreamOpen, + xmlStreamRead, + xmlStreamClose ) ; + if( cbs < 0 ) { + return -1 ; + } } - - //Register the default callbacks. - //Notes: the error will cause xmlsec working problems. - cbs = xmlSecIORegisterDefaultCallbacks() ; - if( cbs < 0 ) { - return -1 ; + else + { + //Register my classbacks. + int cbs = xmlSecIORegisterCallbacks( + xmlStreamMatch, + xmlStreamOpen, + xmlStreamRead, + xmlStreamClose ) ; + if( cbs < 0 ) { + return -1 ; + } + + //Register the default callbacks. + //Notes: the error will cause xmlsec working problems. + cbs = xmlSecIORegisterDefaultCallbacks() ; + if( cbs < 0 ) { + return -1 ; + } } enableXmlStreamIO |= XMLSTREAMIO_INITIALIZED ; |