Nikolay Sivov : msxml3: Accept disabling of external entities loading.

Alexandre Julliard julliard at winehq.org
Tue Oct 4 17:43:04 CDT 2011


Module: wine
Branch: master
Commit: ad336be675ed9a1c95fa4f441040c95c92bc5b68
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ad336be675ed9a1c95fa4f441040c95c92bc5b68

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Oct  4 16:27:39 2011 -0500

msxml3: Accept disabling of external entities loading.

---

 dlls/msxml3/saxreader.c |   48 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c
index fca390a..0460533 100644
--- a/dlls/msxml3/saxreader.c
+++ b/dlls/msxml3/saxreader.c
@@ -49,6 +49,24 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
 
 #ifdef HAVE_LIBXML2
 
+enum ReaderFeatures
+{
+    ExhaustiveErrors             = 1 << 1,
+    ExternalGeneralEntities      = 1 << 2,
+    ExternalParameterEntities    = 1 << 3,
+    ForcedResync                 = 1 << 4,
+    NamespacePrefixes            = 1 << 5,
+    Namespace                    = 1 << 6,
+    ParameterEntities            = 1 << 7,
+    PreserveSystemIndentifiers   = 1 << 8,
+    ProhibitDTD                  = 1 << 9,
+    SchemaValidation             = 1 << 10,
+    ServerHttpRequest            = 1 << 11,
+    SuppressValidationfatalError = 1 << 12,
+    UseInlineSchema              = 1 << 13,
+    UseSchemaLocation            = 1 << 14
+};
+
 struct bstrpool
 {
     BSTR *pool;
@@ -72,6 +90,7 @@ typedef struct _saxreader
     xmlSAXHandler sax;
     BOOL isParsing;
     struct bstrpool pool;
+    enum ReaderFeatures features;
 } saxreader;
 
 typedef struct _saxlocator
@@ -180,6 +199,23 @@ static const WCHAR PropertyXMLDeclVersionW[] = {
     'x','m','l','d','e','c','l','-','v','e','r','s','i','o','n',0
 };
 
+/* feature names */
+static const WCHAR FeatureExternalGeneralEntitiesW[] = {
+    'h','t','t','p',':','/','/','x','m','l','.','o','r','g','/','s','a','x','/',
+    'f','e','a','t','u','r','e','s','/','e','x','t','e','r','n','a','l','-','g','e','n','e','r','a','l',
+    '-','e','n','t','i','t','i','e','s',0
+};
+
+static inline HRESULT set_feature_value(saxreader *reader, enum ReaderFeatures feature, VARIANT_BOOL value)
+{
+    if (value == VARIANT_TRUE)
+        reader->features |=  feature;
+    else
+        reader->features &= ~feature;
+
+    return S_OK;
+}
+
 static inline BOOL has_content_handler(const saxlocator *locator)
 {
     return  (locator->vbInterface && locator->saxreader->vbcontentHandler) ||
@@ -2568,12 +2604,17 @@ static HRESULT WINAPI saxxmlreader_getFeature(
 
 static HRESULT WINAPI saxxmlreader_putFeature(
     IVBSAXXMLReader* iface,
-    const WCHAR *pFeature,
-    VARIANT_BOOL vfValue)
+    const WCHAR *feature,
+    VARIANT_BOOL value)
 {
     saxreader *This = impl_from_IVBSAXXMLReader( iface );
 
-    FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(pFeature), vfValue);
+    TRACE("(%p)->(%s %x)\n", This, debugstr_w(feature), value);
+
+    if (!strcmpW(FeatureExternalGeneralEntitiesW, feature) && value == VARIANT_FALSE)
+        return set_feature_value(This, ExternalGeneralEntities, value);
+
+    FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature), value);
     return E_NOTIMPL;
 }
 
@@ -2964,6 +3005,7 @@ HRESULT SAXXMLReader_create(IUnknown *pUnkOuter, LPVOID *ppObj)
     reader->pool.pool = NULL;
     reader->pool.index = 0;
     reader->pool.len = 0;
+    reader->features = 0;
 
     memset(&reader->sax, 0, sizeof(xmlSAXHandler));
     reader->sax.initialized = XML_SAX2_MAGIC;




More information about the wine-cvs mailing list