authopen or not
authopen or not
- Subject: authopen or not
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sat, 24 Jul 2004 14:48:33 +0200
I have an app which does:
int fd = open( "/dev/rdisk0s9", O_RDONLY, 0);
followed by several:
pread( fd, buffer, nbytes, adress);
Currently this app is setuid root, which is necessary in order to make
the open() work.
But the fine (or fucking?) manuals tell me that: "running code as root
is very dangerous and should be done as seldom as possible.
Setting the setuid bit on an entire application is especially dangerous
because you are trusting that your entire application, and the code
your application links to, is free of security holes."
So I looked at "/usr/libexec/authopen -stdoutpipe /dev/rdisk0s9".
But I do not quite understand the man page.
Do I get a open stream, so that I can read sequentially until EOF?
This would not do.
Or do I get a file-descriptor which I can pass to pread()?
This would be perfect.
In the latter case, could some kind soul tell me how to make this?
I am thinking of:
popen( "/usr/libexec/authopen -stdoutpipe /dev/rdisk0s9", 'r' );
but what about the dup2() mentioned in the authopen man page?
Or is fork(), and execle() the way to go?
Gerriet.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.