Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

Sandboxing/Entitlements - requesting access to a directory

gwelmartengwelmarten Posts: 15Registered Users
Hi
Our app at the moment makes use of SH and echo to append a string to the end of a file in the /etc/ folder. Having this key in this location is critical to the apps functionality, and although we are working on an alternative place to store this key, it won't be fixed for the next couple of months.
What with Apple's Sandboxing requirements, it's no longer simple to get access to this location.
We were using something along the lines of:
    NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @\"/bin/sh\"];

NSArray *arguments;
arguments = [NSArray arrayWithObjects:@\"-c\", @\"echo 'Random bit of text' >> /etc/relevant-file\", nil];
[task setArguments: arguments];

NSPipe *pipe;
pipe = [NSPipe pipe];
[task setStandardOutput: pipe];

NSFileHandle *file;
file = [pipe fileHandleForReading];

[task launch];

NSData *data;
data = [file readDataToEndOfFile];

NSString *string;
string = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
NSLog (@\"grep returned:\n%@\", string);

Also, we are no longer able to request authentication from a user to access this directory (again, Sandboxing requirements).
Is there a way to add an entitlement that gives us access to the /etc/ directory? A string I should be adding to the entitlements folder? I see you can request access to certain folders (user defined, pictures, etc), and wonder if I can get access via this method to the relevant folder.
Does anybody have any other ideas?
Thanks,
Sam
Sign In or Register to comment.