1399 Commits

Author SHA1 Message Date
Luke Street 1ea7813c76 Use DLL_EXPORT condition for DllMain 2018-01-29 17:27:05 -05:00
Nikias Bassen 3a37a4e4a3 idevicesyslog: Wait for passcode entry on device when required
After device bootup several services cannot be used until the passcode
is entered on the device. This commit will detect this state and wait for
the passcode to be entered. Before this change you would have to restart
idevicesyslog or replug the device after entering the passcode to make
the logging work again.
2018-01-17 13:10:05 +02:00
Nikias Bassen 344729536e lockdown: Plug small memory leak
Credit to Rudolf Tammekivi (Blefish), see issue #599
2017-12-08 00:42:38 +07:00
Nikias Bassen b7feed9f5a mobileactivation: Allow passing activation response headers as required for iOS 11.2+
When activating in session mode - which is required for newer iOS versions -
we can now pass the activation response headers with the activation command.
For iOS 11.2+ this is mandatory or the activation will fail.
2017-12-07 16:48:36 +07:00
Nikias Bassen 5b3fcb7fa7 mobileactivation: Don't convert activation record if it is already passed as PLIST_DATA 2017-12-07 16:41:29 +07:00
Nikias Bassen 5a85432719 lockdown: Don't explicitly validate pairing unless we're dealing with an older device
On newer iOS version, ValidatePair is not mandatory to gain trusted host
status. Starting with iOS 11, the ValidatePair request has been removed from
lockdownd and will throw an error. This commit adds a version check so that
ValidatePair is only called on devices prior iOS 7.
2017-08-13 00:12:16 +02:00
Nikias Bassen 0dbe76b4e7 mobileactivation: Add new functions required for drmHandshake / session mode device activation 2017-07-03 03:09:35 +02:00
Nikias Bassen 5250024b53 Add basic mobileactivation service implementation 2017-06-29 02:43:29 +02:00
Nikias Bassen 835d84b678 idevicescreenshot: Detect screenshot image format to determine file extension 2017-06-18 04:10:57 +02:00
Nikias Bassen 53fede06af Updated README with some notes about configuration options 2017-04-28 20:58:53 +02:00
Nikos Mavrogiannopoulos 0cf6bb6f5b gnutls: check for interrupted gnutls_handshake()
That is, recover if gnutls_handshake() returns with non fatal
error codes like GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN.
2017-04-27 14:37:13 +02:00
Nikias Bassen a5b2266b4e cython: Fix build error after error constant rename 2017-04-27 14:32:49 +02:00
Christophe Fergeau b89e4823ef #ifdef out code which is a no-op with OpenSSL 1.1.0
CRYPTO_set_id_callback
CRYPTO_set_locking_callback
EVP_cleanup
CRYPTO_cleanup_all_ex_data
SSL_COMP_free_compression_methods

are all no-ops with OpenSSL 1.1.0, so we can #ifdef out the
corresponding code. This cleans up some warnings about
id_function/locking_function being defined but unused (as the calls to
CRYPTO_set_id_callback and CRYPTO_set_locking_callback disappear at
preprocessing time).

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-26 15:21:02 +02:00
Christophe Fergeau f635812ccc Don't use ERR_remove_thread_state() with OpenSSL 1.1.0
It's deprecated and causes compile-time warnings. We don't want to
fallback to ERR_remove_state() either as it's similarly deprecated.

This commit adds a helper functions to hide the #ifdef mess between
the various openssl versions.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-26 15:21:02 +02:00
Christophe Fergeau 02a0e03e24 Avoid double free with OpenSSL 1.1.0
Since commit OpenSSL_1_1_0-pre3~178
https://github.com/openssl/openssl/commit/b184e3ef73200cb3b7914a603b43a5b8a074c85f
OpenSSL automatically cleans up some of its internal data when the
program exits. This conflicts with some similar clean up
libimobiledevice attempts to do, which causes a double-free.
SSL_COMP_free_compression_methods() was available in OpenSSL 1.0.2,
and is still there in 1.1.0 as a no-op, so we can use that to free
the compression methods.

This bug can be hit with a simple idevicebackup2 --help

==14299== Invalid read of size 4
==14299==    at 0x547AEBC: OPENSSL_sk_pop_free (stack.c:263)
==14299==    by 0x508B848: ssl_library_stop (ssl_init.c:182)
==14299==    by 0x5424D11: OPENSSL_cleanup (init.c:402)
==14299==    by 0x5DC3134: __cxa_finalize (cxa_finalize.c:56)
==14299==    by 0x53332B2: ??? (in /usr/lib64/libcrypto.so.1.1.0e)
==14299==    by 0x4011232: _dl_fini (dl-fini.c:235)
==14299==    by 0x5DC2DC7: __run_exit_handlers (exit.c:83)
==14299==    by 0x5DC2E19: exit (exit.c:105)
==14299==    by 0x5DA8604: (below main) (libc-start.c:329)
==14299==  Address 0x6585590 is 0 bytes inside a block of size 40 free'd
==14299==    at 0x4C2FCC8: free (vg_replace_malloc.c:530)
==14299==    by 0x4E43381: sk_SSL_COMP_free (ssl.h:830)
==14299==    by 0x4E434E7: internal_idevice_deinit (idevice.c:103)
==14299==    by 0x5B79643: __pthread_once_slow (pthread_once.c:116)
==14299==    by 0x4E5663A: thread_once (thread.c:104)
==14299==    by 0x4E43525: libimobiledevice_deinitialize (idevice.c:140)
==14299==    by 0x4011232: _dl_fini (dl-fini.c:235)
==14299==    by 0x5DC2DC7: __run_exit_handlers (exit.c:83)
==14299==    by 0x5DC2E19: exit (exit.c:105)
==14299==    by 0x5DA8604: (below main) (libc-start.c:329)
==14299==  Block was alloc'd at
==14299==    at 0x4C2EB1B: malloc (vg_replace_malloc.c:299)
==14299==    by 0x5428908: CRYPTO_zalloc (mem.c:100)
==14299==    by 0x547A9AE: OPENSSL_sk_new (stack.c:108)
==14299==    by 0x5087D43: sk_SSL_COMP_new (ssl.h:830)
==14299==    by 0x5087D43: do_load_builtin_compressions (ssl_ciph.c:482)
==14299==    by 0x5087D43: do_load_builtin_compressions_ossl_ (ssl_ciph.c:476)
==14299==    by 0x5B79643: __pthread_once_slow (pthread_once.c:116)
==14299==    by 0x547B198: CRYPTO_THREAD_run_once (threads_pthread.c:106)
==14299==    by 0x5089F96: load_builtin_compressions (ssl_ciph.c:500)
==14299==    by 0x5089F96: SSL_COMP_get_compression_methods (ssl_ciph.c:1845)
==14299==    by 0x508B68B: ossl_init_ssl_base (ssl_init.c:125)
==14299==    by 0x508B68B: ossl_init_ssl_base_ossl_ (ssl_init.c:25)
==14299==    by 0x5B79643: __pthread_once_slow (pthread_once.c:116)
==14299==    by 0x547B198: CRYPTO_THREAD_run_once (threads_pthread.c:106)
==14299==    by 0x508B90A: OPENSSL_init_ssl (ssl_init.c:227)
==14299==    by 0x4E43416: internal_idevice_init (idevice.c:73)
=

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2017-04-26 11:36:46 +02:00
BALATON Zoltan 1d844aae78 Fix parameter check of instproxy_check_capabilities_match()
The capabilities parameter is a string array not a plist. Also check
other parameters when we are at it.
2017-04-08 15:48:23 +02:00
BALATON Zoltan f8999ef550 Define htobe16 if not defined 2017-04-08 15:48:23 +02:00
BALATON Zoltan 4bdea2983a Added IDEVICE_DEVICE_PAIRED event constant matching the corresponding
event number in libusbmuxd
2017-04-08 15:48:23 +02:00
BALATON Zoltan 5a8449a391 Propagate lower level errors to callers instead of returning unknown
error for most failures
2017-04-08 15:48:07 +02:00
Antoine Reversat 45fda819e1 property_list_service: Remove packet length check when receiving plist data
There are services that would send really large plist data, e.g. when listing
provisioning profiles. Instead of forcing the data to be less than 16MB we
try to allocate a buffer as large as requested. If the allocation fails the
function returns with an error.
2017-01-18 11:45:10 -08:00
Nikias Bassen b78a42e053 ideviceprovision: Silence compiler warning (missing parenthesis) 2017-01-04 20:28:59 +01:00
Nikias Bassen 038bb5902f Add ax_pthread.m4 for proper pthread cflags/ldflags 2016-12-31 02:59:36 +01:00
Nikias Bassen a80ba9363b ideviceprovision: Fix ASN1 parsing for large provisioning profiles 2016-12-22 14:40:46 +01:00
Nikias Bassen 2b8313181f cython: Make sure to pass correct CFLAGS for libplist 2016-12-21 01:29:54 +01:00
Nikias Bassen c7f24a92f2 idevicebackup2: Fix logical bug when checking for success of backup operation
The condition in line 2278 is incorrectly evaluated when
mb2_status_check_snapshot_state() isn't able to read the Status.plist file.
While `if (-1) { ... }` will be a 'false' condition, `if (1 && -1) { ... }`
will be 'true' which in this case would make idevicebackup2 assume the backup
was successful while it was not.
This commit fixes this issue by changing the default return value of
mb2_status_check_snapshot_state() to be 0 (false).

Thanks to Xiao Deng for pointing out this issue!
2016-12-15 02:57:31 +01:00