diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/iphone.c | 12 | ||||
| -rw-r--r-- | src/lockdown.c | 21 |
2 files changed, 16 insertions, 17 deletions
diff --git a/src/iphone.c b/src/iphone.c index 0e179e7..93d7b5d 100644 --- a/src/iphone.c +++ b/src/iphone.c | |||
| @@ -104,13 +104,13 @@ uint32_t iphone_get_device_handle(iphone_device_t device) | |||
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | char* iphone_get_uuid(iphone_device_t device) | 107 | iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid) |
| 108 | { | 108 | { |
| 109 | if (device) { | 109 | if (!device) |
| 110 | return device->serial_number; | 110 | return IPHONE_E_INVALID_ARG; |
| 111 | } else { | 111 | |
| 112 | return NULL; | 112 | *uuid = strdup(device->serial_number); |
| 113 | } | 113 | return IPHONE_E_SUCCESS; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | /** Cleans up an iPhone structure, then frees the structure itself. | 116 | /** Cleans up an iPhone structure, then frees the structure itself. |
diff --git a/src/lockdown.c b/src/lockdown.c index bfb44d0..3d2b04c 100644 --- a/src/lockdown.c +++ b/src/lockdown.c | |||
| @@ -673,24 +673,24 @@ iphone_error_t lockdownd_new_client(iphone_device_t device, lockdownd_client_t * | |||
| 673 | ret = IPHONE_E_NOT_ENOUGH_DATA; | 673 | ret = IPHONE_E_NOT_ENOUGH_DATA; |
| 674 | } | 674 | } |
| 675 | 675 | ||
| 676 | char *uid = NULL; | 676 | char *uuid = NULL; |
| 677 | ret = lockdownd_get_device_uid(client_loc, &uid); | 677 | ret = iphone_device_get_uuid(device, &uuid); |
| 678 | if (IPHONE_E_SUCCESS != ret) { | 678 | if (IPHONE_E_SUCCESS != ret) { |
| 679 | log_debug_msg("%s: failed to get device uuid.\n", __func__); | 679 | log_debug_msg("%s: failed to get device uuid.\n", __func__); |
| 680 | } | 680 | } |
| 681 | log_debug_msg("%s: device uuid: %s\n", __func__, uid); | 681 | log_debug_msg("%s: device uuid: %s\n", __func__, uuid); |
| 682 | 682 | ||
| 683 | host_id = get_host_id(); | 683 | host_id = get_host_id(); |
| 684 | if (IPHONE_E_SUCCESS == ret && !host_id) { | 684 | if (IPHONE_E_SUCCESS == ret && !host_id) { |
| 685 | ret = IPHONE_E_INVALID_CONF; | 685 | ret = IPHONE_E_INVALID_CONF; |
| 686 | } | 686 | } |
| 687 | 687 | ||
| 688 | if (IPHONE_E_SUCCESS == ret && !is_device_known(uid)) | 688 | if (IPHONE_E_SUCCESS == ret && !is_device_known(uuid)) |
| 689 | ret = lockdownd_pair(client_loc, uid, host_id); | 689 | ret = lockdownd_pair(client_loc, uuid, host_id); |
| 690 | 690 | ||
| 691 | if (uid) { | 691 | if (uuid) { |
| 692 | free(uid); | 692 | free(uuid); |
| 693 | uid = NULL; | 693 | uuid = NULL; |
| 694 | } | 694 | } |
| 695 | 695 | ||
| 696 | if (IPHONE_E_SUCCESS == ret) { | 696 | if (IPHONE_E_SUCCESS == ret) { |
| @@ -779,9 +779,8 @@ iphone_error_t lockdownd_pair(lockdownd_client_t client, char *uid, char *host_i | |||
| 779 | 779 | ||
| 780 | /* store public key in config if pairing succeeded */ | 780 | /* store public key in config if pairing succeeded */ |
| 781 | if (ret == IPHONE_E_SUCCESS) { | 781 | if (ret == IPHONE_E_SUCCESS) { |
| 782 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: pair success\n", __func__); | 782 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: pair success\n", __func__); |
| 783 | store_device_public_key(uid, public_key); | 783 | store_device_public_key(uuid, public_key); |
| 784 | ret = IPHONE_E_SUCCESS; | ||
| 785 | } else { | 784 | } else { |
| 786 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: pair failure\n", __func__); | 785 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: pair failure\n", __func__); |
| 787 | ret = IPHONE_E_PAIRING_FAILED; | 786 | ret = IPHONE_E_PAIRING_FAILED; |
