diff options
author | Damiano Galassi <[email protected]> | 2019-08-19 14:47:48 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2019-08-19 14:47:48 +0200 |
commit | be1cfefe157afda68f109386d416baf8003c0c91 (patch) | |
tree | dadafbcc0bda3581debbb4b08b6b2870f25c3124 | |
parent | 9f05d779eb83181c74fc676553072abb7bbfaedd (diff) |
MacGui: disable security-scoped bookmarks resolution in the XPC service.
-rw-r--r-- | macosx/HBUtilities.h | 8 | ||||
-rw-r--r-- | macosx/HBUtilities.m | 17 | ||||
-rw-r--r-- | macosx/HandBrakeXPCService/main.m | 4 | ||||
-rw-r--r-- | macosx/module.defs | 6 |
4 files changed, 34 insertions, 1 deletions
diff --git a/macosx/HBUtilities.h b/macosx/HBUtilities.h index 892b4f182..4e1851c10 100644 --- a/macosx/HBUtilities.h +++ b/macosx/HBUtilities.h @@ -35,6 +35,14 @@ NS_ASSUME_NONNULL_BEGIN + (void)writeErrorToActivityLog:(NSError *)error; + (void)writeToActivityLogWithNoHeader:(NSString *)text; +/** + Whether to resolve the security-scoped bookmarks or not. + + Security-scoped bookmarks can't be resolved in a XPC service. + Use this options to avoid not useful errors + */ +@property (nonatomic, class, readwrite) BOOL resolveBookmarks; + + (nullable NSURL *)URLFromBookmark:(NSData *)bookmark; + (nullable NSData *)bookmarkFromURL:(NSURL *)url; + (nullable NSData *)bookmarkFromURL:(NSURL *)url options:(NSURLBookmarkCreationOptions)options; diff --git a/macosx/HBUtilities.m b/macosx/HBUtilities.m index 000f0cbcc..1f2810a52 100644 --- a/macosx/HBUtilities.m +++ b/macosx/HBUtilities.m @@ -9,6 +9,8 @@ #include "lang.h" +static BOOL hb_resolveBookmarks = YES; + @implementation HBUtilities + (NSString *)handBrakeVersion @@ -73,8 +75,23 @@ fprintf(stderr, "%s", text.UTF8String); } ++ (void)setResolveBookmarks:(BOOL)resolveBookmarks +{ + hb_resolveBookmarks = resolveBookmarks; +} + ++ (BOOL)resolveBookmarks +{ + return hb_resolveBookmarks; +} + + (nullable NSURL *)URLFromBookmark:(NSData *)bookmark { + if (hb_resolveBookmarks == NO) + { + return nil; + } + NSParameterAssert(bookmark); NSError *error; diff --git a/macosx/HandBrakeXPCService/main.m b/macosx/HandBrakeXPCService/main.m index e127c9a5b..d4321d44f 100644 --- a/macosx/HandBrakeXPCService/main.m +++ b/macosx/HandBrakeXPCService/main.m @@ -5,6 +5,8 @@ #import <Foundation/Foundation.h> #import "HandBrakeXPCService.h" +@import HandBrakeKit; + @interface HBXPCServiceDelegate : NSObject <NSXPCListenerDelegate> @end @@ -27,6 +29,8 @@ int main(int argc, const char *argv[]) { + HBUtilities.resolveBookmarks = NO; + HBXPCServiceDelegate *delegate = [HBXPCServiceDelegate new]; NSXPCListener *listener = [NSXPCListener serviceListener]; diff --git a/macosx/module.defs b/macosx/module.defs index fc6ad9e02..591913a3f 100644 --- a/macosx/module.defs +++ b/macosx/module.defs @@ -21,7 +21,11 @@ BUILD.out += $(MACOSX.osl.filelist) MACOSX.project = -project $(MACOSX.src/)HandBrake.xcodeproj ## configuration: must be one of { release, debug } -MACOSX.configuration = -configuration $(MACOSX.map.g.$(MACOSX.GCC.g)) +ifeq (1,$(FEATURE.macos.sandbox)) + MACOSX.configuration = -configuration $(MACOSX.map.g.$(MACOSX.GCC.g))-sandbox +else + MACOSX.configuration = -configuration $(MACOSX.map.g.$(MACOSX.GCC.g)) +endif ## mapping from symbolic debug value to xcode configuration MACOSX.map.g.none = release |