I've created an application in the past, in Lazarus Pascal, which execute "dd" to write an image to a drive. For this, obviously, elevated rights are needed.
In the initial version I have used AuthorizationExecuteWithPrivileges()
(link), even though not exactly intended for this purpose, it did work very well and very consistently.
This function however has been depreciated since OSX 10.7, as it can be a security issue, and command line statements that redirect do not work properly either (redirecting output from zip
as input for dd
).
In the next version I've used a method described in the Lazarus Pascal Wiki (Executing External Programs), which basically starts a TProcess which my program communicates with. Using sudo -S dd ...
, the users password is asked and entered to make sure he/she has the proper access rights.
Obviously a little bit of a dirty hack method, and it shows, certain users experience issues with this.
After doing a lot of reading, it seems Apple prefers this to be done with a helper tool called SMJobBless(). I'm unfortunately not very experienced when it comes to Objective-C, the presented code seems very minimal at best and not very well documented either.
I was wondering if anyone has experience or could assist in "porting" this method to Lazarus Pascal ... I'm all in favor of doing it right. Alternative methods are most welcome as well of course!
Any help would be greatly appreciated.