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

Side by Side Diff: chromeos/login/auth/cryptohome_authenticator.cc

Issue 2797163002: cryptohome: Make CryptohomeClient::Unmount non-blocking (Closed)
Patch Set: Created 3 years, 8 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 | « chromeos/login/auth/cryptohome_authenticator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromeos/login/auth/cryptohome_authenticator.h" 5 #include "chromeos/login/auth/cryptohome_authenticator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 return false; 722 return false;
723 } 723 }
724 724
725 void CryptohomeAuthenticator::OnOwnershipChecked(bool is_owner) { 725 void CryptohomeAuthenticator::OnOwnershipChecked(bool is_owner) {
726 // Now we can check if this user is the owner. 726 // Now we can check if this user is the owner.
727 user_can_login_ = is_owner; 727 user_can_login_ = is_owner;
728 owner_is_verified_ = true; 728 owner_is_verified_ = true;
729 Resolve(); 729 Resolve();
730 } 730 }
731 731
732 void CryptohomeAuthenticator::OnUnmount(DBusMethodCallStatus call_status,
733 bool success) {
734 if (call_status != DBUS_METHOD_CALL_SUCCESS || !success) {
735 // Maybe we should reboot immediately here?
736 LOGIN_LOG(ERROR) << "Couldn't unmount users home!";
737 }
738 OnAuthFailure(AuthFailure(AuthFailure::OWNER_REQUIRED));
739 }
740
732 void CryptohomeAuthenticator::Resolve() { 741 void CryptohomeAuthenticator::Resolve() {
733 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 742 DCHECK(task_runner_->RunsTasksOnCurrentThread());
734 bool create_if_nonexistent = false; 743 bool create_if_nonexistent = false;
735 CryptohomeAuthenticator::AuthState state = ResolveState(); 744 CryptohomeAuthenticator::AuthState state = ResolveState();
736 VLOG(1) << "Resolved state to: " << state; 745 VLOG(1) << "Resolved state to: " << state;
737 switch (state) { 746 switch (state) {
738 case CONTINUE: 747 case CONTINUE:
739 case POSSIBLE_PW_CHANGE: 748 case POSSIBLE_PW_CHANGE:
740 case NO_MOUNT: 749 case NO_MOUNT:
741 // These are intermediate states; we need more info from a request that 750 // These are intermediate states; we need more info from a request that
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 break; 851 break;
843 case LOGIN_FAILED: 852 case LOGIN_FAILED:
844 current_state_->ResetCryptohomeStatus(); 853 current_state_->ResetCryptohomeStatus();
845 task_runner_->PostTask(FROM_HERE, 854 task_runner_->PostTask(FROM_HERE,
846 base::Bind(&CryptohomeAuthenticator::OnAuthFailure, 855 base::Bind(&CryptohomeAuthenticator::OnAuthFailure,
847 this, 856 this,
848 current_state_->online_outcome())); 857 current_state_->online_outcome()));
849 break; 858 break;
850 case OWNER_REQUIRED: { 859 case OWNER_REQUIRED: {
851 current_state_->ResetCryptohomeStatus(); 860 current_state_->ResetCryptohomeStatus();
852 bool success = false; 861 DBusThreadManager::Get()->GetCryptohomeClient()->Unmount(
853 DBusThreadManager::Get()->GetCryptohomeClient()->Unmount(&success); 862 base::Bind(&CryptohomeAuthenticator::OnUnmount, this));
854 if (!success) {
855 // Maybe we should reboot immediately here?
856 LOGIN_LOG(ERROR) << "Couldn't unmount users home!";
857 }
858 task_runner_->PostTask(
859 FROM_HERE,
860 base::Bind(&CryptohomeAuthenticator::OnAuthFailure,
861 this,
862 AuthFailure(AuthFailure::OWNER_REQUIRED)));
863 break; 863 break;
864 } 864 }
865 case FAILED_OLD_ENCRYPTION: 865 case FAILED_OLD_ENCRYPTION:
866 // In this case, we tried to create/mount cryptohome and failed 866 // In this case, we tried to create/mount cryptohome and failed
867 // because the file system is encrypted in old format. 867 // because the file system is encrypted in old format.
868 // Chrome will show a screen which asks user to migrate the encryption. 868 // Chrome will show a screen which asks user to migrate the encryption.
869 task_runner_->PostTask( 869 task_runner_->PostTask(
870 FROM_HERE, 870 FROM_HERE,
871 base::Bind(&CryptohomeAuthenticator::OnOldEncryptionDetected, this)); 871 base::Bind(&CryptohomeAuthenticator::OnOldEncryptionDetected, this));
872 break; 872 break;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 Resolve(); 1023 Resolve();
1024 } 1024 }
1025 1025
1026 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, 1026 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished,
1027 bool check_result) { 1027 bool check_result) {
1028 owner_is_verified_ = owner_check_finished; 1028 owner_is_verified_ = owner_check_finished;
1029 user_can_login_ = check_result; 1029 user_can_login_ = check_result;
1030 } 1030 }
1031 1031
1032 } // namespace chromeos 1032 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/login/auth/cryptohome_authenticator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698