From 851bc83dfb3be55806a294b456b963febe560266 Mon Sep 17 00:00:00 2001 From: dmiller Date: Sat, 18 Mar 2023 20:26:54 +0000 Subject: [PATCH] Fix auth wrapper: args not supported. Add error reporting --- zenmap/install_scripts/macosx/zenmap_auth.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/zenmap/install_scripts/macosx/zenmap_auth.m b/zenmap/install_scripts/macosx/zenmap_auth.m index a3eae39b3..b42e568a0 100644 --- a/zenmap/install_scripts/macosx/zenmap_auth.m +++ b/zenmap/install_scripts/macosx/zenmap_auth.m @@ -27,19 +27,21 @@ int main(int argc, const char * argv[]) { NSLog(@"%@",executable_path); NSDictionary *error = [NSDictionary new]; - NSString *script = [NSString stringWithFormat:@"do shell script \"%@ %s\" with administrator privileges", executable_path, (char*)argv]; + NSString *script = [NSString stringWithFormat:@"do shell script \"%@\" with administrator privileges", executable_path]; +NSLog(@"Executing: >>%@<<", script); NSAppleScript *appleScript = [[NSAppleScript alloc] initWithSource:script]; if ([appleScript executeAndReturnError:&error]) { NSLog(@"success!"); } else { - NSLog(@"Failed to execute applescript with admin privileges, trying without."); + NSLog(@"Failed to execute applescript with admin privileges: %@", error[@"NSAppleScriptErrorMessage"]); NSDictionary *error = [NSDictionary new]; - NSString *script = [NSString stringWithFormat:@"do shell script \"%@ %s\"", executable_path, (char*)argv]; + NSString *script = [NSString stringWithFormat:@"do shell script \"%@\"", executable_path]; +NSLog(@"Executing: >>%@<<", script); NSAppleScript *appleScript = [[NSAppleScript alloc] initWithSource:script]; if ([appleScript executeAndReturnError:&error]) { NSLog(@"success!"); } else { - NSLog(@"Failed to execute applescript at all."); + NSLog(@"Failed to execute applescript: %@", error[@"NSAppleScriptErrorMessage"]); } } }