X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/b0d623f7f2ae71ed96e60569f61f9a9a27016e80..d41d1dae2cd00cc08c7982087d1c445180cad9f5:/iokit/Kernel/RootDomainUserClient.cpp?ds=inline diff --git a/iokit/Kernel/RootDomainUserClient.cpp b/iokit/Kernel/RootDomainUserClient.cpp index 8dbb20b0e..69c0dfa1a 100644 --- a/iokit/Kernel/RootDomainUserClient.cpp +++ b/iokit/Kernel/RootDomainUserClient.cpp @@ -194,6 +194,23 @@ IOReturn RootDomainUserClient::secureSetMaintenanceWakeCalendar( #endif } +IOReturn RootDomainUserClient::secureSetUserAssertionLevels( + uint32_t assertBits ) +{ + int admin_priv = 0; + IOReturn ret = kIOReturnNotPrivileged; + + ret = clientHasPrivilege(fOwningTask, kIOClientPrivilegeAdministrator); + admin_priv = (kIOReturnSuccess == ret); + + if (admin_priv && fOwner) { + ret = fOwner->setPMAssertionUserLevels(assertBits); + } else { + ret = kIOReturnNotPrivileged; + } + return kIOReturnSuccess; +} + IOReturn RootDomainUserClient::clientClose( void ) { detach(fOwner); @@ -238,6 +255,10 @@ RootDomainUserClient::getTargetAndMethodForIndex( IOService ** targetP, UInt32 i { // kPMSetMaintenanceWakeCalendar, 8 (IOService *)1, (IOMethod)&RootDomainUserClient::secureSetMaintenanceWakeCalendar, kIOUCStructIStructO, sizeof(IOPMCalendarStruct), sizeof(uint32_t) + }, + { // kPMSetUserAssertionLevels, 9 + (IOService *)1, (IOMethod)&RootDomainUserClient::secureSetUserAssertionLevels, + kIOUCScalarIScalarO, 1, 0 } };