Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: remoting/host/pam_authorization_factory_posix.cc

Issue 12326090: Third Party authentication protocol. (Closed) Base URL: http://git.chromium.org/chromium/src.git@host_key_pair
Patch Set: Split authenticator into base, client, host Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..1a5b0b3e7ea14509bb6b9ce576d97a31b76bbd90 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 buzz::XmlElement* message,
+ const base::Closure& resume_callback) 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 buzz::XmlElement* message,
+ const base::Closure& resume_callback) {
+ // |underlying_| is owned, so Unretained() is safe here.
+ underlying_->ProcessMessage(message, base::Bind(
+ &PamAuthorizer::OnMessageProcessed,
+ base::Unretained(this), resume_callback));
+}
+
+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();
}
« no previous file with comments | « no previous file | remoting/protocol/authentication_method.h » ('j') | remoting/protocol/third_party_authenticator_base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698