diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/idevice.c | 26 | ||||
| -rw-r--r-- | src/idevice.h | 2 | ||||
| -rw-r--r-- | src/lockdown.c | 24 | ||||
| -rw-r--r-- | src/lockdown.h | 2 | ||||
| -rw-r--r-- | src/mobilebackup2.c | 4 | ||||
| -rw-r--r-- | src/restore.c | 14 | ||||
| -rw-r--r-- | src/restore.h | 2 | ||||
| -rw-r--r-- | src/userpref.c | 53 | ||||
| -rw-r--r-- | src/userpref.h | 8 |
9 files changed, 68 insertions, 67 deletions
diff --git a/src/idevice.c b/src/idevice.c index d2769de..a6091f2 100644 --- a/src/idevice.c +++ b/src/idevice.c | |||
| @@ -49,7 +49,7 @@ static void usbmux_event_cb(const usbmuxd_event_t *event, void *user_data) | |||
| 49 | idevice_event_t ev; | 49 | idevice_event_t ev; |
| 50 | 50 | ||
| 51 | ev.event = event->event; | 51 | ev.event = event->event; |
| 52 | ev.uuid = event->device.uuid; | 52 | ev.udid = event->device.uuid; |
| 53 | ev.conn_type = CONNECTION_USBMUXD; | 53 | ev.conn_type = CONNECTION_USBMUXD; |
| 54 | 54 | ||
| 55 | if (event_cb) { | 55 | if (event_cb) { |
| @@ -99,7 +99,7 @@ idevice_error_t idevice_event_unsubscribe() | |||
| 99 | /** | 99 | /** |
| 100 | * Get a list of currently available devices. | 100 | * Get a list of currently available devices. |
| 101 | * | 101 | * |
| 102 | * @param devices List of uuids of devices that are currently available. | 102 | * @param devices List of udids of devices that are currently available. |
| 103 | * This list is terminated by a NULL pointer. | 103 | * This list is terminated by a NULL pointer. |
| 104 | * @param count Number of devices found. | 104 | * @param count Number of devices found. |
| 105 | * | 105 | * |
| @@ -136,9 +136,9 @@ idevice_error_t idevice_get_device_list(char ***devices, int *count) | |||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | /** | 138 | /** |
| 139 | * Free a list of device uuids. | 139 | * Free a list of device udids. |
| 140 | * | 140 | * |
| 141 | * @param devices List of uuids to free. | 141 | * @param devices List of udids to free. |
| 142 | * | 142 | * |
| 143 | * @return Always returnes IDEVICE_E_SUCCESS. | 143 | * @return Always returnes IDEVICE_E_SUCCESS. |
| 144 | */ | 144 | */ |
| @@ -156,7 +156,7 @@ idevice_error_t idevice_device_list_free(char **devices) | |||
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | /** | 158 | /** |
| 159 | * Creates an idevice_t structure for the device specified by uuid, | 159 | * Creates an idevice_t structure for the device specified by udid, |
| 160 | * if the device is available. | 160 | * if the device is available. |
| 161 | * | 161 | * |
| 162 | * @note The resulting idevice_t structure has to be freed with | 162 | * @note The resulting idevice_t structure has to be freed with |
| @@ -164,17 +164,17 @@ idevice_error_t idevice_device_list_free(char **devices) | |||
| 164 | * | 164 | * |
| 165 | * @param device Upon calling this function, a pointer to a location of type | 165 | * @param device Upon calling this function, a pointer to a location of type |
| 166 | * idevice_t. On successful return, this location will be populated. | 166 | * idevice_t. On successful return, this location will be populated. |
| 167 | * @param uuid The UUID to match. | 167 | * @param udid The UDID to match. |
| 168 | * | 168 | * |
| 169 | * @return IDEVICE_E_SUCCESS if ok, otherwise an error code. | 169 | * @return IDEVICE_E_SUCCESS if ok, otherwise an error code. |
| 170 | */ | 170 | */ |
| 171 | idevice_error_t idevice_new(idevice_t * device, const char *uuid) | 171 | idevice_error_t idevice_new(idevice_t * device, const char *udid) |
| 172 | { | 172 | { |
| 173 | usbmuxd_device_info_t muxdev; | 173 | usbmuxd_device_info_t muxdev; |
| 174 | int res = usbmuxd_get_device_by_uuid(uuid, &muxdev); | 174 | int res = usbmuxd_get_device_by_uuid(udid, &muxdev); |
| 175 | if (res > 0) { | 175 | if (res > 0) { |
| 176 | idevice_t phone = (idevice_t) malloc(sizeof(struct idevice_private)); | 176 | idevice_t phone = (idevice_t) malloc(sizeof(struct idevice_private)); |
| 177 | phone->uuid = strdup(muxdev.uuid); | 177 | phone->udid = strdup(muxdev.uuid); |
| 178 | phone->conn_type = CONNECTION_USBMUXD; | 178 | phone->conn_type = CONNECTION_USBMUXD; |
| 179 | phone->conn_data = (void*)(long)muxdev.handle; | 179 | phone->conn_data = (void*)(long)muxdev.handle; |
| 180 | *device = phone; | 180 | *device = phone; |
| @@ -200,7 +200,7 @@ idevice_error_t idevice_free(idevice_t device) | |||
| 200 | 200 | ||
| 201 | ret = IDEVICE_E_SUCCESS; | 201 | ret = IDEVICE_E_SUCCESS; |
| 202 | 202 | ||
| 203 | free(device->uuid); | 203 | free(device->udid); |
| 204 | 204 | ||
| 205 | if (device->conn_type == CONNECTION_USBMUXD) { | 205 | if (device->conn_type == CONNECTION_USBMUXD) { |
| 206 | device->conn_data = 0; | 206 | device->conn_data = 0; |
| @@ -471,12 +471,12 @@ idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle) | |||
| 471 | /** | 471 | /** |
| 472 | * Gets the unique id for the device. | 472 | * Gets the unique id for the device. |
| 473 | */ | 473 | */ |
| 474 | idevice_error_t idevice_get_uuid(idevice_t device, char **uuid) | 474 | idevice_error_t idevice_get_udid(idevice_t device, char **udid) |
| 475 | { | 475 | { |
| 476 | if (!device || !uuid) | 476 | if (!device || !udid) |
| 477 | return IDEVICE_E_INVALID_ARG; | 477 | return IDEVICE_E_INVALID_ARG; |
| 478 | 478 | ||
| 479 | *uuid = strdup(device->uuid); | 479 | *udid = strdup(device->udid); |
| 480 | return IDEVICE_E_SUCCESS; | 480 | return IDEVICE_E_SUCCESS; |
| 481 | } | 481 | } |
| 482 | 482 | ||
diff --git a/src/idevice.h b/src/idevice.h index 65fdae0..130d11e 100644 --- a/src/idevice.h +++ b/src/idevice.h | |||
| @@ -63,7 +63,7 @@ struct idevice_connection_private { | |||
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | struct idevice_private { | 65 | struct idevice_private { |
| 66 | char *uuid; | 66 | char *udid; |
| 67 | enum connection_type conn_type; | 67 | enum connection_type conn_type; |
| 68 | void *conn_data; | 68 | void *conn_data; |
| 69 | }; | 69 | }; |
diff --git a/src/lockdown.c b/src/lockdown.c index 2dd20a4..68a74b5 100644 --- a/src/lockdown.c +++ b/src/lockdown.c | |||
| @@ -236,8 +236,8 @@ lockdownd_error_t lockdownd_client_free(lockdownd_client_t client) | |||
| 236 | } | 236 | } |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | if (client->uuid) { | 239 | if (client->udid) { |
| 240 | free(client->uuid); | 240 | free(client->udid); |
| 241 | } | 241 | } |
| 242 | if (client->label) { | 242 | if (client->label) { |
| 243 | free(client->label); | 243 | free(client->label); |
| @@ -549,12 +549,12 @@ lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, const char * | |||
| 549 | * Returns the unique id of the device from lockdownd. | 549 | * Returns the unique id of the device from lockdownd. |
| 550 | * | 550 | * |
| 551 | * @param client An initialized lockdownd client. | 551 | * @param client An initialized lockdownd client. |
| 552 | * @param uuid Holds the unique id of the device. The caller is responsible | 552 | * @param udid Holds the unique id of the device. The caller is responsible |
| 553 | * for freeing the memory. | 553 | * for freeing the memory. |
| 554 | * | 554 | * |
| 555 | * @return LOCKDOWN_E_SUCCESS on success | 555 | * @return LOCKDOWN_E_SUCCESS on success |
| 556 | */ | 556 | */ |
| 557 | lockdownd_error_t lockdownd_get_device_uuid(lockdownd_client_t client, char **uuid) | 557 | lockdownd_error_t lockdownd_get_device_udid(lockdownd_client_t client, char **udid) |
| 558 | { | 558 | { |
| 559 | lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR; | 559 | lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR; |
| 560 | plist_t value = NULL; | 560 | plist_t value = NULL; |
| @@ -563,7 +563,7 @@ lockdownd_error_t lockdownd_get_device_uuid(lockdownd_client_t client, char **uu | |||
| 563 | if (ret != LOCKDOWN_E_SUCCESS) { | 563 | if (ret != LOCKDOWN_E_SUCCESS) { |
| 564 | return ret; | 564 | return ret; |
| 565 | } | 565 | } |
| 566 | plist_get_string_val(value, uuid); | 566 | plist_get_string_val(value, udid); |
| 567 | 567 | ||
| 568 | plist_free(value); | 568 | plist_free(value); |
| 569 | value = NULL; | 569 | value = NULL; |
| @@ -648,7 +648,7 @@ lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *cli | |||
| 648 | 648 | ||
| 649 | property_list_service_client_t plistclient = NULL; | 649 | property_list_service_client_t plistclient = NULL; |
| 650 | if (property_list_service_client_new(device, 0xf27e, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { | 650 | if (property_list_service_client_new(device, 0xf27e, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { |
| 651 | debug_info("could not connect to lockdownd (device %s)", device->uuid); | 651 | debug_info("could not connect to lockdownd (device %s)", device->udid); |
| 652 | return LOCKDOWN_E_MUX_ERROR; | 652 | return LOCKDOWN_E_MUX_ERROR; |
| 653 | } | 653 | } |
| 654 | 654 | ||
| @@ -657,10 +657,10 @@ lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *cli | |||
| 657 | client_loc->ssl_enabled = 0; | 657 | client_loc->ssl_enabled = 0; |
| 658 | client_loc->session_id = NULL; | 658 | client_loc->session_id = NULL; |
| 659 | 659 | ||
| 660 | if (idevice_get_uuid(device, &client_loc->uuid) != IDEVICE_E_SUCCESS) { | 660 | if (idevice_get_udid(device, &client_loc->udid) != IDEVICE_E_SUCCESS) { |
| 661 | debug_info("failed to get device uuid."); | 661 | debug_info("failed to get device udid."); |
| 662 | } | 662 | } |
| 663 | debug_info("device uuid: %s", client_loc->uuid); | 663 | debug_info("device udid: %s", client_loc->udid); |
| 664 | 664 | ||
| 665 | client_loc->label = label ? strdup(label) : NULL; | 665 | client_loc->label = label ? strdup(label) : NULL; |
| 666 | 666 | ||
| @@ -719,7 +719,7 @@ lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdown | |||
| 719 | ret = LOCKDOWN_E_INVALID_CONF; | 719 | ret = LOCKDOWN_E_INVALID_CONF; |
| 720 | } | 720 | } |
| 721 | 721 | ||
| 722 | if (LOCKDOWN_E_SUCCESS == ret && !userpref_has_device_public_key(client_loc->uuid)) | 722 | if (LOCKDOWN_E_SUCCESS == ret && !userpref_has_device_public_key(client_loc->udid)) |
| 723 | ret = lockdownd_pair(client_loc, NULL); | 723 | ret = lockdownd_pair(client_loc, NULL); |
| 724 | 724 | ||
| 725 | /* in any case, we need to validate pairing to receive trusted host status */ | 725 | /* in any case, we need to validate pairing to receive trusted host status */ |
| @@ -925,10 +925,10 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_ | |||
| 925 | if (!pairing_mode) { | 925 | if (!pairing_mode) { |
| 926 | if (!strcmp("Unpair", verb)) { | 926 | if (!strcmp("Unpair", verb)) { |
| 927 | /* remove public key from config */ | 927 | /* remove public key from config */ |
| 928 | userpref_remove_device_public_key(client->uuid); | 928 | userpref_remove_device_public_key(client->udid); |
| 929 | } else { | 929 | } else { |
| 930 | /* store public key in config */ | 930 | /* store public key in config */ |
| 931 | userpref_set_device_public_key(client->uuid, public_key); | 931 | userpref_set_device_public_key(client->udid, public_key); |
| 932 | } | 932 | } |
| 933 | } | 933 | } |
| 934 | } else { | 934 | } else { |
diff --git a/src/lockdown.h b/src/lockdown.h index a08b040..289053a 100644 --- a/src/lockdown.h +++ b/src/lockdown.h | |||
| @@ -31,7 +31,7 @@ struct lockdownd_client_private { | |||
| 31 | property_list_service_client_t parent; | 31 | property_list_service_client_t parent; |
| 32 | int ssl_enabled; | 32 | int ssl_enabled; |
| 33 | char *session_id; | 33 | char *session_id; |
| 34 | char *uuid; | 34 | char *udid; |
| 35 | char *label; | 35 | char *label; |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
diff --git a/src/mobilebackup2.c b/src/mobilebackup2.c index 1e39efa..4263e1c 100644 --- a/src/mobilebackup2.c +++ b/src/mobilebackup2.c | |||
| @@ -418,8 +418,8 @@ leave: | |||
| 418 | * @param client | 418 | * @param client |
| 419 | * @param request The request to send to the backup service. | 419 | * @param request The request to send to the backup service. |
| 420 | * Currently, this is one of "Backup", "Restore", "Info", or "List". | 420 | * Currently, this is one of "Backup", "Restore", "Info", or "List". |
| 421 | * @param target_identifier UUID of the target device. | 421 | * @param target_identifier UDID of the target device. |
| 422 | * @param source_identifier UUID of backup data? | 422 | * @param source_identifier UDID of backup data? |
| 423 | * @param options Additional options in a plist of type PLIST_DICT. | 423 | * @param options Additional options in a plist of type PLIST_DICT. |
| 424 | * | 424 | * |
| 425 | * @return MOBILEBACKUP2_E_SUCCESS if the request was successfully sent, | 425 | * @return MOBILEBACKUP2_E_SUCCESS if the request was successfully sent, |
diff --git a/src/restore.c b/src/restore.c index f4a2ed3..a9ab8b9 100644 --- a/src/restore.c +++ b/src/restore.c | |||
| @@ -112,8 +112,8 @@ restored_error_t restored_client_free(restored_client_t client) | |||
| 112 | } | 112 | } |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | if (client->uuid) { | 115 | if (client->udid) { |
| 116 | free(client->uuid); | 116 | free(client->udid); |
| 117 | } | 117 | } |
| 118 | if (client->label) { | 118 | if (client->label) { |
| 119 | free(client->label); | 119 | free(client->label); |
| @@ -370,22 +370,22 @@ restored_error_t restored_client_new(idevice_t device, restored_client_t *client | |||
| 370 | 370 | ||
| 371 | property_list_service_client_t plistclient = NULL; | 371 | property_list_service_client_t plistclient = NULL; |
| 372 | if (property_list_service_client_new(device, 0xf27e, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { | 372 | if (property_list_service_client_new(device, 0xf27e, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { |
| 373 | debug_info("could not connect to restored (device %s)", device->uuid); | 373 | debug_info("could not connect to restored (device %s)", device->udid); |
| 374 | return RESTORE_E_MUX_ERROR; | 374 | return RESTORE_E_MUX_ERROR; |
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | restored_client_t client_loc = (restored_client_t) malloc(sizeof(struct restored_client_private)); | 377 | restored_client_t client_loc = (restored_client_t) malloc(sizeof(struct restored_client_private)); |
| 378 | client_loc->parent = plistclient; | 378 | client_loc->parent = plistclient; |
| 379 | client_loc->uuid = NULL; | 379 | client_loc->udid = NULL; |
| 380 | client_loc->label = NULL; | 380 | client_loc->label = NULL; |
| 381 | if (label != NULL) | 381 | if (label != NULL) |
| 382 | client_loc->label = strdup(label); | 382 | client_loc->label = strdup(label); |
| 383 | 383 | ||
| 384 | ret = idevice_get_uuid(device, &client_loc->uuid); | 384 | ret = idevice_get_udid(device, &client_loc->udid); |
| 385 | if (RESTORE_E_SUCCESS != ret) { | 385 | if (RESTORE_E_SUCCESS != ret) { |
| 386 | debug_info("failed to get device uuid."); | 386 | debug_info("failed to get device udid."); |
| 387 | } | 387 | } |
| 388 | debug_info("device uuid: %s", client_loc->uuid); | 388 | debug_info("device udid: %s", client_loc->udid); |
| 389 | 389 | ||
| 390 | if (RESTORE_E_SUCCESS == ret) { | 390 | if (RESTORE_E_SUCCESS == ret) { |
| 391 | *client = client_loc; | 391 | *client = client_loc; |
diff --git a/src/restore.h b/src/restore.h index d790d01..cf9307c 100644 --- a/src/restore.h +++ b/src/restore.h | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | struct restored_client_private { | 30 | struct restored_client_private { |
| 31 | property_list_service_client_t parent; | 31 | property_list_service_client_t parent; |
| 32 | char *uuid; | 32 | char *udid; |
| 33 | char *label; | 33 | char *label; |
| 34 | plist_t info; | 34 | plist_t info; |
| 35 | }; | 35 | }; |
diff --git a/src/userpref.c b/src/userpref.c index 2f4e55b..a0c3545 100644 --- a/src/userpref.c +++ b/src/userpref.c | |||
| @@ -432,26 +432,26 @@ void userpref_get_host_id(char **host_id) | |||
| 432 | /** | 432 | /** |
| 433 | * Determines whether this device has been connected to this system before. | 433 | * Determines whether this device has been connected to this system before. |
| 434 | * | 434 | * |
| 435 | * @param uid The device uid as given by the device. | 435 | * @param udid The device UDID as given by the device. |
| 436 | * | 436 | * |
| 437 | * @return 1 if the device has been connected previously to this configuration | 437 | * @return 1 if the device has been connected previously to this configuration |
| 438 | * or 0 otherwise. | 438 | * or 0 otherwise. |
| 439 | */ | 439 | */ |
| 440 | int userpref_has_device_public_key(const char *uuid) | 440 | int userpref_has_device_public_key(const char *udid) |
| 441 | { | 441 | { |
| 442 | int ret = 0; | 442 | int ret = 0; |
| 443 | const char *config_path; | 443 | const char *config_path; |
| 444 | char *config_file; | 444 | char *config_file; |
| 445 | struct stat st; | 445 | struct stat st; |
| 446 | 446 | ||
| 447 | if (!uuid) return 0; | 447 | if (!udid) return 0; |
| 448 | 448 | ||
| 449 | /* first get config file */ | 449 | /* first get config file */ |
| 450 | config_path = userpref_get_config_dir(); | 450 | config_path = userpref_get_config_dir(); |
| 451 | config_file = (char*)malloc(strlen(config_path)+1+strlen(uuid)+4+1); | 451 | config_file = (char*)malloc(strlen(config_path)+1+strlen(udid)+4+1); |
| 452 | strcpy(config_file, config_path); | 452 | strcpy(config_file, config_path); |
| 453 | strcat(config_file, DIR_SEP_S); | 453 | strcat(config_file, DIR_SEP_S); |
| 454 | strcat(config_file, uuid); | 454 | strcat(config_file, udid); |
| 455 | strcat(config_file, ".pem"); | 455 | strcat(config_file, ".pem"); |
| 456 | 456 | ||
| 457 | if ((stat(config_file, &st) == 0) && S_ISREG(st.st_mode)) | 457 | if ((stat(config_file, &st) == 0) && S_ISREG(st.st_mode)) |
| @@ -461,21 +461,21 @@ int userpref_has_device_public_key(const char *uuid) | |||
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | /** | 463 | /** |
| 464 | * Fills a list with UUIDs of devices that have been connected to this | 464 | * Fills a list with UDIDs of devices that have been connected to this |
| 465 | * system before, i.e. for which a public key file exists. | 465 | * system before, i.e. for which a public key file exists. |
| 466 | * | 466 | * |
| 467 | * @param list A pointer to a char** initially pointing to NULL that will | 467 | * @param list A pointer to a char** initially pointing to NULL that will |
| 468 | * hold a newly allocated list of UUIDs upon successful return. | 468 | * hold a newly allocated list of UDIDs upon successful return. |
| 469 | * The caller is responsible for freeing the memory. Note that if | 469 | * The caller is responsible for freeing the memory. Note that if |
| 470 | * no public key file was found the list has to be freed too as it | 470 | * no public key file was found the list has to be freed too as it |
| 471 | * points to a terminating NULL element. | 471 | * points to a terminating NULL element. |
| 472 | * @param count The number of UUIDs found. This parameter can be NULL if it | 472 | * @param count The number of UDIDs found. This parameter can be NULL if it |
| 473 | * is not required. | 473 | * is not required. |
| 474 | * | 474 | * |
| 475 | * @return USERPREF_E_SUCCESS on success, or USERPREF_E_INVALID_ARG if the | 475 | * @return USERPREF_E_SUCCESS on success, or USERPREF_E_INVALID_ARG if the |
| 476 | * list parameter is not pointing to NULL. | 476 | * list parameter is not pointing to NULL. |
| 477 | */ | 477 | */ |
| 478 | userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count) | 478 | userpref_error_t userpref_get_paired_udids(char ***list, unsigned int *count) |
| 479 | { | 479 | { |
| 480 | struct slist_t { | 480 | struct slist_t { |
| 481 | char *name; | 481 | char *name; |
| @@ -483,7 +483,7 @@ userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count) | |||
| 483 | }; | 483 | }; |
| 484 | DIR *config_dir; | 484 | DIR *config_dir; |
| 485 | const char *config_path; | 485 | const char *config_path; |
| 486 | struct slist_t *uuids = NULL; | 486 | struct slist_t *udids = NULL; |
| 487 | unsigned int i; | 487 | unsigned int i; |
| 488 | unsigned int found = 0; | 488 | unsigned int found = 0; |
| 489 | 489 | ||
| @@ -500,7 +500,7 @@ userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count) | |||
| 500 | config_dir = opendir(config_path); | 500 | config_dir = opendir(config_path); |
| 501 | if (config_dir) { | 501 | if (config_dir) { |
| 502 | struct dirent *entry; | 502 | struct dirent *entry; |
| 503 | struct slist_t *listp = uuids; | 503 | struct slist_t *listp = udids; |
| 504 | while ((entry = readdir(config_dir))) { | 504 | while ((entry = readdir(config_dir))) { |
| 505 | char *ext = strstr(entry->d_name, ".pem"); | 505 | char *ext = strstr(entry->d_name, ".pem"); |
| 506 | if (ext && ((ext - entry->d_name) == 40) && (strlen(entry->d_name) == 44)) { | 506 | if (ext && ((ext - entry->d_name) == 40) && (strlen(entry->d_name) == 44)) { |
| @@ -511,7 +511,7 @@ userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count) | |||
| 511 | ne->next = NULL; | 511 | ne->next = NULL; |
| 512 | if (!listp) { | 512 | if (!listp) { |
| 513 | listp = ne; | 513 | listp = ne; |
| 514 | uuids = listp; | 514 | udids = listp; |
| 515 | } else { | 515 | } else { |
| 516 | listp->next = ne; | 516 | listp->next = ne; |
| 517 | listp = listp->next; | 517 | listp = listp->next; |
| @@ -523,10 +523,10 @@ userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count) | |||
| 523 | } | 523 | } |
| 524 | *list = (char**)malloc(sizeof(char*) * (found+1)); | 524 | *list = (char**)malloc(sizeof(char*) * (found+1)); |
| 525 | i = 0; | 525 | i = 0; |
| 526 | while (uuids) { | 526 | while (udids) { |
| 527 | (*list)[i++] = uuids->name; | 527 | (*list)[i++] = udids->name; |
| 528 | struct slist_t *old = uuids; | 528 | struct slist_t *old = udids; |
| 529 | uuids = uuids->next; | 529 | udids = udids->next; |
| 530 | free(old); | 530 | free(old); |
| 531 | } | 531 | } |
| 532 | (*list)[i] = NULL; | 532 | (*list)[i] = NULL; |
| @@ -542,17 +542,18 @@ userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count) | |||
| 542 | * Mark the device (as represented by the key) as having connected to this | 542 | * Mark the device (as represented by the key) as having connected to this |
| 543 | * configuration. | 543 | * configuration. |
| 544 | * | 544 | * |
| 545 | * @param udid The device UDID as given by the device | ||
| 545 | * @param public_key The public key given by the device | 546 | * @param public_key The public key given by the device |
| 546 | * | 547 | * |
| 547 | * @return 1 on success and 0 if no public key is given or if it has already | 548 | * @return 1 on success and 0 if no public key is given or if it has already |
| 548 | * been marked as connected previously. | 549 | * been marked as connected previously. |
| 549 | */ | 550 | */ |
| 550 | userpref_error_t userpref_set_device_public_key(const char *uuid, key_data_t public_key) | 551 | userpref_error_t userpref_set_device_public_key(const char *udid, key_data_t public_key) |
| 551 | { | 552 | { |
| 552 | if (NULL == public_key.data) | 553 | if (NULL == public_key.data) |
| 553 | return USERPREF_E_INVALID_ARG; | 554 | return USERPREF_E_INVALID_ARG; |
| 554 | 555 | ||
| 555 | if (userpref_has_device_public_key(uuid)) | 556 | if (userpref_has_device_public_key(udid)) |
| 556 | return USERPREF_E_SUCCESS; | 557 | return USERPREF_E_SUCCESS; |
| 557 | 558 | ||
| 558 | /* ensure config directory exists */ | 559 | /* ensure config directory exists */ |
| @@ -560,10 +561,10 @@ userpref_error_t userpref_set_device_public_key(const char *uuid, key_data_t pub | |||
| 560 | 561 | ||
| 561 | /* build file path */ | 562 | /* build file path */ |
| 562 | const char *config_path = userpref_get_config_dir(); | 563 | const char *config_path = userpref_get_config_dir(); |
| 563 | char *pem = (char*)malloc(strlen(config_path)+1+strlen(uuid)+4+1); | 564 | char *pem = (char*)malloc(strlen(config_path)+1+strlen(udid)+4+1); |
| 564 | strcpy(pem, config_path); | 565 | strcpy(pem, config_path); |
| 565 | strcat(pem, DIR_SEP_S); | 566 | strcat(pem, DIR_SEP_S); |
| 566 | strcat(pem, uuid); | 567 | strcat(pem, udid); |
| 567 | strcat(pem, ".pem"); | 568 | strcat(pem, ".pem"); |
| 568 | 569 | ||
| 569 | /* store file */ | 570 | /* store file */ |
| @@ -580,23 +581,23 @@ userpref_error_t userpref_set_device_public_key(const char *uuid, key_data_t pub | |||
| 580 | } | 581 | } |
| 581 | 582 | ||
| 582 | /** | 583 | /** |
| 583 | * Remove the public key stored for the device with uuid from this host. | 584 | * Remove the public key stored for the device with udid from this host. |
| 584 | * | 585 | * |
| 585 | * @param uuid The uuid of the device | 586 | * @param udid The udid of the device |
| 586 | * | 587 | * |
| 587 | * @return USERPREF_E_SUCCESS on success. | 588 | * @return USERPREF_E_SUCCESS on success. |
| 588 | */ | 589 | */ |
| 589 | userpref_error_t userpref_remove_device_public_key(const char *uuid) | 590 | userpref_error_t userpref_remove_device_public_key(const char *udid) |
| 590 | { | 591 | { |
| 591 | if (!userpref_has_device_public_key(uuid)) | 592 | if (!userpref_has_device_public_key(udid)) |
| 592 | return USERPREF_E_SUCCESS; | 593 | return USERPREF_E_SUCCESS; |
| 593 | 594 | ||
| 594 | /* build file path */ | 595 | /* build file path */ |
| 595 | const char *config_path = userpref_get_config_dir(); | 596 | const char *config_path = userpref_get_config_dir(); |
| 596 | char *pem = (char*)malloc(strlen(config_path)+1+strlen(uuid)+4+1); | 597 | char *pem = (char*)malloc(strlen(config_path)+1+strlen(udid)+4+1); |
| 597 | strcpy(pem, config_path); | 598 | strcpy(pem, config_path); |
| 598 | strcat(pem, DIR_SEP_S); | 599 | strcat(pem, DIR_SEP_S); |
| 599 | strcat(pem, uuid); | 600 | strcat(pem, udid); |
| 600 | strcat(pem, ".pem"); | 601 | strcat(pem, ".pem"); |
| 601 | 602 | ||
| 602 | /* remove file */ | 603 | /* remove file */ |
diff --git a/src/userpref.h b/src/userpref.h index e5dcd1f..7ff91b3 100644 --- a/src/userpref.h +++ b/src/userpref.h | |||
| @@ -64,10 +64,10 @@ LIBIMOBILEDEVICE_INTERNAL userpref_error_t userpref_get_keys_and_certs(gnutls_x5 | |||
| 64 | #endif | 64 | #endif |
| 65 | LIBIMOBILEDEVICE_INTERNAL userpref_error_t userpref_set_keys_and_certs(key_data_t * root_key, key_data_t * root_cert, key_data_t * host_key, key_data_t * host_cert); | 65 | LIBIMOBILEDEVICE_INTERNAL userpref_error_t userpref_set_keys_and_certs(key_data_t * root_key, key_data_t * root_cert, key_data_t * host_key, key_data_t * host_cert); |
| 66 | LIBIMOBILEDEVICE_INTERNAL userpref_error_t userpref_get_certs_as_pem(key_data_t *pem_root_cert, key_data_t *pem_host_cert); | 66 | LIBIMOBILEDEVICE_INTERNAL userpref_error_t userpref_get_certs_as_pem(key_data_t *pem_root_cert, key_data_t *pem_host_cert); |
| 67 | LIBIMOBILEDEVICE_INTERNAL userpref_error_t userpref_set_device_public_key(const char *uuid, key_data_t public_key); | 67 | LIBIMOBILEDEVICE_INTERNAL userpref_error_t userpref_set_device_public_key(const char *udid, key_data_t public_key); |
| 68 | userpref_error_t userpref_remove_device_public_key(const char *uuid); | 68 | userpref_error_t userpref_remove_device_public_key(const char *udid); |
| 69 | LIBIMOBILEDEVICE_INTERNAL int userpref_has_device_public_key(const char *uuid); | 69 | LIBIMOBILEDEVICE_INTERNAL int userpref_has_device_public_key(const char *udid); |
| 70 | userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count); | 70 | userpref_error_t userpref_get_paired_udids(char ***list, unsigned int *count); |
| 71 | void userpref_get_host_id(char **host_id); | 71 | void userpref_get_host_id(char **host_id); |
| 72 | 72 | ||
| 73 | #endif | 73 | #endif |
