5202674: Reland "Automated T* -> raw_ptr<T> rewrite 'refresh'"

https://chromium-review.googlesource.com/c/chromium/src/+/5202674
This commit is contained in:
John Kleinschmidt
2024-01-22 09:13:51 -05:00
parent 9a788c0c60
commit 55daca952d

View File

@@ -12,7 +12,7 @@ We attempt to migrate the safe storage key from the old account, if that migrati
Existing apps that aren't built for the app store should be unimpacted, there is one edge case where a user uses BOTH an AppStore and a darwin build of the same app only one will keep it's access to the safestorage key as during the migration we delete the old account. This is an acceptable edge case as no one should be actively using two versions of the same app.
diff --git a/components/os_crypt/sync/keychain_password_mac.mm b/components/os_crypt/sync/keychain_password_mac.mm
index e7a65e97b51d93bff864889813317fb7c6ffc846..8fa99cf8957f37bb4154db8a48f752f44f22dfcb 100644
index e7a65e97b51d93bff864889813317fb7c6ffc846..2b93da301b664f90720d2d2b5407be0985d7f334 100644
--- a/components/os_crypt/sync/keychain_password_mac.mm
+++ b/components/os_crypt/sync/keychain_password_mac.mm
@@ -22,6 +22,12 @@
@@ -63,7 +63,7 @@ index e7a65e97b51d93bff864889813317fb7c6ffc846..8fa99cf8957f37bb4154db8a48f752f4
+ // If the suffixed account didn't exist, we should check if the legacy non-suffixed account
+ // exists. If it does we can use that key and migrate it to the new account
+ base::apple::ScopedCFTypeRef<SecKeychainItemRef> item_ref;
+ error = keychain_.FindGenericPassword(
+ error = keychain_->FindGenericPassword(
+ service_name.size(), service_name.c_str(),
+ account_name.size(), account_name.c_str(), &password_length,
+ &password_data, item_ref.InitializeInto());
@@ -74,7 +74,7 @@ index e7a65e97b51d93bff864889813317fb7c6ffc846..8fa99cf8957f37bb4154db8a48f752f4
+
+ // If we found the legacy account name we should copy it over to
+ // the new suffixed account
+ error = keychain_.AddGenericPassword(
+ error = keychain_->AddGenericPassword(
+ service_name.size(), service_name.data(), suffixed_account_name.size(),
+ suffixed_account_name.data(), password.size(), password_data, NULL);
+
@@ -82,7 +82,7 @@ index e7a65e97b51d93bff864889813317fb7c6ffc846..8fa99cf8957f37bb4154db8a48f752f4
+ // If we successfully made the suffixed account we can delete the old
+ // account to ensure new apps don't try to use it and run into IAM
+ // issues
+ error = keychain_.ItemDelete(item_ref.get());
+ error = keychain_->ItemDelete(item_ref.get());
+ if (error != noErr) {
+ OSSTATUS_DLOG(ERROR, error) << "Keychain delete for legacy key failed";
+ }
@@ -90,7 +90,7 @@ index e7a65e97b51d93bff864889813317fb7c6ffc846..8fa99cf8957f37bb4154db8a48f752f4
+ OSSTATUS_DLOG(ERROR, error) << "Keychain add for suffixed key failed";
+ }
+
+ keychain_.ItemFreeContent(password_data);
+ keychain_->ItemFreeContent(password_data);
+ return password;
+ }
+