diff options
author | 2025-06-07 12:09:24 +0200 | |
---|---|---|
committer | 2025-06-07 12:09:24 +0200 | |
commit | e3f2d6070de7125058c343ef63961c27bc991bb6 (patch) | |
tree | 2436f76213b34ba2e06db96a990a6f0e17106e6e /src/idevice.c | |
parent | 2e1ee28bf1d744edcf3513859a38ac5f6615b096 (diff) | |
download | libimobiledevice-e3f2d6070de7125058c343ef63961c27bc991bb6.tar.gz libimobiledevice-e3f2d6070de7125058c343ef63961c27bc991bb6.tar.bz2 |
Add new idevice_get_device_version() to interface
This allows getting a numerical representation of the device's
ProductVersion string for easier version range checks
Diffstat (limited to 'src/idevice.c')
-rw-r--r-- | src/idevice.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/idevice.c b/src/idevice.c index e9c909f..1cdfef2 100644 --- a/src/idevice.c +++ b/src/idevice.c @@ -946,6 +946,20 @@ idevice_error_t idevice_get_udid(idevice_t device, char **udid) return IDEVICE_E_SUCCESS; } +unsigned int idevice_get_device_version(idevice_t device) +{ + if (!device) { + return 0; + } + if (!device->version) { + lockdownd_client_t lockdown = NULL; + lockdownd_client_new(device, &lockdown, NULL); + // we don't handle any errors here. We should have the product version cached now. + lockdownd_client_free(lockdown); + } + return device->version; +} + #if defined(HAVE_OPENSSL) || defined(HAVE_GNUTLS) typedef ssize_t ssl_cb_ret_type_t; #elif defined(HAVE_MBEDTLS) @@ -1229,7 +1243,7 @@ idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection) #if OPENSSL_VERSION_NUMBER < 0x10100002L || \ (defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER < 0x2060000fL)) /* force use of TLSv1 for older devices */ - if (connection->device->version < DEVICE_VERSION(10,0,0)) { + if (connection->device->version < IDEVICE_DEVICE_VERSION(10,0,0)) { #ifdef SSL_OP_NO_TLSv1_1 SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1_1); #endif |