diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lockdown.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/src/lockdown.c b/src/lockdown.c index 5717e52..69ccf34 100644 --- a/src/lockdown.c +++ b/src/lockdown.c | |||
| @@ -618,9 +618,9 @@ lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **de | |||
| 618 | return ret; | 618 | return ret; |
| 619 | } | 619 | } |
| 620 | 620 | ||
| 621 | /** Creates a lockdownd client for the give iPhone | 621 | /** Creates a lockdownd client for the device. |
| 622 | * | 622 | * |
| 623 | * @param phone The iPhone to create a lockdownd client for | 623 | * @param phone The device to create a lockdownd client for |
| 624 | * @param client The pointer to the location of the new lockdownd_client | 624 | * @param client The pointer to the location of the new lockdownd_client |
| 625 | * @param label The label to use for communication. Usually the program name | 625 | * @param label The label to use for communication. Usually the program name |
| 626 | * | 626 | * |
| @@ -630,9 +630,8 @@ lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_ | |||
| 630 | { | 630 | { |
| 631 | if (!client) | 631 | if (!client) |
| 632 | return LOCKDOWN_E_INVALID_ARG; | 632 | return LOCKDOWN_E_INVALID_ARG; |
| 633 | |||
| 633 | lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; | 634 | lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; |
| 634 | char *host_id = NULL; | ||
| 635 | char *type = NULL; | ||
| 636 | 635 | ||
| 637 | property_list_service_client_t plistclient = NULL; | 636 | property_list_service_client_t plistclient = NULL; |
| 638 | if (property_list_service_client_new(device, 0xf27e, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { | 637 | if (property_list_service_client_new(device, 0xf27e, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { |
| @@ -651,6 +650,39 @@ lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_ | |||
| 651 | if (label != NULL) | 650 | if (label != NULL) |
| 652 | strdup(label); | 651 | strdup(label); |
| 653 | 652 | ||
| 653 | if (LOCKDOWN_E_SUCCESS == ret) { | ||
| 654 | *client = client_loc; | ||
| 655 | } else { | ||
| 656 | lockdownd_client_free(client_loc); | ||
| 657 | } | ||
| 658 | |||
| 659 | return ret; | ||
| 660 | } | ||
| 661 | |||
| 662 | /** Creates a lockdownd client for the device and starts initial handshake. | ||
| 663 | * The handshake consists of query_type, validate_pair, pair and | ||
| 664 | * start_session calls. | ||
| 665 | * | ||
| 666 | * @param phone The device to create a lockdownd client for | ||
| 667 | * @param client The pointer to the location of the new lockdownd_client | ||
| 668 | * @param label The label to use for communication. Usually the program name | ||
| 669 | * | ||
| 670 | * @return an error code (LOCKDOWN_E_SUCCESS on success) | ||
| 671 | */ | ||
| 672 | lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lockdownd_client_t *client, const char *label) | ||
| 673 | { | ||
| 674 | if (!client) | ||
| 675 | return LOCKDOWN_E_INVALID_ARG; | ||
| 676 | |||
| 677 | lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; | ||
| 678 | lockdownd_client_t client_loc = NULL; | ||
| 679 | char *host_id = NULL; | ||
| 680 | char *type = NULL; | ||
| 681 | |||
| 682 | |||
| 683 | ret = lockdownd_client_new(device, &client_loc, label); | ||
| 684 | |||
| 685 | /* perform handshake */ | ||
| 654 | if (LOCKDOWN_E_SUCCESS != lockdownd_query_type(client_loc, &type)) { | 686 | if (LOCKDOWN_E_SUCCESS != lockdownd_query_type(client_loc, &type)) { |
| 655 | log_debug_msg("%s: QueryType failed in the lockdownd client.\n", __func__); | 687 | log_debug_msg("%s: QueryType failed in the lockdownd client.\n", __func__); |
| 656 | ret = LOCKDOWN_E_NOT_ENOUGH_DATA; | 688 | ret = LOCKDOWN_E_NOT_ENOUGH_DATA; |
