diff options
Diffstat (limited to 'src/idevice.c')
| -rw-r--r-- | src/idevice.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/idevice.c b/src/idevice.c index 382e9d2..fd1f4b5 100644 --- a/src/idevice.c +++ b/src/idevice.c | |||
| @@ -320,7 +320,7 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connect(idevice_t device, uint16_t | |||
| 320 | new_connection->type = CONNECTION_USBMUXD; | 320 | new_connection->type = CONNECTION_USBMUXD; |
| 321 | new_connection->data = (void*)(long)sfd; | 321 | new_connection->data = (void*)(long)sfd; |
| 322 | new_connection->ssl_data = NULL; | 322 | new_connection->ssl_data = NULL; |
| 323 | idevice_get_udid(device, &new_connection->udid); | 323 | new_connection->device = device; |
| 324 | *connection = new_connection; | 324 | *connection = new_connection; |
| 325 | return IDEVICE_E_SUCCESS; | 325 | return IDEVICE_E_SUCCESS; |
| 326 | } else { | 326 | } else { |
| @@ -348,9 +348,6 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_disconnect(idevice_connection_t con | |||
| 348 | debug_info("Unknown connection type %d", connection->type); | 348 | debug_info("Unknown connection type %d", connection->type); |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | if (connection->udid) | ||
| 352 | free(connection->udid); | ||
| 353 | |||
| 354 | free(connection); | 351 | free(connection); |
| 355 | connection = NULL; | 352 | connection = NULL; |
| 356 | 353 | ||
| @@ -759,9 +756,9 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_enable_ssl(idevice_conne | |||
| 759 | #endif | 756 | #endif |
| 760 | plist_t pair_record = NULL; | 757 | plist_t pair_record = NULL; |
| 761 | 758 | ||
| 762 | userpref_read_pair_record(connection->udid, &pair_record); | 759 | userpref_read_pair_record(connection->device->udid, &pair_record); |
| 763 | if (!pair_record) { | 760 | if (!pair_record) { |
| 764 | debug_info("ERROR: Failed enabling SSL. Unable to read pair record for udid %s.", connection->udid); | 761 | debug_info("ERROR: Failed enabling SSL. Unable to read pair record for udid %s.", connection->device->udid); |
| 765 | return ret; | 762 | return ret; |
| 766 | } | 763 | } |
| 767 | 764 | ||
| @@ -789,16 +786,27 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_enable_ssl(idevice_conne | |||
| 789 | return ret; | 786 | return ret; |
| 790 | } | 787 | } |
| 791 | 788 | ||
| 792 | /* force use of TLSv1 */ | 789 | #if OPENSSL_VERSION_NUMBER < 0x10100002L || \ |
| 790 | (defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER < 0x2060000fL)) | ||
| 791 | /* force use of TLSv1 for older devices */ | ||
| 792 | if (connection->device->version < DEVICE_VERSION(10,0,0)) { | ||
| 793 | #ifdef SSL_OP_NO_TLSv1_1 | 793 | #ifdef SSL_OP_NO_TLSv1_1 |
| 794 | int opts = SSL_OP_NO_TLSv1_1; | 794 | long opts = SSL_CTX_get_options(ssl_ctx); |
| 795 | opts |= SSL_OP_NO_TLSv1_1; | ||
| 795 | #ifdef SSL_OP_NO_TLSv1_2 | 796 | #ifdef SSL_OP_NO_TLSv1_2 |
| 796 | opts |= SSL_OP_NO_TLSv1_2; | 797 | opts |= SSL_OP_NO_TLSv1_2; |
| 797 | #endif | 798 | #endif |
| 798 | #ifdef SSL_OP_NO_TLSv1_3 | 799 | #ifdef SSL_OP_NO_TLSv1_3 |
| 799 | opts |= SSL_OP_NO_TLSv1_3; | 800 | opts |= SSL_OP_NO_TLSv1_3; |
| 801 | #endif | ||
| 802 | SSL_CTX_set_options(ssl_ctx, opts); | ||
| 800 | #endif | 803 | #endif |
| 801 | SSL_CTX_set_options(ssl_ctx, SSL_OP_ALL | opts); | 804 | } |
| 805 | #else | ||
| 806 | SSL_CTX_set_min_proto_version(ssl_ctx, TLS1_VERSION); | ||
| 807 | if (connection->device->version < DEVICE_VERSION(10,0,0)) { | ||
| 808 | SSL_CTX_set_max_proto_version(ssl_ctx, TLS1_VERSION); | ||
| 809 | } | ||
| 802 | #endif | 810 | #endif |
| 803 | 811 | ||
| 804 | BIO* membp; | 812 | BIO* membp; |
