AuthorizationExecuteWithPrivileges를 통해 제거 프로그램 (AppleScript로 작성)을 실행하려고합니다. 내가 그렇게 같은 빈 인증 심판 생성 한 후 내 권한을 설정 해요 : 나중에Objective C의 권한 상승 된 AppleScript 실행
char *tool = "/usr/bin/osascript";
AuthorizationItem items = {kAuthorizationRightExecute, strlen(tool), tool, 0};
AuthorizationRights rights = {sizeof(items)/sizeof(AuthorizationItem), &items};
AuthorizationFlags flags = kAuthorizationFlagDefaults |
kAuthorizationFlagExtendRights |
kAuthorizationFlagPreAuthorize |
kAuthorizationFlagInteractionAllowed;
status = AuthorizationCopyRights(authorizationRef, &rights, NULL, flags, NULL);
을 나는 호출이 잘 작동하지만 레오파드에 나는 syslog에 다음과 같은 얻을 스노우 레오파드 (Snow Leopard)에
status = AuthorizationExecuteWithPrivileges(authorizationRef, tool, kAuthorizationFlagDefaults, (char *const *)args, NULL);
.LOG :
Apr 19 15:30:09 hostname /usr/bin/osascript[39226]: OpenScripting.framework - 'gdut' event blocked in process with mixed credentials (issetugid=0 uid=501 euid=0 gid=20 egid=20)
Apr 19 15:30:12: --- last message repeated 1 time ---
...
Apr 19 15:30:12 hostname [0x0-0x2e92e9].com.example.uninstaller[39219]: /var/folders/vm/vmkIi0nYG8mHMrllaXaTgk+++TI/-Tmp-/TestApp_tmpfiles/Uninstall.scpt:
Apr 19 15:30:12 hostname [0x0-0x2e92e9].com.example.uninstaller[39219]: execution error: «constant afdmasup» doesn’t understand the «event earsffdr» message. (-1708)
내 첫번째 추측은 그것이 ABO 물어 setuid를 상황과 블록 호출에 걸 알고 있기 때문에 레오파드는 어떻게 든 내가 뭘 어떻게하고 싶어하지 않는다는 것입니다 몇 시간 동안이 연구 후 응용 프로그램에서 사용자 별 사물들.
나는이 모든 잘못에 대해 생각하고 있습니까? 난 그냥 ... "sudo는은/usr/빈/osascript"에 해당를 실행하려면
편집 :
FWIW은 "실행 오류"가 발생 첫 번째 라인 :
set userAppSupportPath to (POSIX path of (path to application support folder from user domain))
그러나 빈 스크립트 (argv를 실행하면 실행이 끝났습니다.)에도 여전히 'gdut'메시지가 표시됩니다.
정말 AppleScript로 설치 프로그램을 작성하면 안됩니다. 다른 언어를 선택하십시오. –
그래, 모든 것을 obj-c로 번역했다. – devguydavid