From 4a5e7f34dae29d5d9cb8929c8e8a327fee9cc987 Mon Sep 17 00:00:00 2001 From: Jackson Coxson Date: Wed, 9 Jul 2025 21:37:58 -0600 Subject: [PATCH] Replace static str with borrowed cow for service names --- idevice/src/lib.rs | 2 +- idevice/src/services/afc/mod.rs | 2 +- idevice/src/services/amfi.rs | 2 +- idevice/src/services/core_device_proxy.rs | 2 +- idevice/src/services/crashreportcopymobile.rs | 2 +- idevice/src/services/heartbeat.rs | 2 +- idevice/src/services/house_arrest.rs | 2 +- idevice/src/services/installation_proxy.rs | 2 +- idevice/src/services/lockdown.rs | 2 +- idevice/src/services/misagent.rs | 2 +- idevice/src/services/mobile_image_mounter.rs | 2 +- idevice/src/services/os_trace_relay.rs | 2 +- idevice/src/services/springboardservices.rs | 2 +- idevice/src/services/syslog_relay.rs | 2 +- idevice/src/util.rs | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/idevice/src/lib.rs b/idevice/src/lib.rs index 88bea96..57110cf 100644 --- a/idevice/src/lib.rs +++ b/idevice/src/lib.rs @@ -54,7 +54,7 @@ impl ReadWrit /// device connection protocol. pub trait IdeviceService: Sized { /// Returns the service name as advertised by the device - fn service_name() -> &'static str; + fn service_name() -> std::borrow::Cow<'static, str>; /// Establishes a connection to this service /// diff --git a/idevice/src/services/afc/mod.rs b/idevice/src/services/afc/mod.rs index 19d5e2e..c84a692 100644 --- a/idevice/src/services/afc/mod.rs +++ b/idevice/src/services/afc/mod.rs @@ -61,7 +61,7 @@ pub struct DeviceInfo { } impl IdeviceService for AfcClient { - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.afc") } diff --git a/idevice/src/services/amfi.rs b/idevice/src/services/amfi.rs index aa28176..41c92bd 100644 --- a/idevice/src/services/amfi.rs +++ b/idevice/src/services/amfi.rs @@ -12,7 +12,7 @@ pub struct AmfiClient { impl IdeviceService for AmfiClient { /// Returns the amfi service name as registered with lockdownd - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.amfi.lockdown") } diff --git a/idevice/src/services/core_device_proxy.rs b/idevice/src/services/core_device_proxy.rs index 18ff69e..6c714e3 100644 --- a/idevice/src/services/core_device_proxy.rs +++ b/idevice/src/services/core_device_proxy.rs @@ -93,7 +93,7 @@ pub struct CoreDeviceProxy { impl IdeviceService for CoreDeviceProxy { /// Returns the name of the service used for launching the CoreDeviceProxy. - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.internal.devicecompute.CoreDeviceProxy") } diff --git a/idevice/src/services/crashreportcopymobile.rs b/idevice/src/services/crashreportcopymobile.rs index 8a26949..79b7192 100644 --- a/idevice/src/services/crashreportcopymobile.rs +++ b/idevice/src/services/crashreportcopymobile.rs @@ -22,7 +22,7 @@ pub struct CrashReportCopyMobileClient { impl IdeviceService for CrashReportCopyMobileClient { /// Returns the name of the CrashReportCopyMobile service. - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.crashreportcopymobile") } diff --git a/idevice/src/services/heartbeat.rs b/idevice/src/services/heartbeat.rs index c94ae6b..cf8d144 100644 --- a/idevice/src/services/heartbeat.rs +++ b/idevice/src/services/heartbeat.rs @@ -19,7 +19,7 @@ pub struct HeartbeatClient { impl IdeviceService for HeartbeatClient { /// Returns the heartbeat service name as registered with lockdownd - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.mobile.heartbeat") } diff --git a/idevice/src/services/house_arrest.rs b/idevice/src/services/house_arrest.rs index 1c7cf51..2a4c619 100644 --- a/idevice/src/services/house_arrest.rs +++ b/idevice/src/services/house_arrest.rs @@ -21,7 +21,7 @@ pub struct HouseArrestClient { impl IdeviceService for HouseArrestClient { /// Returns the name of the HouseArrest service as registered with lockdownd - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.mobile.house_arrest") } diff --git a/idevice/src/services/installation_proxy.rs b/idevice/src/services/installation_proxy.rs index 4061d65..f338d5d 100644 --- a/idevice/src/services/installation_proxy.rs +++ b/idevice/src/services/installation_proxy.rs @@ -21,7 +21,7 @@ pub struct InstallationProxyClient { impl IdeviceService for InstallationProxyClient { /// Returns the installation proxy service name as registered with lockdownd - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.mobile.installation_proxy") } diff --git a/idevice/src/services/lockdown.rs b/idevice/src/services/lockdown.rs index ad7e847..46a3589 100644 --- a/idevice/src/services/lockdown.rs +++ b/idevice/src/services/lockdown.rs @@ -22,7 +22,7 @@ pub struct LockdownClient { impl IdeviceService for LockdownClient { /// Returns the lockdown service name as registered with the device - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.mobile.lockdown") } diff --git a/idevice/src/services/misagent.rs b/idevice/src/services/misagent.rs index be2e093..0018ba1 100644 --- a/idevice/src/services/misagent.rs +++ b/idevice/src/services/misagent.rs @@ -21,7 +21,7 @@ pub struct MisagentClient { impl IdeviceService for MisagentClient { /// Returns the misagent service name as registered with lockdownd - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.misagent") } diff --git a/idevice/src/services/mobile_image_mounter.rs b/idevice/src/services/mobile_image_mounter.rs index 0430204..78c71d6 100644 --- a/idevice/src/services/mobile_image_mounter.rs +++ b/idevice/src/services/mobile_image_mounter.rs @@ -29,7 +29,7 @@ pub struct ImageMounter { impl IdeviceService for ImageMounter { /// Returns the image mounter service name as registered with lockdownd - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.mobile.mobile_image_mounter") } diff --git a/idevice/src/services/os_trace_relay.rs b/idevice/src/services/os_trace_relay.rs index 16819a4..8ff203d 100644 --- a/idevice/src/services/os_trace_relay.rs +++ b/idevice/src/services/os_trace_relay.rs @@ -17,7 +17,7 @@ pub struct OsTraceRelayClient { impl IdeviceService for OsTraceRelayClient { /// Returns the OsTraceRelay service name as registered with lockdownd - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.os_trace_relay") } diff --git a/idevice/src/services/springboardservices.rs b/idevice/src/services/springboardservices.rs index 3fd4f45..a2da261 100644 --- a/idevice/src/services/springboardservices.rs +++ b/idevice/src/services/springboardservices.rs @@ -16,7 +16,7 @@ pub struct SpringBoardServicesClient { impl IdeviceService for SpringBoardServicesClient { /// Returns the SpringBoard services name as registered with lockdownd - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.springboardservices") } diff --git a/idevice/src/services/syslog_relay.rs b/idevice/src/services/syslog_relay.rs index a4ac3c0..3553757 100644 --- a/idevice/src/services/syslog_relay.rs +++ b/idevice/src/services/syslog_relay.rs @@ -10,7 +10,7 @@ pub struct SyslogRelayClient { impl IdeviceService for SyslogRelayClient { /// Returns the SyslogRelay service name as registered with lockdownd - fn service_name() -> &'static str { + fn service_name() -> std::borrow::Cow<'static, str> { obf!("com.apple.syslog_relay") } diff --git a/idevice/src/util.rs b/idevice/src/util.rs index 39b0a2d..3b555db 100644 --- a/idevice/src/util.rs +++ b/idevice/src/util.rs @@ -132,7 +132,7 @@ macro_rules! obf { ($lit:literal) => {{ #[cfg(feature = "obfuscate")] { - obfstr::xref!($lit) + std::borrow::Cow::Owned(obfstr::obfstr!($lit).to_string()) } #[cfg(not(feature = "obfuscate"))] {