Commit 5cbf4ebd authored by Asanka Herath's avatar Asanka Herath Committed by Commit Bot

[net/http] Use smart pointers when constructing NTLM handler.

R=mmenke@chromium.org

Bug: 927182
Change-Id: I64abb13045c30f500a85fc4ee8d3f37d9e127ecf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1815099
Commit-Queue: Asanka Herath <asanka@chromium.org>
Auto-Submit: Asanka Herath <asanka@chromium.org>
Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698593}
parent 7910e0de
......@@ -159,7 +159,7 @@ HttpAuthHandlerRegistryFactory::Create(
HttpAuthHandlerNTLM::Factory* ntlm_factory =
new HttpAuthHandlerNTLM::Factory();
#if defined(OS_WIN)
ntlm_factory->set_sspi_library(new SSPILibraryDefault());
ntlm_factory->set_sspi_library(std::make_unique<SSPILibraryDefault>());
#endif // defined(OS_WIN)
registry_factory->RegisterSchemeFactory(kNtlmAuthScheme, ntlm_factory);
}
......
......@@ -32,6 +32,7 @@
#include <vector>
#include "base/containers/span.h"
#include "base/macros.h"
#include "base/strings/string16.h"
#include "net/base/completion_once_callback.h"
#include "net/base/net_export.h"
......@@ -76,17 +77,19 @@ class NET_EXPORT_PRIVATE HttpAuthHandlerNTLM : public HttpAuthHandler {
// this are unit tests which pass in a mocked-out version of the SSPI
// library. After the call |sspi_library| will be owned by this Factory and
// will be destroyed when the Factory is destroyed.
void set_sspi_library(SSPILibrary* sspi_library) {
sspi_library_.reset(sspi_library);
void set_sspi_library(std::unique_ptr<SSPILibrary> sspi_library) {
sspi_library_ = std::move(sspi_library);
}
#endif // defined(NTLM_SSPI)
private:
#if defined(NTLM_SSPI)
ULONG max_token_length_;
bool is_unsupported_;
ULONG max_token_length_ = 0;
bool is_unsupported_ = false;
std::unique_ptr<SSPILibrary> sspi_library_;
#endif // defined(NTLM_SSPI)
DISALLOW_COPY_AND_ASSIGN(Factory);
};
#if defined(NTLM_PORTABLE)
......@@ -123,6 +126,8 @@ class NET_EXPORT_PRIVATE HttpAuthHandlerNTLM : public HttpAuthHandler {
GetMSTimeProc old_ms_time_proc_;
GenerateRandomProc old_random_proc_;
HostNameProc old_host_name_proc_;
DISALLOW_COPY_AND_ASSIGN(ScopedProcSetter);
};
#endif
......@@ -199,6 +204,8 @@ class NET_EXPORT_PRIVATE HttpAuthHandlerNTLM : public HttpAuthHandler {
#if defined(NTLM_SSPI)
const HttpAuthPreferences* http_auth_preferences_;
#endif
DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerNTLM);
};
} // namespace net
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment