mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 16:22:21 +00:00
Extenden Plugin system
Plugin Settings now properly display plugins Plugins are loaded/unloaded based on security settings Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
4C0B038C18E36DA400B9F9C9 /* MPFixAutotypeWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0B038A18E36DA400B9F9C9 /* MPFixAutotypeWindowController.m */; };
|
4C0B038C18E36DA400B9F9C9 /* MPFixAutotypeWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0B038A18E36DA400B9F9C9 /* MPFixAutotypeWindowController.m */; };
|
||||||
4C0B038D18E36DA400B9F9C9 /* FixAutotypeWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C0B038B18E36DA400B9F9C9 /* FixAutotypeWindow.xib */; };
|
4C0B038D18E36DA400B9F9C9 /* FixAutotypeWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C0B038B18E36DA400B9F9C9 /* FixAutotypeWindow.xib */; };
|
||||||
4C0C59F118B17F10009C7B76 /* DDHotKeyUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0C59EF18B17F10009C7B76 /* DDHotKeyUtilities.m */; };
|
4C0C59F118B17F10009C7B76 /* DDHotKeyUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0C59EF18B17F10009C7B76 /* DDHotKeyUtilities.m */; };
|
||||||
|
4C0DBEF51BF508DE00F9B287 /* PluginSettings.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C0DBEF71BF508DE00F9B287 /* PluginSettings.xib */; };
|
||||||
4C0DD6C618B2A44700FCB193 /* AutotypeCandidateSelectionWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C0DD6C518B2A44700FCB193 /* AutotypeCandidateSelectionWindow.xib */; };
|
4C0DD6C618B2A44700FCB193 /* AutotypeCandidateSelectionWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C0DD6C518B2A44700FCB193 /* AutotypeCandidateSelectionWindow.xib */; };
|
||||||
4C0F647817B6B65E00D9522A /* MPSheetWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0F647717B6B65E00D9522A /* MPSheetWindowController.m */; };
|
4C0F647817B6B65E00D9522A /* MPSheetWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0F647717B6B65E00D9522A /* MPSheetWindowController.m */; };
|
||||||
4C0F647B17B6BC9C00D9522A /* MPSavePanelAccessoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0F647A17B6BC9C00D9522A /* MPSavePanelAccessoryViewController.m */; };
|
4C0F647B17B6BC9C00D9522A /* MPSavePanelAccessoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0F647A17B6BC9C00D9522A /* MPSavePanelAccessoryViewController.m */; };
|
||||||
@@ -31,7 +32,6 @@
|
|||||||
4C1FA07B18231900003A3F8C /* MPDocument+Autotype.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1FA07A18231900003A3F8C /* MPDocument+Autotype.m */; };
|
4C1FA07B18231900003A3F8C /* MPDocument+Autotype.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1FA07A18231900003A3F8C /* MPDocument+Autotype.m */; };
|
||||||
4C224B4217DFCB2400FF6AEE /* MPNumericalInputFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C224B4117DFCB2400FF6AEE /* MPNumericalInputFormatter.m */; };
|
4C224B4217DFCB2400FF6AEE /* MPNumericalInputFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C224B4117DFCB2400FF6AEE /* MPNumericalInputFormatter.m */; };
|
||||||
4C25703F1BF11C2300D39416 /* MPPluginSettingsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C25703D1BF11C2300D39416 /* MPPluginSettingsController.m */; };
|
4C25703F1BF11C2300D39416 /* MPPluginSettingsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C25703D1BF11C2300D39416 /* MPPluginSettingsController.m */; };
|
||||||
4C2570401BF11C2300D39416 /* PluginSettings.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C25703E1BF11C2300D39416 /* PluginSettings.xib */; };
|
|
||||||
4C25D58716CF0FAA00F6806C /* EntryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C25D58616CF0FAA00F6806C /* EntryView.xib */; };
|
4C25D58716CF0FAA00F6806C /* EntryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C25D58616CF0FAA00F6806C /* EntryView.xib */; };
|
||||||
4C26C33F18D8C92100CF1A1C /* MPTemporaryFileStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C26C33E18D8C92100CF1A1C /* MPTemporaryFileStorage.m */; };
|
4C26C33F18D8C92100CF1A1C /* MPTemporaryFileStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C26C33E18D8C92100CF1A1C /* MPTemporaryFileStorage.m */; };
|
||||||
4C26C34B18D8D5A300CF1A1C /* MPPreviewViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C26C34918D8D5A300CF1A1C /* MPPreviewViewController.m */; };
|
4C26C34B18D8D5A300CF1A1C /* MPPreviewViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C26C34918D8D5A300CF1A1C /* MPPreviewViewController.m */; };
|
||||||
@@ -373,6 +373,7 @@
|
|||||||
4C0B038B18E36DA400B9F9C9 /* FixAutotypeWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FixAutotypeWindow.xib; sourceTree = "<group>"; };
|
4C0B038B18E36DA400B9F9C9 /* FixAutotypeWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FixAutotypeWindow.xib; sourceTree = "<group>"; };
|
||||||
4C0C59EF18B17F10009C7B76 /* DDHotKeyUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DDHotKeyUtilities.m; path = DDHotKey/DDHotKeyUtilities.m; sourceTree = "<group>"; };
|
4C0C59EF18B17F10009C7B76 /* DDHotKeyUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DDHotKeyUtilities.m; path = DDHotKey/DDHotKeyUtilities.m; sourceTree = "<group>"; };
|
||||||
4C0C59F018B17F10009C7B76 /* DDHotKeyUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = DDHotKeyUtilities.h; path = DDHotKey/DDHotKeyUtilities.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
4C0C59F018B17F10009C7B76 /* DDHotKeyUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = DDHotKeyUtilities.h; path = DDHotKey/DDHotKeyUtilities.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
|
4C0DBEF61BF508DE00F9B287 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PluginSettings.xib; sourceTree = "<group>"; };
|
||||||
4C0DD6C518B2A44700FCB193 /* AutotypeCandidateSelectionWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AutotypeCandidateSelectionWindow.xib; sourceTree = "<group>"; };
|
4C0DD6C518B2A44700FCB193 /* AutotypeCandidateSelectionWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AutotypeCandidateSelectionWindow.xib; sourceTree = "<group>"; };
|
||||||
4C0F647617B6B65E00D9522A /* MPSheetWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSheetWindowController.h; sourceTree = "<group>"; };
|
4C0F647617B6B65E00D9522A /* MPSheetWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSheetWindowController.h; sourceTree = "<group>"; };
|
||||||
4C0F647717B6B65E00D9522A /* MPSheetWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPSheetWindowController.m; sourceTree = "<group>"; };
|
4C0F647717B6B65E00D9522A /* MPSheetWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPSheetWindowController.m; sourceTree = "<group>"; };
|
||||||
@@ -397,7 +398,6 @@
|
|||||||
4C224B4117DFCB2400FF6AEE /* MPNumericalInputFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPNumericalInputFormatter.m; sourceTree = "<group>"; };
|
4C224B4117DFCB2400FF6AEE /* MPNumericalInputFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPNumericalInputFormatter.m; sourceTree = "<group>"; };
|
||||||
4C25703C1BF11C2300D39416 /* MPPluginSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPluginSettingsController.h; sourceTree = "<group>"; };
|
4C25703C1BF11C2300D39416 /* MPPluginSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPluginSettingsController.h; sourceTree = "<group>"; };
|
||||||
4C25703D1BF11C2300D39416 /* MPPluginSettingsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPluginSettingsController.m; sourceTree = "<group>"; };
|
4C25703D1BF11C2300D39416 /* MPPluginSettingsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPluginSettingsController.m; sourceTree = "<group>"; };
|
||||||
4C25703E1BF11C2300D39416 /* PluginSettings.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PluginSettings.xib; sourceTree = "<group>"; };
|
|
||||||
4C25D58616CF0FAA00F6806C /* EntryView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = EntryView.xib; sourceTree = "<group>"; };
|
4C25D58616CF0FAA00F6806C /* EntryView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = EntryView.xib; sourceTree = "<group>"; };
|
||||||
4C26C33D18D8C92100CF1A1C /* MPTemporaryFileStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPTemporaryFileStorage.h; sourceTree = "<group>"; };
|
4C26C33D18D8C92100CF1A1C /* MPTemporaryFileStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPTemporaryFileStorage.h; sourceTree = "<group>"; };
|
||||||
4C26C33E18D8C92100CF1A1C /* MPTemporaryFileStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPTemporaryFileStorage.m; sourceTree = "<group>"; };
|
4C26C33E18D8C92100CF1A1C /* MPTemporaryFileStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPTemporaryFileStorage.m; sourceTree = "<group>"; };
|
||||||
@@ -1466,7 +1466,7 @@
|
|||||||
6021FE5818E1429500C3BC51 /* IntegrationSettings.xib */,
|
6021FE5818E1429500C3BC51 /* IntegrationSettings.xib */,
|
||||||
6021FE6318E15D9100C3BC51 /* WorkflowSettings.xib */,
|
6021FE6318E15D9100C3BC51 /* WorkflowSettings.xib */,
|
||||||
6021FE6E18E15E6D00C3BC51 /* UpdateSettings.xib */,
|
6021FE6E18E15E6D00C3BC51 /* UpdateSettings.xib */,
|
||||||
4C25703E1BF11C2300D39416 /* PluginSettings.xib */,
|
4C0DBEF71BF508DE00F9B287 /* PluginSettings.xib */,
|
||||||
);
|
);
|
||||||
name = Settings;
|
name = Settings;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -1768,7 +1768,7 @@
|
|||||||
4C7ABA4E17BAEC7000FF5799 /* addEntryTemplate.pdf in Resources */,
|
4C7ABA4E17BAEC7000FF5799 /* addEntryTemplate.pdf in Resources */,
|
||||||
4C53A7A51864C39D000DFF0D /* KPKLocalizable.strings in Resources */,
|
4C53A7A51864C39D000DFF0D /* KPKLocalizable.strings in Resources */,
|
||||||
4C3826761AD04C24007D7D67 /* harddiskTemplate.pdf in Resources */,
|
4C3826761AD04C24007D7D67 /* harddiskTemplate.pdf in Resources */,
|
||||||
4C2570401BF11C2300D39416 /* PluginSettings.xib in Resources */,
|
4C0DBEF51BF508DE00F9B287 /* PluginSettings.xib in Resources */,
|
||||||
4C7F8B681A10B68400CCB83D /* WelcomeWindow.xib in Resources */,
|
4C7F8B681A10B68400CCB83D /* WelcomeWindow.xib in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -1942,6 +1942,14 @@
|
|||||||
/* End PBXTargetDependency section */
|
/* End PBXTargetDependency section */
|
||||||
|
|
||||||
/* Begin PBXVariantGroup section */
|
/* Begin PBXVariantGroup section */
|
||||||
|
4C0DBEF71BF508DE00F9B287 /* PluginSettings.xib */ = {
|
||||||
|
isa = PBXVariantGroup;
|
||||||
|
children = (
|
||||||
|
4C0DBEF61BF508DE00F9B287 /* Base */,
|
||||||
|
);
|
||||||
|
name = PluginSettings.xib;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
4C45FB21178E09ED0010007D /* InfoPlist.strings */ = {
|
4C45FB21178E09ED0010007D /* InfoPlist.strings */ = {
|
||||||
isa = PBXVariantGroup;
|
isa = PBXVariantGroup;
|
||||||
children = (
|
children = (
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9059"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
|
||||||
<capability name="box content view" minToolsVersion="7.0"/>
|
<capability name="box content view" minToolsVersion="7.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
@@ -218,6 +218,7 @@
|
|||||||
<constraint firstAttribute="bottom" secondItem="465" secondAttribute="bottom" constant="20" symbolic="YES" id="uwq-az-XwJ"/>
|
<constraint firstAttribute="bottom" secondItem="465" secondAttribute="bottom" constant="20" symbolic="YES" id="uwq-az-XwJ"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<animations/>
|
<animations/>
|
||||||
|
<point key="canvasLocation" x="411" y="190"/>
|
||||||
</customView>
|
</customView>
|
||||||
</objects>
|
</objects>
|
||||||
</document>
|
</document>
|
||||||
|
|||||||
@@ -3,32 +3,58 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
|
||||||
|
<capability name="box content view" minToolsVersion="7.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="MPPluginSettingsController">
|
<customObject id="-2" userLabel="File's Owner" customClass="MPPluginSettingsController">
|
||||||
<connections>
|
<connections>
|
||||||
|
<outlet property="loadInsecurePlugsinCheckButton" destination="CqP-oK-S8k" id="YET-o6-7Cc"/>
|
||||||
<outlet property="pluginTableView" destination="Jyk-V9-KXR" id="qnk-aD-CkH"/>
|
<outlet property="pluginTableView" destination="Jyk-V9-KXR" id="qnk-aD-CkH"/>
|
||||||
<outlet property="settingsView" destination="RyZ-1L-3WB" id="MZn-vo-eTf"/>
|
<outlet property="settingsView" destination="tD5-Na-7XI" id="Pa0-Tt-20U"/>
|
||||||
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
|
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Hz6-mo-xeY">
|
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Hz6-mo-xeY">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="501" height="240"/>
|
<rect key="frame" x="0.0" y="0.0" width="520" height="248"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="RyZ-1L-3WB">
|
<box misplaced="YES" title="Box" borderType="line" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="vBs-Ga-aq0">
|
||||||
<rect key="frame" x="178" y="20" width="303" height="200"/>
|
<rect key="frame" x="175" y="16" width="325" height="156"/>
|
||||||
|
<view key="contentView" id="tD5-Na-7XI">
|
||||||
|
<rect key="frame" x="1" y="1" width="323" height="154"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<animations/>
|
<animations/>
|
||||||
</customView>
|
</view>
|
||||||
|
<animations/>
|
||||||
|
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
|
||||||
|
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||||
|
</box>
|
||||||
|
<button translatesAutoresizingMaskIntoConstraints="NO" id="CqP-oK-S8k">
|
||||||
|
<rect key="frame" x="18" y="212" width="159" height="18"/>
|
||||||
|
<animations/>
|
||||||
|
<buttonCell key="cell" type="check" title="Load unsecure Plugins" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="C4B-6z-ZqX">
|
||||||
|
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||||
|
<font key="font" metaFont="system"/>
|
||||||
|
</buttonCell>
|
||||||
|
</button>
|
||||||
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="aoG-FD-ds8">
|
||||||
|
<rect key="frame" x="18" y="178" width="484" height="28"/>
|
||||||
|
<animations/>
|
||||||
|
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" title="If enabled, only properly signed Plugins will be loaded. Keep in mind, that Plugins have full access to your data!" id="2bX-8S-9XM">
|
||||||
|
<font key="font" metaFont="smallSystem"/>
|
||||||
|
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
</textFieldCell>
|
||||||
|
</textField>
|
||||||
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wl5-yF-mBn">
|
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wl5-yF-mBn">
|
||||||
<rect key="frame" x="20" y="20" width="150" height="200"/>
|
<rect key="frame" x="20" y="20" width="150" height="150"/>
|
||||||
<clipView key="contentView" id="0PQ-0m-LPv">
|
<clipView key="contentView" id="0PQ-0m-LPv">
|
||||||
<rect key="frame" x="1" y="1" width="148" height="198"/>
|
<rect key="frame" x="1" y="1" width="148" height="148"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="Jyk-V9-KXR">
|
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="Jyk-V9-KXR">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="148" height="0.0"/>
|
<rect key="frame" x="0.0" y="0.0" width="148" height="148"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<animations/>
|
<animations/>
|
||||||
<size key="intercellSpacing" width="3" height="2"/>
|
<size key="intercellSpacing" width="3" height="2"/>
|
||||||
@@ -52,8 +78,8 @@
|
|||||||
<rect key="frame" x="1" y="1" width="145" height="17"/>
|
<rect key="frame" x="1" y="1" width="145" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lcQ-hj-Tcp">
|
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="lcQ-hj-Tcp">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="100" height="17"/>
|
<rect key="frame" x="0.0" y="0.0" width="147" height="17"/>
|
||||||
<animations/>
|
<animations/>
|
||||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="uLo-aP-Zyb">
|
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="uLo-aP-Zyb">
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@@ -62,6 +88,11 @@
|
|||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
</subviews>
|
</subviews>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="trailing" secondItem="lcQ-hj-Tcp" secondAttribute="trailing" id="0Fj-Mh-WAj"/>
|
||||||
|
<constraint firstItem="lcQ-hj-Tcp" firstAttribute="leading" secondItem="ksr-nD-o30" secondAttribute="leading" constant="2" id="3Ey-Pz-9eS"/>
|
||||||
|
<constraint firstItem="lcQ-hj-Tcp" firstAttribute="centerY" secondItem="ksr-nD-o30" secondAttribute="centerY" id="nl4-Wi-CIO"/>
|
||||||
|
</constraints>
|
||||||
<animations/>
|
<animations/>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="textField" destination="lcQ-hj-Tcp" id="n9m-kx-gWy"/>
|
<outlet property="textField" destination="lcQ-hj-Tcp" id="n9m-kx-gWy"/>
|
||||||
@@ -77,7 +108,7 @@
|
|||||||
</clipView>
|
</clipView>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="150" id="7Wq-9K-BgW"/>
|
<constraint firstAttribute="width" constant="150" id="7Wq-9K-BgW"/>
|
||||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="200" id="Zhj-a1-fc5"/>
|
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="150" id="fGs-bu-lXJ"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<animations/>
|
<animations/>
|
||||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="C0h-Cx-fXX">
|
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="C0h-Cx-fXX">
|
||||||
@@ -93,16 +124,21 @@
|
|||||||
</scrollView>
|
</scrollView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="RyZ-1L-3WB" firstAttribute="leading" secondItem="Jyk-V9-KXR" secondAttribute="trailing" constant="9" id="0fX-KU-NhZ"/>
|
<constraint firstItem="CqP-oK-S8k" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="1Rj-zS-7t2"/>
|
||||||
<constraint firstAttribute="trailing" secondItem="RyZ-1L-3WB" secondAttribute="trailing" constant="20" id="3UR-Be-L2K"/>
|
<constraint firstItem="vBs-Ga-aq0" firstAttribute="height" secondItem="wl5-yF-mBn" secondAttribute="height" id="8ZG-7i-tAO"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="wl5-yF-mBn" secondAttribute="bottom" constant="20" id="7Wl-rl-S6F"/>
|
<constraint firstAttribute="trailing" secondItem="aoG-FD-ds8" secondAttribute="trailing" constant="20" symbolic="YES" id="95O-Jh-0KG"/>
|
||||||
<constraint firstItem="wl5-yF-mBn" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="HFD-Sm-3aB"/>
|
<constraint firstItem="wl5-yF-mBn" firstAttribute="top" secondItem="aoG-FD-ds8" secondAttribute="bottom" constant="8" symbolic="YES" id="BeI-8A-KLq"/>
|
||||||
<constraint firstItem="RyZ-1L-3WB" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="Y0h-Pg-tZ3"/>
|
<constraint firstAttribute="bottom" secondItem="wl5-yF-mBn" secondAttribute="bottom" constant="20" symbolic="YES" id="JEh-Vt-Nyb"/>
|
||||||
<constraint firstItem="wl5-yF-mBn" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="eqA-Pl-0j5"/>
|
<constraint firstItem="wl5-yF-mBn" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="JeU-Ru-xzh"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="RyZ-1L-3WB" secondAttribute="bottom" constant="20" id="rkB-Iz-nN5"/>
|
<constraint firstAttribute="trailing" secondItem="vBs-Ga-aq0" secondAttribute="trailing" constant="20" id="LUb-Un-azV"/>
|
||||||
|
<constraint firstItem="aoG-FD-ds8" firstAttribute="leading" secondItem="CqP-oK-S8k" secondAttribute="leading" id="NcW-ya-DPx"/>
|
||||||
|
<constraint firstItem="vBs-Ga-aq0" firstAttribute="leading" secondItem="wl5-yF-mBn" secondAttribute="trailing" constant="8" id="bf8-gO-xQc"/>
|
||||||
|
<constraint firstItem="wl5-yF-mBn" firstAttribute="top" secondItem="vBs-Ga-aq0" secondAttribute="top" id="dO2-W1-V2z"/>
|
||||||
|
<constraint firstItem="CqP-oK-S8k" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="rN1-3Z-BBi"/>
|
||||||
|
<constraint firstItem="aoG-FD-ds8" firstAttribute="top" secondItem="CqP-oK-S8k" secondAttribute="bottom" constant="8" symbolic="YES" id="zSW-h3-BrT"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<animations/>
|
<animations/>
|
||||||
<point key="canvasLocation" x="-52.5" y="175"/>
|
<point key="canvasLocation" x="-556.5" y="166.5"/>
|
||||||
</customView>
|
</customView>
|
||||||
</objects>
|
</objects>
|
||||||
</document>
|
</document>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9059"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="MPUpdateSettingsController">
|
<customObject id="-2" userLabel="File's Owner" customClass="MPUpdateSettingsController">
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9059"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
|
||||||
<capability name="box content view" minToolsVersion="7.0"/>
|
<capability name="box content view" minToolsVersion="7.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
|
|||||||
@@ -156,8 +156,8 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
|
|||||||
/* Daemon instanziieren */
|
/* Daemon instanziieren */
|
||||||
[MPLockDaemon defaultDaemon];
|
[MPLockDaemon defaultDaemon];
|
||||||
[MPAutotypeDaemon defaultDaemon];
|
[MPAutotypeDaemon defaultDaemon];
|
||||||
/* Load plugins */
|
/* Create Plugin Manager */
|
||||||
[[MPPluginManager sharedManager] loadPlugins];
|
[MPPluginManager sharedManager];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ FOUNDATION_EXPORT NSString *const kMPPluginFileExtension;
|
|||||||
@property (copy, readonly) NSString *name;
|
@property (copy, readonly) NSString *name;
|
||||||
@property (copy, readonly) NSString *version;
|
@property (copy, readonly) NSString *version;
|
||||||
|
|
||||||
|
|
||||||
+ (instancetype)pluginWithBundleURL:(NSURL *)url pluginManager:(MPPluginManager *)manager;
|
|
||||||
- (instancetype)initWithPluginManager:(MPPluginManager *)manager NS_DESIGNATED_INITIALIZER;
|
- (instancetype)initWithPluginManager:(MPPluginManager *)manager NS_DESIGNATED_INITIALIZER;
|
||||||
- (instancetype)init NS_UNAVAILABLE;
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
|
|
||||||
|
|||||||
@@ -8,25 +8,12 @@
|
|||||||
|
|
||||||
#import "MPPlugin.h"
|
#import "MPPlugin.h"
|
||||||
#import "MPPluginManager.h"
|
#import "MPPluginManager.h"
|
||||||
|
#import "MPSettingsHelper.h"
|
||||||
|
|
||||||
NSString *const kMPPluginFileExtension = @"mpplugin";
|
NSString *const kMPPluginFileExtension = @"mpplugin";
|
||||||
|
|
||||||
@implementation MPPlugin
|
@implementation MPPlugin
|
||||||
|
|
||||||
+ (instancetype)pluginWithBundleURL:(NSURL *)url pluginManager:(MPPluginManager *)manager {
|
|
||||||
if(![self _validURL:url]) {
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
NSBundle *pluginBundle = [NSBundle bundleWithURL:url];
|
|
||||||
if(!pluginBundle) {
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
if(![self _validateClass:pluginBundle.principalClass]) {
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
return [[pluginBundle.principalClass alloc] initWithPluginManager:manager];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)initWithPluginManager:(MPPluginManager *)manager {
|
- (instancetype)initWithPluginManager:(MPPluginManager *)manager {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
return self;
|
return self;
|
||||||
@@ -57,52 +44,5 @@ NSString *const kMPPluginFileExtension = @"mpplugin";
|
|||||||
return @"unknown.version";
|
return @"unknown.version";
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (BOOL)_validURL:(NSURL *)url {
|
|
||||||
return (NSOrderedSame == [url.pathExtension compare:kMPPluginFileExtension options:NSCaseInsensitiveSearch]);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (BOOL)_validateClass:(Class)class {
|
|
||||||
return ([class isSubclassOfClass:[MPPlugin class]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Code by Jedda Wignall<jedda@jedda.me> http://jedda.me/2012/03/verifying-plugin-bundles-using-code-signing/ */
|
|
||||||
+ (BOOL)_validSignature:(NSURL *)url {
|
|
||||||
if(!url.path) {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
NSTask * task = [[NSTask alloc] init];
|
|
||||||
NSPipe * pipe = [NSPipe pipe];
|
|
||||||
NSArray* args = @[ @"--verify",
|
|
||||||
/*[NSString stringWithFormat:@"-R=anchor = \"%@\"", [[NSBundle mainBundle] pathForResource:@"BlargsoftCodeCA" ofType:@"cer"]],*/
|
|
||||||
url.path ];
|
|
||||||
task.launchPath = @"/usr/bin/codesign";
|
|
||||||
task.standardOutput = pipe;
|
|
||||||
task.standardError = pipe;
|
|
||||||
task.arguments = args;
|
|
||||||
[task launch];
|
|
||||||
[task waitUntilExit];
|
|
||||||
|
|
||||||
if(task.terminationStatus == 0) {
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
NSString * taskString = [[NSString alloc] initWithData:pipe.fileHandleForReading.readDataToEndOfFile encoding:NSASCIIStringEncoding];
|
|
||||||
if ([taskString rangeOfString:@"modified"].length > 0 || [taskString rangeOfString:@"a sealed resource is missing or invalid"].length > 0) {
|
|
||||||
// The plugin has been modified or resources removed since being signed. You probably don't want to load this.
|
|
||||||
NSLog(@"Plugin modified - not loaded"); // log a real error here
|
|
||||||
}
|
|
||||||
else if ([taskString rangeOfString:@"failed to satisfy"].length > 0) {
|
|
||||||
// The plugin is missing resources since being signed. Don't load.
|
|
||||||
// throw an error
|
|
||||||
NSLog(@"Plugin not signed by correct CA - not loaded"); // log a real error here
|
|
||||||
}
|
|
||||||
else if ([taskString rangeOfString:@"not signed at all"].length > 0) {
|
|
||||||
// The plugin was not code signed at all. Don't load.
|
|
||||||
NSLog(@"Plugin not signed at all - don't load."); // log a real error here
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Some other codesign error
|
|
||||||
}
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -8,12 +8,20 @@
|
|||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
FOUNDATION_EXPORT NSString *const MPPluginManagerWillLoadPlugin;
|
||||||
|
FOUNDATION_EXPORT NSString *const MPPluginManagerDidLoadPlugin;
|
||||||
|
FOUNDATION_EXPORT NSString *const MPPluginManagerWillUnloadPlugin;
|
||||||
|
FOUNDATION_EXPORT NSString *const MPPluginManagerDidUnloadPlugin;
|
||||||
|
|
||||||
|
FOUNDATION_EXPORT NSString *const MPPluginManagerPluginBundleIdentifiyerKey;
|
||||||
|
|
||||||
@class KPKNode;
|
@class KPKNode;
|
||||||
@class MPPlugin;
|
@class MPPlugin;
|
||||||
|
|
||||||
@interface MPPluginManager : NSObject
|
@interface MPPluginManager : NSObject
|
||||||
|
|
||||||
@property (readonly, copy) NSArray <MPPlugin __kindof*> *plugins;
|
@property (readonly, copy) NSArray <MPPlugin __kindof*> *plugins;
|
||||||
|
@property (nonatomic, readonly) BOOL loadUnsecurePlugins;
|
||||||
|
|
||||||
typedef BOOL (^NodeMatchBlock)(KPKNode *aNode);
|
typedef BOOL (^NodeMatchBlock)(KPKNode *aNode);
|
||||||
|
|
||||||
@@ -24,7 +32,4 @@ typedef BOOL (^NodeMatchBlock)(KPKNode *aNode);
|
|||||||
- (NSArray *)filteredEntriesUsingBlock:(NodeMatchBlock) matchBlock;
|
- (NSArray *)filteredEntriesUsingBlock:(NodeMatchBlock) matchBlock;
|
||||||
- (NSArray *)filteredGroupsUsingBlock:(NodeMatchBlock) matchBlock;
|
- (NSArray *)filteredGroupsUsingBlock:(NodeMatchBlock) matchBlock;
|
||||||
|
|
||||||
- (void)loadPlugins;
|
|
||||||
- (void)installPluginAtURL:(NSURL *)url;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -11,17 +11,32 @@
|
|||||||
#import "MPDocument.h"
|
#import "MPDocument.h"
|
||||||
#import "MPPlugin.h"
|
#import "MPPlugin.h"
|
||||||
#import "NSApplication+MPAdditions.h"
|
#import "NSApplication+MPAdditions.h"
|
||||||
|
#import "MPSettingsHelper.h"
|
||||||
|
|
||||||
#import "KeePassKit/KeePassKit.h"
|
#import "KeePassKit/KeePassKit.h"
|
||||||
|
|
||||||
|
|
||||||
|
NSString *const MPPluginManagerWillLoadPlugin = @"com.hicknhack.macpass.MPPluginManagerWillLoadPlugin";
|
||||||
|
NSString *const MPPluginManagerDidLoadPlugin = @"comt.hicknhack.macpass.MPPluginManagerDidLoadPlugin";
|
||||||
|
NSString *const MPPluginManagerWillUnloadPlugin = @"com.hicknhack.macpass.MPPluginManagerWillUnloadPlugin";
|
||||||
|
NSString *const MPPluginManagerDidUnloadPlugin = @"com.hicknhack.macpass.MPPluginManagerDidUnloadPlugin";
|
||||||
|
|
||||||
|
NSString *const MPPluginManagerPluginBundleIdentifiyerKey = @"MPPluginManagerPluginBundleIdentifiyerKey";
|
||||||
|
|
||||||
|
|
||||||
@interface MPPluginManager ()
|
@interface MPPluginManager ()
|
||||||
|
|
||||||
@property (strong) NSMutableArray<MPPlugin __kindof *> *mutablePlugins;
|
@property (strong) NSMutableArray<MPPlugin __kindof *> *mutablePlugins;
|
||||||
|
@property (nonatomic) BOOL loadUnsecurePlugins;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MPPluginManager
|
@implementation MPPluginManager
|
||||||
|
|
||||||
|
+ (NSSet *)keyPathsForValuesAffectingPlugins {
|
||||||
|
return [NSSet setWithObject:NSStringFromSelector(@selector(mutablePlugins))];
|
||||||
|
}
|
||||||
|
|
||||||
+ (instancetype)sharedManager {
|
+ (instancetype)sharedManager {
|
||||||
static MPPluginManager *instance;
|
static MPPluginManager *instance;
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
@@ -39,10 +54,24 @@
|
|||||||
self = [super init];
|
self = [super init];
|
||||||
if(self) {
|
if(self) {
|
||||||
_mutablePlugins = [[NSMutableArray alloc] init];
|
_mutablePlugins = [[NSMutableArray alloc] init];
|
||||||
|
_loadUnsecurePlugins = [[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyLoadUnsecurePlugins];
|
||||||
|
[self _loadPlugins];
|
||||||
|
|
||||||
|
[self bind:NSStringFromSelector(@selector(loadUnsecurePlugins))
|
||||||
|
toObject:[NSUserDefaultsController sharedUserDefaultsController]
|
||||||
|
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyLoadUnsecurePlugins]
|
||||||
|
options:nil];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setLoadUnsecurePlugins:(BOOL)loadUnsecurePlugins {
|
||||||
|
if(_loadUnsecurePlugins != loadUnsecurePlugins) {
|
||||||
|
_loadUnsecurePlugins = loadUnsecurePlugins;
|
||||||
|
[self _loadPlugins];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (NSArray<MPPlugin *> *)plugins {
|
- (NSArray<MPPlugin *> *)plugins {
|
||||||
return [self.mutablePlugins copy];
|
return [self.mutablePlugins copy];
|
||||||
}
|
}
|
||||||
@@ -60,21 +89,121 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)filteredGroupsUsingBlock:(NodeMatchBlock)matchBlock {
|
- (NSArray *)filteredGroupsUsingBlock:(NodeMatchBlock)matchBlock {
|
||||||
|
NSAssert(NO, @"Not implemented");
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadPlugins {
|
- (void)_unloadPlugins {
|
||||||
|
/* TODO Notofications for UI */
|
||||||
|
NSMutableArray *bundles = [[NSMutableArray alloc] initWithCapacity:self.mutablePlugins.count];
|
||||||
|
for(MPPlugin *plugin in self.mutablePlugins) {
|
||||||
|
NSBundle *pluginBundle = [NSBundle bundleForClass:plugin.class];
|
||||||
|
if(pluginBundle) {
|
||||||
|
[bundles addObject:pluginBundle];
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:MPPluginManagerWillUnloadPlugin object:self userInfo:@{ MPPluginManagerPluginBundleIdentifiyerKey : plugin.identifier}];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[self.mutablePlugins removeAllObjects];
|
||||||
|
for(NSBundle *bundle in bundles) {
|
||||||
|
[bundle unload];
|
||||||
|
NSString *identifiery = bundle.bundleIdentifier ? bundle.bundleIdentifier : @"unknown";
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:MPPluginManagerDidUnloadPlugin object:self userInfo:@{ MPPluginManagerPluginBundleIdentifiyerKey : identifiery }];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)_loadPlugins {
|
||||||
|
/* unload all plugins just to be sure */
|
||||||
|
[self _unloadPlugins];
|
||||||
NSURL *dir = [NSApp applicationSupportDirectoryURL:YES];
|
NSURL *dir = [NSApp applicationSupportDirectoryURL:YES];
|
||||||
NSError *error;
|
NSError *error;
|
||||||
NSArray *contentURLs = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:dir includingPropertiesForKeys:@[] options:NSDirectoryEnumerationSkipsHiddenFiles error:&error];
|
NSArray *contentURLs = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:dir
|
||||||
|
includingPropertiesForKeys:@[]
|
||||||
|
options:NSDirectoryEnumerationSkipsHiddenFiles
|
||||||
|
error:&error];
|
||||||
if(!contentURLs) {
|
if(!contentURLs) {
|
||||||
NSLog(@"Error while trying to locate Plugins: %@", error.localizedDescription);
|
NSLog(@"Error while trying to locate Plugins: %@", error.localizedDescription);
|
||||||
}
|
}
|
||||||
for(NSURL *pluginURL in contentURLs) {
|
for(NSURL *pluginURL in contentURLs) {
|
||||||
MPPlugin *plugin = [MPPlugin pluginWithBundleURL:pluginURL pluginManager:self];
|
|
||||||
|
if(![self _validURL:pluginURL]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(![self _validSignature:pluginURL]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSBundle *pluginBundle = [NSBundle bundleWithURL:pluginURL];
|
||||||
|
if(!pluginBundle) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(![self _validateClass:pluginBundle.principalClass]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
MPPlugin *plugin = [[pluginBundle.principalClass alloc] initWithPluginManager:self];
|
||||||
if(plugin) {
|
if(plugin) {
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:MPPluginManagerWillLoadPlugin object:self userInfo:@{ MPPluginManagerPluginBundleIdentifiyerKey : plugin.identifier }];
|
||||||
[self.mutablePlugins addObject:plugin];
|
[self.mutablePlugins addObject:plugin];
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:MPPluginManagerDidLoadPlugin object:self userInfo:@{ MPPluginManagerPluginBundleIdentifiyerKey : plugin.identifier }];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)_validURL:(NSURL *)url {
|
||||||
|
return (NSOrderedSame == [url.pathExtension compare:kMPPluginFileExtension options:NSCaseInsensitiveSearch]);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)_validateClass:(Class)class {
|
||||||
|
return ([class isSubclassOfClass:[MPPlugin class]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Code by Jedda Wignall<jedda@jedda.me> http://jedda.me/2012/03/verifying-plugin-bundles-using-code-signing/ */
|
||||||
|
- (BOOL)_validSignature:(NSURL *)url {
|
||||||
|
if(!url.path) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(self.loadUnsecurePlugins) {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSTask * task = [[NSTask alloc] init];
|
||||||
|
NSPipe * pipe = [NSPipe pipe];
|
||||||
|
NSArray* args = @[ @"--verify",
|
||||||
|
/*[NSString stringWithFormat:@"-R=anchor = \"%@\"", [[NSBundle mainBundle] pathForResource:@"BlargsoftCodeCA" ofType:@"cer"]],*/
|
||||||
|
url.path ];
|
||||||
|
task.launchPath = @"/usr/bin/codesign";
|
||||||
|
task.standardOutput = pipe;
|
||||||
|
task.standardError = pipe;
|
||||||
|
task.arguments = args;
|
||||||
|
[task launch];
|
||||||
|
[task waitUntilExit];
|
||||||
|
|
||||||
|
if(task.terminationStatus == 0) {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
NSString *pluginPath = url.path ? url.path : @"<emptyPath>";
|
||||||
|
NSString * taskString = [[NSString alloc] initWithData:pipe.fileHandleForReading.readDataToEndOfFile encoding:NSASCIIStringEncoding];
|
||||||
|
if ([taskString rangeOfString:@"modified"].length > 0 || [taskString rangeOfString:@"a sealed resource is missing or invalid"].length > 0) {
|
||||||
|
// The plugin has been modified or resources removed since being signed. You probably don't want to load this.
|
||||||
|
NSLog(@"Plugin %@ modified - not loaded", pluginPath); // log a real error here
|
||||||
|
}
|
||||||
|
else if ([taskString rangeOfString:@"failed to satisfy"].length > 0) {
|
||||||
|
// The plugin is missing resources since being signed. Don't load.
|
||||||
|
// throw an error
|
||||||
|
NSLog(@"Plugin %@ not signed by correct CA - not loaded", pluginPath); // log a real error here
|
||||||
|
}
|
||||||
|
else if ([taskString rangeOfString:@"not signed at all"].length > 0) {
|
||||||
|
// The plugin was not code signed at all. Don't load.
|
||||||
|
NSLog(@"Plugin %@ not signed at all - don't load.", pluginPath); // log a real error here
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
NSLog(@"Unkown CodeSign Error!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -10,17 +10,47 @@
|
|||||||
#import "MPPluginManager.h"
|
#import "MPPluginManager.h"
|
||||||
#import "MPPlugin.h"
|
#import "MPPlugin.h"
|
||||||
|
|
||||||
|
#import "MPSettingsHelper.h"
|
||||||
|
|
||||||
NSString *const _kMPPluginTableNameColumn = @"Name";
|
NSString *const _kMPPluginTableNameColumn = @"Name";
|
||||||
|
|
||||||
@interface MPPluginSettingsController () <NSTableViewDataSource, NSTableViewDelegate>
|
@interface MPPluginSettingsController () <NSTableViewDataSource, NSTableViewDelegate>
|
||||||
|
|
||||||
@property (weak) IBOutlet NSTableView *pluginTableView;
|
@property (weak) IBOutlet NSTableView *pluginTableView;
|
||||||
@property (weak) IBOutlet NSView *settingsView;
|
@property (weak) IBOutlet NSView *settingsView;
|
||||||
|
@property (weak) IBOutlet NSButton *loadInsecurePlugsinCheckButton;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MPPluginSettingsController
|
@implementation MPPluginSettingsController
|
||||||
|
|
||||||
|
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||||
|
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||||
|
if(self) {
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(_didChangePlugins:)
|
||||||
|
name:MPPluginManagerWillLoadPlugin
|
||||||
|
object:[MPPluginManager sharedManager]];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(_didChangePlugins:)
|
||||||
|
name:MPPluginManagerDidLoadPlugin
|
||||||
|
object:[MPPluginManager sharedManager]];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(_didChangePlugins:)
|
||||||
|
name:MPPluginManagerWillUnloadPlugin
|
||||||
|
object:[MPPluginManager sharedManager]];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(_didChangePlugins:)
|
||||||
|
name:MPPluginManagerDidUnloadPlugin
|
||||||
|
object:[MPPluginManager sharedManager]];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc {
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *)nibName {
|
- (NSString *)nibName {
|
||||||
return @"PluginSettings";
|
return @"PluginSettings";
|
||||||
}
|
}
|
||||||
@@ -43,6 +73,11 @@ NSString *const _kMPPluginTableNameColumn = @"Name";
|
|||||||
self.pluginTableView.delegate = self;
|
self.pluginTableView.delegate = self;
|
||||||
self.pluginTableView.dataSource = self;
|
self.pluginTableView.dataSource = self;
|
||||||
|
|
||||||
|
[self.loadInsecurePlugsinCheckButton bind:NSValueBinding
|
||||||
|
toObject:[NSUserDefaultsController sharedUserDefaultsController]
|
||||||
|
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyLoadUnsecurePlugins]
|
||||||
|
options:nil];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
|
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
|
||||||
@@ -68,8 +103,8 @@ NSString *const _kMPPluginTableNameColumn = @"Name";
|
|||||||
[self.settingsView addSubview:viewController.view];
|
[self.settingsView addSubview:viewController.view];
|
||||||
NSDictionary *dict = @{ @"view" : viewController.view,
|
NSDictionary *dict = @{ @"view" : viewController.view,
|
||||||
@"table" : self.pluginTableView.enclosingScrollView };
|
@"table" : self.pluginTableView.enclosingScrollView };
|
||||||
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[view]-0-|" options:0 metrics:nil views:dict]];
|
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[view]-|" options:0 metrics:nil views:dict]];
|
||||||
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[view]-0-|" options:0 metrics:nil views:dict]];
|
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[view]-|" options:0 metrics:nil views:dict]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,4 +122,10 @@ NSString *const _kMPPluginTableNameColumn = @"Name";
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)_didChangePlugins:(NSNotification *)notification {
|
||||||
|
/* better way? */
|
||||||
|
[self.pluginTableView deselectAll:self];
|
||||||
|
[self.pluginTableView reloadData];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user