summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2018-09-29 22:59:25 +0200
committerGravatar Nikias Bassen2018-09-29 22:59:25 +0200
commitf1ee0fd8b2b1dd65c64f5a67e208efc708295caa (patch)
treea12c295d65fd88e5452aeff813daba83a493241b
parent05fefa6aeff45fc84665e8427444295d8414df98 (diff)
downloadlibimobiledevice-f1ee0fd8b2b1dd65c64f5a67e208efc708295caa.tar.gz
libimobiledevice-f1ee0fd8b2b1dd65c64f5a67e208efc708295caa.tar.bz2
lockdown: Pass along usbmux device id when saving pair records
-rw-r--r--common/userpref.c5
-rw-r--r--common/userpref.h2
-rw-r--r--configure.ac2
-rw-r--r--src/lockdown.c3
-rw-r--r--src/lockdown.h1
5 files changed, 8 insertions, 5 deletions
diff --git a/common/userpref.c b/common/userpref.c
index be745cb..0fa5b96 100644
--- a/common/userpref.c
+++ b/common/userpref.c
@@ -273,19 +273,20 @@ userpref_error_t userpref_get_paired_udids(char ***list, unsigned int *count)
* Save a pair record for a device.
*
* @param udid The device UDID as given by the device
+ * @param device_id The usbmux device id (handle) of the connected device, or 0
* @param pair_record The pair record to save
*
* @return 1 on success and 0 if no device record is given or if it has already
* been saved previously.
*/
-userpref_error_t userpref_save_pair_record(const char *udid, plist_t pair_record)
+userpref_error_t userpref_save_pair_record(const char *udid, uint32_t device_id, plist_t pair_record)
{
char* record_data = NULL;
uint32_t record_size = 0;
plist_to_bin(pair_record, &record_data, &record_size);
- int res = usbmuxd_save_pair_record(udid, record_data, record_size);
+ int res = usbmuxd_save_pair_record_with_device_id(udid, device_id, record_data, record_size);
free(record_data);
diff --git a/common/userpref.h b/common/userpref.h
index 84fea53..4ea630f 100644
--- a/common/userpref.h
+++ b/common/userpref.h
@@ -64,7 +64,7 @@ typedef enum {
const char *userpref_get_config_dir(void);
int userpref_read_system_buid(char **system_buid);
userpref_error_t userpref_read_pair_record(const char *udid, plist_t *pair_record);
-userpref_error_t userpref_save_pair_record(const char *udid, plist_t pair_record);
+userpref_error_t userpref_save_pair_record(const char *udid, uint32_t device_id, plist_t pair_record);
userpref_error_t userpref_delete_pair_record(const char *udid);
userpref_error_t pair_record_generate_keys_and_certs(plist_t pair_record, key_data_t public_key);
diff --git a/configure.ac b/configure.ac
index e41baa3..ec210fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@ dnl libtool versioning
LIBIMOBILEDEVICE_SO_VERSION=6:0:0
dnl Minimum package versions
-LIBUSBMUXD_VERSION=1.0.9
+LIBUSBMUXD_VERSION=1.1.0
LIBPLIST_VERSION=1.11
LIBPLISTMM_VERSION=1.11
diff --git a/src/lockdown.c b/src/lockdown.c
index 9d6d17d..2492897 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -668,6 +668,7 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_new(idevice_t device, lo
client_loc->parent = plistclient;
client_loc->ssl_enabled = 0;
client_loc->session_id = NULL;
+ client_loc->mux_id = device->mux_id;
if (idevice_get_udid(device, &client_loc->udid) != IDEVICE_E_SUCCESS) {
debug_info("failed to get device udid.");
@@ -1001,7 +1002,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_
wifi_node = NULL;
}
- userpref_save_pair_record(client->udid, pair_record_plist);
+ userpref_save_pair_record(client->udid, client->mux_id, pair_record_plist);
}
}
} else {
diff --git a/src/lockdown.h b/src/lockdown.h
index ab63e86..bf595df 100644
--- a/src/lockdown.h
+++ b/src/lockdown.h
@@ -34,6 +34,7 @@ struct lockdownd_client_private {
char *session_id;
char *udid;
char *label;
+ uint32_t mux_id;
};
#endif