Skip to content
Browse files

need to pass the proper bundle id to BAS, bit of a hack that could be…

… done better but since we have just one helper tool this will work for now
  • Loading branch information...
1 parent 1976a24 commit f279c3530c1fe7817ec5af7b09a944c8a3a64587 @dustinrue committed Jul 7, 2012
Showing with 12 additions and 2 deletions.
  1. +7 −2 Source/Action+HelperTool.m
  2. +5 −0 Utilities/remove_helper_tool.sh
View
9 Source/Action+HelperTool.m
@@ -94,7 +94,11 @@ - (OSStatus) helperToolActualPerform: (NSString *) action
*response = NULL;
// create request
- bundleID = [[NSBundle mainBundle] bundleIdentifier];
+ // get the bundleID from the Info dictionary, it is the SMPrivilegedExcutable entry
+ // For ControlPlane there is just helper so this is essentially hard coded to returning the first
+ // entry in the dictionary. If more were added then this would need to be able to specify the proper
+ // helper tool to use based on the command to be run.
+ bundleID = [[[[[NSBundle mainBundle] infoDictionary] objectForKey:@"SMPrivilegedExecutables"] allKeys] objectAtIndex:0];
assert(bundleID != NULL);
if (parameter)
request = [NSDictionary dictionaryWithObjectsAndKeys: action, @kBASCommandKey, parameter, @"param", nil];
@@ -103,9 +107,10 @@ - (OSStatus) helperToolActualPerform: (NSString *) action
assert(request != NULL);
// Execute it.
+ NSLog(@"request is %@", request);
error = BASExecuteRequestInHelperTool(auth,
kCPHelperToolCommandSet,
- (CFStringRef) bundleID,
+ (CFStringRef) bundleID,
(CFDictionaryRef) request,
response);
View
5 Utilities/remove_helper_tool.sh
@@ -6,3 +6,8 @@
launchctl unload -F /Library/LaunchDaemons/com.dustinrue.ControlPlane.plist
rm /Library/LaunchDaemons/com.dustinrue.ControlPlane.plist
rm /Library/PrivilegedHelperTools/com.dustinrue.ControlPlane
+
+# newer version
+launchctl unload -F /Library/LaunchDaemons/com.dustinrue.CPHelperTool.plist
+rm /Library/LaunchDaemons/com.dustinrue.CPHelperTool.plist
+rm /Library/PrivilegedHelperTools/com.dustinrue.CPHelperTool

0 comments on commit f279c35

Please sign in to comment.
Something went wrong with that request. Please try again.