From 80ef26c165a08d5251d7ee56e0bd07b86fc82f55 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Fri, 13 Oct 2017 14:06:38 +0100
Subject: Don't require servers to advertise an SSO domain

This doesn't change the behaviour where domain is advertised, but does mean
that SSO can be attempted where the hostname isn't advertised, where
previously it would be refused.

Test-Information:
Light testing (not by me) against M-Link not advertising hostname.
I think this is sufficient, given this is an experimental feature, hidden
behind a config flag, and this only extends behaviour, rather than
changing previously supported paths.
(The tested version was with a ternary instead of value_or)

Change-Id: I381fe23ab152486b195acff5858bf0a705b86b59

diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp
index 661a832..bb9be58 100644
--- a/Swiften/Client/ClientSession.cpp
+++ b/Swiften/Client/ClientSession.cpp
@@ -231,13 +231,13 @@ void ClientSession::handleElement(std::shared_ptr<ToplevelElement> element) {
 #ifdef SWIFTEN_PLATFORM_WIN32
             if (singleSignOn) {
                 const boost::optional<std::string> authenticationHostname = streamFeatures->getAuthenticationHostname();
-                bool gssapiSupported = streamFeatures->hasAuthenticationMechanism("GSSAPI") && authenticationHostname && !authenticationHostname->empty();
+                bool gssapiSupported = streamFeatures->hasAuthenticationMechanism("GSSAPI");
 
                 if (!gssapiSupported) {
                     finishSession(Error::NoSupportedAuthMechanismsError);
                 }
                 else {
-                    WindowsGSSAPIClientAuthenticator* gssapiAuthenticator = new WindowsGSSAPIClientAuthenticator(*authenticationHostname, localJID.getDomain(), authenticationPort);
+                    WindowsGSSAPIClientAuthenticator* gssapiAuthenticator = new WindowsGSSAPIClientAuthenticator(authenticationHostname.value_or(""), localJID.getDomain(), authenticationPort);
                     std::shared_ptr<Error> error = std::make_shared<Error>(Error::AuthenticationFailedError);
 
                     authenticator = gssapiAuthenticator;
-- 
cgit v0.10.2-6-g49f6