2012-01-19 33 views
7

我已經做了一些挖掘,我見過的主要想法是使用setuid/getuid和使用授權服務(由於某些原因,編譯時出現符號錯誤,但出現現在不推薦使用)。升級應用程序權限編程OS X

我的應用程序需要能夠請求根訪問(用於訪問原始磁盤驅動器)在某一點,最好是與OS X身份驗證對話框(我是OS X的新手,所以我不知道該打電話給什麼那)。

回答

2

授權服務得到很好的支持,AFAIK。

Here's a link to a tutorial (with sample projects!)您可以使用它啓動一個小工具,在該工具中您可以獲取管理員權限,然後您可以在調用過程(鏈接的文檔)上調用setpriority API。

+0

謝謝!出於某種原因,我無法找到AuthorizationExecuteWithPrivileges聲明在哪裏,因爲當我#include 我有其他符號,除了一個函數 – Lander

+0

http://developer.apple.com/library/ mac /#documentation/Security/Reference/authorization_ref/Reference/reference.html表示自10.7起已棄用AuthorizationExecuteWithPrivileges。 http://stackoverflow.com/questions/6841937/authorizationexecutewithprivileges-is-deprecated有一些相關的信息。 – Vishal

+0

大家......'AuthorizationExecuteWithPrivileges'從10.7開始變成「棄用」。我正在查看Apple的[授權服務任務](http://developer.apple.com/library/mac/#documentation/Security/Conceptual/authorization_concepts/03authtasks/authtasks.html#//apple_ref/doc/uid/TP30000995 -CH206-TP9)文檔,以瞭解如何['renice'](http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man8/renice.8.html)調用處理。 –