Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c032475 authored by Christopher Tate's avatar Christopher Tate
Browse files

If we can't get the restore set's metadata, don't continue

Without the metadata we can't verify the version number or the signatures of the
apps whose data we'd be trying to restore against the apps present on device.
This is not acceptable; we need to refuse to give data to an unauthenticated
app.
parent 9701b3d5
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -943,6 +943,15 @@ class BackupManagerService extends IBackupManager.Stub {
                        mPackageManager, agentPackages);
                        mPackageManager, agentPackages);
                processOneRestore(omPackage, 0, IBackupAgent.Stub.asInterface(pmAgent.onBind()));
                processOneRestore(omPackage, 0, IBackupAgent.Stub.asInterface(pmAgent.onBind()));


                // Verify that the backup set includes metadata.  If not, we can't do
                // signature/version verification etc, so we simply do not proceed with
                // the restore operation.
                Metadata pmMeta = pmAgent.getRestoredMetadata(packageName);
                if (pmMeta == null) {
                    Log.i(TAG, "No restore metadata available, so not restoring settings");
                    return;
                }

                int count = 0;
                int count = 0;
                for (;;) {
                for (;;) {
                    packageName = mTransport.nextRestorePackage();
                    packageName = mTransport.nextRestorePackage();