Fix build with libxml2-2.12.0

https://github.com/lsh123/xmlsec/pull/729
This commit is contained in:
Yaakov Selkowitz 2023-12-12 20:15:59 -05:00
parent 6ea2eedf8d
commit 01da50c5c9
2 changed files with 117 additions and 1 deletions

View File

@ -0,0 +1,108 @@
From ffb327376f5bb69e8dfe7f805529e45a40118c2b Mon Sep 17 00:00:00 2001
From: lsh123 <aleksey@aleksey.com>
Date: Mon, 20 Nov 2023 11:50:43 -0500
Subject: [PATCH] Fix libxml2 v2.12.0 includes (#729)
---
Dropped mscrypto changes as unused and conflicting with older sources
apps/crypto.c | 1 +
apps/xmlsec.c | 3 ++-
include/xmlsec/xmlsec.h | 1 +
src/errors_helpers.h | 10 +++++-----
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/apps/crypto.c b/apps/crypto.c
index 8561dd659..4411233da 100644
--- a/apps/crypto.c
+++ b/apps/crypto.c
@@ -12,6 +12,7 @@
#endif
#include <string.h>
+#include <stdlib.h>
#include <xmlsec/xmlsec.h>
#include <xmlsec/keys.h>
diff --git a/apps/xmlsec.c b/apps/xmlsec.c
index 7655c1dbd..4bedb16a7 100644
--- a/apps/xmlsec.c
+++ b/apps/xmlsec.c
@@ -22,6 +22,7 @@
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
+#include <libxml/xmlsave.h>
#include <libxml/xpathInternals.h>
#ifndef XMLSEC_NO_XSLT
@@ -3030,7 +3031,7 @@ xmlSecAppInit(void) {
/* Init libxml */
xmlInitParser();
LIBXML_TEST_VERSION
- xmlTreeIndentString = "\t";
+ xmlThrDefTreeIndentString("\t");
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
diff --git a/include/xmlsec/xmlsec.h b/include/xmlsec/xmlsec.h
index 5757fc570..6f9101229 100644
--- a/include/xmlsec/xmlsec.h
+++ b/include/xmlsec/xmlsec.h
@@ -12,6 +12,7 @@
#define __XMLSEC_H__
#include <libxml/tree.h>
+#include <libxml/parser.h>
#include <xmlsec/version.h>
#include <xmlsec/exports.h>
diff --git a/src/errors_helpers.h b/src/errors_helpers.h
index 1a4f41837..470fdde65 100644
--- a/src/errors_helpers.h
+++ b/src/errors_helpers.h
@@ -136,7 +136,7 @@ extern "C" {
*/
#define xmlSecXmlError(errorFunction, errorObject) \
{ \
- xmlErrorPtr error = xmlGetLastError(); \
+ const xmlError * error = xmlGetLastError(); \
int code = (error != NULL) ? error->code : 0; \
const char* message = (error != NULL) ? error->message : NULL; \
xmlSecError(XMLSEC_ERRORS_HERE, \
@@ -159,7 +159,7 @@ extern "C" {
*/
#define xmlSecXmlError2(errorFunction, errorObject, msg, param) \
{ \
- xmlErrorPtr error = xmlGetLastError(); \
+ const xmlError * error = xmlGetLastError(); \
int code = (error != NULL) ? error->code : 0; \
const char* message = (error != NULL) ? error->message : NULL; \
xmlSecError(XMLSEC_ERRORS_HERE, \
@@ -181,7 +181,7 @@ extern "C" {
*/
#define xmlSecXmlParserError(errorFunction, ctxt, errorObject) \
{ \
- xmlErrorPtr error = xmlCtxtGetLastError(ctxt);\
+ const xmlError * error = xmlCtxtGetLastError(ctxt);\
int code = (error != NULL) ? error->code : 0; \
const char* message = (error != NULL) ? error->message : NULL; \
xmlSecError(XMLSEC_ERRORS_HERE, \
@@ -205,7 +205,7 @@ extern "C" {
*/
#define xmlSecXmlParserError2(errorFunction, ctxt, errorObject, msg, param) \
{ \
- xmlErrorPtr error = xmlCtxtGetLastError(ctxt);\
+ const xmlError * error = xmlCtxtGetLastError(ctxt);\
int code = (error != NULL) ? error->code : 0; \
const char* message = (error != NULL) ? error->message : NULL; \
xmlSecError(XMLSEC_ERRORS_HERE, \
@@ -227,7 +227,7 @@ extern "C" {
*/
#define xmlSecXsltError(errorFunction, ctxt, errorObject) \
{ \
- xmlErrorPtr error = xmlGetLastError(); \
+ const xmlError * error = xmlGetLastError(); \
int code = (error != NULL) ? error->code : 0; \
const char* message = (error != NULL) ? error->message : NULL; \
xmlSecError(XMLSEC_ERRORS_HERE, \

View File

@ -1,11 +1,15 @@
Summary: Library providing support for "XML Signature" and "XML Encryption" standards
Name: xmlsec1
Version: 1.2.37
Release: 5%{?dist}%{?extra_release}
Release: 6%{?dist}%{?extra_release}
Epoch: 1
License: MIT
Source0: https://www.aleksey.com/xmlsec/download/xmlsec1-%{version}.tar.gz
URL: http://www.aleksey.com/xmlsec/
# https://github.com/lsh123/xmlsec/pull/729
Patch0: 0001-Fix-libxml2-v2.12.0-includes.patch
BuildRequires: make
BuildRequires: pkgconfig(libxml-2.0) >= 2.8.0
BuildRequires: pkgconfig(libxslt) >= 1.0.20
@ -102,6 +106,7 @@ Libraries, includes, etc. for developing XML Security applications with NSS.
%prep
%setup -q
%patch -P0 -p1
%build
autoreconf -vfi
@ -176,6 +181,9 @@ mv %{buildroot}%{_docdir}/xmlsec1/* __tmp_doc
%{_libdir}/pkgconfig/xmlsec1-nss.pc
%changelog
* Wed Dec 13 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 1:1.2.37-6
- Fix build with libxml2-2.12.0
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.2.37-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild