]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common source file not applicable to open-vm-tools.
authorKruti Pendharkar <kp025370@broadcom.com>
Wed, 8 Jan 2025 06:05:51 +0000 (22:05 -0800)
committerKruti Pendharkar <kp025370@broadcom.com>
Wed, 8 Jan 2025 06:05:51 +0000 (22:05 -0800)
open-vm-tools/vgauth/serviceImpl/saml-xmlsec1.c

index 7de27aa44bdb29537f80c3a493af9fdf49af2da9..7bf70fa74adb1e795995d482201fc12c35e786db 100644 (file)
 #include <libxml/parser.h>
 #include <libxml/catalog.h>
 #include <libxml/xmlschemas.h>
-#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>
@@ -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
     */