Index: remoting/host/host_stub_fake.cc |
diff --git a/remoting/host/host_stub_fake.cc b/remoting/host/host_stub_fake.cc |
index 895b21a3ce3d069e547ab336eb27dd11a20a9214..b133bc2e290023307b4e1307866b2e4d138830b5 100644 |
--- a/remoting/host/host_stub_fake.cc |
+++ b/remoting/host/host_stub_fake.cc |
@@ -9,6 +9,10 @@ |
#include "remoting/protocol/client_stub.h" |
#include "remoting/protocol/connection_to_client.h" |
+#if defined(OS_LINUX) |
+#include "remoting/host/user_auth_pam.h" |
+#endif |
+ |
namespace remoting { |
HostStubFake::HostStubFake(ChromotingHost* host) |
@@ -23,14 +27,31 @@ void HostStubFake::SuggestResolution( |
void HostStubFake::BeginSessionRequest( |
const protocol::LocalLoginCredentials* credentials, Task* done) { |
- done->Run(); |
- delete done; |
- |
protocol::LocalLoginStatus* status = new protocol::LocalLoginStatus(); |
- status->set_success(true); |
+ bool success = false; |
+ switch (credentials->type()) { |
+ case protocol::PASSWORD: |
+#if defined(OS_LINUX) |
+ success = UserAuthPam().Authenticate(credentials->username(), |
+ credentials->credential()); |
+#else |
+ // TODO(lambroslambrou): Implement on other platforms. |
+ success = true; |
+#endif // defined(OS_LINUX) |
+ break; |
+ default: |
+ break; |
+ } |
+ status->set_success(success); |
host_->connection_to_client()->client_stub()->BeginSessionResponse( |
status, new DeleteTask<protocol::LocalLoginStatus>(status)); |
- host_->LocalLoginSucceeded(); |
+ if (success) { |
+ host_->LocalLoginSucceeded(); |
+ } else { |
+ LOG(ERROR) << "Login failed for user " << credentials->username(); |
+ } |
+ done->Run(); |
+ delete done; |
} |
} // namespace remoting |