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

Unified Diff: remoting/host/host_stub_fake.cc

Issue 6484002: Authenticate user/password with PAM in BeginSessionRequest() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 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/host_stub_fake.cc
diff --git a/remoting/host/host_stub_fake.cc b/remoting/host/host_stub_fake.cc
index 895b21a3ce3d069e547ab336eb27dd11a20a9214..b11e277778a5d34e8d0350471d561ce95a735601 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();
Sergey Ulanov 2011/02/10 20:14:28 We shouldn't add pam auth in HostStubFake. It is f
- 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 {
+ // ???
Sergey Ulanov 2011/02/10 20:14:28 I think it should be enough to log the failure her
+ }
+ done->Run();
+ delete done;
}
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698