mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-21 13:54:15 -07:00
New way of doing authenticate and install. Now with more kittens.
This commit is contained in:
parent
49076d406e
commit
99c384e110
5 changed files with 136 additions and 39 deletions
24
ZeroTierUI/mac_doprivileged.mm
Normal file
24
ZeroTierUI/mac_doprivileged.mm
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mac_doprivileged.h"
|
||||
|
||||
#undef slots
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
bool macExecutePrivilegedShellCommand(const char *commandAndArgs)
|
||||
{
|
||||
char tmp[32768];
|
||||
|
||||
snprintf(tmp,sizeof(tmp),"do shell script \"%s\" with administrator privileges\n",commandAndArgs);
|
||||
tmp[32767] = (char)0;
|
||||
|
||||
NSString *scriptApple = [[NSString alloc] initWithUTF8String:tmp];
|
||||
NSAppleScript *as = [[NSAppleScript alloc] initWithSource:scriptApple];
|
||||
NSDictionary *err = nil;
|
||||
[as executeAndReturnError:&err];
|
||||
[as release];
|
||||
[scriptApple release];
|
||||
|
||||
return (err == nil);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue