diff options
author | Martin Szulecki | 2012-03-22 16:07:07 +0100 |
---|---|---|
committer | Martin Szulecki | 2012-03-22 16:07:07 +0100 |
commit | 7457346a7ad7dddc0188cd1cd6fc5920aabfe39a (patch) | |
tree | 4d9aa158fc2fb1e05d3349ca8a5ec22207a9a7e4 /src | |
parent | 0331050438d1bd5824237d13240a766a9b503b55 (diff) | |
download | libimobiledevice-7457346a7ad7dddc0188cd1cd6fc5920aabfe39a.tar.gz libimobiledevice-7457346a7ad7dddc0188cd1cd6fc5920aabfe39a.tar.bz2 |
Mass replace UUID by UDID, which is the correct term for it
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) idevice_event_t ev; ev.event = event->event; - ev.uuid = event->device.uuid; + ev.udid = event->device.uuid; ev.conn_type = CONNECTION_USBMUXD; if (event_cb) { @@ -99,7 +99,7 @@ idevice_error_t idevice_event_unsubscribe() /** * Get a list of currently available devices. * - * @param devices List of uuids of devices that are currently available. + * @param devices List of udids of devices that are currently available. * This list is terminated by a NULL pointer. * @param count Number of devices found. * @@ -136,9 +136,9 @@ idevice_error_t idevice_get_device_list(char ***devices, int *count) } /** - * Free a list of device uuids. + * Free a list of device udids. * - * @param devices List of uuids to free. + * @param devices List of udids to free. * * @return Always returnes IDEVICE_E_SUCCESS. */ @@ -156,7 +156,7 @@ idevice_error_t idevice_device_list_free(char **devices) } /** - * Creates an idevice_t structure for the device specified by uuid, + * Creates an idevice_t structure for the device specified by udid, * if the device is available. * * @note The resulting idevice_t structure has to be freed with @@ -164,17 +164,17 @@ idevice_error_t idevice_device_list_free(char **devices) * * @param device Upon calling this function, a pointer to a location of type * idevice_t. On successful return, this location will be populated. - * @param uuid The UUID to match. + * @param udid The UDID to match. * * @return IDEVICE_E_SUCCESS if ok, otherwise an error code. */ -idevice_error_t idevice_new(idevice_t * device, const char *uuid) +idevice_error_t idevice_new(idevice_t * device, const char *udid) { usbmuxd_device_info_t muxdev; - int res = usbmuxd_get_device_by_uuid(uuid, &muxdev); + int res = usbmuxd_get_device_by_uuid(udid, &muxdev); if (res > 0) { idevice_t phone = (idevice_t) malloc(sizeof(struct idevice_private)); - phone->uuid = strdup(muxdev.uuid); + phone->udid = strdup(muxdev.uuid); phone->conn_type = CONNECTION_USBMUXD; phone->conn_data = (void*)(long)muxdev.handle; *device = phone; @@ -200,7 +200,7 @@ idevice_error_t idevice_free(idevice_t device) ret = IDEVICE_E_SUCCESS; - free(device->uuid); + free(device->udid); if (device->conn_type == CONNECTION_USBMUXD) { device->conn_data = 0; @@ -471,12 +471,12 @@ idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle) /** * Gets the unique id for the device. */ -idevice_error_t idevice_get_uuid(idevice_t device, char **uuid) +idevice_error_t idevice_get_udid(idevice_t device, char **udid) { - if (!device || !uuid) + if (!device || !udid) return IDEVICE_E_INVALID_ARG; - *uuid = strdup(device->uuid); + *udid = strdup(device->udid); return IDEVICE_E_SUCCESS; } 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 { }; struct idevice_private { - char *uuid; + char *udid; enum connection_type conn_type; void *conn_data; }; 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) } } - if (client->uuid) { - free(client->uuid); + if (client->udid) { + free(client->udid); } if (client->label) { free(client->label); @@ -549,12 +549,12 @@ lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, const char * * Returns the unique id of the device from lockdownd. * * @param client An initialized lockdownd client. - * @param uuid Holds the unique id of the device. The caller is responsible + * @param udid Holds the unique id of the device. The caller is responsible * for freeing the memory. * * @return LOCKDOWN_E_SUCCESS on success */ -lockdownd_error_t lockdownd_get_device_uuid(lockdownd_client_t client, char **uuid) +lockdownd_error_t lockdownd_get_device_udid(lockdownd_client_t client, char **udid) { lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR; plist_t value = NULL; @@ -563,7 +563,7 @@ lockdownd_error_t lockdownd_get_device_uuid(lockdownd_client_t client, char **uu if (ret != LOCKDOWN_E_SUCCESS) { return ret; } - plist_get_string_val(value, uuid); + plist_get_string_val(value, udid); plist_free(value); value = NULL; @@ -648,7 +648,7 @@ lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *cli property_list_service_client_t plistclient = NULL; if (property_list_service_client_new(device, 0xf27e, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { - debug_info("could not connect to lockdownd (device %s)", device->uuid); + debug_info("could not connect to lockdownd (device %s)", device->udid); return LOCKDOWN_E_MUX_ERROR; } @@ -657,10 +657,10 @@ lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *cli client_loc->ssl_enabled = 0; client_loc->session_id = NULL; - if (idevice_get_uuid(device, &client_loc->uuid) != IDEVICE_E_SUCCESS) { - debug_info("failed to get device uuid."); + if (idevice_get_udid(device, &client_loc->udid) != IDEVICE_E_SUCCESS) { + debug_info("failed to get device udid."); } - debug_info("device uuid: %s", client_loc->uuid); + debug_info("device udid: %s", client_loc->udid); client_loc->label = label ? strdup(label) : NULL; @@ -719,7 +719,7 @@ lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdown ret = LOCKDOWN_E_INVALID_CONF; } - if (LOCKDOWN_E_SUCCESS == ret && !userpref_has_device_public_key(client_loc->uuid)) + if (LOCKDOWN_E_SUCCESS == ret && !userpref_has_device_public_key(client_loc->udid)) ret = lockdownd_pair(client_loc, NULL); /* 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_ if (!pairing_mode) { if (!strcmp("Unpair", verb)) { /* remove public key from config */ - userpref_remove_device_public_key(client->uuid); + userpref_remove_device_public_key(client->udid); } else { /* store public key in config */ - userpref_set_device_public_key(client->uuid, public_key); + userpref_set_device_public_key(client->udid, public_key); } } } 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 { property_list_service_client_t parent; int ssl_enabled; char *session_id; - char *uuid; + char *udid; char *label; }; 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: * @param client * @param request The request to send to the backup service. * Currently, this is one of "Backup", "Restore", "Info", or "List". - * @param target_identifier UUID of the target device. - * @param source_identifier UUID of backup data? + * @param target_identifier UDID of the target device. + * @param source_identifier UDID of backup data? * @param options Additional options in a plist of type PLIST_DICT. * * @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) } } - if (client->uuid) { - free(client->uuid); + if (client->udid) { + free(client->udid); } if (client->label) { free(client->label); @@ -370,22 +370,22 @@ restored_error_t restored_client_new(idevice_t device, restored_client_t *client property_list_service_client_t plistclient = NULL; if (property_list_service_client_new(device, 0xf27e, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { - debug_info("could not connect to restored (device %s)", device->uuid); + debug_info("could not connect to restored (device %s)", device->udid); return RESTORE_E_MUX_ERROR; } restored_client_t client_loc = (restored_client_t) malloc(sizeof(struct restored_client_private)); client_loc->parent = plistclient; - client_loc->uuid = NULL; + client_loc->udid = NULL; client_loc->label = NULL; if (label != NULL) client_loc->label = strdup(label); - ret = idevice_get_uuid(device, &client_loc->uuid); + ret = idevice_get_udid(device, &client_loc->udid); if (RESTORE_E_SUCCESS != ret) { - debug_info("failed to get device uuid."); + debug_info("failed to get device udid."); } - debug_info("device uuid: %s", client_loc->uuid); + debug_info("device udid: %s", client_loc->udid); if (RESTORE_E_SUCCESS == ret) { *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 @@ struct restored_client_private { property_list_service_client_t parent; - char *uuid; + char *udid; char *label; plist_t info; }; 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) /** * Determines whether this device has been connected to this system before. * - * @param uid The device uid as given by the device. + * @param udid The device UDID as given by the device. * * @return 1 if the device has been connected previously to this configuration * or 0 otherwise. */ -int userpref_has_device_public_key(const char *uuid) +int userpref_has_device_public_key(const char *udid) { int ret = 0; const char *config_path; char *config_file; struct stat st; - if (!uuid) return 0; + if (!udid) return 0; /* first get config file */ config_path = userpref_get_config_dir(); - config_file = (char*)malloc(strlen(config_path)+1+strlen(uuid)+4+1); + config_file = (char*)malloc(strlen(config_path)+1+strlen(udid)+4+1); strcpy(config_file, config_path); strcat(config_file, DIR_SEP_S); - strcat(config_file, uuid); + strcat(config_file, udid); strcat(config_file, ".pem"); if ((stat(config_file, &st) == 0) && S_ISREG(st.st_mode)) @@ -461,21 +461,21 @@ int userpref_has_device_public_key(const char *uuid) } /** - * Fills a list with UUIDs of devices that have been connected to this + * Fills a list with UDIDs of devices that have been connected to this * system before, i.e. for which a public key file exists. * * @param list A pointer to a char** initially pointing to NULL that will - * hold a newly allocated list of UUIDs upon successful return. + * hold a newly allocated list of UDIDs upon successful return. * The caller is responsible for freeing the memory. Note that if * no public key file was found the list has to be freed too as it * points to a terminating NULL element. - * @param count The number of UUIDs found. This parameter can be NULL if it + * @param count The number of UDIDs found. This parameter can be NULL if it * is not required. * * @return USERPREF_E_SUCCESS on success, or USERPREF_E_INVALID_ARG if the * list parameter is not pointing to NULL. */ -userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count) +userpref_error_t userpref_get_paired_udids(char ***list, unsigned int *count) { struct slist_t { char *name; @@ -483,7 +483,7 @@ userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count) }; DIR *config_dir; const char *config_path; - struct slist_t *uuids = NULL; + struct slist_t *udids = NULL; unsigned int i; unsigned int found = 0; @@ -500,7 +500,7 @@ userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count) config_dir = opendir(config_path); if (config_dir) { struct dirent *entry; - struct slist_t *listp = uuids; + struct slist_t *listp = udids; while ((entry = readdir(config_dir))) { char *ext = strstr(entry->d_name, ".pem"); 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) ne->next = NULL; if (!listp) { listp = ne; - uuids = listp; + udids = listp; } else { listp->next = ne; listp = listp->next; @@ -523,10 +523,10 @@ userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count) } *list = (char**)malloc(sizeof(char*) * (found+1)); i = 0; - while (uuids) { - (*list)[i++] = uuids->name; - struct slist_t *old = uuids; - uuids = uuids->next; + while (udids) { + (*list)[i++] = udids->name; + struct slist_t *old = udids; + udids = udids->next; free(old); } (*list)[i] = NULL; @@ -542,17 +542,18 @@ userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count) * Mark the device (as represented by the key) as having connected to this * configuration. * + * @param udid The device UDID as given by the device * @param public_key The public key given by the device * * @return 1 on success and 0 if no public key is given or if it has already * been marked as connected previously. */ -userpref_error_t userpref_set_device_public_key(const char *uuid, key_data_t public_key) +userpref_error_t userpref_set_device_public_key(const char *udid, key_data_t public_key) { if (NULL == public_key.data) return USERPREF_E_INVALID_ARG; - if (userpref_has_device_public_key(uuid)) + if (userpref_has_device_public_key(udid)) return USERPREF_E_SUCCESS; /* ensure config directory exists */ @@ -560,10 +561,10 @@ userpref_error_t userpref_set_device_public_key(const char *uuid, key_data_t pub /* build file path */ const char *config_path = userpref_get_config_dir(); - char *pem = (char*)malloc(strlen(config_path)+1+strlen(uuid)+4+1); + char *pem = (char*)malloc(strlen(config_path)+1+strlen(udid)+4+1); strcpy(pem, config_path); strcat(pem, DIR_SEP_S); - strcat(pem, uuid); + strcat(pem, udid); strcat(pem, ".pem"); /* store file */ @@ -580,23 +581,23 @@ userpref_error_t userpref_set_device_public_key(const char *uuid, key_data_t pub } /** - * Remove the public key stored for the device with uuid from this host. + * Remove the public key stored for the device with udid from this host. * - * @param uuid The uuid of the device + * @param udid The udid of the device * * @return USERPREF_E_SUCCESS on success. */ -userpref_error_t userpref_remove_device_public_key(const char *uuid) +userpref_error_t userpref_remove_device_public_key(const char *udid) { - if (!userpref_has_device_public_key(uuid)) + if (!userpref_has_device_public_key(udid)) return USERPREF_E_SUCCESS; /* build file path */ const char *config_path = userpref_get_config_dir(); - char *pem = (char*)malloc(strlen(config_path)+1+strlen(uuid)+4+1); + char *pem = (char*)malloc(strlen(config_path)+1+strlen(udid)+4+1); strcpy(pem, config_path); strcat(pem, DIR_SEP_S); - strcat(pem, uuid); + strcat(pem, udid); strcat(pem, ".pem"); /* 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 #endif 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); LIBIMOBILEDEVICE_INTERNAL userpref_error_t userpref_get_certs_as_pem(key_data_t *pem_root_cert, key_data_t *pem_host_cert); -LIBIMOBILEDEVICE_INTERNAL userpref_error_t userpref_set_device_public_key(const char *uuid, key_data_t public_key); -userpref_error_t userpref_remove_device_public_key(const char *uuid); -LIBIMOBILEDEVICE_INTERNAL int userpref_has_device_public_key(const char *uuid); -userpref_error_t userpref_get_paired_uuids(char ***list, unsigned int *count); +LIBIMOBILEDEVICE_INTERNAL userpref_error_t userpref_set_device_public_key(const char *udid, key_data_t public_key); +userpref_error_t userpref_remove_device_public_key(const char *udid); +LIBIMOBILEDEVICE_INTERNAL int userpref_has_device_public_key(const char *udid); +userpref_error_t userpref_get_paired_udids(char ***list, unsigned int *count); void userpref_get_host_id(char **host_id); #endif |