set actions +x, clarify admin privs
User specified action (script/binary) now set to +x (#2) Clarifies that OverSight requires admin access to function properly (#10)
This commit is contained in:
parent
692e000b1a
commit
4425d1df0f
|
@ -475,6 +475,9 @@ bail:
|
||||||
//set path in ui
|
//set path in ui
|
||||||
self.executePath.stringValue = panel.URL.path;
|
self.executePath.stringValue = panel.URL.path;
|
||||||
|
|
||||||
|
//ensure its executable
|
||||||
|
execTask(CHMOD, @[@"+x", panel.URL.path], YES, NO);
|
||||||
|
|
||||||
//save path & sync
|
//save path & sync
|
||||||
[NSUserDefaults.standardUserDefaults setObject:self.executePath.stringValue forKey:PREF_EXECUTE_PATH];
|
[NSUserDefaults.standardUserDefaults setObject:self.executePath.stringValue forKey:PREF_EXECUTE_PATH];
|
||||||
[NSUserDefaults.standardUserDefaults synchronize];
|
[NSUserDefaults.standardUserDefaults synchronize];
|
||||||
|
|
|
@ -198,7 +198,7 @@
|
||||||
CD86B6E923A5BBE7003F6BA4 /* configure.sh */,
|
CD86B6E923A5BBE7003F6BA4 /* configure.sh */,
|
||||||
);
|
);
|
||||||
name = Script;
|
name = Script;
|
||||||
path = Configure/Script;
|
path = Source/Script;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
CD73DA9C20049158001FFC84 /* Shared */ = {
|
CD73DA9C20049158001FFC84 /* Shared */ = {
|
||||||
|
|
|
@ -40,7 +40,7 @@ int main(int argc, char *argv[])
|
||||||
if(YES != hasAdminPrivileges())
|
if(YES != hasAdminPrivileges())
|
||||||
{
|
{
|
||||||
//show alert
|
//show alert
|
||||||
showAlert(@"ERROR: Insuffient Privileges.", @"Administrator privileges are required to monitor the camera & microphone.");
|
showAlert(@"ERROR: Insuffient Privileges.", @"OverSight can only be installed / run on accounts with administrative privileges");
|
||||||
|
|
||||||
//bail
|
//bail
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
|
@ -208,6 +208,9 @@
|
||||||
//support us
|
//support us
|
||||||
#define ACTION_SUPPORT 5
|
#define ACTION_SUPPORT 5
|
||||||
|
|
||||||
|
//path to chmod
|
||||||
|
#define CHMOD @"/bin/chmod"
|
||||||
|
|
||||||
//path to xattr
|
//path to xattr
|
||||||
#define XATTR @"/usr/bin/xattr"
|
#define XATTR @"/usr/bin/xattr"
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,8 @@ NSString* topLevelApp(NSString* binaryPath);
|
||||||
// b) signed with signing auth
|
// b) signed with signing auth
|
||||||
OSStatus verifyApp(NSString* path, NSString* signingAuth);
|
OSStatus verifyApp(NSString* path, NSString* signingAuth);
|
||||||
|
|
||||||
//get name of logged in user
|
//get user id of logged in user
|
||||||
NSString* getConsoleUser(void);
|
uid_t getConsoleUserID(void);
|
||||||
|
|
||||||
//check if process is alive
|
//check if process is alive
|
||||||
BOOL isProcessAlive(pid_t processID);
|
BOOL isProcessAlive(pid_t processID);
|
||||||
|
|
|
@ -408,10 +408,20 @@ bail:
|
||||||
}
|
}
|
||||||
|
|
||||||
//get name of logged in user
|
//get name of logged in user
|
||||||
NSString* getConsoleUser()
|
uid_t getConsoleUserID()
|
||||||
{
|
{
|
||||||
//copy/return user
|
//uid
|
||||||
return CFBridgingRelease(SCDynamicStoreCopyConsoleUser(NULL, NULL, NULL));
|
uid_t userID = 0;
|
||||||
|
|
||||||
|
//copy logged in user
|
||||||
|
if(NULL == CFBridgingRelease(SCDynamicStoreCopyConsoleUser(NULL, &userID, NULL)))
|
||||||
|
{
|
||||||
|
//error?
|
||||||
|
// defer to current user
|
||||||
|
userID = getuid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return userID;
|
||||||
}
|
}
|
||||||
|
|
||||||
//get process name
|
//get process name
|
||||||
|
@ -1679,8 +1689,8 @@ BOOL hasAdminPrivileges()
|
||||||
//admin group
|
//admin group
|
||||||
struct group* adminGroup = NULL;
|
struct group* adminGroup = NULL;
|
||||||
|
|
||||||
//get password entry for current user
|
//get password entry for console user
|
||||||
pwentry = getpwuid(getuid());
|
pwentry = getpwuid(getConsoleUserID());
|
||||||
|
|
||||||
//get admin group
|
//get admin group
|
||||||
adminGroup = getgrnam("admin");
|
adminGroup = getgrnam("admin");
|
||||||
|
|
Loading…
Reference in New Issue