diff options
| -rw-r--r-- | tools/ideviceimagemounter.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c index 0117d17..90c5190 100644 --- a/tools/ideviceimagemounter.c +++ b/tools/ideviceimagemounter.c | |||
| @@ -268,23 +268,14 @@ int main(int argc, char **argv) | |||
| 268 | goto leave; | 268 | goto leave; |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | plist_t pver = NULL; | 271 | unsigned int device_version = idevice_get_device_version(device); |
| 272 | char *product_version = NULL; | 272 | |
| 273 | lockdownd_get_value(lckd, NULL, "ProductVersion", &pver); | ||
| 274 | if (pver && plist_get_node_type(pver) == PLIST_STRING) { | ||
| 275 | plist_get_string_val(pver, &product_version); | ||
| 276 | } | ||
| 277 | disk_image_upload_type_t disk_image_upload_type = DISK_IMAGE_UPLOAD_TYPE_AFC; | 273 | disk_image_upload_type_t disk_image_upload_type = DISK_IMAGE_UPLOAD_TYPE_AFC; |
| 278 | int product_version_major = 0; | 274 | if (device_version >= IDEVICE_DEVICE_VERSION(7,0,0)) { |
| 279 | int product_version_minor = 0; | 275 | disk_image_upload_type = DISK_IMAGE_UPLOAD_TYPE_UPLOAD_IMAGE; |
| 280 | if (product_version) { | ||
| 281 | if (sscanf(product_version, "%d.%d.%*d", &product_version_major, &product_version_minor) == 2) { | ||
| 282 | if (product_version_major >= 7) | ||
| 283 | disk_image_upload_type = DISK_IMAGE_UPLOAD_TYPE_UPLOAD_IMAGE; | ||
| 284 | } | ||
| 285 | } | 276 | } |
| 286 | 277 | ||
| 287 | if (product_version_major >= 16) { | 278 | if (device_version >= IDEVICE_DEVICE_VERSION(16,0,0)) { |
| 288 | uint8_t dev_mode_status = 0; | 279 | uint8_t dev_mode_status = 0; |
| 289 | plist_t val = NULL; | 280 | plist_t val = NULL; |
| 290 | ldret = lockdownd_get_value(lckd, "com.apple.security.mac.amfi", "DeveloperModeStatus", &val); | 281 | ldret = lockdownd_get_value(lckd, "com.apple.security.mac.amfi", "DeveloperModeStatus", &val); |
| @@ -337,7 +328,7 @@ int main(int argc, char **argv) | |||
| 337 | goto leave; | 328 | goto leave; |
| 338 | } | 329 | } |
| 339 | image_size = fst.st_size; | 330 | image_size = fst.st_size; |
| 340 | if (product_version_major < 17 && stat(image_sig_path, &fst) != 0) { | 331 | if (device_version < IDEVICE_DEVICE_VERSION(17,0,0) && stat(image_sig_path, &fst) != 0) { |
| 341 | fprintf(stderr, "ERROR: stat: %s: %s\n", image_sig_path, strerror(errno)); | 332 | fprintf(stderr, "ERROR: stat: %s: %s\n", image_sig_path, strerror(errno)); |
| 342 | goto leave; | 333 | goto leave; |
| 343 | } | 334 | } |
| @@ -352,7 +343,7 @@ int main(int argc, char **argv) | |||
| 352 | if (cmd == CMD_LIST) { | 343 | if (cmd == CMD_LIST) { |
| 353 | /* list mounts mode */ | 344 | /* list mounts mode */ |
| 354 | if (!imagetype) { | 345 | if (!imagetype) { |
| 355 | if (product_version_major < 17) { | 346 | if (device_version < IDEVICE_DEVICE_VERSION(17,0,0)) { |
| 356 | imagetype = "Developer"; | 347 | imagetype = "Developer"; |
| 357 | } else { | 348 | } else { |
| 358 | imagetype = "Personalized"; | 349 | imagetype = "Personalized"; |
| @@ -372,7 +363,7 @@ int main(int argc, char **argv) | |||
| 372 | struct stat fst; | 363 | struct stat fst; |
| 373 | plist_t mount_options = NULL; | 364 | plist_t mount_options = NULL; |
| 374 | 365 | ||
| 375 | if (product_version_major < 17) { | 366 | if (device_version < IDEVICE_DEVICE_VERSION(17,0,0)) { |
| 376 | f = fopen(image_sig_path, "rb"); | 367 | f = fopen(image_sig_path, "rb"); |
| 377 | if (!f) { | 368 | if (!f) { |
| 378 | fprintf(stderr, "Error opening signature file '%s': %s\n", image_sig_path, strerror(errno)); | 369 | fprintf(stderr, "Error opening signature file '%s': %s\n", image_sig_path, strerror(errno)); |
