Chromium Code Reviews| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 | 115 |
| 116 bool PamAuthorizer::IsLocalLoginAllowed() { | 116 bool PamAuthorizer::IsLocalLoginAllowed() { |
| 117 std::string username = GetUsername(); | 117 std::string username = GetUsername(); |
| 118 if (username.empty()) { | 118 if (username.empty()) { |
| 119 return false; | 119 return false; |
| 120 } | 120 } |
| 121 struct pam_conv conv = { PamConversation, nullptr }; | 121 struct pam_conv conv = { PamConversation, nullptr }; |
| 122 pam_handle_t* handle = nullptr; | 122 pam_handle_t* handle = nullptr; |
| 123 int result = pam_start("chrome-remote-desktop", username.c_str(), | 123 int result = pam_start("chrome-remote-desktop", username.c_str(), |
| 124 &conv, &handle); | 124 &conv, &handle); |
| 125 HOST_LOG << "pam_start: " << pam_strerror(handle, result); | |
|
rkjnsn
2016/11/15 22:56:48
Oops. These were for debugging. They'll be removed
| |
| 125 if (result == PAM_SUCCESS) { | 126 if (result == PAM_SUCCESS) { |
| 126 result = pam_acct_mgmt(handle, 0); | 127 result = pam_acct_mgmt(handle, 0); |
| 128 HOST_LOG << "pam_acct_mgmt: " << pam_strerror(handle, result); | |
| 127 } | 129 } |
| 128 pam_end(handle, result); | 130 pam_end(handle, result); |
| 129 | 131 |
| 130 HOST_LOG << "Local login check for " << username | 132 HOST_LOG << "Local login check for " << username |
| 131 << (result == PAM_SUCCESS ? " succeeded." : " failed."); | 133 << (result == PAM_SUCCESS ? " succeeded." : " failed."); |
| 132 | 134 |
| 133 return result == PAM_SUCCESS; | 135 return result == PAM_SUCCESS; |
| 134 } | 136 } |
| 135 | 137 |
| 136 int PamAuthorizer::PamConversation(int num_messages, | 138 int PamAuthorizer::PamConversation(int num_messages, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 | 172 |
| 171 std::unique_ptr<protocol::Authenticator> | 173 std::unique_ptr<protocol::Authenticator> |
| 172 PamAuthorizationFactory::CreateAuthenticator(const std::string& local_jid, | 174 PamAuthorizationFactory::CreateAuthenticator(const std::string& local_jid, |
| 173 const std::string& remote_jid) { | 175 const std::string& remote_jid) { |
| 174 std::unique_ptr<protocol::Authenticator> authenticator( | 176 std::unique_ptr<protocol::Authenticator> authenticator( |
| 175 underlying_->CreateAuthenticator(local_jid, remote_jid)); | 177 underlying_->CreateAuthenticator(local_jid, remote_jid)); |
| 176 return base::MakeUnique<PamAuthorizer>(std::move(authenticator)); | 178 return base::MakeUnique<PamAuthorizer>(std::move(authenticator)); |
| 177 } | 179 } |
| 178 | 180 |
| 179 } // namespace remoting | 181 } // namespace remoting |
| OLD | NEW |