SSPCPP-616 - clean up concatenated string literals
[shibboleth/cpp-sp.git] / shibsp / handler / impl / SAML2LogoutInitiator.cpp
index a97e1e8..83a7a02 100644 (file)
@@ -87,6 +87,7 @@ namespace shibsp {
             ) const;
 
         string m_appId;
+        auto_ptr_char m_protocol;
 #ifndef SHIBSP_LITE
         auto_ptr<LogoutRequest> buildRequest(
             const Application& application, const Session& session, const RoleDescriptor& role, const MessageEncoder* encoder=nullptr
@@ -105,7 +106,6 @@ namespace shibsp {
         vector<string> m_bindings;
         map< string,boost::shared_ptr<MessageEncoder> > m_encoders;
 #endif
-        auto_ptr_char m_protocol;
     };
 
 #if defined (_MSC_VER)
@@ -119,7 +119,7 @@ namespace shibsp {
 };
 
 SAML2LogoutInitiator::SAML2LogoutInitiator(const DOMElement* e, const char* appId)
-    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".LogoutInitiator.SAML2")), m_appId(appId), m_protocol(samlconstants::SAML20P_NS)
+    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT ".LogoutInitiator.SAML2")), m_appId(appId), m_protocol(samlconstants::SAML20P_NS)
 #ifndef SHIBSP_LITE
         ,m_async(true)
 #endif
@@ -157,6 +157,7 @@ void SAML2LogoutInitiator::init(const char* location)
         pair<bool,const char*> outgoing = getString("outgoingBindings");
         if (outgoing.first) {
             dupBindings = outgoing.second;
+            trim(dupBindings);
         }
         else {
             // No override, so we'll install a default binding precedence.
@@ -363,6 +364,7 @@ pair<bool,long> SAML2LogoutInitiator::doRequest(
                         logout_event->m_logoutType = LogoutEvent::LOGOUT_EVENT_UNKNOWN;
                         logout_event->m_saml2Request = msg.get();
                         application.getServiceProvider().getTransactionLog()->write(*logout_event);
+                        logout_event->m_saml2Request = nullptr;
                     }
 
                     auto_ptr_char dest(epit->getLocation());
@@ -527,10 +529,12 @@ auto_ptr<LogoutRequest> SAML2LogoutInitiator::buildRequest(
         msg->setNameID(nameid->cloneNameID());
     }
 
-    msg->setID(SAMLConfig::getConfig().generateIdentifier());
+    XMLCh* msgid = SAMLConfig::getConfig().generateIdentifier();
+    msg->setID(msgid);
+    XMLString::release(&msgid);
     msg->setIssueInstant(time(nullptr));
 
-    if (m_async) {
+    if (m_async && encoder) {
         msg->setExtensions(saml2p::ExtensionsBuilder::buildExtensions());
         msg->getExtensions()->getUnknownXMLObjects().push_back(AsynchronousBuilder::buildAsynchronous());
     }