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

Side by Side Diff: remoting/host/pam_authorization_factory_posix.cc

Issue 86523005: Replace all usage of LOG(INFO) in Chromoting host with HOST_LOG to bypass the presubmit check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/linux/x_server_clipboard.cc ('k') | remoting/host/plugin/host_log_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/logging.h" 12 #include "remoting/base/logging.h"
13 #include "remoting/base/util.h" 13 #include "remoting/base/util.h"
14 #include "remoting/protocol/channel_authenticator.h" 14 #include "remoting/protocol/channel_authenticator.h"
15 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" 15 #include "third_party/libjingle/source/talk/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);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 struct pam_conv conv = { PamConversation, NULL }; 109 struct pam_conv conv = { PamConversation, NULL };
110 pam_handle_t* handle = NULL; 110 pam_handle_t* handle = NULL;
111 int result = pam_start("chrome-remote-desktop", username.c_str(), 111 int result = pam_start("chrome-remote-desktop", username.c_str(),
112 &conv, &handle); 112 &conv, &handle);
113 if (result == PAM_SUCCESS) { 113 if (result == PAM_SUCCESS) {
114 result = pam_acct_mgmt(handle, 0); 114 result = pam_acct_mgmt(handle, 0);
115 } 115 }
116 pam_end(handle, result); 116 pam_end(handle, result);
117 117
118 LOG(INFO) << "Local login check for " << username 118 HOST_LOG << "Local login check for " << username
119 << (result == PAM_SUCCESS ? " succeeded." : " failed."); 119 << (result == PAM_SUCCESS ? " succeeded." : " failed.");
120 120
121 return result == PAM_SUCCESS; 121 return result == PAM_SUCCESS;
122 } 122 }
123 123
124 int PamAuthorizer::PamConversation(int num_messages, 124 int PamAuthorizer::PamConversation(int num_messages,
125 const struct pam_message** messages, 125 const struct pam_message** messages,
126 struct pam_response** responses, 126 struct pam_response** responses,
127 void* context) { 127 void* context) {
128 // Assume we're only being asked to log messages, in which case our response 128 // Assume we're only being asked to log messages, in which case our response
129 // need to be free()-able zero-initialized memory. 129 // need to be free()-able zero-initialized memory.
130 *responses = static_cast<struct pam_response*>( 130 *responses = static_cast<struct pam_response*>(
131 calloc(num_messages, sizeof(struct pam_response))); 131 calloc(num_messages, sizeof(struct pam_response)));
132 132
133 // We don't expect this function to be called. Since we have no easy way 133 // We don't expect this function to be called. Since we have no easy way
134 // of returning a response, we consider it to be an error if we're asked 134 // of returning a response, we consider it to be an error if we're asked
135 // for one and abort. Informational and error messages are logged. 135 // for one and abort. Informational and error messages are logged.
136 for (int i = 0; i < num_messages; ++i) { 136 for (int i = 0; i < num_messages; ++i) {
137 const struct pam_message* message = messages[i]; 137 const struct pam_message* message = messages[i];
138 switch (message->msg_style) { 138 switch (message->msg_style) {
139 case PAM_ERROR_MSG: 139 case PAM_ERROR_MSG:
140 LOG(ERROR) << "PAM conversation error message: " << message->msg; 140 LOG(ERROR) << "PAM conversation error message: " << message->msg;
141 break; 141 break;
142 case PAM_TEXT_INFO: 142 case PAM_TEXT_INFO:
143 LOG(INFO) << "PAM conversation message: " << message->msg; 143 HOST_LOG << "PAM conversation message: " << message->msg;
144 break; 144 break;
145 default: 145 default:
146 LOG(FATAL) << "Unexpected PAM conversation response required: " 146 LOG(FATAL) << "Unexpected PAM conversation response required: "
147 << message->msg << "; msg_style = " << message->msg_style; 147 << message->msg << "; msg_style = " << message->msg_style;
148 } 148 }
149 } 149 }
150 return PAM_SUCCESS; 150 return PAM_SUCCESS;
151 } 151 }
152 152
153 153
(...skipping 11 matching lines...) Expand all
165 const std::string& remote_jid, 165 const std::string& remote_jid,
166 const buzz::XmlElement* first_message) { 166 const buzz::XmlElement* first_message) {
167 scoped_ptr<protocol::Authenticator> authenticator( 167 scoped_ptr<protocol::Authenticator> authenticator(
168 underlying_->CreateAuthenticator(local_jid, remote_jid, first_message)); 168 underlying_->CreateAuthenticator(local_jid, remote_jid, first_message));
169 return scoped_ptr<protocol::Authenticator>( 169 return scoped_ptr<protocol::Authenticator>(
170 new PamAuthorizer(authenticator.Pass())); 170 new PamAuthorizer(authenticator.Pass()));
171 } 171 }
172 172
173 173
174 } // namespace remoting 174 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/linux/x_server_clipboard.cc ('k') | remoting/host/plugin/host_log_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698