source: ocsinventory-agent/trunk/fuentes/tools/macosx/ocsng_app-xcode/ocscontact.m @ 468

Last change on this file since 468 was 468, checked in by mabarracus, 4 years ago

Copyt trusty code

File size: 1.0 KB
Line 
1//
2// OCSINVENTORY-NG
3// Copyleft Guillaume PROTET 2011
4// Web : http://www.ocsinventory-ng.org
5//
6// This code is open source and may be copied and modified as long as the source
7// code is always made freely available.
8// Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
9//
10//
11
12
13//ocscontact is the helper tool to run OCS agent using Authorization Services.
14//ocscontact executable MUST be owned by root anbd have 700 permissions
15
16#import "ocscontact.h"
17
18@implementation ocscontact
19
20int main( int argc, char *argv[], char *envp[]) {
21
22        NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
23        NSLog(@"Running ocscontact");
24        setuid(0); //To be able to run OCS agent as root
25               
26        NSTask *Task = [[NSTask alloc] init];
27
28        //We get the path of ocsinventory-agent executable
29        NSString *ocsinventoryAgentPath = [[NSBundle mainBundle] pathForResource:@"ocsinventory-agent"ofType:nil];
30
31        [Task setLaunchPath:ocsinventoryAgentPath];
32        [Task launch];
33               
34        [autoreleasepool release];
35        return 0;
36}
37
38
39
40@end
Note: See TracBrowser for help on using the repository browser.