Imported Upstream version 2.2.1+dfsg
[shibboleth/sp.git] / util / mdquery.cpp
index 33435cc..89cc34e 100644 (file)
@@ -94,48 +94,25 @@ int main(int argc,char* argv[])
 \r
     if (!entityID) {\r
         usage();\r
-        exit(-10);\r
+        return -10;\r
     }\r
 \r
-    char* path=getenv("SHIBSP_SCHEMAS");\r
-    if (!path)\r
-        path=SHIBSP_SCHEMAS;\r
-    char* config=getenv("SHIBSP_CONFIG");\r
-    if (!config)\r
-        config=SHIBSP_CONFIG;\r
-\r
-    XMLToolingConfig::getConfig().log_config(getenv("SHIBSP_LOGGING") ? getenv("SHIBSP_LOGGING") : SHIBSP_LOGGING);\r
-\r
-    SPConfig& conf=SPConfig::getConfig();\r
-    conf.setFeatures(SPConfig::Metadata | SPConfig::Trust | SPConfig::OutOfProcess | SPConfig::Credentials);\r
-    if (!conf.init(path))\r
-        return -1;\r
-\r
     if (rname) {\r
         if (!protocol) {\r
             if (prot)\r
                 protocol = XMLString::transcode(prot);\r
         }\r
         if (!protocol) {\r
-            conf.term();\r
             usage();\r
-            exit(-10);\r
+            return -10;\r
         }\r
     }\r
 \r
-    try {\r
-        static const XMLCh _path[] = UNICODE_LITERAL_4(p,a,t,h);\r
-        static const XMLCh validate[] = UNICODE_LITERAL_8(v,a,l,i,d,a,t,e);\r
-        xercesc::DOMDocument* dummydoc=XMLToolingConfig::getConfig().getParser().newDocument();\r
-        XercesJanitor<xercesc::DOMDocument> docjanitor(dummydoc);\r
-        xercesc::DOMElement* dummy = dummydoc->createElementNS(NULL,_path);\r
-        auto_ptr_XMLCh src(config);\r
-        dummy->setAttributeNS(NULL,_path,src.get());\r
-        dummy->setAttributeNS(NULL,validate,xmlconstants::XML_ONE);\r
-        conf.setServiceProvider(conf.ServiceProviderManager.newPlugin(XML_SERVICE_PROVIDER,dummy));\r
-        conf.getServiceProvider()->init();\r
-    }\r
-    catch (exception&) {\r
+    SPConfig& conf=SPConfig::getConfig();\r
+    conf.setFeatures(SPConfig::Metadata | SPConfig::Trust | SPConfig::OutOfProcess | SPConfig::Credentials);\r
+    if (!conf.init())\r
+        return -1;\r
+    if (!conf.instantiate()) {\r
         conf.term();\r
         return -2;\r
     }\r