]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Ignore deprecated warning for LIBXML2 APIs xmlFileXXX.
authorKruti <kpendharkar@vmware.com>
Fri, 4 Oct 2024 05:57:50 +0000 (22:57 -0700)
committerKruti <kpendharkar@vmware.com>
Fri, 4 Oct 2024 05:57:50 +0000 (22:57 -0700)
CVE-2024-40896 has been fixed in the following libxml2 releases.
  - 2.13.3
  - 2.12.9
  - 2.11.9

The libxml2 version 2.13.0 has deprecated the xmlFileMatch, UserXmlFileOpen,
xmlFileRead, xmlFileClose callback functions. This change suppresses a
"deprecated-declaration" warning when these functions are invoked.

open-vm-tools/vgauth/serviceImpl/saml-xmlsec1.c

index 8572a7110648eb73c4d3b5cf353dbb7db47c3303..7de27aa44bdb29537f80c3a493af9fdf49af2da9 100644 (file)
 #include <libxml/xmlIO.h>
 #include <libxml/uri.h>
 
+// PR 3416639, xmlFile* APIs were deprecated in libxml2 2.13.0
+// Ignore the deprecated warnings after updating libxml2 to 2.13.3
+// ToDo: Define the deprecated APIs locally and remove the
+// XML_IGNORE_DEPRECATION_WARNINGS
+#ifdef _WIN32
+#define XML_IGNORE_DEPRECATION_WARNINGS \
+    __pragma(warning(push)) \
+    __pragma(warning(disable : 4996))
+#define XML_POP_WARNINGS __pragma(warning(pop))
+#else
+#define XML_IGNORE_DEPRECATION_WARNINGS \
+    _Pragma("GCC diagnostic push") \
+    _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+#define XML_POP_WARNINGS _Pragma("GCC diagnostic pop")
+#endif
+
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/xmltree.h>
 #include <xmlsec/xmldsig.h>
@@ -120,7 +136,9 @@ UserXmlFileOpen(const char *filename)
    unescaped = xmlURIUnescapeString(filename, 0, NULL);
    if (unescaped != NULL) {
       g_debug("%s: Opening file \"%s\"\n", __FUNCTION__, unescaped);
+XML_IGNORE_DEPRECATION_WARNINGS
       retval = xmlFileOpen(unescaped);
+XML_POP_WARNINGS
       xmlFree(unescaped);
    }
 
@@ -438,8 +456,10 @@ SAML_Init(void)
    /*
     * Register user defined UserXmlFileOpen
     */
+XML_IGNORE_DEPRECATION_WARNINGS
    xmlRegisterInputCallbacks(xmlFileMatch, UserXmlFileOpen,
                              xmlFileRead, xmlFileClose);
+XML_POP_WARNINGS
 
    /*
     * Load schemas