Implement lockdown enter recovery

This commit is contained in:
Jackson Coxson
2026-01-05 12:00:11 -07:00
parent a4e17ea076
commit bb64dc0b1c
3 changed files with 55 additions and 1 deletions

View File

@@ -179,7 +179,7 @@ pub unsafe extern "C" fn lockdownd_get_value(
domain: *const libc::c_char,
out_plist: *mut plist_t,
) -> *mut IdeviceFfiError {
if out_plist.is_null() {
if client.is_null() || out_plist.is_null() {
return ffi_err!(IdeviceError::FfiInvalidArg);
}
@@ -221,6 +221,35 @@ pub unsafe extern "C" fn lockdownd_get_value(
}
}
/// Tells the device to enter recovery mode
///
/// # Arguments
/// * `client` - A valid LockdowndClient handle
///
/// # Returns
/// An IdeviceFfiError on error, null on success
///
/// # Safety
/// `client` must be a valid pointer to a handle allocated by this library
#[unsafe(no_mangle)]
pub unsafe extern "C" fn lockdownd_enter_recovery(
client: *mut LockdowndClientHandle,
) -> *mut IdeviceFfiError {
if client.is_null() {
return ffi_err!(IdeviceError::FfiInvalidArg);
}
let res: Result<(), IdeviceError> = run_sync_local(async move {
let client_ref = unsafe { &mut (*client).0 };
client_ref.enter_recovery().await
});
match res {
Ok(_) => null_mut(),
Err(e) => ffi_err!(e),
}
}
/// Frees a LockdowndClient handle
///
/// # Arguments