OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef REMOTING_HOST_USER_AUTHENTICATOR_PAM_H_ | |
6 #define REMOTING_HOST_USER_AUTHENTICATOR_PAM_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "remoting/host/user_authenticator.h" | |
12 | |
13 struct pam_message; | |
14 struct pam_response; | |
15 | |
16 namespace remoting { | |
17 | |
18 // Class to perform a single PAM user authentication. | |
19 // | |
20 // TODO(lambroslambrou): As pam_authenticate() can be blocking, this needs to | |
21 // expose an asynchronous API, with pam_authenticate() called in a background | |
22 // thread. | |
23 class UserAuthenticatorPam : public UserAuthenticator { | |
24 public: | |
25 UserAuthenticatorPam(); | |
26 virtual ~UserAuthenticatorPam(); | |
27 virtual bool Authenticate(const std::string& username, | |
28 const std::string& password); | |
29 | |
30 private: | |
31 // Conversation function passed to PAM as a callback. | |
32 static int ConvFunction(int num_msg, | |
33 const pam_message** msg, | |
34 pam_response** resp, | |
35 void* appdata_ptr); | |
36 | |
37 // Store these for the PAM conversation function. | |
38 std::string username_; | |
39 std::string password_; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(UserAuthenticatorPam); | |
42 }; | |
43 | |
44 } // namespace remoting | |
45 | |
46 #endif // REMOTING_HOST_USER_AUTHENTICATOR_PAM_H_ | |
OLD | NEW |