| Index: net/socket/ssl_client_socket_win.cc
|
| diff --git a/net/socket/ssl_client_socket_win.cc b/net/socket/ssl_client_socket_win.cc
|
| index 4cc310357da2bcf74952aded6f5aeafc7fcca17c..ecdf8cfd892d433ab4c429306ee2ebc6d8b4e829 100644
|
| --- a/net/socket/ssl_client_socket_win.cc
|
| +++ b/net/socket/ssl_client_socket_win.cc
|
| @@ -337,40 +337,6 @@ static BOOL WINAPI ClientCertFindCallback(PCCERT_CONTEXT cert_context,
|
|
|
| //-----------------------------------------------------------------------------
|
|
|
| -// A memory certificate store for client certificates. This allows us to
|
| -// close the "MY" system certificate store when we finish searching for
|
| -// client certificates.
|
| -class ClientCertStore {
|
| - public:
|
| - ClientCertStore() {
|
| - store_ = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, 0, NULL);
|
| - }
|
| -
|
| - ~ClientCertStore() {
|
| - if (store_) {
|
| - BOOL ok = CertCloseStore(store_, CERT_CLOSE_STORE_CHECK_FLAG);
|
| - DCHECK(ok);
|
| - }
|
| - }
|
| -
|
| - PCCERT_CONTEXT CopyCertContext(PCCERT_CONTEXT client_cert) {
|
| - PCCERT_CONTEXT copy;
|
| - BOOL ok = CertAddCertificateContextToStore(store_, client_cert,
|
| - CERT_STORE_ADD_USE_EXISTING,
|
| - ©);
|
| - DCHECK(ok);
|
| - return ok ? copy : NULL;
|
| - }
|
| -
|
| - private:
|
| - HCERTSTORE store_;
|
| -};
|
| -
|
| -static base::LazyInstance<ClientCertStore> g_client_cert_store(
|
| - base::LINKER_INITIALIZED);
|
| -
|
| -//-----------------------------------------------------------------------------
|
| -
|
| // Size of recv_buffer_
|
| //
|
| // Ciphertext is decrypted one SSL record at a time, so recv_buffer_ needs to
|
| @@ -522,17 +488,18 @@ void SSLClientSocketWin::GetSSLCertRequestInfo(
|
| // Get the leaf certificate.
|
| PCCERT_CONTEXT cert_context =
|
| chain_context->rgpChain[0]->rgpElement[0]->pCertContext;
|
| - // Copy it to our own certificate store, so that we can close the "MY"
|
| - // certificate store before returning from this function.
|
| - PCCERT_CONTEXT cert_context2 =
|
| - g_client_cert_store.Get().CopyCertContext(cert_context);
|
| - if (!cert_context2) {
|
| + // Copy the certificate into a NULL store, so that we can close the "MY"
|
| + // store before returning from this function.
|
| + PCCERT_CONTEXT cert_context2 = NULL;
|
| + BOOL ok = CertAddCertificateContextToStore(NULL, cert_context,
|
| + CERT_STORE_ADD_USE_EXISTING,
|
| + &cert_context2);
|
| + if (!ok) {
|
| NOTREACHED();
|
| continue;
|
| }
|
| scoped_refptr<X509Certificate> cert = X509Certificate::CreateFromHandle(
|
| - cert_context2, X509Certificate::SOURCE_LONE_CERT_IMPORT,
|
| - X509Certificate::OSCertHandles());
|
| + cert_context2, X509Certificate::OSCertHandles());
|
| cert_request_info->client_certs.push_back(cert);
|
| CertFreeCertificateContext(cert_context2);
|
| }
|
| @@ -1514,8 +1481,7 @@ int SSLClientSocketWin::DidCompleteHandshake() {
|
| DidCompleteRenegotiation();
|
| } else {
|
| server_cert_ = X509Certificate::CreateFromHandle(
|
| - server_cert_handle, X509Certificate::SOURCE_FROM_NETWORK,
|
| - X509Certificate::OSCertHandles());
|
| + server_cert_handle, X509Certificate::OSCertHandles());
|
|
|
| next_state_ = STATE_VERIFY_CERT;
|
| }
|
|
|