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) | |||
| 946 | return IDEVICE_E_SUCCESS; | 946 | return IDEVICE_E_SUCCESS; |
| 947 | } | 947 | } |
| 948 | 948 | ||
| 949 | unsigned int idevice_get_device_version(idevice_t device) | ||
| 950 | { | ||
| 951 | if (!device) { | ||
| 952 | return 0; | ||
| 953 | } | ||
| 954 | if (!device->version) { | ||
| 955 | lockdownd_client_t lockdown = NULL; | ||
| 956 | lockdownd_client_new(device, &lockdown, NULL); | ||
| 957 | // we don't handle any errors here. We should have the product version cached now. | ||
| 958 | lockdownd_client_free(lockdown); | ||
| 959 | } | ||
| 960 | return device->version; | ||
| 961 | } | ||
| 962 | |||
| 949 | #if defined(HAVE_OPENSSL) || defined(HAVE_GNUTLS) | 963 | #if defined(HAVE_OPENSSL) || defined(HAVE_GNUTLS) |
| 950 | typedef ssize_t ssl_cb_ret_type_t; | 964 | typedef ssize_t ssl_cb_ret_type_t; |
| 951 | #elif defined(HAVE_MBEDTLS) | 965 | #elif defined(HAVE_MBEDTLS) |
| @@ -1229,7 +1243,7 @@ idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection) | |||
| 1229 | #if OPENSSL_VERSION_NUMBER < 0x10100002L || \ | 1243 | #if OPENSSL_VERSION_NUMBER < 0x10100002L || \ |
| 1230 | (defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER < 0x2060000fL)) | 1244 | (defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER < 0x2060000fL)) |
| 1231 | /* force use of TLSv1 for older devices */ | 1245 | /* force use of TLSv1 for older devices */ |
| 1232 | if (connection->device->version < DEVICE_VERSION(10,0,0)) { | 1246 | if (connection->device->version < IDEVICE_DEVICE_VERSION(10,0,0)) { |
| 1233 | #ifdef SSL_OP_NO_TLSv1_1 | 1247 | #ifdef SSL_OP_NO_TLSv1_1 |
| 1234 | SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1_1); | 1248 | SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1_1); |
| 1235 | #endif | 1249 | #endif |
