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

Side by Side Diff: src/platform/pam_offline/username_password.h

Issue 591001: move enable_localaccount.sh, make pam_offline use it (Closed)
Patch Set: fix comment Created 10 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 unified diff | Download patch
« no previous file with comments | « src/platform/pam_offline/credentials.h ('k') | src/platform/pam_offline/username_password.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) 2009-2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009-2010 The Chromium OS 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 // UsernamePassword wraps a username/password pair that can be used to 5 // UsernamePassword wraps a username/password pair that can be used to
6 // authenticate a user. 6 // authenticate a user.
7 7
8 #ifndef PAM_OFFLINE_USERNAME_PASSWORD_H_ 8 #ifndef PAM_OFFLINE_USERNAME_PASSWORD_H_
9 #define PAM_OFFLINE_USERNAME_PASSWORD_H_ 9 #define PAM_OFFLINE_USERNAME_PASSWORD_H_
10 10
11 #include "pam_offline/credentials.h" 11 #include "pam_offline/credentials.h"
12 12
13 #include <string.h> 13 #include <string.h>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "gtest/gtest.h" 16 #include "gtest/gtest.h"
17 17
18 // Enable local account only if user has specifically requested it
19 #ifdef CHROMEOS_PAM_LOCALACCOUNT
20 #include "pam_offline/pam_localaccount.h"
21 #endif
22
18 namespace pam_offline { 23 namespace pam_offline {
19 24
20 class UsernamePassword : public Credentials { 25 class UsernamePassword : public Credentials {
21 public: 26 public:
22 UsernamePassword(const char *username, const int username_length, 27 UsernamePassword(const char *username, const int username_length,
23 const char *password, const int password_length); 28 const char *password, const int password_length);
24 ~UsernamePassword(); 29 ~UsernamePassword();
25 30
26 // From credentials.h... 31 // From credentials.h...
27 void GetFullUsername(char *name_buffer, int length) const; 32 void GetFullUsername(char *name_buffer, int length) const;
28 void GetPartialUsername(char *name_buffer, int length) const; 33 void GetPartialUsername(char *name_buffer, int length) const;
29 std::string GetObfuscatedUsername(const Blob &system_salt) const; 34 std::string GetObfuscatedUsername(const Blob &system_salt) const;
30 std::string GetPasswordWeakHash(const Blob &system_salt) const; 35 std::string GetPasswordWeakHash(const Blob &system_salt) const;
31 36
37 #ifdef CHROMEOS_PAM_LOCALACCOUNT
38 // returns true if username_ is the local account (if set up)
39 bool IsLocalAccount() const;
40 #endif
41
32 private: 42 private:
33 // ONLY FOR TESTING. Allows the caller to tell us not to free the 43 // ONLY FOR TESTING. Allows the caller to tell us not to free the
34 // memory we allocate for username_ and password_. 44 // memory we allocate for username_ and password_.
35 UsernamePassword(const char *username, const int username_length, 45 UsernamePassword(const char *username, const int username_length,
36 const char *password, const int password_length, 46 const char *password, const int password_length,
37 bool dont_free_memory); 47 bool dont_free_memory);
38 48
39 void Init(const char *username, const int username_length, 49 void Init(const char *username, const int username_length,
40 const char *password, const int password_length); 50 const char *password, const int password_length);
41 51
(...skipping 17 matching lines...) Expand all
59 69
60 FRIEND_TEST(UsernamePasswordTest, MemoryZeroTest); 70 FRIEND_TEST(UsernamePasswordTest, MemoryZeroTest);
61 FRIEND_TEST(UsernamePasswordFetcherTest, FetchTest); 71 FRIEND_TEST(UsernamePasswordFetcherTest, FetchTest);
62 72
63 DISALLOW_COPY_AND_ASSIGN(UsernamePassword); 73 DISALLOW_COPY_AND_ASSIGN(UsernamePassword);
64 }; 74 };
65 75
66 } // namespace pam_offline 76 } // namespace pam_offline
67 77
68 #endif // PAM_OFFLINE_USERNAME_PASSWORD_H_ 78 #endif // PAM_OFFLINE_USERNAME_PASSWORD_H_
OLDNEW
« no previous file with comments | « src/platform/pam_offline/credentials.h ('k') | src/platform/pam_offline/username_password.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698