| Index: remoting/host/pam_authorization_factory_posix.cc
|
| diff --git a/remoting/host/pam_authorization_factory_posix.cc b/remoting/host/pam_authorization_factory_posix.cc
|
| index 6d1bf588f701aa7fa6adf281560db12083972c9e..2dc66712bfc0ac15301b9698528c511147c64ce6 100644
|
| --- a/remoting/host/pam_authorization_factory_posix.cc
|
| +++ b/remoting/host/pam_authorization_factory_posix.cc
|
| @@ -6,6 +6,8 @@
|
|
|
| #include <security/pam_appl.h>
|
|
|
| +#include "base/bind.h"
|
| +#include "base/callback.h"
|
| #include "base/environment.h"
|
| #include "base/logging.h"
|
| #include "remoting/protocol/channel_authenticator.h"
|
| @@ -22,7 +24,8 @@ class PamAuthorizer : public protocol::Authenticator {
|
| // protocol::Authenticator interface.
|
| virtual State state() const OVERRIDE;
|
| virtual RejectionReason rejection_reason() const OVERRIDE;
|
| - virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE;
|
| + virtual void ProcessMessage(const base::Closure& resume_callback,
|
| + const buzz::XmlElement* message) OVERRIDE;
|
| virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE;
|
| virtual scoped_ptr<protocol::ChannelAuthenticator>
|
| CreateChannelAuthenticator() const OVERRIDE;
|
| @@ -30,6 +33,7 @@ class PamAuthorizer : public protocol::Authenticator {
|
| private:
|
| void MaybeCheckLocalLogin();
|
| bool IsLocalLoginAllowed();
|
| + void OnMessageProcessed(const base::Closure& resume_callback);
|
|
|
| static int PamConversation(int num_messages,
|
| const struct pam_message** messages,
|
| @@ -66,13 +70,21 @@ PamAuthorizer::rejection_reason() const {
|
| }
|
| }
|
|
|
| -void PamAuthorizer::ProcessMessage(const buzz::XmlElement* message) {
|
| - underlying_->ProcessMessage(message);
|
| +void PamAuthorizer::ProcessMessage(const base::Closure& resume_callback,
|
| + const buzz::XmlElement* message) {
|
| + underlying_->ProcessMessage(base::Bind(
|
| + &PamAuthorizer::OnMessageProcessed,
|
| + // underlying is owned by PamAuthorizer and cannot outlive it.
|
| + base::Unretained(this), resume_callback), message);
|
| +}
|
| +
|
| +void PamAuthorizer::OnMessageProcessed(const base::Closure& resume_callback) {
|
| MaybeCheckLocalLogin();
|
| + resume_callback.Run();
|
| }
|
|
|
| scoped_ptr<buzz::XmlElement> PamAuthorizer::GetNextMessage() {
|
| - scoped_ptr<buzz::XmlElement> result (underlying_->GetNextMessage());
|
| + scoped_ptr<buzz::XmlElement> result(underlying_->GetNextMessage());
|
| MaybeCheckLocalLogin();
|
| return result.Pass();
|
| }
|
|
|