summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libimobiledevice/misagent.h24
-rw-r--r--src/misagent.c40
2 files changed, 63 insertions, 1 deletions
diff --git a/include/libimobiledevice/misagent.h b/include/libimobiledevice/misagent.h
index 92165f2..09af57a 100644
--- a/include/libimobiledevice/misagent.h
+++ b/include/libimobiledevice/misagent.h
@@ -101,7 +101,7 @@ misagent_error_t misagent_client_free(misagent_client_t client);
misagent_error_t misagent_install(misagent_client_t client, plist_t profile);
/**
- * Retrieves an array of all installed provisioning profiles.
+ * Retrieves all installed provisioning profiles (iOS 9.2.1 or below).
*
* @param client The connected misagent to use.
* @param profiles Pointer to a plist_t that will be set to a PLIST_ARRAY
@@ -110,6 +110,9 @@ misagent_error_t misagent_install(misagent_client_t client, plist_t profile);
* @return MISAGENT_E_SUCCESS on success, MISAGENT_E_INVALID_ARG when
* client is invalid, or an MISAGENT_E_* error code otherwise.
*
+ * @note This API call only works with iOS 9.2.1 or below.
+ * For newer iOS versions use misagent_copy_all() instead.
+ *
* @note If no provisioning profiles are installed on the device, this function
* still returns MISAGENT_E_SUCCESS and profiles will just point to an
* empty array.
@@ -117,6 +120,25 @@ misagent_error_t misagent_install(misagent_client_t client, plist_t profile);
misagent_error_t misagent_copy(misagent_client_t client, plist_t* profiles);
/**
+ * Retrieves all installed provisioning profiles (iOS 9.3 or higher).
+ *
+ * @param client The connected misagent to use.
+ * @param profiles Pointer to a plist_t that will be set to a PLIST_ARRAY
+ * if the function is successful.
+ *
+ * @return MISAGENT_E_SUCCESS on success, MISAGENT_E_INVALID_ARG when
+ * client is invalid, or an MISAGENT_E_* error code otherwise.
+ *
+ * @note This API call only works with iOS 9.3 or higher.
+ * For older iOS versions use misagent_copy() instead.
+ *
+ * @note If no provisioning profiles are installed on the device, this function
+ * still returns MISAGENT_E_SUCCESS and profiles will just point to an
+ * empty array.
+ */
+misagent_error_t misagent_copy_all(misagent_client_t client, plist_t* profiles);
+
+/**
* Removes a given provisioning profile.
*
* @param client The connected misagent to use.
diff --git a/src/misagent.c b/src/misagent.c
index 2dd3451..095edba 100644
--- a/src/misagent.c
+++ b/src/misagent.c
@@ -202,6 +202,46 @@ LIBIMOBILEDEVICE_API misagent_error_t misagent_copy(misagent_client_t client, pl
}
+LIBIMOBILEDEVICE_API misagent_error_t misagent_copy_all(misagent_client_t client, plist_t* profiles)
+{
+ if (!client || !client->parent || !profiles)
+ return MISAGENT_E_INVALID_ARG;
+
+ client->last_error = MISAGENT_E_UNKNOWN_ERROR;
+
+ plist_t dict = plist_new_dict();
+ plist_dict_set_item(dict, "MessageType", plist_new_string("CopyAll"));
+ plist_dict_set_item(dict, "ProfileType", plist_new_string("Provisioning"));
+
+ misagent_error_t res = misagent_error(property_list_service_send_xml_plist(client->parent, dict));
+ plist_free(dict);
+ dict = NULL;
+
+ if (res != MISAGENT_E_SUCCESS) {
+ debug_info("could not send plist, error %d", res);
+ return res;
+ }
+
+ res = misagent_error(property_list_service_receive_plist(client->parent, &dict));
+ if (res != MISAGENT_E_SUCCESS) {
+ debug_info("could not receive response, error %d", res);
+ return res;
+ }
+ if (!dict) {
+ debug_info("could not get response plist");
+ return MISAGENT_E_UNKNOWN_ERROR;
+ }
+
+ res = misagent_check_result(dict, &client->last_error);
+ if (res == MISAGENT_E_SUCCESS) {
+ *profiles = plist_copy(plist_dict_get_item(dict, "Payload"));
+ }
+ plist_free(dict);
+
+ return res;
+
+}
+
LIBIMOBILEDEVICE_API misagent_error_t misagent_remove(misagent_client_t client, const char* profileID)
{
if (!client || !client->parent || !profileID)