Authorization of application

Joined
May 19, 2008
Messages
2
Reaction score
0
Points
1
Hi all.
I am really junior mac-developer. I have verry little experience in building applications and using the unix-based operating systems.
My problem is this: I am building an application in which I have to open a device to read and write from it. I use the function open() with parameters the "path" to the device (for example /dev/rdisk2s3) and an option for opening (for example O_RDONLY). When the device is "local" (I don't know how to explain it in other way - not flash or ISCSI or image or etc...) this function returns -1 with errno 13 - EACCES - Permission denied.
My application has both command line and UI "versions". If I run the command line "version" with sudo and I write the password - it works with no problems.
I want to make the UI ask for password and run the rest of the code with root rights, as if I have run it with sudo.
I tried using the Security Framework - the functions from Authorization.h, but I couldn't make it work - I manage to create and initiate an authorization reference, but the open function still doesn't work.
Help please. :|
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top