From: Kruti Date: Fri, 4 Oct 2024 05:57:50 +0000 (-0700) Subject: Ignore deprecated warning for LIBXML2 APIs xmlFileXXX. X-Git-Tag: stable-12.5.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a240f6a1d75c4fbacb1e9364ff48dfce304a23dc;p=thirdparty%2Fopen-vm-tools.git Ignore deprecated warning for LIBXML2 APIs xmlFileXXX. 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. --- diff --git a/open-vm-tools/vgauth/serviceImpl/saml-xmlsec1.c b/open-vm-tools/vgauth/serviceImpl/saml-xmlsec1.c index 8572a7110..7de27aa44 100644 --- a/open-vm-tools/vgauth/serviceImpl/saml-xmlsec1.c +++ b/open-vm-tools/vgauth/serviceImpl/saml-xmlsec1.c @@ -35,6 +35,22 @@ #include #include +// 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 #include #include @@ -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