From: Kruti Pendharkar Date: Wed, 8 Jan 2025 06:05:51 +0000 (-0800) Subject: Change to common source file not applicable to open-vm-tools. X-Git-Tag: stable-13.0.0~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d55893a0b9971a410ea84afd1b1de40ef3467861;p=thirdparty%2Fopen-vm-tools.git Change to common source file not applicable to open-vm-tools. --- diff --git a/open-vm-tools/vgauth/serviceImpl/saml-xmlsec1.c b/open-vm-tools/vgauth/serviceImpl/saml-xmlsec1.c index 7de27aa44..7bf70fa74 100644 --- a/open-vm-tools/vgauth/serviceImpl/saml-xmlsec1.c +++ b/open-vm-tools/vgauth/serviceImpl/saml-xmlsec1.c @@ -32,24 +32,6 @@ #include #include #include -#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 @@ -101,61 +83,6 @@ static xmlSchemaValidCtxtPtr gSchemaValidateCtx = NULL; #define SAML_SCHEMA_FILENAME "saml-schema-assertion-2.0.xsd" -/* - ****************************************************************************** - * UserXmlFileOpen -- */ /** - * - * User defined version of libxml2 export xmlFileOpen. - * - * This function opens a file with its unescaped name only. - * - * xmlInitParser() calls xmlRegisterDefaultInputCallbacks() which calls - * xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen, - * xmlFileRead, xmlFileClose) - * - * UserXmlFileOpen is registered at the end of the xmlInputCallback table by - * xmlRegisterInputCallbacks(xmlFileMatch, UserXmlFileOpen, - * xmlFileRead, xmlFileClose) - * - * Based on libxml2 xmlIO.c, precedence is given to user defined handlers. - * - * @param[in] filename The URI file name. - * - * @return A handler or NULL in case of failure. - ****************************************************************************** - */ - -static void * -UserXmlFileOpen(const char *filename) -{ - char *unescaped; - void *retval = NULL; - - g_debug("%s: Incoming file name is \"%s\"\n", __FUNCTION__, 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); - } - - if (retval == NULL) { - g_warning("%s: Failed to open file \"%s\"\n", __FUNCTION__, filename); - /* - * Do not retry xmlFileOpen(filename) here. - * Calling system API to open escaped file paths is risky. This can - * cause unexpected not-secured paths being accessed and expose - * privilege escalation vulnerabilities. - */ - } - - return retval; -} - - /* * Hack to test expired tokens and by-pass the time checks. * @@ -453,14 +380,6 @@ SAML_Init(void) /* set up the xml2 error handler */ xmlSetGenericErrorFunc(NULL, XmlErrorHandler); - /* - * Register user defined UserXmlFileOpen - */ -XML_IGNORE_DEPRECATION_WARNINGS - xmlRegisterInputCallbacks(xmlFileMatch, UserXmlFileOpen, - xmlFileRead, xmlFileClose); -XML_POP_WARNINGS - /* * Load schemas */