Bug 1501589 - Port bug 1501404 (part 6): Replace use of NS_STARTTLSSOCKETPROVIDER_CONTRACTID. r=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Wed, 24 Oct 2018 11:31:18 +0300
changeset 33551 fc3bc776f223d2244dd3a596b11460d826860d65
parent 33550 a3783aedb7814e69b3c0ccf4e7b7daa4327a8838
child 33552 97346356d25ce1dce070e8188f1a83749e2e8df7
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersjorgk
bugs1501589, 1501404
Bug 1501589 - Port bug 1501404 (part 6): Replace use of NS_STARTTLSSOCKETPROVIDER_CONTRACTID. r=jorgk
ldap/xpcom/src/nsLDAPSecurityGlue.cpp
--- a/ldap/xpcom/src/nsLDAPSecurityGlue.cpp
+++ b/ldap/xpcom/src/nsLDAPSecurityGlue.cpp
@@ -6,16 +6,17 @@
 //
 #include "nsLDAPInternal.h"
 #include "nsCOMPtr.h"
 #include "nsIServiceManager.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsNetCID.h"
 #include "nsISocketProvider.h"
 #include "nsISSLSocketControl.h"
+#include "nsTLSSocketProvider.h"
 #include "nsString.h"
 #include "nsMemory.h"
 #include "plstr.h"
 #include "ldap.h"
 #include "ldappr.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 
@@ -148,22 +149,18 @@ nsLDAPSSLConnect(const char *hostlist, i
     if (!socketClosure) {
         NS_WARNING("nsLDAPSSLConnect(): unable to allocate socket closure");
         goto close_socket_and_exit_with_error;
     }
     memset(socketClosure, 0, sizeof(nsLDAPSSLSocketClosure));
     socketClosure->sessionClosure = sessionClosure;
 
     // Add the NSPR layer for SSL provided by PSM to this socket.
-    //
-    tlsSocketProvider = do_GetService(NS_STARTTLSSOCKETPROVIDER_CONTRACTID, &rv);
-    if (NS_FAILED(rv)) {
-        NS_ERROR("nsLDAPSSLConnect(): unable to get socket provider service");
-        goto close_socket_and_exit_with_error;
-    }
+    tlsSocketProvider = new nsTLSSocketProvider();
+
     // XXXdmose: Note that hostlist can be a list of hosts (in the
     // current XPCOM SDK code, it will always be a list of IP
     // addresses).  Because of this, we need to use
     // sessionClosure->hostname which was passed in separately to tell
     // AddToSocket what to match the name in the certificate against.
     // What exactly happen will happen when this is used with some IP
     // address in the list other than the first one is not entirely
     // clear, and I suspect it may depend on the format of the name in