summaryrefslogtreecommitdiffstats
path: root/tools/idevicepair.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2014-03-21 00:16:29 +0100
committerGravatar Martin Szulecki2014-03-21 00:16:29 +0100
commitd1ccd4eeebc94dac11140ae77b73392d0763d3a4 (patch)
treefb5fa6cab2bdaf55b28004921960d331db59bf7b /tools/idevicepair.c
parent88ce6113593158944630435678e689bf155d9a03 (diff)
downloadlibimobiledevice-d1ccd4eeebc94dac11140ae77b73392d0763d3a4.tar.gz
libimobiledevice-d1ccd4eeebc94dac11140ae77b73392d0763d3a4.tar.bz2
Refactor pair record handling to use new usbmuxd pair record interface
This refactoring is mandatory as libimobiledevice should not interact with the pair record configuration directory which is owned by the usbmuxd user. This change also adds compatibility for the native usbmuxd and thus pair records saved by iTunes.
Diffstat (limited to 'tools/idevicepair.c')
-rw-r--r--tools/idevicepair.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/idevicepair.c b/tools/idevicepair.c
index 91ed49b..5af95f0 100644
--- a/tools/idevicepair.c
+++ b/tools/idevicepair.c
@@ -134,7 +134,7 @@ int main(int argc, char **argv)
134 134
135 if (op == OP_SYSTEMBUID) { 135 if (op == OP_SYSTEMBUID) {
136 char *systembuid = NULL; 136 char *systembuid = NULL;
137 userpref_get_system_buid(&systembuid); 137 userpref_read_system_buid(&systembuid);
138 138
139 printf("%s\n", systembuid); 139 printf("%s\n", systembuid);
140 140
@@ -184,14 +184,20 @@ int main(int argc, char **argv)
184 } 184 }
185 185
186 if (op == OP_HOSTID) { 186 if (op == OP_HOSTID) {
187 plist_t pair_record = NULL;
187 char *hostid = NULL; 188 char *hostid = NULL;
188 userpref_device_record_get_host_id(udid, &hostid); 189
190 userpref_read_pair_record(udid, &pair_record);
191 pair_record_get_host_id(pair_record, &hostid);
189 192
190 printf("%s\n", hostid); 193 printf("%s\n", hostid);
191 194
192 if (hostid) 195 if (hostid)
193 free(hostid); 196 free(hostid);
194 197
198 if (pair_record)
199 plist_free(pair_record);
200
195 return EXIT_SUCCESS; 201 return EXIT_SUCCESS;
196 } 202 }
197 203
@@ -254,7 +260,7 @@ int main(int argc, char **argv)
254 lerr = lockdownd_unpair(client, NULL); 260 lerr = lockdownd_unpair(client, NULL);
255 if (lerr == LOCKDOWN_E_SUCCESS) { 261 if (lerr == LOCKDOWN_E_SUCCESS) {
256 /* also remove local device record */ 262 /* also remove local device record */
257 userpref_remove_device_record(udid); 263 userpref_delete_pair_record(udid);
258 printf("SUCCESS: Unpaired with device %s\n", udid); 264 printf("SUCCESS: Unpaired with device %s\n", udid);
259 } else { 265 } else {
260 result = EXIT_FAILURE; 266 result = EXIT_FAILURE;