diff options
Diffstat (limited to 'src/afc.c')
| -rw-r--r-- | src/afc.c | 12 |
1 files changed, 8 insertions, 4 deletions
| @@ -119,7 +119,7 @@ afc_error_t afc_client_new_from_connection(idevice_connection_t connection, afc_ | |||
| 119 | * @see afc_client_new_from_connection | 119 | * @see afc_client_new_from_connection |
| 120 | * | 120 | * |
| 121 | * @param device The device to connect to. | 121 | * @param device The device to connect to. |
| 122 | * @param port The destination port. | 122 | * @param service The service descriptor returned by lockdownd_start_service. |
| 123 | * @param client Pointer that will be set to a newly allocated afc_client_t | 123 | * @param client Pointer that will be set to a newly allocated afc_client_t |
| 124 | * upon successful return. | 124 | * upon successful return. |
| 125 | * | 125 | * |
| @@ -127,17 +127,21 @@ afc_error_t afc_client_new_from_connection(idevice_connection_t connection, afc_ | |||
| 127 | * invalid, AFC_E_MUX_ERROR if the connection cannot be established, | 127 | * invalid, AFC_E_MUX_ERROR if the connection cannot be established, |
| 128 | * or AFC_E_NO_MEM if there is a memory allocation problem. | 128 | * or AFC_E_NO_MEM if there is a memory allocation problem. |
| 129 | */ | 129 | */ |
| 130 | afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t * client) | 130 | afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t service, afc_client_t * client) |
| 131 | { | 131 | { |
| 132 | if (!device || port==0) | 132 | if (!device || service->port == 0) |
| 133 | return AFC_E_INVALID_ARG; | 133 | return AFC_E_INVALID_ARG; |
| 134 | 134 | ||
| 135 | /* attempt connection */ | 135 | /* attempt connection */ |
| 136 | idevice_connection_t connection = NULL; | 136 | idevice_connection_t connection = NULL; |
| 137 | if (idevice_connect(device, port, &connection) != IDEVICE_E_SUCCESS) { | 137 | if (idevice_connect(device, service->port, &connection) != IDEVICE_E_SUCCESS) { |
| 138 | return AFC_E_MUX_ERROR; | 138 | return AFC_E_MUX_ERROR; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | /* enable SSL if requested */ | ||
| 142 | if (service->ssl_enabled) | ||
| 143 | idevice_connection_enable_ssl(connection); | ||
| 144 | |||
| 141 | afc_error_t err = afc_client_new_from_connection(connection, client); | 145 | afc_error_t err = afc_client_new_from_connection(connection, client); |
| 142 | if (err != AFC_E_SUCCESS) { | 146 | if (err != AFC_E_SUCCESS) { |
| 143 | idevice_disconnect(connection); | 147 | idevice_disconnect(connection); |
