SSPCPP-616 - clean up concatenated string literals
[shibboleth/cpp-sp.git] / util / mdquery.cpp
index 9b928a8..56f988e 100644 (file)
@@ -1,23 +1,27 @@
-/*
- *  Copyright 2001-2009 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
+ *
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
  */
 
 /**
  * mdquery.cpp
  * 
- * SAML Metadata Query tool layered on SP configuration
+ * SAML Metadata Query tool layered on SP configuration.
  */
 
 #if defined (_MSC_VER) || defined(__BORLANDC__)
@@ -57,13 +61,13 @@ void usage()
 
 int main(int argc,char* argv[])
 {
-    char* entityID = NULL;
+    char* entityID = nullptr;
     char* appID = "default";
     bool strict = true;
-    char* prot = NULL;
-    const XMLCh* protocol = NULL;
-    char* rname = NULL;
-    char* rns = NULL;
+    char* prot = nullptr;
+    const XMLCh* protocol = nullptr;
+    char* rname = nullptr;
+    char* rns = nullptr;
 
     for (int i=1; i<argc; i++) {
         if (!strcmp(argv[i],"-e") && i+1<argc)
@@ -99,21 +103,23 @@ int main(int argc,char* argv[])
         return -10;
     }
 
+    SPConfig& conf=SPConfig::getConfig();
+    conf.setFeatures(SPConfig::Metadata | SPConfig::Trust | SPConfig::OutOfProcess | SPConfig::Credentials);
+    if (!conf.init())
+        return -1;
+
     if (rname) {
         if (!protocol) {
             if (prot)
                 protocol = XMLString::transcode(prot);
         }
         if (!protocol) {
+            conf.term();
             usage();
             return -10;
         }
     }
 
-    SPConfig& conf=SPConfig::getConfig();
-    conf.setFeatures(SPConfig::Metadata | SPConfig::Trust | SPConfig::OutOfProcess | SPConfig::Credentials);
-    if (!conf.init())
-        return -1;
     if (!conf.instantiate()) {
         conf.term();
         return -2;
@@ -122,7 +128,7 @@ int main(int argc,char* argv[])
     ServiceProvider* sp=conf.getServiceProvider();
     sp->lock();
 
-    Category& log = Category::getInstance(SHIBSP_LOGCAT".Utility.MDQuery");
+    Category& log = Category::getInstance(SHIBSP_LOGCAT ".Utility.MDQuery");
 
     const Application* app = sp->getApplication(appID);
     if (!app) {
@@ -133,7 +139,7 @@ int main(int argc,char* argv[])
     }
 
     app->getMetadataProvider()->lock();
-    MetadataProviderCriteria mc(*app, entityID, NULL, NULL, strict);
+    MetadataProviderCriteria mc(*app, entityID, nullptr, nullptr, strict);
     if (rname) {
         const XMLCh* ns = rns ? XMLString::transcode(rns) : samlconstants::SAML20MD_NS;
         auto_ptr_XMLCh n(rname);