From acbd2dc2ccd436f1505c99566f8362a789121da0 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Mon, 6 Jul 2020 22:28:15 -0400 Subject: [PATCH] Include purchased features in export file. --- platform-darwin/Source/MPAppDelegate_Store.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platform-darwin/Source/MPAppDelegate_Store.m b/platform-darwin/Source/MPAppDelegate_Store.m index eadc2661..7dae61f7 100644 --- a/platform-darwin/Source/MPAppDelegate_Store.m +++ b/platform-darwin/Source/MPAppDelegate_Store.m @@ -19,6 +19,8 @@ #import "MPAppDelegate_Store.h" #import "mpw-marshal.h" #import "mpw-util.h" +#import "MPAppDelegate_InApp.h" +#import "MPSecrets.h" #if TARGET_OS_IPHONE #define STORE_OPTIONS NSPersistentStoreFileProtectionKey : NSFileProtectionComplete, @@ -721,7 +723,7 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted ); error:(__autoreleasing NSError **)error { MPMarshalledUser *exportUser = NULL; - MPMarshalledFile *exportFile = NULL; + MPMarshalledFile *exportFile = mpw_marshal_file( NULL, NULL, mpw_marshal_data_new() ); @try { inf( @"Exporting sites, %@, for user: %@", revealPasswords? @"revealing passwords": @"omitting passwords", user.userID ); NSString *masterPassword = askExportPassword( user.name ); @@ -730,6 +732,11 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted ); return nil; } + for (NSString *feature in @[MPProductGenerateLogins, MPProductGenerateAnswers, MPProductOSIntegration, MPProductTouchID]) + if ([[MPAppDelegate_Shared get] isFeatureUnlocked:feature]) + mpw_marshal_data_set_str( digest( strf( @"%@/%@", user.name, feature )).UTF8String, exportFile->data, + "user", "_ext_mpw", feature.UTF8String, nil ); + MPKey *key = [[MPKey alloc] initForFullName:user.name withMasterPassword:masterPassword]; exportUser = mpw_marshal_user( user.name.UTF8String, mpw_masterKeyProvider_str( masterPassword.UTF8String ), user.algorithm.version );