| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/pam_authorization_factory_posix.h" | 5 #include "remoting/host/pam_authorization_factory_posix.h" |
| 6 | 6 |
| 7 #include <security/pam_appl.h> | 7 #include <security/pam_appl.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/environment.h" | 11 #include "base/environment.h" |
| 12 #include "remoting/base/logging.h" | 12 #include "remoting/base/logging.h" |
| 13 #include "remoting/host/username.h" | 13 #include "remoting/host/username.h" |
| 14 #include "remoting/protocol/channel_authenticator.h" | 14 #include "remoting/protocol/channel_authenticator.h" |
| 15 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 15 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| 16 | 16 |
| 17 namespace remoting { | 17 namespace remoting { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 class PamAuthorizer : public protocol::Authenticator { | 20 class PamAuthorizer : public protocol::Authenticator { |
| 21 public: | 21 public: |
| 22 PamAuthorizer(scoped_ptr<protocol::Authenticator> underlying); | 22 PamAuthorizer(scoped_ptr<protocol::Authenticator> underlying); |
| 23 virtual ~PamAuthorizer(); | 23 ~PamAuthorizer() override; |
| 24 | 24 |
| 25 // protocol::Authenticator interface. | 25 // protocol::Authenticator interface. |
| 26 virtual State state() const override; | 26 State state() const override; |
| 27 virtual bool started() const override; | 27 bool started() const override; |
| 28 virtual RejectionReason rejection_reason() const override; | 28 RejectionReason rejection_reason() const override; |
| 29 virtual void ProcessMessage(const buzz::XmlElement* message, | 29 void ProcessMessage(const buzz::XmlElement* message, |
| 30 const base::Closure& resume_callback) override; | 30 const base::Closure& resume_callback) override; |
| 31 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() override; | 31 scoped_ptr<buzz::XmlElement> GetNextMessage() override; |
| 32 virtual scoped_ptr<protocol::ChannelAuthenticator> | 32 scoped_ptr<protocol::ChannelAuthenticator> CreateChannelAuthenticator() |
| 33 CreateChannelAuthenticator() const override; | 33 const override; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 void MaybeCheckLocalLogin(); | 36 void MaybeCheckLocalLogin(); |
| 37 bool IsLocalLoginAllowed(); | 37 bool IsLocalLoginAllowed(); |
| 38 void OnMessageProcessed(const base::Closure& resume_callback); | 38 void OnMessageProcessed(const base::Closure& resume_callback); |
| 39 | 39 |
| 40 static int PamConversation(int num_messages, | 40 static int PamConversation(int num_messages, |
| 41 const struct pam_message** messages, | 41 const struct pam_message** messages, |
| 42 struct pam_response** responses, | 42 struct pam_response** responses, |
| 43 void* context); | 43 void* context); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 const std::string& local_jid, | 169 const std::string& local_jid, |
| 170 const std::string& remote_jid, | 170 const std::string& remote_jid, |
| 171 const buzz::XmlElement* first_message) { | 171 const buzz::XmlElement* first_message) { |
| 172 scoped_ptr<protocol::Authenticator> authenticator( | 172 scoped_ptr<protocol::Authenticator> authenticator( |
| 173 underlying_->CreateAuthenticator(local_jid, remote_jid, first_message)); | 173 underlying_->CreateAuthenticator(local_jid, remote_jid, first_message)); |
| 174 return make_scoped_ptr(new PamAuthorizer(authenticator.Pass())); | 174 return make_scoped_ptr(new PamAuthorizer(authenticator.Pass())); |
| 175 } | 175 } |
| 176 | 176 |
| 177 | 177 |
| 178 } // namespace remoting | 178 } // namespace remoting |
| OLD | NEW |