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" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 if (local_login_status_ == NOT_CHECKED && state() == ACCEPTED) { | 104 if (local_login_status_ == NOT_CHECKED && state() == ACCEPTED) { |
105 local_login_status_ = IsLocalLoginAllowed() ? ALLOWED : DISALLOWED; | 105 local_login_status_ = IsLocalLoginAllowed() ? ALLOWED : DISALLOWED; |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 bool PamAuthorizer::IsLocalLoginAllowed() { | 109 bool PamAuthorizer::IsLocalLoginAllowed() { |
110 std::string username = GetUsername(); | 110 std::string username = GetUsername(); |
111 if (username.empty()) { | 111 if (username.empty()) { |
112 return false; | 112 return false; |
113 } | 113 } |
114 struct pam_conv conv = { PamConversation, NULL }; | 114 struct pam_conv conv = { PamConversation, nullptr }; |
115 pam_handle_t* handle = NULL; | 115 pam_handle_t* handle = nullptr; |
116 int result = pam_start("chrome-remote-desktop", username.c_str(), | 116 int result = pam_start("chrome-remote-desktop", username.c_str(), |
117 &conv, &handle); | 117 &conv, &handle); |
118 if (result == PAM_SUCCESS) { | 118 if (result == PAM_SUCCESS) { |
119 result = pam_acct_mgmt(handle, 0); | 119 result = pam_acct_mgmt(handle, 0); |
120 } | 120 } |
121 pam_end(handle, result); | 121 pam_end(handle, result); |
122 | 122 |
123 HOST_LOG << "Local login check for " << username | 123 HOST_LOG << "Local login check for " << username |
124 << (result == PAM_SUCCESS ? " succeeded." : " failed."); | 124 << (result == PAM_SUCCESS ? " succeeded." : " failed."); |
125 | 125 |
(...skipping 43 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 |