bug 1503053 - Backed out 2 changesets since ported bug 1502774 was backed out. a=backout DONTBUILD
authorJorg K <jorgk@jorgk.com>
Tue, 30 Oct 2018 21:14:35 +0100
changeset 33622 550ea359e239e322cef978fbb3dfd4e6fc5eec09
parent 33621 fd1f4b9f6638f3f9c81a65ad651ac536187e5a7b
child 33623 13e1bf3609be5c2d39f126ad3df2e5aa39f78fdc
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersbackout
bugs1503053, 1502774
bug 1503053 - Backed out 2 changesets since ported bug 1502774 was backed out. a=backout DONTBUILD Backed out changeset 9abb0344923c (bug 1503053) Backed out changeset fb4b473cb75e (bug 1503053)
mailnews/addrbook/src/nsAbLDAPListenerBase.cpp
mailnews/base/util/nsMsgProtocol.cpp
--- a/mailnews/addrbook/src/nsAbLDAPListenerBase.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPListenerBase.cpp
@@ -258,17 +258,18 @@ NS_IMETHODIMP nsAbLDAPListenerBase::OnLD
   {
     nsAutoCString service;
     rv = mDirectoryUrl->GetAsciiHost(service);
     NS_ENSURE_SUCCESS(rv, rv);
 
     service.InsertLiteral("ldap@", 0);
 
     nsCOMPtr<nsIAuthModule> authModule =
-      nsIAuthModule::CreateInstance("sasl-gssapi");
+      do_CreateInstance(NS_AUTH_MODULE_CONTRACTID_PREFIX "sasl-gssapi", &rv);
+    NS_ENSURE_SUCCESS(rv, rv);
 
     rv = mOperation->SaslBind(service, mSaslMechanism, authModule);
     if (NS_FAILED(rv))
     {
       NS_ERROR("nsAbLDAPMessageBase::OnLDAPInit(): "
                "failed to perform GSSAPI bind");
       mOperation = nullptr; // Break Listener -> Operation -> Listener ref cycle
       InitFailed();
--- a/mailnews/base/util/nsMsgProtocol.cpp
+++ b/mailnews/base/util/nsMsgProtocol.cpp
@@ -857,17 +857,18 @@ nsresult nsMsgProtocol::PostMessage(nsIU
 nsresult nsMsgProtocol::DoGSSAPIStep1(const char *service, const char *username, nsCString &response)
 {
     nsresult rv;
 #ifdef DEBUG_BenB
     printf("GSSAPI step 1 for service %s, username %s\n", service, username);
 #endif
 
     // if this fails, then it means that we cannot do GSSAPI SASL.
-    m_authModule = nsIAuthModule::CreateInstance("sasl-gssapi");
+    m_authModule = do_CreateInstance(NS_AUTH_MODULE_CONTRACTID_PREFIX "sasl-gssapi", &rv);
+    NS_ENSURE_SUCCESS(rv,rv);
 
     m_authModule->Init(service, nsIAuthModule::REQ_DEFAULT, nullptr, NS_ConvertUTF8toUTF16(username).get(), nullptr);
 
     void *outBuf;
     uint32_t outBufLen;
     rv = m_authModule->GetNextToken((void *)nullptr, 0, &outBuf, &outBufLen);
     if (NS_SUCCEEDED(rv) && outBuf)
     {
@@ -948,17 +949,20 @@ nsresult nsMsgProtocol::DoGSSAPIStep2(ns
 #endif
     return rv;
 }
 
 nsresult nsMsgProtocol::DoNtlmStep1(const nsACString &username, const nsAString &password, nsCString &response)
 {
     nsresult rv;
 
-    m_authModule = nsIAuthModule::CreateInstance("ntlm");
+    m_authModule = do_CreateInstance(NS_AUTH_MODULE_CONTRACTID_PREFIX "ntlm", &rv);
+    // if this fails, then it means that we cannot do NTLM auth.
+    if (NS_FAILED(rv) || !m_authModule)
+        return rv;
 
     m_authModule->Init(nullptr, 0, nullptr, NS_ConvertUTF8toUTF16(username).get(),
                        PromiseFlatString(password).get());
 
     void *outBuf;
     uint32_t outBufLen;
     rv = m_authModule->GetNextToken((void *)nullptr, 0, &outBuf, &outBufLen);
     if (NS_SUCCEEDED(rv) && outBuf)