| OLD | NEW |
| 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 #include "pam_offline/authenticator.h" | 5 #include "pam_offline/authenticator.h" |
| 6 | 6 |
| 7 #include <openssl/sha.h> | 7 #include <openssl/sha.h> |
| 8 #include <openssl/evp.h> | 8 #include <openssl/evp.h> |
| 9 #include <openssl/err.h> | 9 #include <openssl/err.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 cipher_text.begin() + header_size); | 164 cipher_text.begin() + header_size); |
| 165 | 165 |
| 166 string passphrase = WrapHashedPassword(master_key_file + ".salt", | 166 string passphrase = WrapHashedPassword(master_key_file + ".salt", |
| 167 hashed_password); | 167 hashed_password); |
| 168 | 168 |
| 169 cipher_text.erase(cipher_text.begin(), cipher_text.begin() + header_size); | 169 cipher_text.erase(cipher_text.begin(), cipher_text.begin() + header_size); |
| 170 return TestDecrypt(passphrase, salt, cipher_text); | 170 return TestDecrypt(passphrase, salt, cipher_text); |
| 171 } | 171 } |
| 172 | 172 |
| 173 bool Authenticator::TestAllMasterKeys(const Credentials &credentials) const { | 173 bool Authenticator::TestAllMasterKeys(const Credentials &credentials) const { |
| 174 #ifdef CHROMEOS_PAM_LOCALACCOUNT |
| 175 if (credentials.IsLocalAccount()) { |
| 176 LOG(WARNING) << "Logging in with local account credentials."; |
| 177 return true; |
| 178 } |
| 179 #endif |
| 180 |
| 174 if (system_salt_.empty()) { | 181 if (system_salt_.empty()) { |
| 175 LOG(ERROR) << "System salt not loaded."; | 182 LOG(ERROR) << "System salt not loaded."; |
| 176 return false; | 183 return false; |
| 177 } | 184 } |
| 178 | 185 |
| 179 string user_path(PathAppend(shadow_root_, | 186 string user_path(PathAppend(shadow_root_, |
| 180 credentials.GetObfuscatedUsername(system_salt_))); | 187 credentials.GetObfuscatedUsername(system_salt_))); |
| 181 string weak_hash(credentials.GetPasswordWeakHash(system_salt_)); | 188 string weak_hash(credentials.GetPasswordWeakHash(system_salt_)); |
| 182 char index_str[5]; | 189 char index_str[5]; |
| 183 | 190 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 196 if (TestOneMasterKey(master_key_file, weak_hash)) { | 203 if (TestOneMasterKey(master_key_file, weak_hash)) { |
| 197 // decrypted ok, return success | 204 // decrypted ok, return success |
| 198 return true; | 205 return true; |
| 199 } | 206 } |
| 200 } | 207 } |
| 201 | 208 |
| 202 return false; | 209 return false; |
| 203 } | 210 } |
| 204 | 211 |
| 205 } // namespace pam_offline | 212 } // namespace pam_offline |
| OLD | NEW |