Commit 5bf52313 authored by sergeyu@chromium.org's avatar sergeyu@chromium.org

Use scoped_ptr<>.Pass() to pass ownership in the remoting protocol code.

Review URL: https://chromiumcodereview.appspot.com/9240033

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118407 0039d316-1c4b-4281-b951-d872f2087c98
parent 0bc93ad3
......@@ -21,8 +21,9 @@ bool Authenticator::IsAuthenticatorMessage(const buzz::XmlElement* message) {
}
// static
buzz::XmlElement* Authenticator::CreateEmptyAuthenticatorMessage() {
return new buzz::XmlElement(kAuthenticationQName);
scoped_ptr<buzz::XmlElement> Authenticator::CreateEmptyAuthenticatorMessage() {
return scoped_ptr<buzz::XmlElement>(
new buzz::XmlElement(kAuthenticationQName));
}
// static
......
......@@ -7,6 +7,8 @@
#include <string>
#include "base/memory/scoped_ptr.h"
namespace buzz {
class XmlElement;
} // namespace buzz
......@@ -57,7 +59,7 @@ class Authenticator {
static bool IsAuthenticatorMessage(const buzz::XmlElement* message);
// Creates an empty Authenticator message, owned by the caller.
static buzz::XmlElement* CreateEmptyAuthenticatorMessage();
static scoped_ptr<buzz::XmlElement> CreateEmptyAuthenticatorMessage();
// Finds Authenticator message among child elements of |message|, or
// returns NULL otherwise.
......@@ -77,12 +79,12 @@ class Authenticator {
// Must be called when in MESSAGE_READY state. Returns next
// authentication message that needs to be sent to the peer.
virtual buzz::XmlElement* GetNextMessage() = 0;
virtual scoped_ptr<buzz::XmlElement> GetNextMessage() = 0;
// Creates new authenticator for a channel. Caller must take
// ownership of the result. Can be called only in the ACCEPTED
// state.
virtual ChannelAuthenticator* CreateChannelAuthenticator() const = 0;
// Creates new authenticator for a channel. Can be called only in
// the ACCEPTED state.
virtual scoped_ptr<ChannelAuthenticator>
CreateChannelAuthenticator() const = 0;
};
// Factory for Authenticator instances.
......@@ -99,7 +101,7 @@ class AuthenticatorFactory {
// if the |first_message| is invalid and the session should be
// rejected. ProcessMessage() should be called with |first_message|
// for the result of this method.
virtual Authenticator* CreateAuthenticator(
virtual scoped_ptr<Authenticator> CreateAuthenticator(
const std::string& remote_jid,
const buzz::XmlElement* first_message) = 0;
};
......
......@@ -124,14 +124,14 @@ void ConnectionToHost::OnSessionManagerReady() {
DCHECK(message_loop_->BelongsToCurrentThread());
// After SessionManager is initialized we can try to connect to the host.
CandidateSessionConfig* candidate_config =
scoped_ptr<CandidateSessionConfig> candidate_config =
CandidateSessionConfig::CreateDefault();
V1ClientAuthenticator* authenticator =
new V1ClientAuthenticator(signal_strategy_->GetLocalJid(), access_code_);
session_.reset(session_manager_->Connect(
host_jid_, authenticator, candidate_config,
scoped_ptr<Authenticator> authenticator(
new V1ClientAuthenticator(signal_strategy_->GetLocalJid(), access_code_));
session_ = session_manager_->Connect(
host_jid_, authenticator.Pass(), candidate_config.Pass(),
base::Bind(&ConnectionToHost::OnSessionStateChange,
base::Unretained(this))));
base::Unretained(this)));
}
void ConnectionToHost::OnIncomingSession(
......
......@@ -146,10 +146,10 @@ bool ParseChannelConfig(const XmlElement* element, bool codec_required,
} // namespace
ContentDescription::ContentDescription(
const CandidateSessionConfig* candidate_config,
const buzz::XmlElement* authenticator_message)
: candidate_config_(candidate_config),
authenticator_message_(authenticator_message) {
scoped_ptr<CandidateSessionConfig> config,
scoped_ptr<buzz::XmlElement> authenticator_message)
: candidate_config_(config.Pass()),
authenticator_message_(authenticator_message.Pass()) {
}
ContentDescription::~ContentDescription() { }
......@@ -247,8 +247,7 @@ ContentDescription* ContentDescription::ParseXml(
if (child)
authenticator_message.reset(new XmlElement(*child));
return new ContentDescription(
config.release(), authenticator_message.release());
return new ContentDescription(config.Pass(), authenticator_message.Pass());
}
LOG(ERROR) << "Invalid description: " << element->Str();
return NULL;
......
......@@ -28,9 +28,8 @@ class ContentDescription : public cricket::ContentDescription {
public:
static const char kChromotingContentName[];
// Takes ownership of |config| and |authenticator_message|.
ContentDescription(const CandidateSessionConfig* config,
const buzz::XmlElement* authenticator_message);
ContentDescription(scoped_ptr<CandidateSessionConfig> config,
scoped_ptr<buzz::XmlElement> authenticator_message);
virtual ~ContentDescription();
const CandidateSessionConfig* config() const {
......
......@@ -97,24 +97,25 @@ void FakeAuthenticator::ProcessMessage(const buzz::XmlElement* message) {
++messages_;
}
buzz::XmlElement* FakeAuthenticator::GetNextMessage() {
scoped_ptr<buzz::XmlElement> FakeAuthenticator::GetNextMessage() {
EXPECT_EQ(MESSAGE_READY, state());
buzz::XmlElement* result = new buzz::XmlElement(
buzz::QName(kChromotingXmlNamespace, "authentication"));
scoped_ptr<buzz::XmlElement> result(new buzz::XmlElement(
buzz::QName(kChromotingXmlNamespace, "authentication")));
buzz::XmlElement* id = new buzz::XmlElement(
buzz::QName(kChromotingXmlNamespace, "id"));
id->AddText(base::IntToString(messages_));
result->AddElement(id);
++messages_;
return result;
return result.Pass();
}
ChannelAuthenticator*
scoped_ptr<ChannelAuthenticator>
FakeAuthenticator::CreateChannelAuthenticator() const {
EXPECT_EQ(ACCEPTED, state());
return new FakeChannelAuthenticator(action_ != REJECT_CHANNEL, async_);
return scoped_ptr<ChannelAuthenticator>(
new FakeChannelAuthenticator(action_ != REJECT_CHANNEL, async_));
}
FakeHostAuthenticatorFactory::FakeHostAuthenticatorFactory(
......@@ -126,11 +127,11 @@ FakeHostAuthenticatorFactory::FakeHostAuthenticatorFactory(
FakeHostAuthenticatorFactory::~FakeHostAuthenticatorFactory() {
}
Authenticator* FakeHostAuthenticatorFactory::CreateAuthenticator(
scoped_ptr<Authenticator> FakeHostAuthenticatorFactory::CreateAuthenticator(
const std::string& remote_jid,
const buzz::XmlElement* first_message) {
return new FakeAuthenticator(FakeAuthenticator::HOST, round_trips_,
action_, async_);
return scoped_ptr<Authenticator>(new FakeAuthenticator(
FakeAuthenticator::HOST, round_trips_, action_, async_));
}
} // namespace protocol
......
......@@ -54,8 +54,9 @@ class FakeAuthenticator : public Authenticator {
// Authenticator interface.
virtual State state() const OVERRIDE;
virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE;
virtual buzz::XmlElement* GetNextMessage() OVERRIDE;
virtual ChannelAuthenticator* CreateChannelAuthenticator() const OVERRIDE;
virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE;
virtual scoped_ptr<ChannelAuthenticator>
CreateChannelAuthenticator() const OVERRIDE;
protected:
Type type_;
......@@ -76,7 +77,7 @@ class FakeHostAuthenticatorFactory : public AuthenticatorFactory {
virtual ~FakeHostAuthenticatorFactory();
// AuthenticatorFactory interface.
virtual Authenticator* CreateAuthenticator(
virtual scoped_ptr<Authenticator> CreateAuthenticator(
const std::string& remote_jid,
const buzz::XmlElement* first_message) OVERRIDE;
......
......@@ -24,7 +24,7 @@ It2MeHostAuthenticatorFactory::It2MeHostAuthenticatorFactory(
It2MeHostAuthenticatorFactory::~It2MeHostAuthenticatorFactory() {
}
Authenticator* It2MeHostAuthenticatorFactory::CreateAuthenticator(
scoped_ptr<Authenticator> It2MeHostAuthenticatorFactory::CreateAuthenticator(
const std::string& remote_jid,
const buzz::XmlElement* first_message) {
// TODO(sergeyu): V2 authenticator is not finished yet. Enable it
......@@ -35,8 +35,8 @@ Authenticator* It2MeHostAuthenticatorFactory::CreateAuthenticator(
// local_cert_, *local_private_key_, shared_secret_);
// }
return new V1HostAuthenticator(local_cert_, *local_private_key_,
shared_secret_, remote_jid);
return scoped_ptr<Authenticator>(new V1HostAuthenticator(
local_cert_, *local_private_key_, shared_secret_, remote_jid));
}
} // namespace protocol
......
......@@ -30,7 +30,7 @@ class It2MeHostAuthenticatorFactory : public AuthenticatorFactory {
virtual ~It2MeHostAuthenticatorFactory();
// AuthenticatorFactory interface.
virtual Authenticator* CreateAuthenticator(
virtual scoped_ptr<Authenticator> CreateAuthenticator(
const std::string& remote_jid,
const buzz::XmlElement* first_message) OVERRIDE;
......
......@@ -28,9 +28,8 @@ class JingleChannelConnector : public base::NonThreadSafe {
JingleChannelConnector() { }
virtual ~JingleChannelConnector() { }
// Starts the connection process for the channel. Takes ownership of
// |authenticator|.
virtual void Connect(ChannelAuthenticator* authenticator,
// Starts the connection process for the channel.
virtual void Connect(scoped_ptr<ChannelAuthenticator> authenticator,
cricket::TransportChannel* raw_channel) = 0;
protected:
......
......@@ -24,11 +24,11 @@ JingleDatagramConnector::~JingleDatagramConnector() {
}
void JingleDatagramConnector::Connect(
ChannelAuthenticator* authenticator,
scoped_ptr<ChannelAuthenticator> authenticator,
cricket::TransportChannel* raw_channel) {
DCHECK(CalledOnValidThread());
authenticator_.reset(authenticator);
authenticator_ = authenticator.Pass();
net::Socket* socket =
new jingle_glue::TransportChannelSocketAdapter(raw_channel);
......
......@@ -27,7 +27,7 @@ class JingleDatagramConnector : public JingleChannelConnector {
// TODO(sergeyu): In the current implementation ChannelAuthenticator
// cannot be used for datagram channels, so needs to be either
// extended or replaced with something else here.
virtual void Connect(ChannelAuthenticator* authenticator,
virtual void Connect(scoped_ptr<ChannelAuthenticator> authenticator,
cricket::TransportChannel* raw_channel) OVERRIDE;
private:
......
......@@ -33,9 +33,9 @@ namespace protocol {
JingleSession::JingleSession(
JingleSessionManager* jingle_session_manager,
cricket::Session* cricket_session,
Authenticator* authenticator)
scoped_ptr<Authenticator> authenticator)
: jingle_session_manager_(jingle_session_manager),
authenticator_(authenticator),
authenticator_(authenticator.Pass()),
state_(INITIALIZING),
error_(OK),
closing_(false),
......@@ -62,8 +62,9 @@ JingleSession::~JingleSession() {
void JingleSession::SendSessionInitiate() {
DCHECK_EQ(authenticator_->state(), Authenticator::MESSAGE_READY);
cricket_session_->Initiate(
jid_, CreateSessionDescription(candidate_config()->Clone(),
authenticator_->GetNextMessage()));
jid_, CreateSessionDescription(
candidate_config()->Clone(),
authenticator_->GetNextMessage()).release());
}
void JingleSession::CloseInternal(int result, Error error) {
......@@ -172,11 +173,11 @@ const CandidateSessionConfig* JingleSession::candidate_config() {
}
void JingleSession::set_candidate_config(
const CandidateSessionConfig* candidate_config) {
scoped_ptr<CandidateSessionConfig> candidate_config) {
DCHECK(CalledOnValidThread());
DCHECK(!candidate_config_.get());
DCHECK(candidate_config);
candidate_config_.reset(candidate_config);
DCHECK(candidate_config.get());
candidate_config_ = candidate_config.Pass();
}
const SessionConfig& JingleSession::config() {
......@@ -384,7 +385,7 @@ void JingleSession::AcceptConnection() {
CHECK(content);
const ContentDescription* content_description =
static_cast<const ContentDescription*>(content->description);
candidate_config_.reset(content_description->config()->Clone());
candidate_config_ = content_description->config()->Clone();
SessionManager::IncomingSessionResponse response =
jingle_session_manager_->AcceptConnection(this);
......@@ -411,8 +412,8 @@ void JingleSession::AcceptConnection() {
return;
}
authenticator_.reset(
jingle_session_manager_->CreateAuthenticator(jid(), auth_message));
authenticator_ =
jingle_session_manager_->CreateAuthenticator(jid(), auth_message);
if (!authenticator_.get()) {
CloseInternal(net::ERR_CONNECTION_FAILED, INCOMPATIBLE_PROTOCOL);
return;
......@@ -426,24 +427,26 @@ void JingleSession::AcceptConnection() {
}
// Connection must be configured by the AcceptConnection() callback.
CandidateSessionConfig* candidate_config =
scoped_ptr<CandidateSessionConfig> candidate_config =
CandidateSessionConfig::CreateFrom(config());
buzz::XmlElement* auth_reply = NULL;
scoped_ptr<buzz::XmlElement> auth_reply;
if (authenticator_->state() == Authenticator::MESSAGE_READY)
auth_reply = authenticator_->GetNextMessage();
DCHECK_NE(authenticator_->state(), Authenticator::MESSAGE_READY);
cricket_session_->Accept(
CreateSessionDescription(candidate_config, auth_reply));
CreateSessionDescription(candidate_config.Pass(),
auth_reply.Pass()).release());
}
void JingleSession::ProcessAuthenticationStep() {
DCHECK_EQ(state_, CONNECTED);
if (authenticator_->state() == Authenticator::MESSAGE_READY) {
buzz::XmlElement* auth_message = authenticator_->GetNextMessage();
scoped_ptr<buzz::XmlElement> auth_message =
authenticator_->GetNextMessage();
cricket::XmlElements message;
message.push_back(auth_message);
message.push_back(auth_message.release());
cricket_session_->SendInfoMessage(message);
}
DCHECK_NE(authenticator_->state(), Authenticator::MESSAGE_READY);
......@@ -471,9 +474,9 @@ void JingleSession::AddChannelConnector(
}
channel_connectors_[name] = connector;
ChannelAuthenticator* authenticator =
scoped_ptr<ChannelAuthenticator> authenticator =
authenticator_->CreateChannelAuthenticator();
connector->Connect(authenticator, raw_channel);
connector->Connect(authenticator.Pass(), raw_channel);
// Workaround bug in libjingle - it doesn't connect channels if they
// are created after the session is accepted. See crbug.com/89384.
......@@ -517,14 +520,15 @@ void JingleSession::SetState(State new_state) {
}
// static
cricket::SessionDescription* JingleSession::CreateSessionDescription(
const CandidateSessionConfig* config,
const buzz::XmlElement* authenticator_message) {
cricket::SessionDescription* desc = new cricket::SessionDescription();
scoped_ptr<cricket::SessionDescription> JingleSession::CreateSessionDescription(
scoped_ptr<CandidateSessionConfig> config,
scoped_ptr<buzz::XmlElement> authenticator_message) {
scoped_ptr<cricket::SessionDescription> desc(
new cricket::SessionDescription());
desc->AddContent(
ContentDescription::kChromotingContentName, kChromotingXmlNamespace,
new ContentDescription(config, authenticator_message));
return desc;
new ContentDescription(config.Pass(), authenticator_message.Pass()));
return desc.Pass();
}
} // namespace protocol
......
......@@ -25,6 +25,8 @@ class JingleSessionManager;
class JingleSession : public protocol::Session,
public sigslot::has_slots<> {
public:
virtual ~JingleSession();
// Session interface.
virtual void SetStateChangeCallback(
const StateChangeCallback& callback) OVERRIDE;
......@@ -49,14 +51,13 @@ class JingleSession : public protocol::Session,
typedef std::map<std::string, JingleChannelConnector*> ChannelConnectorsMap;
// Takes ownership of |authenticator|.
JingleSession(JingleSessionManager* jingle_session_manager,
cricket::Session* cricket_session,
Authenticator* authenticator);
virtual ~JingleSession();
scoped_ptr<Authenticator> authenticator);
// Called by JingleSessionManager.
void set_candidate_config(const CandidateSessionConfig* candidate_config);
void set_candidate_config(
scoped_ptr<CandidateSessionConfig> candidate_config);
// Sends session-initiate for new session.
void SendSessionInitiate();
......@@ -107,9 +108,9 @@ class JingleSession : public protocol::Session,
void SetState(State new_state);
static cricket::SessionDescription* CreateSessionDescription(
const CandidateSessionConfig* candidate_config,
const buzz::XmlElement* authenticator_message);
static scoped_ptr<cricket::SessionDescription> CreateSessionDescription(
scoped_ptr<CandidateSessionConfig> candidate_config,
scoped_ptr<buzz::XmlElement> authenticator_message);
// JingleSessionManager that created this session. Guaranteed to
// exist throughout the lifetime of the session.
......
......@@ -122,10 +122,10 @@ void JingleSessionManager::set_authenticator_factory(
authenticator_factory_ = authenticator_factory.Pass();
}
Session* JingleSessionManager::Connect(
scoped_ptr<Session> JingleSessionManager::Connect(
const std::string& host_jid,
Authenticator* authenticator,
CandidateSessionConfig* candidate_config,
scoped_ptr<Authenticator> authenticator,
scoped_ptr<CandidateSessionConfig> config,
const Session::StateChangeCallback& state_change_callback) {
DCHECK(CalledOnValidThread());
......@@ -133,15 +133,15 @@ Session* JingleSessionManager::Connect(
signal_strategy_->GetLocalJid(), kChromotingXmlNamespace);
cricket_session->set_remote_name(host_jid);
JingleSession* jingle_session =
new JingleSession(this, cricket_session, authenticator);
jingle_session->set_candidate_config(candidate_config);
scoped_ptr<JingleSession> jingle_session(
new JingleSession(this, cricket_session, authenticator.Pass()));
jingle_session->set_candidate_config(config.Pass());
jingle_session->SetStateChangeCallback(state_change_callback);
sessions_.push_back(jingle_session);
sessions_.push_back(jingle_session.get());
jingle_session->SendSessionInitiate();
return jingle_session;
return scoped_ptr<Session>(jingle_session.Pass());
}
void JingleSessionManager::OnSessionCreate(
......@@ -153,7 +153,7 @@ void JingleSessionManager::OnSessionCreate(
if (incoming) {
JingleSession* jingle_session =
new JingleSession(this, cricket_session, NULL);
new JingleSession(this, cricket_session, scoped_ptr<Authenticator>());
sessions_.push_back(jingle_session);
}
}
......@@ -198,12 +198,12 @@ SessionManager::IncomingSessionResponse JingleSessionManager::AcceptConnection(
return response;
}
Authenticator* JingleSessionManager::CreateAuthenticator(
scoped_ptr<Authenticator> JingleSessionManager::CreateAuthenticator(
const std::string& jid, const buzz::XmlElement* auth_message) {
DCHECK(CalledOnValidThread());
if (!authenticator_factory_.get())
return NULL;
return scoped_ptr<Authenticator>(NULL);
return authenticator_factory_->CreateAuthenticator(jid, auth_message);
}
......
......@@ -44,10 +44,10 @@ class JingleSessionManager : public SessionManager,
virtual void Init(SignalStrategy* signal_strategy,
SessionManager::Listener* listener,
const NetworkSettings& network_settings) OVERRIDE;
virtual Session* Connect(
virtual scoped_ptr<Session> Connect(
const std::string& host_jid,
Authenticator* authenticator,
CandidateSessionConfig* config,
scoped_ptr<Authenticator> authenticator,
scoped_ptr<CandidateSessionConfig> config,
const Session::StateChangeCallback& state_change_callback) OVERRIDE;
virtual void Close() OVERRIDE;
virtual void set_authenticator_factory(
......@@ -80,10 +80,10 @@ class JingleSessionManager : public SessionManager,
// Creates authenticator for incoming session. Returns NULL if
// authenticator cannot be created, e.g. if |auth_message| is
// invalid. Caller reatins ownership of |auth_message| and must
// accept ownership of the result.
Authenticator* CreateAuthenticator(const std::string& jid,
const buzz::XmlElement* auth_message);
// invalid.
scoped_ptr<Authenticator> CreateAuthenticator(
const std::string& jid,
const buzz::XmlElement* auth_message);
// Called by JingleSession when it is being destroyed.
void SessionDestroyed(JingleSession* jingle_session);
......
......@@ -206,14 +206,14 @@ class JingleSessionTest : public testing::Test {
}
}
Authenticator* authenticator = new FakeAuthenticator(
FakeAuthenticator::CLIENT, auth_round_trips, auth_action, true);
scoped_ptr<Authenticator> authenticator(new FakeAuthenticator(
FakeAuthenticator::CLIENT, auth_round_trips, auth_action, true));
client_session_.reset(client_server_->Connect(
kHostJid, authenticator,
client_session_ = client_server_->Connect(
kHostJid, authenticator.Pass(),
CandidateSessionConfig::CreateDefault(),
base::Bind(&MockSessionCallback::OnStateChange,
base::Unretained(&client_connection_callback_))));
base::Unretained(&client_connection_callback_)));
message_loop_.RunAllPending();
......@@ -308,13 +308,12 @@ TEST_F(JingleSessionTest, RejectConnection) {
.Times(1);
}
Authenticator* authenticator = new FakeAuthenticator(
FakeAuthenticator::CLIENT, 1, FakeAuthenticator::ACCEPT, true);
client_session_.reset(client_server_->Connect(
kHostJid, authenticator,
CandidateSessionConfig::CreateDefault(),
scoped_ptr<Authenticator> authenticator(new FakeAuthenticator(
FakeAuthenticator::CLIENT, 1, FakeAuthenticator::ACCEPT, true));
client_session_ = client_server_->Connect(
kHostJid, authenticator.Pass(), CandidateSessionConfig::CreateDefault(),
base::Bind(&MockSessionCallback::OnStateChange,
base::Unretained(&client_connection_callback_))));
base::Unretained(&client_connection_callback_)));
message_loop_.RunAllPending();
}
......
......@@ -47,12 +47,13 @@ JingleStreamConnector::JingleStreamConnector(
JingleStreamConnector::~JingleStreamConnector() {
}
void JingleStreamConnector::Connect(ChannelAuthenticator* authenticator,
cricket::TransportChannel* raw_channel) {
void JingleStreamConnector::Connect(
scoped_ptr<ChannelAuthenticator> authenticator,
cricket::TransportChannel* raw_channel) {
DCHECK(CalledOnValidThread());
DCHECK(!raw_channel_);
authenticator_.reset(authenticator);
authenticator_ = authenticator.Pass();
raw_channel_ = raw_channel;
net::Socket* socket =
......
......@@ -42,7 +42,7 @@ class JingleStreamConnector : public JingleChannelConnector {
virtual ~JingleStreamConnector();
// JingleChannelConnector implementation.
virtual void Connect(ChannelAuthenticator* authenticator,
virtual void Connect(scoped_ptr<ChannelAuthenticator> authenticator,
cricket::TransportChannel* raw_channel) OVERRIDE;
private:
......
......@@ -28,13 +28,13 @@ Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory(
Me2MeHostAuthenticatorFactory::~Me2MeHostAuthenticatorFactory() {
}
Authenticator* Me2MeHostAuthenticatorFactory::CreateAuthenticator(
scoped_ptr<Authenticator> Me2MeHostAuthenticatorFactory::CreateAuthenticator(
const std::string& remote_jid,
const buzz::XmlElement* first_message) {
// Reject incoming connection if the client's jid is not an ASCII string.
if (!IsStringASCII(remote_jid)) {
LOG(ERROR) << "Rejecting incoming connection from " << remote_jid;
return NULL;
return scoped_ptr<Authenticator>(NULL);
}
// Check that the client has the same bare jid as the host, i.e.
......@@ -42,7 +42,7 @@ Authenticator* Me2MeHostAuthenticatorFactory::CreateAuthenticator(
// insensitive.
if (!StartsWithASCII(remote_jid, local_jid_prefix_, false)) {
LOG(ERROR) << "Rejecting incoming connection from " << remote_jid;
return NULL;
return scoped_ptr<Authenticator>(NULL);
}
// TODO(sergeyu): V2 authenticator is not finished yet. Enable it
......@@ -55,8 +55,9 @@ Authenticator* Me2MeHostAuthenticatorFactory::CreateAuthenticator(
// TODO(sergeyu): Old clients still use V1 auth protocol. Remove
// this once we are done migrating to V2.
return new V1HostAuthenticator(local_cert_, *local_private_key_,
shared_secret_, remote_jid);
return scoped_ptr<Authenticator>(new V1HostAuthenticator(
local_cert_, *local_private_key_,
shared_secret_, remote_jid));
}
} // namespace protocol
......
......@@ -29,7 +29,7 @@ class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory {
virtual ~Me2MeHostAuthenticatorFactory();
// AuthenticatorFactory interface.
virtual Authenticator* CreateAuthenticator(
virtual scoped_ptr<Authenticator> CreateAuthenticator(
const std::string& remote_jid,
const buzz::XmlElement* first_message) OVERRIDE;
......