0

I am writing a program that needs to write a plist file that's owned by root.

The way to create the file is apparently using authopen with the -w option. The problem is that authopen takes its input from stdin (or sends its permissions back using the SCM_RIGHTS extension to the calling process). There's also an option that uses something called the "Authorization External Form" structure which I don't quite understand.

In any event, what I would like to do is write my plist to a temporary file and then to use authopen or a similar authorization mechanism to do a privileged rename of the file in question.

So I need a way to either:

  1. Write the NSDictionary to a pipe, rather than to a file.
  2. Write the NSDictionary to a file, then provide that file to the authopen process as stdin.
  3. Use authopen to do a rename

or something else.

Is there any code for doing this?

Thanks.

4

0 回答 0